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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
82 | 82 |
83 let enabled = Aardvark.canSelect(this.browser); | 83 let running = this.browser == Aardvark.browser; |
84 let running = (enabled && this.browser == Aardvark.browser); | |
85 | 84 |
86 let [labelStart, labelStop] = getMenuItem(); | 85 let [labelStart, labelStop] = getMenuItem(); |
87 let item = popup.ownerDocument.createElement("menuitem"); | 86 let item = popup.ownerDocument.createElement("menuitem"); |
88 item.setAttribute("label", running ? labelStop : labelStart); | 87 item.setAttribute("label", running ? labelStop : labelStart); |
89 item.setAttribute("class", "elemhidehelper-item"); | 88 item.setAttribute("class", "elemhidehelper-item"); |
90 if (!enabled) | |
91 item.setAttribute("disabled", "true"); | |
92 | 89 |
93 if (typeof key == "undefined") | 90 if (typeof key == "undefined") |
94 this.configureKey(event.currentTarget); | 91 this.configureKey(event.currentTarget); |
95 item.setAttribute("acceltext", KeySelector.getTextForKey(key)); | 92 item.setAttribute("acceltext", KeySelector.getTextForKey(key)); |
96 | 93 |
97 item.addEventListener("command", this.toggleSelection, false); | 94 item.addEventListener("command", this.toggleSelection, false); |
98 | 95 |
99 let insertBefore = null; | 96 let insertBefore = null; |
100 for (let child = popup.firstChild; child; child = child.nextSibling) | 97 for (let child = popup.firstChild; child; child = child.nextSibling) |
101 if (/-options$/.test(child.id)) | 98 if (/-options$/.test(child.id)) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 { | 132 { |
136 if (Aardvark.window == this.window) | 133 if (Aardvark.window == this.window) |
137 Aardvark.hideTooltips(); | 134 Aardvark.hideTooltips(); |
138 }, | 135 }, |
139 | 136 |
140 toggleSelection: function() | 137 toggleSelection: function() |
141 { | 138 { |
142 if ("@adblockplus.org/abp/public;1" in Cc && this.browser != Aardvark.browse
r) | 139 if ("@adblockplus.org/abp/public;1" in Cc && this.browser != Aardvark.browse
r) |
143 Aardvark.start(this); | 140 Aardvark.start(this); |
144 else | 141 else |
145 Aardvark.quit(); | 142 Aardvark.doCommand("quit", null); |
146 } | 143 } |
147 }; | 144 }; |
OLD | NEW |