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: Rebase after change in http://codereview.adblockplus.org/5924365505921024 Created March 17, 2015, 3:30 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 {UI} = require("ui");
38
39 var AdblockPlusApi =
40 {
41 get acceptableAdsEnabled()
42 {
43 return FilterStorage.subscriptions.some(
44 (subscription) => subscription.url == Prefs.subscriptions_exceptionsurl);
45 },
46 set acceptableAdsEnabled(acceptableAdsEnabled)
47 {
48 if (acceptableAdsEnabled != AdblockPlusApi.acceptableAdsEnabled)
49 UI.toggleAcceptableAds();
50 }
51 };
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