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(); |