LEFT | RIGHT |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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", () => | 52 button.addEventListener("command", () => |
53 { | 53 { |
54 let node = panel.selection.nodeFront; | 54 let node = panel.selection.nodeFront; |
55 if (panel.target.form.elemhidehelper) | 55 let target = panel.target; |
| 56 if (node && target.form.elemhidehelper) |
56 { | 57 { |
57 panel.target.client.request({to: panel.target.form.elemhidehelper, type:
"nodeinfo", nodeActor: node.actorID}, function(response) | 58 target.client.request({ |
| 59 to: target.form.elemhidehelper, |
| 60 type: "nodeinfo", |
| 61 nodeActor: node.actorID |
| 62 }, function(response) |
58 { | 63 { |
59 if ("nodeData" in response) | 64 if (!response.nodeData) |
60 { | 65 return; |
61 panelWindow.openDialog("chrome://elemhidehelper/content/composer.xul
", "_blank", | 66 |
62 "chrome,centerscreen,resizable,dialog=no", re
sponse.nodeData, response.host); | 67 panelWindow.openDialog("chrome://elemhidehelper/content/composer.xul", |
63 } | 68 "_blank", "chrome,centerscreen,resizable,dialog=no", |
| 69 response.nodeData, response.host); |
64 }); | 70 }); |
65 } | 71 } |
66 }, false); | 72 }, false); |
67 | 73 |
68 //Override button style for light DevTools theme | 74 //Override button style for light DevTools theme |
69 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"'); |
70 panelWindow.document.insertBefore(style, panelWindow.document.firstChild); | 76 panelWindow.document.insertBefore(style, panelWindow.document.firstChild); |
71 | 77 |
72 inspectBtn.parentNode.insertBefore(button, inspectBtn); | 78 inspectBtn.parentNode.insertBefore(button, inspectBtn); |
73 } | 79 } |
74 }; | 80 }; |
75 | 81 |
76 InspectorObserver.init(); | 82 InspectorObserver.init(); |
LEFT | RIGHT |