remotes/1693045480750635534/spooky-22
Aevann1 2021-09-26 12:30:15 +02:00
parent 9615f5a652
commit 16c23f3fc1
3 changed files with 61 additions and 33 deletions

View File

@ -172,15 +172,19 @@
if (xhr.status==200) { if (xhr.status==200) {
commentForm=document.getElementById('comment-form-space-'+fullname); commentForm=document.getElementById('comment-form-space-'+fullname);
commentForm.innerHTML=JSON.parse(xhr.response)["html"]; commentForm.innerHTML=JSON.parse(xhr.response)["html"];
document.getElementById('toast-comment-success').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
document.getElementById('toast-comment-error').toast('dispose'); myToast.hide();
document.getElementById('toast-comment-success').toast('show'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
myToast.hide();
myToast.show();
} }
else { else {
var commentError = document.getElementById("comment-error-text"); var commentError = document.getElementById("comment-error-text");
document.getElementById('toast-comment-success').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
document.getElementById('toast-comment-error').toast('dispose'); myToast.hide();
document.getElementById('toast-comment-error').toast('show'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
myToast.hide();
myToast.show();
commentError.textContent = JSON.parse(xhr.response)["error"]; commentError.textContent = JSON.parse(xhr.response)["error"];
} }
} }
@ -204,16 +208,20 @@
if (xhr.status==200) { if (xhr.status==200) {
commentForm=document.getElementById('comment-form-space-'+id); commentForm=document.getElementById('comment-form-space-'+id);
commentForm.innerHTML=JSON.parse(xhr.response)["html"]; commentForm.innerHTML=JSON.parse(xhr.response)["html"];
document.getElementById('toast-comment-success').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
document.getElementById('toast-comment-error').toast('dispose'); myToast.hide();
document.getElementById('toast-comment-success').toast('show'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
myToast.hide();
myToast.show();
} }
else { else {
var commentError = document.getElementById("comment-error-text"); var commentError = document.getElementById("comment-error-text");
document.getElementById('toast-comment-success').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
document.getElementById('toast-comment-error').toast('dispose'); myToast.hide();
document.getElementById('toast-comment-error').toast('show'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
commentError.textContent = JSON.parse(xhr.response)["error"]; myToast.hide();
myToast.show();
} }
} }
xhr.send(form) xhr.send(form)
@ -240,14 +248,19 @@
commentForm=document.getElementById('comment-text-'+id); commentForm=document.getElementById('comment-text-'+id);
commentForm.innerHTML=JSON.parse(xhr.response)["html"]; commentForm.innerHTML=JSON.parse(xhr.response)["html"];
document.getElementById('cancel-edit-'+id).click() document.getElementById('cancel-edit-'+id).click()
document.getElementById('toast-comment-success').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
document.getElementById('toast-comment-error').toast('dispose'); myToast.hide();
document.getElementById('toast-comment-success').toast('show'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
myToast.hide();
myToast.show();
} }
else { else {
document.getElementById('toast-comment-success').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
document.getElementById('toast-comment-error').toast('dispose'); myToast.hide();
document.getElementById('toast-comment-error').toast('show'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
myToast.hide();
myToast.show();
commentError.textContent = JSON.parse(xhr.response)["error"]; commentError.textContent = JSON.parse(xhr.response)["error"];
} }
} }
@ -357,9 +370,12 @@
} }
else { else {
var commentError = document.getElementById("comment-error-text"); var commentError = document.getElementById("comment-error-text");
document.getElementById('toast-comment-success').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
document.getElementById('toast-comment-error').toast('dispose'); myToast.hide();
document.getElementById('toast-comment-error').toast('show'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
myToast.hide();
myToast.show();
commentError.textContent = JSON.parse(xhr.response)["error"]; commentError.textContent = JSON.parse(xhr.response)["error"];
} }
} }
@ -397,9 +413,12 @@
} }
else { else {
var commentError = document.getElementById("comment-error-text"); var commentError = document.getElementById("comment-error-text");
document.getElementById('toast-comment-success').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
document.getElementById('toast-comment-error').toast('dispose'); myToast.hide();
document.getElementById('toast-comment-error').toast('show'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
myToast.hide();
myToast.show();
commentError.textContent = JSON.parse(xhr.response)["error"]; commentError.textContent = JSON.parse(xhr.response)["error"];
} }
} }

View File

@ -148,8 +148,12 @@
window.location.reload(true); window.location.reload(true);
} }
else { else {
document.getElementById('toast-exile-error').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
document.getElementById('toast-exile-error').toast('show'); myToast.hide();
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
myToast.hide();
myToast.show();
exileError.textContent = JSON.parse(xhr.response)["error"]; exileError.textContent = JSON.parse(xhr.response)["error"];
} }
} }

View File

@ -55,15 +55,20 @@
if (xhr.status==200) { if (xhr.status==200) {
commentForm=document.getElementById('comment-form-space-'+fullname); commentForm=document.getElementById('comment-form-space-'+fullname);
commentForm.innerHTML=JSON.parse(xhr.response)["html"]; commentForm.innerHTML=JSON.parse(xhr.response)["html"];
document.getElementById('toast-comment-success').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
document.getElementById('toast-comment-error').toast('dispose'); myToast.hide();
document.getElementById('toast-comment-success').toast('show'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
myToast.hide();
myToast.show();
} }
else { else {
var commentError = document.getElementById("comment-error-text"); var commentError = document.getElementById("comment-error-text");
document.getElementById('toast-comment-success').toast('dispose'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
document.getElementById('toast-comment-error').toast('dispose'); myToast.hide();
document.getElementById('toast-comment-error').toast('show'); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
myToast.hide();
myToast.show();
commentError.textContent = JSON.parse(xhr.response)["error"]; commentError.textContent = JSON.parse(xhr.response)["error"];
} }
} }