diff --git a/drama/templates/default.html b/drama/templates/default.html index 29342b45b..78cfba175 100644 --- a/drama/templates/default.html +++ b/drama/templates/default.html @@ -219,26 +219,19 @@ document.getElementById("comment-author").textContent = author; + //offtopic.disabled=true; document.getElementById("reportCommentButton").onclick = function() { this.innerHTML='Reporting comment'; this.disabled = true; - var xhr = new XMLHttpRequest(); - xhr.open("POST", '/api/flag/comment/'+id, true); - var form = new FormData() - form.append("formkey", formkey()); - form.append("reason", document.getElementById("reason").value); + post('/api/flag/comment/' + id, + callback = function() { - xhr.withCredentials=true; - - 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); + document.getElementById("reportCommentFormBefore").classList.add('d-none'); + document.getElementById("reportCommentFormAfter").classList.remove('d-none'); + } + ) } };