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); |
@@ -110,16 +110,19 @@ let ElemHide = exports.ElemHide = |
}, |
/** |
* Add a new element hiding filter |
* @param {ElemHideFilter} filter |
*/ |
add: function(filter) |
{ |
+ if (!Prefs.element_hiding_enabled) |
+ return; |
+ |
if (filter instanceof ElemHideException) |
{ |
if (filter.text in knownExceptions) |
return; |
let selector = filter.selector; |
if (!(selector in exceptions)) |
exceptions[selector] = []; |
@@ -207,32 +210,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) |