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: fix after Wladimir comments Created April 11, 2014, 3:53 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
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.accesskey"), stringBundle.GetStringFromName("inspector.button.tooltiptext")];
Wladimir Palant 2014/04/11 18:39:10 An access key only makes sense in combination with
saroyanm 2014/04/12 10:39:35 Wladimir why we need to remove accesskey ? Isn't i
Wladimir Palant 2014/04/12 18:14:11 You probably don't know what access keys are - see
saroyanm 2014/04/12 20:23:20 Thanks for the reference Wladimir, actually I feel
Wladimir Palant 2014/04/12 20:51:26 An access key is not the same thing as a shortcut
saroyanm 2014/04/12 20:59:38 I thought again regarding your notes Wladimir I gu
saroyanm 2014/04/12 21:03:22 Got it. Thanks.
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 [accesskey, 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')";
saroyanm 2014/04/11 16:09:11 Not sure if I need to copy icon to elemhidehelper/
Wladimir Palant 2014/04/11 18:39:10 No, it's fine like that - Element Hiding Helper ca
+ 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);
}
};

Powered by Google App Engine
This is Rietveld