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

Side by Side Diff: lib/inspectorObserver.js

Issue 5201912261509120: issue #390 - remove already integrated parts From EHH (Closed)
Patch Set: Created July 18, 2014, 11:17 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/aardvark.js ('k') | lib/main.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
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
4 * http://mozilla.org/MPL/2.0/.
5 */
6
7 let InspectorObserver =
8 {
9 init: function()
10 {
11 let gDevTools;
12 try
13 {
14 ({gDevTools}) = Cu.import("resource:///modules/devtools/gDevTools.jsm", nu ll);
15 }
16 catch(e)
17 {
18 // No developer tools or unsupported version - ignore.
19 return;
20 }
21
22 gDevTools.on("inspector-ready", this.inspectorReady);
23 onShutdown.add(function()
24 {
25 gDevTools.off("inspector-ready", this.inspectorReady);
26 }.bind(this));
27 },
28
29 get inspectorButtonTooltip()
30 {
31 // Randomize URI to work around bug 719376
32 let stringBundle = Services.strings.createBundle("chrome://elemhidehelper/lo cale/global.properties?" + Math.random());
33 let result = stringBundle.GetStringFromName("inspector.button.tooltiptext");
34
35 delete this.inspectorButtonTooltip;
36 this.__defineGetter__("inspectorButtonTooltip", function() result);
37 return this.inspectorButtonTooltip;
38 },
39
40 inspectorReady: function(eventName, toolbox, panel)
41 {
42 let panelWindow = panel.panelWin;
43 let inspectBtn = panelWindow.document.getElementById("inspector-breadcrumbs" );
44 if (!inspectBtn)
45 return;
46
47 let tooltiptext = InspectorObserver.inspectorButtonTooltip;
48 button = panelWindow.document.createElement("toolbarbutton");
49 button.setAttribute("id", "ehh-inspector-toolbarbutton");
50 button.setAttribute("class", "devtools-toolbarbutton");
51 button.setAttribute("tooltiptext", tooltiptext);
52 button.setAttribute("tabindex", "0");
53 button.addEventListener("command", function()
54 {
55 panelWindow.openDialog("chrome://elemhidehelper/content/composer.xul", "_b lank",
56 "chrome,centerscreen,resizable,dialog=no", panel.se lection.node);
57 }, false);
58
59 //Override button style for light DevTools theme
60 let style = panelWindow.document.createProcessingInstruction("xml-stylesheet ", 'href="chrome://elemhidehelper/skin/devToolsOverlay.css" type="text/css"');
61 panelWindow.document.insertBefore(style, panelWindow.document.firstChild);
62
63 inspectBtn.parentNode.insertBefore(button, inspectBtn);
64 }
65 };
66
67 InspectorObserver.init();
OLDNEW
« no previous file with comments | « lib/aardvark.js ('k') | lib/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld