Left: | ||
Right: |
OLD | NEW |
---|---|
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 14 matching lines...) Expand all Loading... | |
25 Cu.import("resource://gre/modules/Services.jsm"); | 25 Cu.import("resource://gre/modules/Services.jsm"); |
26 | 26 |
27 function require(module) | 27 function require(module) |
28 { | 28 { |
29 let result = {}; | 29 let result = {}; |
30 result.wrappedJSObject = result; | 30 result.wrappedJSObject = result; |
31 Services.obs.notifyObservers(result, "adblockplus-require", module); | 31 Services.obs.notifyObservers(result, "adblockplus-require", module); |
32 return result.exports; | 32 return result.exports; |
33 } | 33 } |
34 | 34 |
35 let {FilterNotifier} = require("filterNotifier"); | |
35 let {FilterStorage} = require("filterStorage"); | 36 let {FilterStorage} = require("filterStorage"); |
36 let {Prefs} = require("prefs"); | 37 let {Prefs} = require("prefs"); |
37 let {UI} = require("ui"); | 38 let {UI} = require("ui"); |
38 | 39 |
39 var AdblockPlusApi = | 40 var AdblockPlusApi = |
40 { | 41 { |
42 get filtersLoaded() | |
43 { | |
44 return !FilterStorage._loading; | |
45 }, | |
46 filterLoadListener: null, | |
41 get acceptableAdsEnabled() | 47 get acceptableAdsEnabled() |
42 { | 48 { |
43 return FilterStorage.subscriptions.some( | 49 return FilterStorage.subscriptions.some( |
44 (subscription) => subscription.url == Prefs.subscriptions_exceptionsurl); | 50 (subscription) => subscription.url == Prefs.subscriptions_exceptionsurl); |
45 }, | 51 }, |
46 set acceptableAdsEnabled(acceptableAdsEnabled) | 52 set acceptableAdsEnabled(acceptableAdsEnabled) |
47 { | 53 { |
48 if (acceptableAdsEnabled != AdblockPlusApi.acceptableAdsEnabled) | 54 if (acceptableAdsEnabled != AdblockPlusApi.acceptableAdsEnabled) |
49 UI.toggleAcceptableAds(); | 55 UI.toggleAcceptableAds(); |
50 } | 56 } |
51 }; | 57 }; |
58 | |
59 FilterNotifier.addListener(function filterListener(action) | |
60 { | |
61 if (action != "load") | |
62 return; | |
63 | |
64 if (typeof AdblockPlusApi.filterLoadListener == "function") | |
65 AdblockPlusApi.filterLoadListener(); | |
66 FilterNotifier.removeListener(filterListener); | |
Wladimir Palant
2015/03/22 19:23:34
Please remove listener as the very first thing - f
Felix Dahlke
2015/03/22 20:59:31
Done.
| |
67 }); | |
OLD | NEW |