diff --git a/files/templates/default.html b/files/templates/default.html index fec23f10e..bc14cb599 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -247,6 +247,83 @@ } } + admin_comment=function(cid,button1,button2,distinguish){ + + + var xhr = new XMLHttpRequest(); + xhr.open("post", "/distinguish_comment/"+cid); + + var form = new FormData(); + + form.append('formkey', formkey()); + + xhr.withCredentials=true; + xhr.onload=function(){ + if (xhr.status==200) { + comment=document.getElementById('comment-'+cid+'-only'); + comment.innerHTML=JSON.parse(xhr.response)["html"]; + } + else { + var commentError = document.getElementById("comment-error-text"); + $('#toast-comment-success').toast('dispose'); + $('#toast-comment-error').toast('dispose'); + $('#toast-comment-error').toast('show'); + commentError.textContent = JSON.parse(xhr.response)["error"]; + } + } + xhr.send(form) + + document.getElementById(button1).classList.toggle("d-md-inline-block"); + document.getElementById(button2).classList.toggle("d-md-inline-block"); + + $('#toast-post-success').toast('dispose'); + $('#toast-post-success').toast('show'); + if (distinguish=='yes') { + document.getElementById('toast-post-success-text').innerText = "Comment distinguished!"; + } + else { + document.getElementById('toast-post-success-text').innerText = "Comment undistinguished!"; + } + } + + + admin_comment2=function(cid,button1,button2,distinguish){ + var xhr = new XMLHttpRequest(); + xhr.open("post", "/distinguish_comment/"+cid); + + var form = new FormData(); + + form.append('formkey', formkey()); + + xhr.withCredentials=true; + xhr.onload=function(){ + if (xhr.status==200) { + comment=document.getElementById('comment-'+cid+'-only'); + comment.innerHTML=JSON.parse(xhr.response)["html"]; + } + else { + var commentError = document.getElementById("comment-error-text"); + $('#toast-comment-success').toast('dispose'); + $('#toast-comment-error').toast('dispose'); + $('#toast-comment-error').toast('show'); + commentError.textContent = JSON.parse(xhr.response)["error"]; + } + } + xhr.send(form) + + document.getElementById(button1).classList.toggle("d-none"); + document.getElementById(button2).classList.toggle("d-none"); + + $('#toast-post-success').toast('dispose'); + $('#toast-post-success').toast('show'); + if (distinguish=='yes') { + document.getElementById('toast-post-success-text').innerText = "Comment distinguished!"; + } + else { + document.getElementById('toast-post-success-text').innerText = "Comment undistinguished!"; + } + } + //Autoexpand textedit comments function autoExpand (field) { diff --git a/files/templates/submission.html b/files/templates/submission.html index da0210c9d..60369d2c9 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -134,7 +134,7 @@ {% if v.admin_level >=3 or v.id == p.author.id and v.coins > 150 %} - + {% endif %} {% if v.admin_level >=3 %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index c9c8cc892..44442c159 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -322,7 +322,7 @@ {% if v.admin_level >=3 or v.id == p.author.id and v.coins > 150 %} - + {% endif %} {% if v.admin_level >=3 %}