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

Side by Side Diff: lib/windowWrapper.js

Issue 5684127030312960: Issue 1091 - Implement a better templating approach for Element Hiding Helper (Closed)
Patch Set: Switched to a functional approach Created Sept. 11, 2014, 4:50 p.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/main.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {Aardvark} = require("aardvark"); 7 let {Aardvark} = require("aardvark");
8 let {Prefs} = require("prefs"); 8 let {Prefs} = require("prefs");
9 let {KeySelector} = require("keySelector"); 9 let {KeySelector} = require("keySelector");
10 10
11 let key = undefined; 11 let key = undefined;
12 12
13 function getMenuItem() 13 function getMenuItem()
14 { 14 {
15 // Randomize URI to work around bug 719376 15 // Randomize URI to work around bug 719376
16 let stringBundle = Services.strings.createBundle("chrome://elemhidehelper/loca le/global.properties?" + Math.random()); 16 let stringBundle = Services.strings.createBundle("chrome://elemhidehelper/loca le/global.properties?" + Math.random());
17 let result = [stringBundle.GetStringFromName("selectelement.label"), stringBun dle.GetStringFromName("stopselection.label")]; 17 let result = [stringBundle.GetStringFromName("selectelement.label"), stringBun dle.GetStringFromName("stopselection.label")];
18 18
19 getMenuItem = function() result; 19 getMenuItem = function() result;
20 return getMenuItem(); 20 return getMenuItem();
21 } 21 }
22 22
23 exports.WindowWrapper = WindowWrapper; 23 exports.WindowWrapper = WindowWrapper;
24 function WindowWrapper(wnd, elementMarkerClass) 24 function WindowWrapper(wnd)
25 { 25 {
26 this.window = wnd; 26 this.window = wnd;
27 27
28 this.popupShowingHandler = this.popupShowingHandler.bind(this); 28 this.popupShowingHandler = this.popupShowingHandler.bind(this);
29 this.popupHiddenHandler = this.popupHiddenHandler.bind(this); 29 this.popupHiddenHandler = this.popupHiddenHandler.bind(this);
30 this.keyPressHandler = this.keyPressHandler.bind(this); 30 this.keyPressHandler = this.keyPressHandler.bind(this);
31 this.toggleSelection = this.toggleSelection.bind(this); 31 this.toggleSelection = this.toggleSelection.bind(this);
32 this.hideTooltips = this.hideTooltips.bind(this); 32 this.hideTooltips = this.hideTooltips.bind(this);
33 33
34 this.E("ehh-elementmarker").firstElementChild.setAttribute("class", elementMar kerClass);
35
36 this.init(); 34 this.init();
37 } 35 }
38 WindowWrapper.prototype = 36 WindowWrapper.prototype =
39 { 37 {
40 window: null, 38 window: null,
41 39
42 get browser() 40 get browser()
43 { 41 {
44 if ("gBrowser" in this.window) 42 if ("gBrowser" in this.window)
45 return this.window.gBrowser; // Firefox / SeaMonkey browser 43 return this.window.gBrowser; // Firefox / SeaMonkey browser
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 }, 138 },
141 139
142 toggleSelection: function() 140 toggleSelection: function()
143 { 141 {
144 if ("@adblockplus.org/abp/public;1" in Cc && this.browser != Aardvark.browse r) 142 if ("@adblockplus.org/abp/public;1" in Cc && this.browser != Aardvark.browse r)
145 Aardvark.start(this); 143 Aardvark.start(this);
146 else 144 else
147 Aardvark.quit(); 145 Aardvark.quit();
148 } 146 }
149 }; 147 };
OLDNEW
« no previous file with comments | « lib/main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld