diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-12 20:23:00 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-12 20:23:00 +0200 |
commit | 1170e81edd38ec530d09fd6a3e76936657ff52ce (patch) | |
tree | 49bd415233ff56646bbfbe989bfc2a1f7ba81f12 /toolkit/components/alerts/resources/content/alert.js | |
parent | 4c2e77404f43040ce7a9f0d9052448b3f23a8c28 (diff) | |
download | UXP-1170e81edd38ec530d09fd6a3e76936657ff52ce.tar UXP-1170e81edd38ec530d09fd6a3e76936657ff52ce.tar.gz UXP-1170e81edd38ec530d09fd6a3e76936657ff52ce.tar.lz UXP-1170e81edd38ec530d09fd6a3e76936657ff52ce.tar.xz UXP-1170e81edd38ec530d09fd6a3e76936657ff52ce.zip |
moebius#154: Notifications - user settings - the immediate duration of the alert
https://github.com/MoonchildProductions/moebius/pull/154
Diffstat (limited to 'toolkit/components/alerts/resources/content/alert.js')
-rw-r--r-- | toolkit/components/alerts/resources/content/alert.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/toolkit/components/alerts/resources/content/alert.js b/toolkit/components/alerts/resources/content/alert.js index ead4d503f..ce60ab0fa 100644 --- a/toolkit/components/alerts/resources/content/alert.js +++ b/toolkit/components/alerts/resources/content/alert.js @@ -166,7 +166,12 @@ function prefillAlertInfo() { } function onAlertLoad() { - const ALERT_DURATION_IMMEDIATE = 20000; + const ALERT_DURATION_IMMEDIATE_MIN = 4000; + const ALERT_DURATION_IMMEDIATE_MAX = 60000; + let alertDurationImmediate = Services.prefs.getIntPref("alerts.durationImmediate", ALERT_DURATION_IMMEDIATE_MIN); + alertDurationImmediate = alertDurationImmediate >= ALERT_DURATION_IMMEDIATE_MIN + && alertDurationImmediate <= ALERT_DURATION_IMMEDIATE_MAX + ? alertDurationImmediate : ALERT_DURATION_IMMEDIATE_MIN; let alertTextBox = document.getElementById("alertTextBox"); let alertImageBox = document.getElementById("alertImageBox"); alertImageBox.style.minHeight = alertTextBox.scrollHeight + "px"; @@ -186,7 +191,7 @@ function onAlertLoad() { // If the require interaction flag is set, prevent auto-closing the notification. if (!gRequireInteraction) { if (Services.prefs.getBoolPref("alerts.disableSlidingEffect")) { - setTimeout(function() { window.close(); }, ALERT_DURATION_IMMEDIATE); + setTimeout(function() { window.close(); }, alertDurationImmediate); } else { let alertBox = document.getElementById("alertBox"); alertBox.addEventListener("animationend", function hideAlert(event) { @@ -197,6 +202,7 @@ function onAlertLoad() { window.close(); } }, false); + alertBox.style.animationDuration = Math.round(alertDurationImmediate / 1000).toString() + "s"; alertBox.setAttribute("animate", true); } } |