diff --git a/CTFd/themes/admin/static/js/challenges/chalboard.js b/CTFd/themes/admin/static/js/challenges/chalboard.js index b7ae6e39..e5fa0d0b 100644 --- a/CTFd/themes/admin/static/js/challenges/chalboard.js +++ b/CTFd/themes/admin/static/js/challenges/chalboard.js @@ -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({ diff --git a/CTFd/themes/admin/templates/correct_keys.html b/CTFd/themes/admin/templates/correct_keys.html index 30269db3..d79d67a1 100644 --- a/CTFd/themes/admin/templates/correct_keys.html +++ b/CTFd/themes/admin/templates/correct_keys.html @@ -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(); } }); } diff --git a/CTFd/themes/admin/templates/team.html b/CTFd/themes/admin/templates/team.html index 78f4a0ff..f8bdc587 100644 --- a/CTFd/themes/admin/templates/team.html +++ b/CTFd/themes/admin/templates/team.html @@ -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 " + "{0}?".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(); } }); } diff --git a/CTFd/themes/admin/templates/teams.html b/CTFd/themes/admin/templates/teams.html index 2f76cf67..10ef2a33 100644 --- a/CTFd/themes/admin/templates/teams.html +++ b/CTFd/themes/admin/templates/teams.html @@ -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(""+name+""), @@ -326,7 +329,7 @@ $('.fa-times').click(function(){ }, function (data) { var data = $.parseJSON(JSON.stringify(data)); if (data == "1") { - location.reload(); + td_row.remove(); } }); } diff --git a/CTFd/themes/admin/templates/wrong_keys.html b/CTFd/themes/admin/templates/wrong_keys.html index 8a146256..e2042416 100644 --- a/CTFd/themes/admin/templates/wrong_keys.html +++ b/CTFd/themes/admin/templates/wrong_keys.html @@ -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(); } }); } diff --git a/CTFd/themes/core/static/css/base.css b/CTFd/themes/core/static/css/base.css index 017306dd..48ed4675 100644 --- a/CTFd/themes/core/static/css/base.css +++ b/CTFd/themes/core/static/css/base.css @@ -102,6 +102,7 @@ table > thead > tr > td { .btn-info { background-color: #5B7290 !important; + border-color: #5B7290 !important; } .alert { diff --git a/CTFd/themes/core/static/js/chalboard.js b/CTFd/themes/core/static/js/chalboard.js index 665f48c2..579b3e34 100644 --- a/CTFd/themes/core/static/js/chalboard.js +++ b/CTFd/themes/core/static/js/chalboard.js @@ -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); + } }) }