| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This Source Code is subject to the terms of the Mozilla Public License | 2 * This Source Code is subject to the terms of the Mozilla Public License |
| 3 * version 2.0 (the "License"). You can obtain a copy of the License at | 3 * version 2.0 (the "License"). You can obtain a copy of the License at |
| 4 * http://mozilla.org/MPL/2.0/. | 4 * http://mozilla.org/MPL/2.0/. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 let InspectorObserver = | 7 let InspectorObserver = |
| 8 { | 8 { |
| 9 init: function() | 9 init: function() |
| 10 { | 10 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 let stringBundle = Services.strings.createBundle("chrome://elemhidehelper/lo
cale/global.properties?" + Math.random()); | 41 let stringBundle = Services.strings.createBundle("chrome://elemhidehelper/lo
cale/global.properties?" + Math.random()); |
| 42 let result = stringBundle.GetStringFromName("inspector.button.tooltiptext"); | 42 let result = stringBundle.GetStringFromName("inspector.button.tooltiptext"); |
| 43 | 43 |
| 44 Object.defineProperty(this, "inspectorButtonTooltip", {value: result, enumer
able: true}); | 44 Object.defineProperty(this, "inspectorButtonTooltip", {value: result, enumer
able: true}); |
| 45 return this.inspectorButtonTooltip; | 45 return this.inspectorButtonTooltip; |
| 46 }, | 46 }, |
| 47 | 47 |
| 48 inspectorReady: function(eventName, toolbox, panel) | 48 inspectorReady: function(eventName, toolbox, panel) |
| 49 { | 49 { |
| 50 let panelWindow = panel.panelWin; | 50 let panelWindow = panel.panelWin; |
| 51 let inspectBtn = panelWindow.document.getElementById("inspector-breadcrumbs"
); | 51 let inspectorToolbar = panelWindow.document.getElementById("inspector-toolba
r"); |
| 52 if (!inspectBtn) | 52 if (!inspectorToolbar) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 let insertBefore = inspectorToolbar.firstChild; |
| 56 let inspectorAddButton = panelWindow.document.getElementById("inspector-elem
ent-add-button"); |
| 57 if (inspectorAddButton && inspectorAddButton.parentNode == inspectorToolbar) |
| 58 { |
| 59 // Firefox 48+ |
| 60 insertBefore = inspectorAddButton.nextSibling; |
| 61 } |
| 62 |
| 55 let tooltiptext = InspectorObserver.inspectorButtonTooltip; | 63 let tooltiptext = InspectorObserver.inspectorButtonTooltip; |
| 56 let button = panelWindow.document.createElement("toolbarbutton"); | 64 let button = panelWindow.document.createElement("toolbarbutton"); |
| 57 button.setAttribute("id", "ehh-inspector-toolbarbutton"); | 65 button.setAttribute("id", "ehh-inspector-toolbarbutton"); |
| 58 button.setAttribute("class", "devtools-toolbarbutton"); | 66 button.setAttribute("class", "devtools-toolbarbutton"); |
| 59 button.setAttribute("tooltiptext", tooltiptext); | 67 button.setAttribute("tooltiptext", tooltiptext); |
| 60 button.setAttribute("tabindex", "0"); | 68 button.setAttribute("tabindex", "0"); |
| 61 button.addEventListener("command", () => | 69 button.addEventListener("command", () => |
| 62 { | 70 { |
| 63 let node = panel.selection.nodeFront; | 71 let node = panel.selection.nodeFront; |
| 64 let target = panel.target; | 72 let target = panel.target; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 76 panelWindow.openDialog("chrome://elemhidehelper/content/composer.xul", | 84 panelWindow.openDialog("chrome://elemhidehelper/content/composer.xul", |
| 77 "_blank", "chrome,centerscreen,resizable,dialog=no", response); | 85 "_blank", "chrome,centerscreen,resizable,dialog=no", response); |
| 78 }); | 86 }); |
| 79 } | 87 } |
| 80 }, false); | 88 }, false); |
| 81 | 89 |
| 82 //Override button style for light DevTools theme | 90 //Override button style for light DevTools theme |
| 83 let style = panelWindow.document.createProcessingInstruction("xml-stylesheet
", 'href="chrome://elemhidehelper/skin/devToolsOverlay.css" type="text/css"'); | 91 let style = panelWindow.document.createProcessingInstruction("xml-stylesheet
", 'href="chrome://elemhidehelper/skin/devToolsOverlay.css" type="text/css"'); |
| 84 panelWindow.document.insertBefore(style, panelWindow.document.firstChild); | 92 panelWindow.document.insertBefore(style, panelWindow.document.firstChild); |
| 85 | 93 |
| 86 inspectBtn.parentNode.insertBefore(button, inspectBtn); | 94 inspectorToolbar.insertBefore(button, insertBefore); |
| 87 } | 95 } |
| 88 }; | 96 }; |
| 89 | 97 |
| 90 InspectorObserver.init(); | 98 InspectorObserver.init(); |
| OLD | NEW |