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: address comments and rebase Created March 17, 2017, 3:49 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
Index: lib/api.js
diff --git a/lib/api.js b/lib/api.js
index ca656b898f6680637d15e84a030a5c8b02986738..bc6803b34575cb0ae99167b053de748e3f7299c9 100644
--- a/lib/api.js
+++ b/lib/api.js
@@ -137,6 +137,36 @@ 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) {
hub 2017/03/17 20:04:15 'nit: new line before the {
sergei 2017/03/17 22:10:06 Done.
+ 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 +211,7 @@ var API = (function()
getHostFromUrl: function(url)
{
- return extractHostFromURL(url);
+ return extractHostFromURL(url);
},
compareVersions: function(v1, v2)

Powered by Google App Engine
This is Rietveld