diff --git a/pkg/web/static/js/core.js b/pkg/web/static/js/core.js index c18c13d..2a1c85b 100644 --- a/pkg/web/static/js/core.js +++ b/pkg/web/static/js/core.js @@ -75,9 +75,21 @@ function showBanEventToast(event) { + ' ' + escapeHtml(server) + ' • ' + escapeHtml(country) + ' ' + ' ' + + ' ' + ''; - - // Add click handler to scroll to ban events table + + // Close button handler + var closeBtn = toast.querySelector('button'); + closeBtn.addEventListener('click', function(e) { + e.stopPropagation(); + clearTimeout(autoRemoveTimer); + toast.classList.remove('show'); + setTimeout(function() { toast.remove(); }, 300); + }); + + // Click on toast body scrolls to ban events table toast.addEventListener('click', function() { var logSection = document.getElementById('logOverviewSection'); if (logSection) { @@ -92,7 +104,7 @@ function showBanEventToast(event) { toast.classList.add('show'); }); - setTimeout(function() { + var autoRemoveTimer = setTimeout(function() { toast.classList.remove('show'); setTimeout(function() { toast.remove();