LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 }, | 179 }, |
180 initCommunication: function() | 180 initCommunication: function() |
181 { | 181 { |
182 initFilterListeners(); | 182 initFilterListeners(); |
183 | 183 |
184 Messaging.addListener((function(data) | 184 Messaging.addListener((function(data) |
185 { | 185 { |
186 if (!data) | 186 if (!data) |
187 return {"success": false, "error": "malformed request"}; | 187 return {"success": false, "error": "malformed request"}; |
188 | 188 |
189 if (data["action"] == "getFiltersLoaded") | |
190 return {"success": true, "value": this.filtersLoaded}; | |
191 | |
192 if (!this.filtersLoaded) | 189 if (!this.filtersLoaded) |
193 return {"success": false, "error": "filters not loaded"}; | 190 return {"success": false, "error": "filters not loaded"}; |
194 | 191 |
195 switch (data["action"]) | 192 switch (data["action"]) |
196 { | 193 { |
197 case "getAcceptableAdsEnabled": | 194 case "getAcceptableAdsEnabled": |
198 return {"success": true, "value": this.acceptableAdsEnabled}; | 195 return {"success": true, "value": this.acceptableAdsEnabled}; |
199 case "setAcceptableAdsEnabled": | 196 case "setAcceptableAdsEnabled": |
200 if ("enable" in data) | 197 if ("enable" in data) |
201 { | 198 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 { | 240 { |
244 this.whitelistSite(data["url"], data["whitelisted"]); | 241 this.whitelistSite(data["url"], data["whitelisted"]); |
245 return {"success": true}; | 242 return {"success": true}; |
246 } | 243 } |
247 break; | 244 break; |
248 } | 245 } |
249 return {"success": false, "error": "malformed request"}; | 246 return {"success": false, "error": "malformed request"}; |
250 }).bind(this), "AdblockPlus:Api"); | 247 }).bind(this), "AdblockPlus:Api"); |
251 } | 248 } |
252 }; | 249 }; |
LEFT | RIGHT |