| Left: | ||
| Right: |
| 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 19 matching lines...) Expand all Loading... | |
| 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 {FilterNotifier} = require("filterNotifier"); |
| 36 let {FilterStorage} = require("filterStorage"); | 36 let {FilterStorage} = require("filterStorage"); |
| 37 let {Prefs} = require("prefs"); | 37 let {Prefs} = require("prefs"); |
| 38 let {UI} = require("ui"); | 38 let {UI} = require("ui"); |
| 39 | 39 |
| 40 let filtersLoaded = false; | |
| 41 | |
| 42 var AdblockPlusApi = | 40 var AdblockPlusApi = |
| 43 { | 41 { |
| 44 get filtersLoaded() | 42 get filtersLoaded() |
| 45 { | 43 { |
| 46 return filtersLoaded; | 44 return !FilterStorage._loading; |
| 47 }, | 45 }, |
| 48 filterLoadListener: null, | 46 filterLoadListener: null, |
| 49 get acceptableAdsEnabled() | 47 get acceptableAdsEnabled() |
| 50 { | 48 { |
| 51 return FilterStorage.subscriptions.some( | 49 return FilterStorage.subscriptions.some( |
| 52 (subscription) => subscription.url == Prefs.subscriptions_exceptionsurl); | 50 (subscription) => subscription.url == Prefs.subscriptions_exceptionsurl); |
| 53 }, | 51 }, |
| 54 set acceptableAdsEnabled(acceptableAdsEnabled) | 52 set acceptableAdsEnabled(acceptableAdsEnabled) |
| 55 { | 53 { |
| 56 if (acceptableAdsEnabled != AdblockPlusApi.acceptableAdsEnabled) | 54 if (acceptableAdsEnabled != AdblockPlusApi.acceptableAdsEnabled) |
| 57 UI.toggleAcceptableAds(); | 55 UI.toggleAcceptableAds(); |
| 58 } | 56 } |
| 59 }; | 57 }; |
| 60 | 58 |
| 61 FilterNotifier.addListener(function(action) | 59 FilterNotifier.addListener(function filterListener(action) |
|
René Jeschke
2015/03/22 21:01:46
Oh, and from my side: we do not even really need t
Felix Dahlke
2015/03/22 21:13:28
Right, we _can't_ use it there, actually - interac
| |
| 62 { | 60 { |
| 63 if (action != "load") | 61 if (action != "load") |
| 64 return; | 62 return; |
| 65 | 63 |
| 66 filtersLoaded = true; | 64 FilterNotifier.removeListener(filterListener); |
| 67 if (typeof AdblockPlusApi.filterLoadListener == "function") | 65 if (typeof AdblockPlusApi.filterLoadListener == "function") |
| 68 { | |
| 69 AdblockPlusApi.filterLoadListener(); | 66 AdblockPlusApi.filterLoadListener(); |
| 70 AdblockPlusApi.filterLoadListener = null; | |
| 71 } | |
| 72 }); | 67 }); |
| LEFT | RIGHT |