MarseyWorld/files/assets/js/admin/comments.js

50 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-11-03 15:43:00 +00:00
function removeComment(t,comment_id,button1,button2,cls) {
2023-08-23 21:57:39 +00:00
url = "/remove_comment/"+comment_id
2022-07-16 21:00:02 +00:00
postToastSwitch(t, url,
2022-11-03 19:07:08 +00:00
button1,
button2,
cls,
() => {
2022-12-30 12:52:59 +00:00
if (location.pathname == '/admin/reported/comments')
2022-11-03 19:07:08 +00:00
{
document.getElementById("post-info-"+comment_id).remove()
document.getElementById("comment-"+comment_id).remove()
}
else
{
try {
document.getElementById("comment-"+comment_id+"-only").classList.add("banned");
} catch(e) {
document.getElementById("context").classList.add("banned");
2022-11-03 15:43:00 +00:00
}
}
}
2022-11-03 15:43:00 +00:00
);
}
2022-07-16 21:00:02 +00:00
2022-11-03 15:43:00 +00:00
function approveComment(t,comment_id,button1,button2,cls) {
2023-08-23 21:57:39 +00:00
url = "/approve_comment/"+comment_id
2022-07-16 21:00:02 +00:00
postToastSwitch(t, url,
2022-11-03 19:07:08 +00:00
button1,
button2,
cls,
() => {
2022-12-30 12:52:59 +00:00
if (location.pathname == '/admin/reported/comments')
2022-11-03 19:07:08 +00:00
{
document.getElementById("post-info-"+comment_id).remove()
document.getElementById("comment-"+comment_id).remove()
}
else
{
try {
document.getElementById("comment-"+comment_id+"-only").classList.remove("banned");
} catch(e) {
document.getElementById("context").classList.remove("banned");
2022-11-03 15:43:00 +00:00
}
}
}
2022-11-03 15:43:00 +00:00
);
}