mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 14:34:21 +01:00
* Adding a callback to submitkey * Most deletions in the admin panel no longer cause an entire page reload * Change border for .btn-info
This commit is contained in:
@@ -154,6 +154,7 @@ function submitkey(chal, key, nonce){
|
||||
|
||||
$('.delete-challenge').click(function (e) {
|
||||
var chal_id = $(this).attr('chal-id');
|
||||
var td_row = $(this).parent().parent();
|
||||
|
||||
ezq({
|
||||
title: "Delete Challenge",
|
||||
@@ -161,7 +162,7 @@ $('.delete-challenge').click(function (e) {
|
||||
success: function () {
|
||||
$.post(script_root + '/admin/chal/delete', {'id': chal_id, 'nonce': $('#nonce').val()}, function (data) {
|
||||
if (data == 1) {
|
||||
location.reload();
|
||||
td_row.remove();
|
||||
}
|
||||
else {
|
||||
ezal({
|
||||
|
||||
@@ -81,6 +81,8 @@ $('.fa-times').click(function(){
|
||||
var team_name = elem.find('.team').text().trim();
|
||||
var key_id = elem.find('.flag').attr('id');
|
||||
|
||||
var td_row = $(this).parent().parent();
|
||||
|
||||
ezq({
|
||||
title: 'Delete Submission',
|
||||
body: "Are you sure you want to delete correct submission from {0} for challenge {1}".format(
|
||||
@@ -94,7 +96,7 @@ $('.fa-times').click(function(){
|
||||
}, function (data) {
|
||||
var data = $.parseJSON(JSON.stringify(data));
|
||||
if (data == "1") {
|
||||
location.reload();
|
||||
td_row.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -325,6 +325,8 @@ $('.fa-times').click(function () {
|
||||
action : action,
|
||||
};
|
||||
|
||||
var td_row = $(this).parent().parent();
|
||||
|
||||
ezq({
|
||||
title: title,
|
||||
body: description,
|
||||
@@ -335,7 +337,7 @@ $('.fa-times').click(function () {
|
||||
}, function (data) {
|
||||
var data = $.parseJSON(JSON.stringify(data));
|
||||
if (data == "1") {
|
||||
location.reload();
|
||||
td_row.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -365,6 +367,8 @@ $('.mark-correct').click(function () {
|
||||
"as solved for team " +
|
||||
"<strong>{0}</strong>?</span>".format(chal_name);
|
||||
|
||||
var td_row = $(this).parent().parent();
|
||||
|
||||
ezq({
|
||||
title: title,
|
||||
body: description,
|
||||
@@ -375,7 +379,7 @@ $('.mark-correct').click(function () {
|
||||
}, function (data) {
|
||||
var data = $.parseJSON(JSON.stringify(data));
|
||||
if (data == "1") {
|
||||
location.reload();
|
||||
td_row.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -316,6 +316,9 @@ $('.fa-times').click(function(){
|
||||
var elem = $(this).parent().parent().parent();
|
||||
var team_id = elem.find('.team-id').text().trim();
|
||||
var name = elem.find('.team-name').text().trim();
|
||||
|
||||
var td_row = $(this).parent().parent().parent();
|
||||
|
||||
ezq({
|
||||
title: "Delete User",
|
||||
body: "Are you sure you want to delete {0}".format("<strong>"+name+"</strong>"),
|
||||
@@ -326,7 +329,7 @@ $('.fa-times').click(function(){
|
||||
}, function (data) {
|
||||
var data = $.parseJSON(JSON.stringify(data));
|
||||
if (data == "1") {
|
||||
location.reload();
|
||||
td_row.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -85,6 +85,9 @@ $('.fa-times').click(function () {
|
||||
var team = elem.find('.team').attr('id');
|
||||
var team_name = elem.find('.team').text().trim();
|
||||
var key_id = elem.find('.flag').attr('id');
|
||||
|
||||
var td_row = $(this).parent().parent();
|
||||
|
||||
ezq({
|
||||
title: 'Delete Submission',
|
||||
body: "Are you sure you want to delete incorrect submission from {0} for challenge {1}".format(
|
||||
@@ -98,7 +101,7 @@ $('.fa-times').click(function () {
|
||||
}, function (data) {
|
||||
var data = $.parseJSON(JSON.stringify(data));
|
||||
if (data == "1") {
|
||||
location.reload();
|
||||
td_row.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ table > thead > tr > td {
|
||||
|
||||
.btn-info {
|
||||
background-color: #5B7290 !important;
|
||||
border-color: #5B7290 !important;
|
||||
}
|
||||
|
||||
.alert {
|
||||
|
||||
@@ -79,7 +79,7 @@ $("#answer-input").keyup(function(event){
|
||||
});
|
||||
|
||||
|
||||
function submitkey(chal, key, nonce) {
|
||||
function submitkey(chal, key, nonce, cb) {
|
||||
$('#submit-key').addClass("disabled-button");
|
||||
$('#submit-key').prop('disabled', true);
|
||||
$.post(script_root + "/chal/" + chal, {
|
||||
@@ -140,6 +140,10 @@ function submitkey(chal, key, nonce) {
|
||||
$('#submit-key').removeClass("disabled-button");
|
||||
$('#submit-key').prop('disabled', false);
|
||||
}, 3000);
|
||||
|
||||
if (cb) {
|
||||
cb(result);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user