master
Aevann1 2021-09-12 04:26:45 +02:00
parent 49acbe139c
commit f28a06df5c
3 changed files with 79 additions and 2 deletions

View File

@ -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) {

View File

@ -134,7 +134,7 @@
{% if v.admin_level >=3 or v.id == p.author.id and v.coins > 150 %}
<button id="club2-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}')" data-dismiss="modal"><i class="fas fa-eye-slash mr-3"></i>Mark club</button>
<button id="unclub2-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}')" data-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button>
<button id="unclub2-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}')" data-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button>
{% endif %}
{% if v.admin_level >=3 %}

View File

@ -322,7 +322,7 @@
{% if v.admin_level >=3 or v.id == p.author.id and v.coins > 150 %}
<button id="club2-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}')" data-dismiss="modal"><i class="fas fa-eye-slash mr-3"></i>Mark club</button>
<button id="unclub2-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}')" data-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button>
<button id="unclub2-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" href="javascript:void(0)" onclick="post_toast2('/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}')" data-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button>
{% endif %}
{% if v.admin_level >=3 %}