From 2bcc090622c0e62dbff94e52bb6892a51b40ba2a Mon Sep 17 00:00:00 2001
From: maTh <1645099+math-GH@users.noreply.github.com>
Date: Wed, 1 Oct 2025 10:48:07 +0200
Subject: configurable notification timeout (#7942)
Ref #7931
Ref #5466
Ref #6409
added configuration in "Display"
* i18n: fr
* Update app/i18n/pl/conf.php
Co-authored-by: Inverle
* make fix-all
* max()
* Minor whitespace
(I am not a fan of excessive vertical indenting)
---------
Co-authored-by: Alexandre Alapetite
Co-authored-by: Inverle
---
p/scripts/main.js | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
(limited to 'p/scripts/main.js')
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);
}
}
}
--
cgit v1.2.3