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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 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 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 // These aren't normally properties of a Subscription object 131 // These aren't normally properties of a Subscription object
132 subscription.author = subscriptions[i].author; 132 subscription.author = subscriptions[i].author;
133 subscription.prefixes = subscriptions[i].prefixes; 133 subscription.prefixes = subscriptions[i].prefixes;
134 subscription.specialization = subscriptions[i].specialization; 134 subscription.specialization = subscriptions[i].specialization;
135 result.push(subscription); 135 result.push(subscription);
136 } 136 }
137 return result; 137 return result;
138 }, 138 },
139 139
140 isAASubscription: function(subscription)
141 {
142 return subscription.url == Prefs.subscriptions_exceptionsurl;
143 },
144
145 setAASubscriptionEnabled: function(enabled)
146 {
147 var aaSubscription = FilterStorage.subscriptions.find(API.isAASubscription );
148 if (!enabled)
149 {
150 if (aaSubscription && !aaSubscription.disabled)
151 aaSubscription.disabled = true;
152 return;
153 }
154 if (!aaSubscription) {
hub 2017/03/17 20:04:15 'nit: new line before the {
sergei 2017/03/17 22:10:06 Done.
155 aaSubscription = Subscription.fromURL(Prefs.subscriptions_exceptionsurl) ;
156 FilterStorage.addSubscription(aaSubscription);
157 }
158 if (aaSubscription.disabled)
159 aaSubscription.disabled = false;
160 if (!aaSubscription.lastDownload)
161 Synchronizer.execute(aaSubscription);
162 },
163
164 isAASubscriptionEnabled: function()
165 {
166 var aaSubscription = FilterStorage.subscriptions.find(API.isAASubscription );
167 return aaSubscription && !aaSubscription.disabled;
168 },
169
140 showNextNotification: function(url) 170 showNextNotification: function(url)
141 { 171 {
142 Notification.showNext(url); 172 Notification.showNext(url);
143 }, 173 },
144 174
145 getNotificationTexts: function(notification) 175 getNotificationTexts: function(notification)
146 { 176 {
147 return Notification.getLocalizedTexts(notification); 177 return Notification.getLocalizedTexts(notification);
148 }, 178 },
149 179
(...skipping 24 matching lines...) Expand all
174 Prefs[pref] = value; 204 Prefs[pref] = value;
175 }, 205 },
176 206
177 forceUpdateCheck: function(eventName) 207 forceUpdateCheck: function(eventName)
178 { 208 {
179 checkForUpdates(_triggerEvent.bind(null, eventName)); 209 checkForUpdates(_triggerEvent.bind(null, eventName));
180 }, 210 },
181 211
182 getHostFromUrl: function(url) 212 getHostFromUrl: function(url)
183 { 213 {
184 return extractHostFromURL(url); 214 return extractHostFromURL(url);
185 }, 215 },
186 216
187 compareVersions: function(v1, v2) 217 compareVersions: function(v1, v2)
188 { 218 {
189 return Services.vc.compare(v1, v2); 219 return Services.vc.compare(v1, v2);
190 } 220 }
191 }; 221 };
192 })(); 222 })();
OLDNEW

Powered by Google App Engine
This is Rietveld