OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * |
| 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 |
| 7 * published by the Free Software Foundation. |
| 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ |
| 17 |
| 18 var EXPORTED_SYMBOLS = ["AdblockPlusApi"]; |
| 19 |
| 20 const Cc = Components.classes; |
| 21 const Ci = Components.interfaces; |
| 22 const Cr = Components.results; |
| 23 const Cu = Components.utils; |
| 24 |
| 25 Cu.import("resource://gre/modules/Services.jsm"); |
| 26 |
| 27 function require(module) |
| 28 { |
| 29 let result = {}; |
| 30 result.wrappedJSObject = result; |
| 31 Services.obs.notifyObservers(result, "adblockplus-require", module); |
| 32 return result.exports; |
| 33 } |
| 34 |
| 35 let {FilterStorage} = require("filterStorage"); |
| 36 let {DownloadableSubscription} = require("subscriptionClasses"); |
| 37 let {Prefs} = require("prefs"); |
| 38 let {UI} = require("ui"); |
| 39 |
| 40 var AdblockPlusApi = |
| 41 { |
| 42 get acceptableAdsEnabled() |
| 43 { |
| 44 return FilterStorage.subscriptions.some( |
| 45 (subscription) => subscription instanceof DownloadableSubscription && |
| 46 subscription.url == Prefs.subscriptions_exceptionsurl); |
| 47 }, |
| 48 set acceptableAdsEnabled(acceptableAdsEnabled) |
| 49 { |
| 50 if (acceptableAdsEnabled === AdblockPlusApi.acceptableAdsEnabled) |
| 51 return; |
| 52 UI.toggleAcceptableAds(); |
| 53 } |
| 54 }; |
OLD | NEW |