remotes/1693045480750635534/spooky-22
Aevann1 2021-07-21 13:00:39 +02:00
parent c0cb68e04a
commit cab9ff1f4c
2 changed files with 104 additions and 89 deletions

View File

@ -3,101 +3,101 @@
<head>
<script>
post_comment=function(fullname){
post_comment=function(fullname){
var form = new FormData();
var form = new FormData();
form.append('formkey', formkey());
form.append('parent_fullname', fullname);
form.append('submission', document.getElementById('reply-form-submission-'+fullname).value);
form.append('body', document.getElementById('reply-form-body-'+fullname).value);
form.append('file', document.getElementById('file-upload-reply-'+fullname).files[0]);
var xhr = new XMLHttpRequest();
xhr.open("post", "/api/comment");
xhr.withCredentials=true;
xhr.onload=function(){
if (xhr.status==200) {
commentForm=document.getElementById('comment-form-space-'+fullname);
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-success').toast('show');
}
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('save-reply-to-'+fullname).classList.add('disabled');
form.append('formkey', formkey());
form.append('parent_fullname', fullname);
form.append('submission', document.getElementById('reply-form-submission-'+fullname).value);
form.append('body', document.getElementById('reply-form-body-'+fullname).value);
form.append('file', document.getElementById('file-upload-reply-'+fullname).files[0]);
var xhr = new XMLHttpRequest();
xhr.open("post", "/api/comment");
xhr.withCredentials=true;
xhr.onload=function(){
if (xhr.status==200) {
commentForm=document.getElementById('comment-form-space-'+fullname);
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-success').toast('show');
}
else {
herald_comment=function(bid,cid){
var xhr = new XMLHttpRequest();
xhr.open("post", "/mod/distinguish_comment/"+bid+'/'+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)
}
comment_edit=function(id){
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"];
var form = new FormData();
form.append('formkey', formkey());
form.append('body', document.getElementById('comment-edit-body-'+id).value);
form.append('file', document.getElementById('file-edit-reply-'+id).files[0]);
var xhr = new XMLHttpRequest();
xhr.open("post", "/edit_comment/"+id);
xhr.withCredentials=true;
xhr.onload=function(){
if (xhr.status==200) {
commentForm=document.getElementById('comment-text-'+id);
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
document.getElementById('cancel-edit-'+id).click()
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-success').toast('show');
}
else {
$('#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)
}
}
xhr.send(form)
document.getElementById('save-reply-to-'+fullname).classList.add('disabled');
}
herald_comment=function(bid,cid){
var xhr = new XMLHttpRequest();
xhr.open("post", "/mod/distinguish_comment/"+bid+'/'+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)
}
comment_edit=function(id){
var commentError = document.getElementById("comment-error-text");
var form = new FormData();
form.append('formkey', formkey());
form.append('body', document.getElementById('comment-edit-body-'+id).value);
form.append('file', document.getElementById('file-edit-reply-'+id).files[0]);
var xhr = new XMLHttpRequest();
xhr.open("post", "/edit_comment/"+id);
xhr.withCredentials=true;
xhr.onload=function(){
if (xhr.status==200) {
commentForm=document.getElementById('comment-text-'+id);
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
document.getElementById('cancel-edit-'+id).click()
$('#toast-comment-success').toast('dispose');
$('#toast-comment-error').toast('dispose');
$('#toast-comment-success').toast('show');
}
else {
$('#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)
}
block_user=function() {

View File

@ -1,3 +1,18 @@
<script>
$('.text-expand').click(function(event){
if (event.which != 1) {
return
};
id=$(this).data('id');
$('#post-text-'+id).toggleClass('d-none');
$('.text-expand-icon-'+id).toggleClass('fa-expand-alt');
$('.text-expand-icon-'+id).toggleClass('fa-compress-alt');
})
</script>
{% for p in listing %}
<script>