[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 423/483: InspectorUI.registerTool API disappeared in Firefox 14 (bug 707809), add inspector button manually
David Prévot
taffit at moszumanska.debian.org
Thu Jan 22 21:42:03 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus-element-hiding-helper.
commit 9ff7e54ac88cfcaa37b3bea68396daa0631b6527
Author: Wladimir Palant <trev at adblockplus.org>
Date: Wed Jun 20 22:53:53 2012 +0200
InspectorUI.registerTool API disappeared in Firefox 14 (bug 707809), add inspector button manually
---
lib/inspectorObserver.js | 53 +++++++++++++++++++++++++++++++++---------------
1 file changed, 37 insertions(+), 16 deletions(-)
diff --git a/lib/inspectorObserver.js b/lib/inspectorObserver.js
index 0eb0c6b..8240e44 100644
--- a/lib/inspectorObserver.js
+++ b/lib/inspectorObserver.js
@@ -12,7 +12,19 @@ let InspectorObserver =
init: function()
{
Services.obs.addObserver(this, "inspector-opened", true);
- onShutdown.add((function() Services.obs.removeObserver(this, "inspector-opened")).bind(this));
+ onShutdown.add((function()
+ {
+ Services.obs.removeObserver(this, "inspector-opened");
+
+ let e = Services.ww.getWindowEnumerator();
+ while (e.hasMoreElements())
+ {
+ let window = e.getNext().QueryInterface(Ci.nsIDOMWindow);
+ let button = window.document.getElementById("inspector-abp-elemhide-toolbutton");
+ if (button)
+ button.parentNode.removeChild(button);
+ }
+ }).bind(this));
},
get inspectorButton()
@@ -28,28 +40,37 @@ let InspectorObserver =
observe: function(subject, topic, data)
{
- if (topic != "inspector-opened" || !("@adblockplus.org/abp/public;1" in Cc))
+ if (topic != "inspector-opened")
return;
let InspectorUI = subject.wrappedJSObject;
let window = InspectorUI.chromeWin;
- if (!window._ehhWrapper || !require("aardvark").Aardvark.canSelect(window._ehhWrapper.browser))
+ let button = window.document.getElementById("inspector-abp-elemhide-toolbutton");
+ if (button)
+ button.parentNode.removeChild(button);
+
+ if (!("@adblockplus.org/abp/public;1" in Cc) || !window._ehhWrapper || !require("aardvark").Aardvark.canSelect(window._ehhWrapper.browser))
+ return;
+
+ let parent = window.document.getElementById("inspector-tools");
+ if (!parent)
return;
let [label, accesskey, tooltiptext] = this.inspectorButton;
- InspectorUI.registerTool({
- id: "abp-elemhide",
- label: label,
- accesskey: accesskey,
- tooltiptext: tooltiptext,
- get isOpen() false,
- show: function(selection)
- {
- InspectorUI.chromeWin.openDialog("chrome://elemhidehelper/content/composer.xul", "_blank",
- "chrome,centerscreen,resizable,dialog=no", selection);
- InspectorUI.closeInspectorUI();
- }
- });
+ button = window.document.createElement("toolbarbutton");
+ button.setAttribute("id", "inspector-abp-elemhide-toolbutton");
+ button.setAttribute("label", label);
+ button.setAttribute("class", "devtools-toolbarbutton");
+ button.setAttribute("accesskey", accesskey);
+ button.setAttribute("tooltiptext", tooltiptext);
+ button.setAttribute("tabindex", "0");
+ button.addEventListener("command", function()
+ {
+ InspectorUI.chromeWin.openDialog("chrome://elemhidehelper/content/composer.xul", "_blank",
+ "chrome,centerscreen,resizable,dialog=no", InspectorUI.selection);
+ InspectorUI.closeInspectorUI();
+ }, false);
+ parent.appendChild(button);
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObserver])
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus-element-hiding-helper.git
More information about the Pkg-mozext-commits
mailing list