Index: lib/main.js |
=================================================================== |
--- a/lib/main.js |
+++ b/lib/main.js |
@@ -41,6 +41,52 @@ |
} |
} |
+/** |
+ * Object initializing add-on options, observes add-on manager notifications |
+ * about add-on options being opened. |
+ * @type nsIObserver |
+ */ |
+let optionsObserver = |
+{ |
+ init: function() |
+ { |
+ Services.obs.addObserver(this, "addon-options-displayed", true); |
+ onShutdown.add(function() |
+ { |
+ Services.obs.removeObserver(this, "addon-options-displayed"); |
+ }.bind(this)); |
+ }, |
+ |
+ initOptionsDoc: function(/**Document*/ doc) |
+ { |
+ function hideElement(id, hide) |
+ { |
+ let element = doc.getElementById(id); |
+ if (element) |
+ element.collapsed = hide; |
+ } |
Wladimir Palant
2014/07/30 07:45:40
No point to have a generic function here, we only
saroyanm
2014/07/30 09:18:32
Will keep in mind.
|
+ |
+ try |
+ { |
+ let {CustomizableUI} = Cu.import("resource:///modules/CustomizableUI.jsm", null); |
+ if (CustomizableUI) |
Wladimir Palant
2014/07/30 07:45:40
This check is pointless, if the module fails to lo
|
+ hideElement("abpcustomization-icondisplay", true); |
+ } catch (e) {} |
+ }, |
+ |
+ observe: function(subject, topic, data) |
+ { |
+ let {addonID} = require("info") |
+ if (data != addonID) |
+ return; |
+ |
+ this.initOptionsDoc(subject.QueryInterface(Ci.nsIDOMDocument)); |
+ }, |
+ |
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]) |
Wladimir Palant
2014/07/30 07:45:40
Please import XPCOMUtils in this file. The fact th
saroyanm
2014/07/30 09:18:32
Done.
|
+}; |
+optionsObserver.init(); |
+ |
var VerticalPreferencesLayout = |
{ |
__proto__: WindowFeature, |
@@ -193,7 +239,6 @@ |
} |
} |
- |
// Initialize features and make sure to update them on changes |
for (let feature in features) |
updateFeature(feature); |