Bug 355846 - Add a pref to disable sliding effect for alerts. r=enndeakin

This commit is contained in:
Javi Rueda
2011-08-22 18:43:37 +02:00
parent f0f521ae97
commit f51e1019a2
2 changed files with 24 additions and 17 deletions

View File

@@ -3331,5 +3331,11 @@ pref("network.buffer.cache.size", 32768);
// Desktop Notification
pref("notification.feature.enabled", false);
// Alert sliding effect
pref("alerts.slideIncrement", 1);
pref("alerts.slideIncrementTime", 10);
pref("alerts.totalOpenTime", 4000);
pref("alerts.disableSlidingEffect", false);
//3D Transforms
pref("layout.3d-transforms.enabled, false);

View File

@@ -48,7 +48,8 @@ var gSlideIncrement = 1;
var gSlideTime = 10;
var gOpenTime = 3000; // total time the alert should stay up once we are done animating.
var gOrigin = 0; // Default value: alert from bottom right, sliding in vertically.
var gDisableSlideEffect = false;
var gAlertListener = null;
var gAlertTextClickable = false;
var gAlertCookie = "";
@@ -92,20 +93,14 @@ function prefillAlertInfo()
function onAlertLoad()
{
// Read out our initial settings from prefs.
try
{
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService();
prefService = prefService.QueryInterface(Components.interfaces.nsIPrefService);
var prefBranch = prefService.getBranch(null);
gSlideIncrement = prefBranch.getIntPref("alerts.slideIncrement");
gSlideTime = prefBranch.getIntPref("alerts.slideIncrementTime");
gOpenTime = prefBranch.getIntPref("alerts.totalOpenTime");
}
catch (ex)
{
}
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService();
prefService = prefService.QueryInterface(Components.interfaces.nsIPrefService);
var prefBranch = prefService.getBranch(null);
gSlideIncrement = prefBranch.getIntPref("alerts.slideIncrement");
gSlideTime = prefBranch.getIntPref("alerts.slideIncrementTime");
gOpenTime = prefBranch.getIntPref("alerts.totalOpenTime");
gDisableSlideEffect = prefBranch.getBoolPref("alerts.disableSlidingEffect");
// Make sure that the contents are fixed at the window edge facing the
// screen's center so that the window looks like "sliding in" and not
// like "unfolding". The default packing of "start" only works for
@@ -170,6 +165,9 @@ function animate(step)
{
gCurrentSize += step;
if (gFinalSize < gCurrentSize)
gCurrentSize = gFinalSize;
if (gOrigin & NS_ALERT_HORIZONTAL)
{
if (!(gOrigin & NS_ALERT_LEFT))
@@ -188,7 +186,10 @@ function animateAlert()
{
if (gCurrentSize < gFinalSize)
{
animate(gSlideIncrement);
if (gDisableSlideEffect)
animate(gFinalSize); // We don't begin on zero.
else
animate(gSlideIncrement);
setTimeout(animateAlert, gSlideTime);
}
else
@@ -197,7 +198,7 @@ function animateAlert()
function animateCloseAlert()
{
if (gCurrentSize > 1)
if (gCurrentSize > 1 && !gDisableSlideEffect)
{
animate(-gSlideIncrement);
setTimeout(animateCloseAlert, gSlideTime);