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

Unified Diff: lib/inspectorObserver.js

Issue 4780225334345728: Element Hiding Helper inspector tool fix (Closed)
Patch Set: accesskey removed from inspector button Created April 12, 2014, 8: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 | « chrome/locale/en-US/global.properties ('k') | metadata.gecko » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
};
« no previous file with comments | « chrome/locale/en-US/global.properties ('k') | metadata.gecko » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld