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 comment Created March 17, 2017, 10:09 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 | « include/AdblockPlus/FilterEngine.h ('k') | lib/compat.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
155 {
156 aaSubscription = Subscription.fromURL(Prefs.subscriptions_exceptionsurl) ;
157 FilterStorage.addSubscription(aaSubscription);
158 }
159 if (aaSubscription.disabled)
160 aaSubscription.disabled = false;
161 if (!aaSubscription.lastDownload)
162 Synchronizer.execute(aaSubscription);
163 },
164
165 isAASubscriptionEnabled: function()
166 {
167 var aaSubscription = FilterStorage.subscriptions.find(API.isAASubscription );
168 return aaSubscription && !aaSubscription.disabled;
169 },
170
140 showNextNotification: function(url) 171 showNextNotification: function(url)
141 { 172 {
142 Notification.showNext(url); 173 Notification.showNext(url);
143 }, 174 },
144 175
145 getNotificationTexts: function(notification) 176 getNotificationTexts: function(notification)
146 { 177 {
147 return Notification.getLocalizedTexts(notification); 178 return Notification.getLocalizedTexts(notification);
148 }, 179 },
149 180
(...skipping 24 matching lines...) Expand all
174 Prefs[pref] = value; 205 Prefs[pref] = value;
175 }, 206 },
176 207
177 forceUpdateCheck: function(eventName) 208 forceUpdateCheck: function(eventName)
178 { 209 {
179 checkForUpdates(_triggerEvent.bind(null, eventName)); 210 checkForUpdates(_triggerEvent.bind(null, eventName));
180 }, 211 },
181 212
182 getHostFromUrl: function(url) 213 getHostFromUrl: function(url)
183 { 214 {
184 return extractHostFromURL(url); 215 return extractHostFromURL(url);
185 }, 216 },
186 217
187 compareVersions: function(v1, v2) 218 compareVersions: function(v1, v2)
188 { 219 {
189 return Services.vc.compare(v1, v2); 220 return Services.vc.compare(v1, v2);
190 } 221 }
191 }; 222 };
192 })(); 223 })();
OLDNEW
« 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