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: Use == instead of === as the Mozilla coding style says Created March 14, 2015, 10:55 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.url == Prefs.subscriptions_exceptionsurl);
46 },
47 set acceptableAdsEnabled(acceptableAdsEnabled)
48 {
49 if (acceptableAdsEnabled == AdblockPlusApi.acceptableAdsEnabled)
50 return;
51 UI.toggleAcceptableAds();
52 }
53 };
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