Index: lib/inspectorObserver.js |
=================================================================== |
--- a/lib/inspectorObserver.js |
+++ b/lib/inspectorObserver.js |
@@ -4,7 +4,7 @@ |
* http://mozilla.org/MPL/2.0/. |
*/ |
-Cu.import("resource:///modules/devtools/gDevTools.jsm"); |
+let {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", null); |
let InspectorObserver = |
{ |
@@ -21,32 +21,26 @@ |
{ |
// Randomize URI to work around bug 719376 |
let stringBundle = Services.strings.createBundle("chrome://elemhidehelper/locale/global.properties?" + Math.random()); |
- let result = [stringBundle.GetStringFromName("inspector.button.label"), stringBundle.GetStringFromName("inspector.button.accesskey"), stringBundle.GetStringFromName("inspector.button.tooltiptext")]; |
+ let result = stringBundle.GetStringFromName("inspector.button.tooltiptext"); |
delete this.inspectorButton; |
this.__defineGetter__("inspectorButton", function() result); |
return this.inspectorButton; |
}, |
- inspectorReady: function(eventName, listener) |
+ inspectorReady: function(eventName, toolbox, panel) |
{ |
- let toolbox = gDevTools.getToolbox(listener.target); |
- if (!toolbox) |
+ let panelWindow = panel.panelWin; |
+ let inspectBtn = panelWindow.document.getElementById("inspector-inspect-toolbutton"); |
+ if (!inspectBtn) |
return; |
- let panel = toolbox.getToolPanels().get("inspector"); |
- if (!panel) |
- return; |
- |
- let panelWindow = panel.panelWin; |
- let parent = panelWindow.document.getElementById("inspector-toolbar"); |
- if (!parent) |
- return; |
- |
- let [label, accesskey, tooltiptext] = InspectorObserver.inspectorButton; |
+ let tooltiptext = InspectorObserver.inspectorButton; |
button = panelWindow.document.createElement("toolbarbutton"); |
button.setAttribute("id", "inspector-abp-elemhide-toolbutton"); |
- button.setAttribute("label", label); |
+ button.style.listStyleImage = "url('chrome://adblockplus/skin/abp-status-16.png')"; |
+ button.style.MozImageRegion = "rect(0px, 16px, 16px, 0px)"; |
+ button.style.paddingTop = "4px"; |
button.setAttribute("class", "devtools-toolbarbutton"); |
button.setAttribute("accesskey", accesskey); |
button.setAttribute("tooltiptext", tooltiptext); |
@@ -56,7 +50,7 @@ |
panelWindow.openDialog("chrome://elemhidehelper/content/composer.xul", "_blank", |
"chrome,centerscreen,resizable,dialog=no", panel.selection.node); |
}, false); |
- parent.appendChild(button); |
+ inspectBtn.parentNode.insertBefore(button, inspectBtn.nextSibling); |
} |
}; |