diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index 32e8fb7f8..a8f2ec88d 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -24,18 +24,21 @@ function post_toast3(url, button1, button2) { xhr.withCredentials=true; xhr.onload = function() { - try {let data = JSON.parse(xhr.response)} - catch(e) {new bootstrap.Toast(document.getElementById('toast-post-error')).show();} - if (xhr.status >= 200 && xhr.status < 300 && !data['error']) { - document.getElementById('toast-post-success-text').innerText = data["message"]; - new bootstrap.Toast(document.getElementById('toast-post-success')).show(); - document.getElementById(button1).classList.toggle("d-md-inline-block"); - document.getElementById(button2).classList.toggle("d-md-inline-block"); + try { + let data = JSON.parse(xhr.response) + if (xhr.status >= 200 && xhr.status < 300 && !data['error']) { + document.getElementById('toast-post-success-text').innerText = data["message"]; + new bootstrap.Toast(document.getElementById('toast-post-success')).show(); - } else { - if (data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; - new bootstrap.Toast(document.getElementById('toast-post-error')).show(); + document.getElementById(button1).classList.toggle("d-none"); + document.getElementById(button2).classList.toggle("d-none"); + + } else { + if (data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; + new bootstrap.Toast(document.getElementById('toast-post-error')).show(); + } } + catch(e) {new bootstrap.Toast(document.getElementById('toast-post-error')).show();} }; xhr.send(form); diff --git a/files/assets/js/header.js b/files/assets/js/header.js index 75eadc784..107f07dc4 100644 --- a/files/assets/js/header.js +++ b/files/assets/js/header.js @@ -26,16 +26,21 @@ function post_toast(url, reload, data) { xhr.withCredentials=true; xhr.onload = function() { - try {let data = JSON.parse(xhr.response)} - catch(e) {new bootstrap.Toast(document.getElementById('toast-post-error')).show();} - if (xhr.status >= 200 && xhr.status < 300 && !data['error']) { - document.getElementById('toast-post-success-text').innerText = data["message"]; - new bootstrap.Toast(document.getElementById('toast-post-success')).show(); - if (reload == 1) {location.reload(true)} - } else { - if (data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; - new bootstrap.Toast(document.getElementById('toast-post-error')).show(); + try { + let data = JSON.parse(xhr.response) + if (xhr.status >= 200 && xhr.status < 300 && !data['error']) { + document.getElementById('toast-post-success-text').innerText = data["message"]; + new bootstrap.Toast(document.getElementById('toast-post-success')).show(); + + document.getElementById(button1).classList.toggle("d-none"); + document.getElementById(button2).classList.toggle("d-none"); + + } else { + if (data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; + new bootstrap.Toast(document.getElementById('toast-post-error')).show(); + } } + catch(e) {new bootstrap.Toast(document.getElementById('toast-post-error')).show();} }; xhr.send(form); diff --git a/files/assets/js/post_toast2.js b/files/assets/js/post_toast2.js index 24224e951..24c303aa0 100644 --- a/files/assets/js/post_toast2.js +++ b/files/assets/js/post_toast2.js @@ -15,19 +15,21 @@ function post_toast2(url, button1, button2) { xhr.withCredentials=true; xhr.onload = function() { - try {let data = JSON.parse(xhr.response)} - catch(e) {new bootstrap.Toast(document.getElementById('toast-post-error')).show();} - if (xhr.status >= 200 && xhr.status < 300 && !data['error']) { - document.getElementById('toast-post-success-text').innerText = data["message"]; - new bootstrap.Toast(document.getElementById('toast-post-success')).show(); + try { + let data = JSON.parse(xhr.response) + if (xhr.status >= 200 && xhr.status < 300 && !data['error']) { + document.getElementById('toast-post-success-text').innerText = data["message"]; + new bootstrap.Toast(document.getElementById('toast-post-success')).show(); - document.getElementById(button1).classList.toggle("d-none"); - document.getElementById(button2).classList.toggle("d-none"); - - } else { - if (data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; - new bootstrap.Toast(document.getElementById('toast-post-error')).show(); + document.getElementById(button1).classList.toggle("d-none"); + document.getElementById(button2).classList.toggle("d-none"); + + } else { + if (data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; + new bootstrap.Toast(document.getElementById('toast-post-error')).show(); + } } + catch(e) {new bootstrap.Toast(document.getElementById('toast-post-error')).show();} }; xhr.send(form); diff --git a/files/templates/changelog.html b/files/templates/changelog.html index eeeea51bc..c9ae03453 100644 --- a/files/templates/changelog.html +++ b/files/templates/changelog.html @@ -104,6 +104,6 @@ {% endif %} - + {% endblock %} \ No newline at end of file diff --git a/files/templates/comments.html b/files/templates/comments.html index b3293ed7e..27950766e 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -844,7 +844,7 @@ {% if v %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index f765b6781..c58e4e63a 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -322,7 +322,7 @@ {% if v %} - + {% endif %} diff --git a/files/templates/header.html b/files/templates/header.html index 666d85b11..b941eca8a 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -210,7 +210,7 @@ - +