fds
This commit is contained in:
parent
c5af36ad2e
commit
e88971dd3e
7 changed files with 32 additions and 44 deletions
|
@ -24,9 +24,8 @@ function post_toast3(url, button1, button2) {
|
|||
xhr.withCredentials=true;
|
||||
|
||||
xhr.onload = function() {
|
||||
try {
|
||||
let data = JSON.parse(xhr.response)
|
||||
if (xhr.status >= 200 && xhr.status < 300 && !data['error']) {
|
||||
if (xhr.status >= 200 && xhr.status < 300 && data && data["message"]) {
|
||||
document.getElementById('toast-post-success-text').innerText = data["message"];
|
||||
new bootstrap.Toast(document.getElementById('toast-post-success')).show();
|
||||
|
||||
|
@ -34,11 +33,9 @@ function post_toast3(url, button1, button2) {
|
|||
document.getElementById(button2).classList.toggle("d-none");
|
||||
|
||||
} else {
|
||||
if (data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"];
|
||||
if (data && 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);
|
||||
|
|
|
@ -26,21 +26,15 @@ function post_toast(url, reload, data) {
|
|||
xhr.withCredentials=true;
|
||||
|
||||
xhr.onload = function() {
|
||||
try {
|
||||
let data = JSON.parse(xhr.response)
|
||||
if (xhr.status >= 200 && xhr.status < 300 && !data['error']) {
|
||||
if (xhr.status >= 200 && xhr.status < 300 && data && data['message']) {
|
||||
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");
|
||||
|
||||
if (reload == 1) {location.reload(true)}
|
||||
} else {
|
||||
if (data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"];
|
||||
if (data && 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);
|
||||
|
|
|
@ -15,9 +15,8 @@ function post_toast2(url, button1, button2) {
|
|||
xhr.withCredentials=true;
|
||||
|
||||
xhr.onload = function() {
|
||||
try {
|
||||
let data = JSON.parse(xhr.response)
|
||||
if (xhr.status >= 200 && xhr.status < 300 && !data['error']) {
|
||||
if (xhr.status >= 200 && xhr.status < 300 && data && data["message"]) {
|
||||
document.getElementById('toast-post-success-text').innerText = data["message"];
|
||||
new bootstrap.Toast(document.getElementById('toast-post-success')).show();
|
||||
|
||||
|
@ -25,11 +24,9 @@ function post_toast2(url, button1, button2) {
|
|||
document.getElementById(button2).classList.toggle("d-none");
|
||||
|
||||
} else {
|
||||
if (data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"];
|
||||
if (data && 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);
|
||||
|
|
|
@ -104,6 +104,6 @@
|
|||
</nav>
|
||||
{% endif %}
|
||||
|
||||
<script src="/static/assets/js/post_toast2.js?a=6"></script>
|
||||
<script src="/static/assets/js/post_toast2.js?a=7"></script>
|
||||
|
||||
{% endblock %}
|
|
@ -844,7 +844,7 @@
|
|||
|
||||
{% if v %}
|
||||
<script src="/static/assets/js/marked.js?a=3"></script>
|
||||
<script src="/static/assets/js/comments_v.js?a=6"></script>
|
||||
<script src="/static/assets/js/comments_v.js?a=7"></script>
|
||||
{% endif %}
|
||||
|
||||
<script src="/static/assets/js/clipboard.js?a=3"></script>
|
||||
|
|
|
@ -318,7 +318,7 @@
|
|||
<script src="/static/assets/js/lozad.js?a=3"></script>
|
||||
|
||||
{% if v %}
|
||||
<script src="/static/assets/js/post_toast2.js?a=6"></script>
|
||||
<script src="/static/assets/js/post_toast2.js?a=7"></script>
|
||||
<script src="/static/assets/js/formatting.js?a=3"></script>
|
||||
<script src="/static/assets/js/default.js?a=3"></script>
|
||||
{% endif %}
|
||||
|
|
|
@ -210,7 +210,7 @@
|
|||
</div>
|
||||
</nav>
|
||||
|
||||
<script src="/static/assets/js/header.js?a=6"></script>
|
||||
<script src="/static/assets/js/header.js?a=7"></script>
|
||||
|
||||
<style>
|
||||
.notif-count {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue