OLD | NEW |
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 178 } |
179 | 179 |
180 // Add "acceptable ads" subscription | 180 // Add "acceptable ads" subscription |
181 if (addAcceptable) | 181 if (addAcceptable) |
182 { | 182 { |
183 var subscription = Subscription.fromURL(Prefs.subscriptions_exceptionsurl); | 183 var subscription = Subscription.fromURL(Prefs.subscriptions_exceptionsurl); |
184 if (subscription) | 184 if (subscription) |
185 { | 185 { |
186 subscription.title = "Allow non-intrusive advertising"; | 186 subscription.title = "Allow non-intrusive advertising"; |
187 FilterStorage.addSubscription(subscription); | 187 FilterStorage.addSubscription(subscription); |
188 if (subscription instanceof DownloadableSubscription && !subscription.last
Download) | 188 if (subscription instanceof DownloadableSubscription && |
| 189 !subscription.lastDownload) |
189 Synchronizer.execute(subscription); | 190 Synchronizer.execute(subscription); |
190 } | 191 } |
191 else | 192 else |
192 addAcceptable = false; | 193 addAcceptable = false; |
193 } | 194 } |
194 | 195 |
| 196 // Add "anti-adblock messages" subscription for new users |
| 197 if (!prevVersion) |
| 198 { |
| 199 var subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl); |
| 200 if (subscription && !(subscription.url in FilterStorage.knownSubscriptions)) |
| 201 { |
| 202 subscription.disabled = true; |
| 203 FilterStorage.addSubscription(subscription); |
| 204 if (subscription instanceof DownloadableSubscription && |
| 205 !subscription.lastDownload) |
| 206 Synchronizer.execute(subscription); |
| 207 } |
| 208 } |
| 209 |
195 if (!addSubscription && !addAcceptable) | 210 if (!addSubscription && !addAcceptable) |
196 return; | 211 return; |
197 | 212 |
198 Promise.resolve(addSubscription && fetch("subscriptions.xml") | 213 Promise.resolve(addSubscription && fetch("subscriptions.xml") |
199 .then(function(response) | 214 .then(function(response) |
200 { | 215 { |
201 return response.text(); | 216 return response.text(); |
202 }) | 217 }) |
203 .then(function(text) | 218 .then(function(text) |
204 { | 219 { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 } | 441 } |
427 }); | 442 }); |
428 | 443 |
429 // update icon when page changes location | 444 // update icon when page changes location |
430 ext.pages.onLoading.addListener(function(page) | 445 ext.pages.onLoading.addListener(function(page) |
431 { | 446 { |
432 page.sendMessage({type: "blockelement-finished"}); | 447 page.sendMessage({type: "blockelement-finished"}); |
433 refreshIconAndContextMenu(page); | 448 refreshIconAndContextMenu(page); |
434 showNextNotificationForUrl(page.url); | 449 showNextNotificationForUrl(page.url); |
435 }); | 450 }); |
OLD | NEW |