Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/elemHide.js

Issue 5062082168881152: NO BUG Allow users to disable element hiding (Closed)
Patch Set: Created Feb. 18, 2015, 1:47 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « defaults/prefs.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/elemHide.js
===================================================================
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -78,17 +78,17 @@ let ElemHide = exports.ElemHide =
/**
* Called on module startup.
*/
init: function()
{
Prefs.addListener(function(name)
{
- if (name == "enabled")
+ if (name == "enabled" || name == "element_hiding_enabled")
ElemHide.apply();
});
onShutdown.add(function()
{
ElemHide.unapply();
});
let styleFile = IO.resolveFilePath(Prefs.data_directory);
@@ -207,32 +207,34 @@ let ElemHide = exports.ElemHide =
apply: function()
{
if (this._applying)
{
this._needsApply = true;
return;
}
- if (!ElemHide.isDirty || !Prefs.enabled)
+ let enabled = Prefs.enabled && Prefs.element_hiding_enabled;
+
+ if (!ElemHide.isDirty || !enabled)
{
// Nothing changed, looks like we merely got enabled/disabled
- if (Prefs.enabled && !ElemHide.applied)
+ if (enabled && !ElemHide.applied)
{
try
{
Utils.styleService.loadAndRegisterSheet(styleURL, Ci.nsIStyleSheetService.USER_SHEET);
ElemHide.applied = true;
}
catch (e)
{
Cu.reportError(e);
}
}
- else if (!Prefs.enabled && ElemHide.applied)
+ else if (!enabled && ElemHide.applied)
{
ElemHide.unapply();
}
return;
}
IO.writeToFile(styleURL.file, this._generateCSSContent(), function(e)
« no previous file with comments | « defaults/prefs.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld