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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 /** | 133 /** |
134 * Notifies Matcher instances or ElemHide object about a new filter | 134 * Notifies Matcher instances or ElemHide object about a new filter |
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 if (!filter.subscriptionsAdded) |
| 144 filterStorage.addSubscriptionsToFilter(filter); |
| 145 |
143 let hasEnabled = false; | 146 let hasEnabled = false; |
144 let allowSnippets = false; | 147 let allowSnippets = false; |
145 for (let subscription of filter.subscriptions()) | 148 for (let subscription of filter.subscriptions()) |
146 { | 149 { |
147 if (!subscription.disabled) | 150 if (!subscription.disabled) |
148 { | 151 { |
149 hasEnabled = true; | 152 hasEnabled = true; |
150 | 153 |
151 // Allow snippets to be executed only by the circumvention lists or the | 154 // Allow snippets to be executed only by the circumvention lists or the |
152 // user's own filters. | 155 // user's own filters. |
(...skipping 29 matching lines...) Expand all Loading... |
182 * if necessary. | 185 * if necessary. |
183 * @param {Filter} filter filter that has been removed | 186 * @param {Filter} filter filter that has been removed |
184 */ | 187 */ |
185 function removeFilter(filter) | 188 function removeFilter(filter) |
186 { | 189 { |
187 if (!(filter instanceof ActiveFilter)) | 190 if (!(filter instanceof ActiveFilter)) |
188 return; | 191 return; |
189 | 192 |
190 if (!filter.disabled) | 193 if (!filter.disabled) |
191 { | 194 { |
| 195 if (!filter.subscriptionsAdded) |
| 196 filterStorage.addSubscriptionsToFilter(filter); |
| 197 |
192 let hasEnabled = false; | 198 let hasEnabled = false; |
193 for (let subscription of filter.subscriptions()) | 199 for (let subscription of filter.subscriptions()) |
194 { | 200 { |
195 if (!subscription.disabled) | 201 if (!subscription.disabled) |
196 { | 202 { |
197 hasEnabled = true; | 203 hasEnabled = true; |
198 break; | 204 break; |
199 } | 205 } |
200 } | 206 } |
201 if (hasEnabled) | 207 if (hasEnabled) |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 { | 346 { |
341 if (!subscription.disabled) | 347 if (!subscription.disabled) |
342 addFilters(subscription.filters); | 348 addFilters(subscription.filters); |
343 } | 349 } |
344 } | 350 } |
345 | 351 |
346 function onSave() | 352 function onSave() |
347 { | 353 { |
348 isDirty = 0; | 354 isDirty = 0; |
349 } | 355 } |
OLD | NEW |