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

Unified Diff: lib/inspectorObserver.js

Issue 29348056: Issue 4255 - Place Element Hiding Helper button in the DevTools toolbar if one exists (Closed)
Patch Set: Created July 20, 2016, 10:51 a.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 | « no previous file | no next file » | 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
@@ -43,20 +43,28 @@ let InspectorObserver =
Object.defineProperty(this, "inspectorButtonTooltip", {value: result, enumerable: true});
return this.inspectorButtonTooltip;
},
inspectorReady: function(eventName, toolbox, panel)
{
let panelWindow = panel.panelWin;
- let inspectBtn = panelWindow.document.getElementById("inspector-breadcrumbs");
- if (!inspectBtn)
+ let inspectorToolbar = panelWindow.document.getElementById("inspector-toolbar");
+ if (!inspectorToolbar)
return;
+ let insertBefore = inspectorToolbar.firstChild;
+ let inspectorAddButton = panelWindow.document.getElementById("inspector-element-add-button");
+ if (inspectorAddButton && inspectorAddButton.parentNode == inspectorToolbar)
+ {
+ // Firefox 48+
+ insertBefore = inspectorAddButton.nextSibling;
+ }
+
let tooltiptext = InspectorObserver.inspectorButtonTooltip;
let button = panelWindow.document.createElement("toolbarbutton");
button.setAttribute("id", "ehh-inspector-toolbarbutton");
button.setAttribute("class", "devtools-toolbarbutton");
button.setAttribute("tooltiptext", tooltiptext);
button.setAttribute("tabindex", "0");
button.addEventListener("command", () =>
{
@@ -78,13 +86,13 @@ let InspectorObserver =
});
}
}, false);
//Override button style for light DevTools theme
let style = panelWindow.document.createProcessingInstruction("xml-stylesheet", 'href="chrome://elemhidehelper/skin/devToolsOverlay.css" type="text/css"');
panelWindow.document.insertBefore(style, panelWindow.document.firstChild);
- inspectBtn.parentNode.insertBefore(button, inspectBtn);
+ inspectorToolbar.insertBefore(button, insertBefore);
}
};
InspectorObserver.init();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld