From 47a86f877172fe6cdc44991c0722550e4190cb95 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 3 May 2024 06:52:05 +0000 Subject: make sure to always move the recent notification to the top --- view/js/main.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/view/js/main.js b/view/js/main.js index 4280284ae..7eca7408e 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1819,18 +1819,19 @@ function toggleAside() { } function toast(string, severity) { + let id = btoa(string); let container = document.getElementById('toast-container'); - - let toast = document.getElementById(btoa(string)); + let toast = document.getElementById(id); if (!toast) { toast = document.createElement('div'); - toast.setAttribute('id', btoa(string)); + toast.setAttribute('id', id); toast.innerHTML = '
' + string + '
'; toast.classList.add('toast', 'p-2', 'bg-' + severity + '-subtle', 'text-' + severity + '-emphasis', 'border-' + severity); - container.prepend(toast); } + container.prepend(toast); + let toastInstance = bootstrap.Toast.getOrCreateInstance(toast); if (severity === 'danger') { -- cgit v1.2.3