diff --git a/files/assets/js/comments_admin.js b/files/assets/js/comments_admin.js index d70abbeda..9f73985d5 100644 --- a/files/assets/js/comments_admin.js +++ b/files/assets/js/comments_admin.js @@ -1,19 +1,17 @@ function removeComment(post_id,button1,button2) { url="/ban_comment/"+post_id - callback=function(){ + post(url) - try { - document.getElementById("comment-"+post_id+"-only").classList.add("banned"); - } catch(e) { - document.getElementById("context").classList.add("banned"); - } - - button=document.getElementById("remove-"+post_id); - button.onclick=function(){approveComment(post_id)}; - button.innerHTML='Approve' + try { + document.getElementById("comment-"+post_id+"-only").classList.add("banned"); + } catch(e) { + document.getElementById("context").classList.add("banned"); } - post(url, callback, "Comment has been removed.") + + var button=document.getElementById("remove-"+post_id); + button.onclick=function(){approveComment(post_id)}; + button.innerHTML='Approve' if (typeof button1 !== 'undefined') { document.getElementById(button1).classList.toggle("d-md-inline-block"); @@ -24,19 +22,17 @@ function removeComment(post_id,button1,button2) { function approveComment(post_id,button1,button2) { url="/unban_comment/"+post_id - callback=function(){ - try { - document.getElementById("comment-"+post_id+"-only").classList.remove("banned"); - } catch(e) { - document.getElementById("context").classList.remove("banned"); - } + post(url) - button=document.getElementById("remove-"+post_id); - button.onclick=function(){removeComment(post_id)}; - button.innerHTML='Remove' + try { + document.getElementById("comment-"+post_id+"-only").classList.remove("banned"); + } catch(e) { + document.getElementById("context").classList.remove("banned"); } - post(url, callback, "Comment has been approved.") + var button=document.getElementById("remove-"+post_id); + button.onclick=function(){removeComment(post_id)}; + button.innerHTML='Remove' if (typeof button1 !== 'undefined') { document.getElementById(button1).classList.toggle("d-md-inline-block"); @@ -48,14 +44,12 @@ function approveComment(post_id,button1,button2) { function removeComment2(post_id,button1,button2) { url="/ban_comment/"+post_id - callback=function(){ - document.getElementById("comment-"+post_id+"-only").classList.add("banned"); + post(url) - button=document.getElementById("remove-"+post_id); - button.onclick=function(){approveComment(post_id)}; - button.innerHTML='Approve' - } - post(url, callback, "Comment has been removed.") + document.getElementById("comment-"+post_id+"-only").classList.add("banned"); + var button=document.getElementById("remove-"+post_id); + button.onclick=function(){approveComment(post_id)}; + button.innerHTML='Approve' if (typeof button1 !== 'undefined') { document.getElementById(button1).classList.toggle("d-none"); @@ -66,15 +60,12 @@ function removeComment2(post_id,button1,button2) { function approveComment2(post_id,button1,button2) { url="/unban_comment/"+post_id - callback=function(){ - document.getElementById("comment-"+post_id+"-only").classList.remove("banned"); + post(url) - button=document.getElementById("remove-"+post_id); - button.onclick=function(){removeComment(post_id)}; - button.innerHTML='Remove' - } - - post(url, callback, "Comment has been approved.") + document.getElementById("comment-"+post_id+"-only").classList.remove("banned"); + var button=document.getElementById("remove-"+post_id); + button.onclick=function(){removeComment(post_id)}; + button.innerHTML='Remove' if (typeof button1 !== 'undefined') { document.getElementById(button1).classList.toggle("d-none"); diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index 9b668bbe9..a956256d3 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -109,12 +109,8 @@ function delete_commentModal(id) { this.innerHTML='Deleting comment'; this.disabled = true; - post('/delete/comment/' + id, - callback = function() { - - location.reload(); - } - ) + post('/delete/comment/' + id) + location.reload(); } }; diff --git a/files/assets/js/settings_profile.js b/files/assets/js/settings_profile.js index 205d66d40..27fc9b0fa 100644 --- a/files/assets/js/settings_profile.js +++ b/files/assets/js/settings_profile.js @@ -1,18 +1,11 @@ -function post(url, callback, errortext) { +function post(url) { var xhr = new XMLHttpRequest(); xhr.open("POST", url, true); var form = new FormData() form.append("formkey", formkey()); xhr.withCredentials=true; - xhr.onerror=function() { alert(errortext); }; - xhr.onload = function() { - if (xhr.status >= 200 && xhr.status < 300) { - callback(); - } else { - xhr.onerror(); - } - }; xhr.send(form); + window.location.reload(true) }; function updatebgselection(){ @@ -74,7 +67,7 @@ function updatebgselection(){ let bgsDir = backgrounds[bgselector.selectedIndex].folder; for (i=0; i < bgsToDisplay.length; i++) { let onclickPost = bgsDir + "/" + bgsToDisplay[i]; - str += ``; + str += ``; } bgContainer.innerHTML = str; } diff --git a/files/templates/comments.html b/files/templates/comments.html index db4f368ca..c8d8e9a96 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -33,14 +33,14 @@ {% if v %} {% include "award_modal.html" %} - + {% endif %} {% if v and v.admin_level == 6 %} - + {% endif %} +
diff --git a/files/templates/submission.html b/files/templates/submission.html index 38aa02cd5..a820240b5 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -45,7 +45,7 @@ {% if 'rdrama' not in request.host %} {% if v %} - + {% include "award_modal.html" %} {% include "emoji_modal.html" %} {% include "gif_modal.html" %}