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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 let inspectBtn = panelWindow.document.getElementById("inspector-breadcrumbs"
); | 42 let inspectBtn = panelWindow.document.getElementById("inspector-breadcrumbs"
); |
43 if (!inspectBtn) | 43 if (!inspectBtn) |
44 return; | 44 return; |
45 | 45 |
46 let tooltiptext = InspectorObserver.inspectorButtonTooltip; | 46 let tooltiptext = InspectorObserver.inspectorButtonTooltip; |
47 button = panelWindow.document.createElement("toolbarbutton"); | 47 button = panelWindow.document.createElement("toolbarbutton"); |
48 button.setAttribute("id", "ehh-inspector-toolbarbutton"); | 48 button.setAttribute("id", "ehh-inspector-toolbarbutton"); |
49 button.setAttribute("class", "devtools-toolbarbutton"); | 49 button.setAttribute("class", "devtools-toolbarbutton"); |
50 button.setAttribute("tooltiptext", tooltiptext); | 50 button.setAttribute("tooltiptext", tooltiptext); |
51 button.setAttribute("tabindex", "0"); | 51 button.setAttribute("tabindex", "0"); |
52 button.addEventListener("command", function() | 52 button.addEventListener("command", () => |
53 { | 53 { |
54 panelWindow.openDialog("chrome://elemhidehelper/content/composer.xul", "_b
lank", | 54 let node = panel.selection.nodeFront; |
55 "chrome,centerscreen,resizable,dialog=no", panel.se
lection.node); | 55 let target = panel.target; |
| 56 if (node && target.form.elemhidehelper) |
| 57 { |
| 58 target.client.request({ |
| 59 to: target.form.elemhidehelper, |
| 60 type: "nodeinfo", |
| 61 nodeActor: node.actorID |
| 62 }, function(response) |
| 63 { |
| 64 if (!response.nodeData) |
| 65 return; |
| 66 |
| 67 panelWindow.openDialog("chrome://elemhidehelper/content/composer.xul", |
| 68 "_blank", "chrome,centerscreen,resizable,dialog=no", |
| 69 response.nodeData, response.host); |
| 70 }); |
| 71 } |
56 }, false); | 72 }, false); |
57 | 73 |
58 //Override button style for light DevTools theme | 74 //Override button style for light DevTools theme |
59 let style = panelWindow.document.createProcessingInstruction("xml-stylesheet
", 'href="chrome://elemhidehelper/skin/devToolsOverlay.css" type="text/css"'); | 75 let style = panelWindow.document.createProcessingInstruction("xml-stylesheet
", 'href="chrome://elemhidehelper/skin/devToolsOverlay.css" type="text/css"'); |
60 panelWindow.document.insertBefore(style, panelWindow.document.firstChild); | 76 panelWindow.document.insertBefore(style, panelWindow.document.firstChild); |
61 | 77 |
62 inspectBtn.parentNode.insertBefore(button, inspectBtn); | 78 inspectBtn.parentNode.insertBefore(button, inspectBtn); |
63 } | 79 } |
64 }; | 80 }; |
65 | 81 |
66 InspectorObserver.init(); | 82 InspectorObserver.init(); |
OLD | NEW |