From aeeac05f2a436098383c3da76dad9bdebdb3ed38 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 1 Feb 2022 08:23:36 +0200 Subject: [PATCH] vxc --- files/assets/js/comments_v.js | 33 +++++++++++++------------- files/assets/js/report_post_modal.js | 3 +++ files/templates/comments.html | 2 +- files/templates/report_post_modal.html | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index 783bcdc4b..51ac20785 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -52,24 +52,25 @@ function report_commentModal(id, author) { document.getElementById("reportCommentFormAfter").classList.add('d-none'); document.getElementById("reportCommentButton").onclick = function() { + this.innerHTML='Reporting comment'; + this.disabled = true; + const xhr = new XMLHttpRequest(); + xhr.open("POST", '/report/comment/'+id); + xhr.setRequestHeader('xhr', 'xhr'); + var form = new FormData() + form.append("formkey", formkey()); + form.append("reason", document.getElementById("reason-comment").value); - this.innerHTML='Reporting comment'; - this.disabled = true; - const xhr = new XMLHttpRequest(); - xhr.open("POST", '/report/comment/'+id); - xhr.setRequestHeader('xhr', 'xhr'); - var form = new FormData() - form.append("formkey", formkey()); - form.append("reason", document.getElementById("reason-comment").value); + xhr.onload=function() { + document.getElementById("reportCommentFormBefore").classList.add('d-none'); + document.getElementById("reportCommentFormAfter").classList.remove('d-none'); + this.innerHTML='Report comment'; + this.disabled = false; + }; - xhr.onload=function() { - document.getElementById("reportCommentFormBefore").classList.add('d-none'); - document.getElementById("reportCommentFormAfter").classList.remove('d-none'); - }; - - xhr.onerror=function(){alert(errortext)}; - xhr.send(form); -} + xhr.onerror=function(){alert(errortext)}; + xhr.send(form); + } }; diff --git a/files/assets/js/report_post_modal.js b/files/assets/js/report_post_modal.js index f355a825a..26dcfd22b 100644 --- a/files/assets/js/report_post_modal.js +++ b/files/assets/js/report_post_modal.js @@ -1,6 +1,8 @@ function report_postModal(id) { submitbutton=document.getElementById("reportPostButton"); + document.getElementById("reportPostFormBefore").classList.remove('d-none'); + document.getElementById("reportPostFormAfter").classList.add('d-none'); submitbutton.onclick = function() { @@ -18,6 +20,7 @@ function report_postModal(id) { document.getElementById("reportPostFormBefore").classList.add('d-none'); document.getElementById("reportPostFormAfter").classList.remove('d-none'); this.disabled = false; + this.innerHTML='Report post'; }; xhr.onerror=function(){alert(errortext)}; diff --git a/files/templates/comments.html b/files/templates/comments.html index 875e382e1..67bf71079 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -904,7 +904,7 @@ {% if v %} - + {% endif %} diff --git a/files/templates/report_post_modal.html b/files/templates/report_post_modal.html index 6fb12011c..ea8b9b1d0 100644 --- a/files/templates/report_post_modal.html +++ b/files/templates/report_post_modal.html @@ -32,4 +32,4 @@ - \ No newline at end of file + \ No newline at end of file