From 5efe1640adf93d69944c92094dfe07740b09253e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 26 Sep 2021 12:24:04 +0200 Subject: [PATCH] dfs --- files/templates/comments.html | 26 ++++++++++++++++---------- files/templates/userpage.html | 18 ++++++++++++------ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/files/templates/comments.html b/files/templates/comments.html index de7aa453cb..c7c0c5016f 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -19,8 +19,9 @@ xhr.onload = function() { if (xhr.status >= 200 && xhr.status < 300) { - document.getElementById('toast-post-success').toast('dispose'); - document.getElementById('toast-post-success').toast('show'); + var myToast = new bootstrap.Toast(document.getElementById('toast-post-success')); + myToast.hide(); + myToast.show(); try { document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"]; } catch(e) { @@ -34,14 +35,18 @@ try { data=JSON.parse(xhr.response); - document.getElementById('toast-post-error').toast('dispose'); - document.getElementById('toast-post-error').toast('show'); + var myToast = new bootstrap.Toast(document.getElementById('toast-post-error')); + myToast.hide(); + myToast.show(); document.getElementById('toast-post-error-text').innerText = data["error"]; return false } catch(e) { - document.getElementById('toast-post-success').toast('dispose'); - document.getElementById('toast-post-error').toast('dispose'); - document.getElementById('toast-post-error').toast('show'); + var myToast = new bootstrap.Toast(document.getElementById('toast-post-success')); + myToast.hide(); + + var myToast = new bootstrap.Toast(document.getElementById('toast-post-error')); + myToast.hide(); + myToast.show(); document.getElementById('toast-post-error-text').innerText = "Error. Try again later."; return false } @@ -412,8 +417,9 @@ document.getElementById(button1).classList.toggle("d-none"); document.getElementById(button2).classList.toggle("d-none"); - document.getElementById('toast-post-success').toast('dispose'); - document.getElementById('toast-post-success').toast('show'); + var myToast = new bootstrap.Toast(document.getElementById('toast-post-success')); + myToast.hide(); + myToast.show(); if (distinguish=='yes') { document.getElementById('toast-post-success-text').innerText = "Comment distinguished!"; } @@ -489,7 +495,7 @@
-
+