Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: adblockplus/Api.jsm

Issue 6302236728623104: Add Adblock Plus API (Closed)
Patch Set: Nit: Requires ordered alphabetically by module name Created March 13, 2015, 10:26 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | adblockplus/build.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 {Prefs} = require("prefs");
37 let {DownloadableSubscription} = require("subscriptionClasses");
38 let {UI} = require("ui");
39
40 var AdblockPlusApi =
41 {
42 get acceptableAdsEnabled()
43 {
44 return FilterStorage.subscriptions.some(
45 (subscription) => subscription instanceof DownloadableSubscription &&
Wladimir Palant 2015/03/14 19:53:04 Checking subscription.url is sufficient (this prop
Felix Dahlke 2015/03/14 22:56:11 Hm, true, every Subscription object has the url pr
46 subscription.url == Prefs.subscriptions_exceptionsurl);
47 },
48 set acceptableAdsEnabled(acceptableAdsEnabled)
49 {
50 if (acceptableAdsEnabled === AdblockPlusApi.acceptableAdsEnabled)
51 return;
52 UI.toggleAcceptableAds();
53 }
54 };
OLDNEW
« no previous file with comments | « no previous file | adblockplus/build.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld