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

Unified Diff: lib/api.js

Issue 29366747: Issue 4657 - Add Acceptable Ads API (Closed)
Patch Set: fix typo Created April 5, 2017, 4:53 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | lib/compat.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/api.js
diff --git a/lib/api.js b/lib/api.js
index bb52f3f06d40ef47603a4080dc6214928fceb5a9..fdfb351f3824b66b62306af42ddf41efd19ac2b3 100644
--- a/lib/api.js
+++ b/lib/api.js
@@ -137,6 +137,37 @@ var API = (function()
return result;
},
+ isAASubscription: function(subscription)
+ {
+ return subscription.url == Prefs.subscriptions_exceptionsurl;
+ },
+
+ setAASubscriptionEnabled: function(enabled)
+ {
+ var aaSubscription = FilterStorage.subscriptions.find(API.isAASubscription);
+ if (!enabled)
+ {
+ if (aaSubscription && !aaSubscription.disabled)
+ aaSubscription.disabled = true;
+ return;
+ }
+ if (!aaSubscription)
+ {
+ aaSubscription = Subscription.fromURL(Prefs.subscriptions_exceptionsurl);
+ FilterStorage.addSubscription(aaSubscription);
+ }
+ if (aaSubscription.disabled)
+ aaSubscription.disabled = false;
+ if (!aaSubscription.lastDownload)
+ Synchronizer.execute(aaSubscription);
+ },
+
+ isAASubscriptionEnabled: function()
+ {
+ var aaSubscription = FilterStorage.subscriptions.find(API.isAASubscription);
+ return aaSubscription && !aaSubscription.disabled;
+ },
+
showNextNotification: function(url)
{
Notification.showNext(url);
@@ -181,7 +212,7 @@ var API = (function()
getHostFromUrl: function(url)
{
- return extractHostFromURL(url);
+ return extractHostFromURL(url);
},
compareVersions: function(v1, v2)
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | lib/compat.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld