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

Side by Side Diff: lib/windowWrapper.js

Issue 6520005931827200: Issue 2259 - Removed non-standard JavaScript code from Element Hiding Helper (Closed)
Patch Set: Use a Set instead an object Created April 2, 2015, 7:19 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/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 = () => result;
20 return getMenuItem(); 20 return getMenuItem();
21 } 21 }
22 22
23 exports.WindowWrapper = WindowWrapper; 23 exports.WindowWrapper = WindowWrapper;
24 function WindowWrapper(wnd) 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);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 { 61 {
62 this.window.removeEventListener("popupshowing", this.popupShowingHandler, fa lse); 62 this.window.removeEventListener("popupshowing", this.popupShowingHandler, fa lse);
63 this.window.removeEventListener("popuphidden", this.popupHiddenHandler, fals e); 63 this.window.removeEventListener("popuphidden", this.popupHiddenHandler, fals e);
64 this.window.removeEventListener("keypress", this.keyPressHandler, false); 64 this.window.removeEventListener("keypress", this.keyPressHandler, false);
65 this.window.removeEventListener("blur", this.hideTooltips, true); 65 this.window.removeEventListener("blur", this.hideTooltips, true);
66 }, 66 },
67 67
68 E: function(id) 68 E: function(id)
69 { 69 {
70 let doc = this.window.document; 70 let doc = this.window.document;
71 this.E = function(id) doc.getElementById(id); 71 this.E = id => doc.getElementById(id);
72 return this.E(id); 72 return this.E(id);
73 }, 73 },
74 74
75 popupShowingHandler: function(event) 75 popupShowingHandler: function(event)
76 { 76 {
77 let popup = event.originalTarget; 77 let popup = event.originalTarget;
78 if (!/^(abp-(?:toolbar|status|menuitem)-)popup$/.test(popup.id)) 78 if (!/^(abp-(?:toolbar|status|menuitem)-)popup$/.test(popup.id))
79 return; 79 return;
80 80
81 this.popupHiddenHandler(event); 81 this.popupHiddenHandler(event);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 }, 138 },
139 139
140 toggleSelection: function() 140 toggleSelection: function()
141 { 141 {
142 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)
143 Aardvark.start(this); 143 Aardvark.start(this);
144 else 144 else
145 Aardvark.quit(); 145 Aardvark.quit();
146 } 146 }
147 }; 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