| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 url: null, | 52 url: null, |
| 53 | 53 |
| 54 /** | 54 /** |
| 55 * Type of the subscription | 55 * Type of the subscription |
| 56 * @type {?string} | 56 * @type {?string} |
| 57 */ | 57 */ |
| 58 type: null, | 58 type: null, |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Filters contained in the filter subscription | 61 * Filters contained in the filter subscription |
| 62 * @type {Filter[]} | 62 * @type {Array.<string>} |
| 63 */ | 63 */ |
| 64 filters: null, | 64 filters: null, |
| 65 | 65 |
| 66 /** |
| 67 * A list of {@link Filter} objects associated with the subscription in some |
| 68 * way. This is used by {@link INIParser} to temporarily cache objects |
| 69 * corresponding to the subscription's filter text. |
| 70 * @type {?Array.<Filter>} |
| 71 * @package |
| 72 */ |
| 73 filterObjects: null, |
| 74 |
| 66 _title: null, | 75 _title: null, |
| 67 _fixedTitle: false, | 76 _fixedTitle: false, |
| 68 _disabled: false, | 77 _disabled: false, |
| 69 | 78 |
| 70 /** | 79 /** |
| 71 * Title of the filter subscription | 80 * Title of the filter subscription |
| 72 * @type {string} | 81 * @type {string} |
| 73 */ | 82 */ |
| 74 get title() | 83 get title() |
| 75 { | 84 { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if (_disabled) | 153 if (_disabled) |
| 145 yield "disabled=true"; | 154 yield "disabled=true"; |
| 146 }, | 155 }, |
| 147 | 156 |
| 148 *serializeFilters() | 157 *serializeFilters() |
| 149 { | 158 { |
| 150 let {filters} = this; | 159 let {filters} = this; |
| 151 | 160 |
| 152 yield "[Subscription filters]"; | 161 yield "[Subscription filters]"; |
| 153 | 162 |
| 154 for (let filter of filters) | 163 for (let text of filters) |
| 155 yield filter.text.replace(/\[/g, "\\["); | 164 yield text.replace(/\[/g, "\\["); |
| 156 }, | 165 }, |
| 157 | 166 |
| 158 toString() | 167 toString() |
| 159 { | 168 { |
| 160 return [...this.serialize()].join("\n"); | 169 return [...this.serialize()].join("\n"); |
| 161 } | 170 } |
| 162 }; | 171 }; |
| 163 | 172 |
| 164 /** | 173 /** |
| 165 * Cache for known filter subscriptions, maps URL to subscription objects. | 174 * Cache for known filter subscriptions, maps URL to subscription objects. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 335 |
| 327 /** | 336 /** |
| 328 * Creates a new user-defined filter group and adds the given filter to it. | 337 * Creates a new user-defined filter group and adds the given filter to it. |
| 329 * This group will act as the default group for this filter type. | 338 * This group will act as the default group for this filter type. |
| 330 * @param {Filter} filter | 339 * @param {Filter} filter |
| 331 * @return {SpecialSubscription} | 340 * @return {SpecialSubscription} |
| 332 */ | 341 */ |
| 333 SpecialSubscription.createForFilter = function(filter) | 342 SpecialSubscription.createForFilter = function(filter) |
| 334 { | 343 { |
| 335 let subscription = SpecialSubscription.create(); | 344 let subscription = SpecialSubscription.create(); |
| 336 subscription.filters.push(filter); | 345 subscription.filters.push(filter.text); |
| 337 for (let [type, class_] of SpecialSubscription.defaultsMap) | 346 for (let [type, class_] of SpecialSubscription.defaultsMap) |
| 338 { | 347 { |
| 339 if (filter instanceof class_) | 348 if (filter instanceof class_) |
| 340 subscription.defaults = [type]; | 349 subscription.defaults = [type]; |
| 341 } | 350 } |
| 342 if (!subscription.defaults) | 351 if (!subscription.defaults) |
| 343 subscription.defaults = ["blocking"]; | 352 subscription.defaults = ["blocking"]; |
| 344 return subscription; | 353 return subscription; |
| 345 }; | 354 }; |
| 346 | 355 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 if (errors) | 591 if (errors) |
| 583 yield "errors=" + errors; | 592 yield "errors=" + errors; |
| 584 if (version) | 593 if (version) |
| 585 yield "version=" + version; | 594 yield "version=" + version; |
| 586 if (requiredVersion) | 595 if (requiredVersion) |
| 587 yield "requiredVersion=" + requiredVersion; | 596 yield "requiredVersion=" + requiredVersion; |
| 588 if (downloadCount) | 597 if (downloadCount) |
| 589 yield "downloadCount=" + downloadCount; | 598 yield "downloadCount=" + downloadCount; |
| 590 } | 599 } |
| 591 }); | 600 }); |
| OLD | NEW |