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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 28 matching lines...) Expand all Loading... |
39 let subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl); | 39 let subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl); |
40 if (subscription.url in FilterStorage.knownSubscriptions) | 40 if (subscription.url in FilterStorage.knownSubscriptions) |
41 subscription.disabled = !approved; | 41 subscription.disabled = !approved; |
42 } | 42 } |
43 | 43 |
44 function addAntiAdblockNotification(subscription) | 44 function addAntiAdblockNotification(subscription) |
45 { | 45 { |
46 let urlFilters = []; | 46 let urlFilters = []; |
47 for (let filter of subscription.filters) | 47 for (let filter of subscription.filters) |
48 { | 48 { |
49 if (filter instanceof ActiveFilter) | 49 if (filter instanceof ActiveFilter && filter.domains) |
50 { | 50 { |
51 for (let domain in filter.domains) | 51 for (let [domain, included] of filter.domains) |
52 { | 52 { |
53 let urlFilter = "||" + domain + "^$document"; | 53 let urlFilter = "||" + domain + "^$document"; |
54 if (domain && filter.domains[domain] && | 54 if (domain && included && urlFilters.indexOf(urlFilter) == -1) |
55 urlFilters.indexOf(urlFilter) == -1) | |
56 urlFilters.push(urlFilter); | 55 urlFilters.push(urlFilter); |
57 } | 56 } |
58 } | 57 } |
59 } | 58 } |
60 notification.urlFilters = urlFilters; | 59 notification.urlFilters = urlFilters; |
61 Notification.addNotification(notification); | 60 Notification.addNotification(notification); |
62 Notification.addQuestionListener(notification.id, notificationListener); | 61 Notification.addQuestionListener(notification.id, notificationListener); |
63 } | 62 } |
64 | 63 |
65 function removeAntiAdblockNotification() | 64 function removeAntiAdblockNotification() |
(...skipping 17 matching lines...) Expand all Loading... |
83 if (url in FilterStorage.knownSubscriptions && subscription.disabled) | 82 if (url in FilterStorage.knownSubscriptions && subscription.disabled) |
84 addAntiAdblockNotification(subscription); | 83 addAntiAdblockNotification(subscription); |
85 else | 84 else |
86 removeAntiAdblockNotification(); | 85 removeAntiAdblockNotification(); |
87 } | 86 } |
88 | 87 |
89 FilterNotifier.on("subscription.updated", onSubscriptionChange); | 88 FilterNotifier.on("subscription.updated", onSubscriptionChange); |
90 FilterNotifier.on("subscription.removed", onSubscriptionChange); | 89 FilterNotifier.on("subscription.removed", onSubscriptionChange); |
91 FilterNotifier.on("subscription.disabled", onSubscriptionChange); | 90 FilterNotifier.on("subscription.disabled", onSubscriptionChange); |
92 }; | 91 }; |
OLD | NEW |