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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 */ | 134 */ |
135 function addFilter(filter) | 135 function addFilter(filter) |
136 { | 136 { |
137 if (!(filter instanceof ActiveFilter) || filter.disabled) | 137 if (!(filter instanceof ActiveFilter) || filter.disabled) |
138 return; | 138 return; |
139 | 139 |
140 let hasEnabled = false; | 140 let hasEnabled = false; |
141 for (let i = 0; i < filter.subscriptions.length; i++) | 141 for (let i = 0; i < filter.subscriptions.length; i++) |
142 { | 142 { |
143 if (!filter.subscriptions[i].disabled) | 143 if (!filter.subscriptions[i].disabled) |
| 144 { |
144 hasEnabled = true; | 145 hasEnabled = true; |
| 146 break; |
| 147 } |
145 } | 148 } |
146 if (!hasEnabled) | 149 if (!hasEnabled) |
147 return; | 150 return; |
148 | 151 |
149 if (filter instanceof RegExpFilter) | 152 if (filter instanceof RegExpFilter) |
150 defaultMatcher.add(filter); | 153 defaultMatcher.add(filter); |
151 else if (filter instanceof ElemHideBase) | 154 else if (filter instanceof ElemHideBase) |
152 { | 155 { |
153 if (filter instanceof ElemHideEmulationFilter) | 156 if (filter instanceof ElemHideEmulationFilter) |
154 ElemHideEmulation.add(filter); | 157 ElemHideEmulation.add(filter); |
(...skipping 11 matching lines...) Expand all Loading... |
166 { | 169 { |
167 if (!(filter instanceof ActiveFilter)) | 170 if (!(filter instanceof ActiveFilter)) |
168 return; | 171 return; |
169 | 172 |
170 if (!filter.disabled) | 173 if (!filter.disabled) |
171 { | 174 { |
172 let hasEnabled = false; | 175 let hasEnabled = false; |
173 for (let i = 0; i < filter.subscriptions.length; i++) | 176 for (let i = 0; i < filter.subscriptions.length; i++) |
174 { | 177 { |
175 if (!filter.subscriptions[i].disabled) | 178 if (!filter.subscriptions[i].disabled) |
| 179 { |
176 hasEnabled = true; | 180 hasEnabled = true; |
| 181 break; |
| 182 } |
177 } | 183 } |
178 if (hasEnabled) | 184 if (hasEnabled) |
179 return; | 185 return; |
180 } | 186 } |
181 | 187 |
182 if (filter instanceof RegExpFilter) | 188 if (filter instanceof RegExpFilter) |
183 defaultMatcher.remove(filter); | 189 defaultMatcher.remove(filter); |
184 else if (filter instanceof ElemHideBase) | 190 else if (filter instanceof ElemHideBase) |
185 { | 191 { |
186 if (filter instanceof ElemHideEmulationFilter) | 192 if (filter instanceof ElemHideEmulationFilter) |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 { | 317 { |
312 if (!subscription.disabled) | 318 if (!subscription.disabled) |
313 addFilters(subscription.filters); | 319 addFilters(subscription.filters); |
314 } | 320 } |
315 } | 321 } |
316 | 322 |
317 function onSave() | 323 function onSave() |
318 { | 324 { |
319 isDirty = 0; | 325 isDirty = 0; |
320 } | 326 } |
OLD | NEW |