diff options
| author | 2025-10-01 10:48:07 +0200 | |
|---|---|---|
| committer | 2025-10-01 10:48:07 +0200 | |
| commit | 2bcc090622c0e62dbff94e52bb6892a51b40ba2a (patch) | |
| tree | 7d9d93c839e45e41c4a75db7dce04a9bb8bc6c2a /p/scripts/main.js | |
| parent | 72884813e13596d211471482ffdc6d723ed678c9 (diff) | |
configurable notification timeout (#7942)
Ref #7931
Ref #5466
Ref #6409
added configuration in "Display"
<img width="636" height="167" alt="grafik" src="https://github.com/user-attachments/assets/7bbc9f26-d91b-4dd2-b715-1d3f9b7a9ad3" />
* i18n: fr
* Update app/i18n/pl/conf.php
Co-authored-by: Inverle <inverle@proton.me>
* make fix-all
* max()
* Minor whitespace
(I am not a fan of excessive vertical indenting)
---------
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Co-authored-by: Inverle <inverle@proton.me>
Diffstat (limited to 'p/scripts/main.js')
| -rw-r--r-- | p/scripts/main.js | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 372a86050..8f85f7333 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1814,14 +1814,22 @@ function openNotification(msg, status) { } notification_working = true; notification.querySelector('.msg').innerHTML = msg; - notification.className = 'notification'; - notification.classList.add(status); + if (status == 'good') { - notification_interval = setTimeout(closeNotification, 4000); + if (context.closeNotification.good > 0) { + notification_interval = setTimeout(closeNotification, context.closeNotification.good); + } else { + notification.classList.add('closed'); + notification_working = false; + } } else { // no status or f.e. status = 'bad', give some more time to read - notification_interval = setTimeout(closeNotification, 8000); + if (context.closeNotification.good > 0) { + notification_interval = setTimeout(closeNotification, context.closeNotification.bad); + } } + notification.className = 'notification'; + notification.classList.add(status); } function closeNotification() { @@ -1844,16 +1852,16 @@ function init_notifications() { }); notification.addEventListener('mouseleave', function () { - notification_interval = setTimeout(closeNotification, 3000); + notification_interval = setTimeout(closeNotification, context.closeNotification.mouseLeave); }); if (notification.querySelector('.msg').innerHTML.length > 0) { notification_working = true; if (notification.classList.contains('good')) { - notification_interval = setTimeout(closeNotification, 4000); + notification_interval = setTimeout(closeNotification, context.closeNotification.good); } else { // no status or f.e. status = 'bad', give some more time to read - notification_interval = setTimeout(closeNotification, 8000); + notification_interval = setTimeout(closeNotification, context.closeNotification.bad); } } } |
