aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-05-02 17:51:39 +0000
committerMario <mario@mariovavti.com>2024-05-02 17:51:39 +0000
commitba4773a61e6a406dcea92a7251c17709b97dcfdc (patch)
treebcd0a768dcb1009b14e8bff51500d83512248b08 /view
parent977e6a02f4c21bbfc15e49f9b7247e3c216ba171 (diff)
downloadvolse-hubzilla-ba4773a61e6a406dcea92a7251c17709b97dcfdc.tar.gz
volse-hubzilla-ba4773a61e6a406dcea92a7251c17709b97dcfdc.tar.bz2
volse-hubzilla-ba4773a61e6a406dcea92a7251c17709b97dcfdc.zip
add some deduplication
Diffstat (limited to 'view')
-rw-r--r--view/js/main.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 5d273ee39..4280284ae 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -1820,11 +1820,16 @@ function toggleAside() {
function toast(string, severity) {
let container = document.getElementById('toast-container');
- let toast = document.createElement('div');
- toast.innerHTML = '<div class="d-flex"><div class="toast-body">' + string + '</div><button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button></div>';
- toast.classList.add('toast', 'p-2', 'bg-' + severity + '-subtle', 'text-' + severity + '-emphasis', 'border-' + severity);
- container.prepend(toast);
+ let toast = document.getElementById(btoa(string));
+
+ if (!toast) {
+ toast = document.createElement('div');
+ toast.setAttribute('id', btoa(string));
+ toast.innerHTML = '<div class="d-flex"><div class="toast-body">' + string + '</div><button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button></div>';
+ toast.classList.add('toast', 'p-2', 'bg-' + severity + '-subtle', 'text-' + severity + '-emphasis', 'border-' + severity);
+ container.prepend(toast);
+ }
let toastInstance = bootstrap.Toast.getOrCreateInstance(toast);