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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 * if necessary. | 135 * if necessary. |
136 * @param {Filter} filter filter that has been added | 136 * @param {Filter} filter filter that has been added |
137 */ | 137 */ |
138 function addFilter(filter) | 138 function addFilter(filter) |
139 { | 139 { |
140 if (!(filter instanceof ActiveFilter) || filter.disabled) | 140 if (!(filter instanceof ActiveFilter) || filter.disabled) |
141 return; | 141 return; |
142 | 142 |
143 let hasEnabled = false; | 143 let hasEnabled = false; |
144 let allowSnippets = false; | 144 let allowSnippets = false; |
145 for (let subscription of filter.subscriptions()) | 145 for (let subscription of filterStorage.subscriptionsForFilter(filter)) |
146 { | 146 { |
147 if (!subscription.disabled) | 147 if (!subscription.disabled) |
148 { | 148 { |
149 hasEnabled = true; | 149 hasEnabled = true; |
150 | 150 |
151 // Allow snippets to be executed only by the circumvention lists or the | 151 // Allow snippets to be executed only by the circumvention lists or the |
152 // user's own filters. | 152 // user's own filters. |
153 if (subscription.type == "circumvention" || | 153 if (subscription.type == "circumvention" || |
154 subscription.url == "https://easylist-downloads.adblockplus.org/abp-fi
lters-anti-cv.txt" || | 154 subscription.url == "https://easylist-downloads.adblockplus.org/abp-fi
lters-anti-cv.txt" || |
155 subscription instanceof SpecialSubscription) | 155 subscription instanceof SpecialSubscription) |
(...skipping 27 matching lines...) Expand all Loading... |
183 * @param {Filter} filter filter that has been removed | 183 * @param {Filter} filter filter that has been removed |
184 */ | 184 */ |
185 function removeFilter(filter) | 185 function removeFilter(filter) |
186 { | 186 { |
187 if (!(filter instanceof ActiveFilter)) | 187 if (!(filter instanceof ActiveFilter)) |
188 return; | 188 return; |
189 | 189 |
190 if (!filter.disabled) | 190 if (!filter.disabled) |
191 { | 191 { |
192 let hasEnabled = false; | 192 let hasEnabled = false; |
193 for (let subscription of filter.subscriptions()) | 193 for (let subscription of filterStorage.subscriptionsForFilter(filter)) |
194 { | 194 { |
195 if (!subscription.disabled) | 195 if (!subscription.disabled) |
196 { | 196 { |
197 hasEnabled = true; | 197 hasEnabled = true; |
198 break; | 198 break; |
199 } | 199 } |
200 } | 200 } |
201 if (hasEnabled) | 201 if (hasEnabled) |
202 return; | 202 return; |
203 } | 203 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 { | 351 { |
352 if (!subscription.disabled) | 352 if (!subscription.disabled) |
353 addSubscriptionFilters(subscription); | 353 addSubscriptionFilters(subscription); |
354 } | 354 } |
355 } | 355 } |
356 | 356 |
357 function onSave() | 357 function onSave() |
358 { | 358 { |
359 isDirty = 0; | 359 isDirty = 0; |
360 } | 360 } |
OLD | NEW |