diff options
-rw-r--r-- | modules/libpref/init/all.js | 2 | ||||
-rw-r--r-- | toolkit/components/alerts/resources/content/alert.css | 1 | ||||
-rw-r--r-- | toolkit/components/alerts/resources/content/alert.js | 10 |
3 files changed, 10 insertions, 3 deletions
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 5f88882d1..aef570109 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4380,6 +4380,8 @@ pref("dom.webnotifications.enabled", true); // Alert animation effect, name is disableSlidingEffect for backwards-compat. pref("alerts.disableSlidingEffect", false); +// The immediate duration of the alert, in milliseconds. +pref("alerts.durationImmediate", 20000); // DOM full-screen API. pref("full-screen-api.enabled", false); diff --git a/toolkit/components/alerts/resources/content/alert.css b/toolkit/components/alerts/resources/content/alert.css index e6c1a14eb..37140a911 100644 --- a/toolkit/components/alerts/resources/content/alert.css +++ b/toolkit/components/alerts/resources/content/alert.css @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #alertBox[animate] { - animation-duration: 4s; animation-fill-mode: both; animation-name: alert-animation; } diff --git a/toolkit/components/alerts/resources/content/alert.js b/toolkit/components/alerts/resources/content/alert.js index e97c0c23d..a9450f883 100644 --- a/toolkit/components/alerts/resources/content/alert.js +++ b/toolkit/components/alerts/resources/content/alert.js @@ -85,7 +85,12 @@ function prefillAlertInfo() { } function onAlertLoad() { - const ALERT_DURATION_IMMEDIATE = 4000; + const ALERT_DURATION_IMMEDIATE_MIN = 4000; + const ALERT_DURATION_IMMEDIATE_MAX = 60000; + var alertDurationImmediate = Services.prefs.getIntPref("alerts.durationImmediate"); + 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"; @@ -103,7 +108,7 @@ function onAlertLoad() { window.addEventListener("XULAlertClose", function() { window.close(); }); if (Services.prefs.getBoolPref("alerts.disableSlidingEffect")) { - setTimeout(function() { window.close(); }, ALERT_DURATION_IMMEDIATE); + setTimeout(function() { window.close(); }, alertDurationImmediate); return; } @@ -114,6 +119,7 @@ function onAlertLoad() { window.close(); } }, false); + alertBox.style.animationDuration = Math.round(alertDurationImmediate / 1000).toString() + "s"; alertBox.setAttribute("animate", true); if (gAlertListener) { |