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 {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 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 E: function(id) | 70 E: function(id) |
71 { | 71 { |
72 let doc = this.window.document; | 72 let doc = this.window.document; |
73 this.E = function(id) doc.getElementById(id); | 73 this.E = function(id) doc.getElementById(id); |
74 return this.E(id); | 74 return this.E(id); |
75 }, | 75 }, |
76 | 76 |
77 popupShowingHandler: function(event) | 77 popupShowingHandler: function(event) |
78 { | 78 { |
79 let popup = event.target; | 79 let popup = event.originalTarget; |
80 if (!/^(abp-(?:toolbar|status|menuitem)-)popup$/.test(popup.id)) | 80 if (!/^(abp-(?:toolbar|status|menuitem)-)popup$/.test(popup.id)) |
81 return; | 81 return; |
82 | 82 |
83 this.popupHiddenHandler(event); | 83 this.popupHiddenHandler(event); |
84 | 84 |
85 let enabled = Aardvark.canSelect(this.browser); | 85 let enabled = Aardvark.canSelect(this.browser); |
86 let running = (enabled && this.browser == Aardvark.browser); | 86 let running = (enabled && this.browser == Aardvark.browser); |
87 | 87 |
88 let [labelStart, labelStop] = getMenuItem(); | 88 let [labelStart, labelStop] = getMenuItem(); |
89 let item = popup.ownerDocument.createElement("menuitem"); | 89 let item = popup.ownerDocument.createElement("menuitem"); |
(...skipping 10 matching lines...) Expand all Loading... |
100 | 100 |
101 let insertBefore = null; | 101 let insertBefore = null; |
102 for (let child = popup.firstChild; child; child = child.nextSibling) | 102 for (let child = popup.firstChild; child; child = child.nextSibling) |
103 if (/-options$/.test(child.id)) | 103 if (/-options$/.test(child.id)) |
104 insertBefore = child; | 104 insertBefore = child; |
105 popup.insertBefore(item, insertBefore); | 105 popup.insertBefore(item, insertBefore); |
106 }, | 106 }, |
107 | 107 |
108 popupHiddenHandler: function(event) | 108 popupHiddenHandler: function(event) |
109 { | 109 { |
110 let popup = event.target; | 110 let popup = event.originalTarget; |
111 if (!/^(abp-(?:toolbar|status|menuitem)-)popup$/.test(popup.id)) | 111 if (!/^(abp-(?:toolbar|status|menuitem)-)popup$/.test(popup.id)) |
112 return; | 112 return; |
113 | 113 |
114 let items = popup.getElementsByClassName("elemhidehelper-item"); | 114 let items = popup.getElementsByClassName("elemhidehelper-item"); |
115 while (items.length) | 115 while (items.length) |
116 items[0].parentNode.removeChild(items[0]); | 116 items[0].parentNode.removeChild(items[0]); |
117 }, | 117 }, |
118 | 118 |
119 keyPressHandler: function(event) | 119 keyPressHandler: function(event) |
120 { | 120 { |
(...skipping 19 matching lines...) Expand all Loading... |
140 }, | 140 }, |
141 | 141 |
142 toggleSelection: function() | 142 toggleSelection: function() |
143 { | 143 { |
144 if ("@adblockplus.org/abp/public;1" in Cc && this.browser != Aardvark.browse
r) | 144 if ("@adblockplus.org/abp/public;1" in Cc && this.browser != Aardvark.browse
r) |
145 Aardvark.start(this); | 145 Aardvark.start(this); |
146 else | 146 else |
147 Aardvark.quit(); | 147 Aardvark.quit(); |
148 } | 148 } |
149 }; | 149 }; |
OLD | NEW |