| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 option.substr(cspMatch[0].length).trim().replace(/ +/g, " "); | 222 option.substr(cspMatch[0].length).trim().replace(/ +/g, " "); |
| 223 } | 223 } |
| 224 else | 224 else |
| 225 options[i] = option.replace(/ +/g, ""); | 225 options[i] = option.replace(/ +/g, ""); |
| 226 } | 226 } |
| 227 | 227 |
| 228 return beforeOptions + "$" + options.join(); | 228 return beforeOptions + "$" + options.join(); |
| 229 }; | 229 }; |
| 230 | 230 |
| 231 /** | 231 /** |
| 232 * @see filterToRegExp | |
| 233 */ | |
| 234 Filter.toRegExp = filterToRegExp; | |
| 235 | |
| 236 /** | |
| 237 * Class for invalid filters | 232 * Class for invalid filters |
| 238 * @param {string} text see {@link Filter Filter()} | 233 * @param {string} text see {@link Filter Filter()} |
| 239 * @param {string} reason Reason why this filter is invalid | 234 * @param {string} reason Reason why this filter is invalid |
| 240 * @constructor | 235 * @constructor |
| 241 * @augments Filter | 236 * @augments Filter |
| 242 */ | 237 */ |
| 243 function InvalidFilter(text, reason) | 238 function InvalidFilter(text, reason) |
| 244 { | 239 { |
| 245 Filter.call(this, text); | 240 Filter.call(this, text); |
| 246 | 241 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 * for delayed creation of the regexp property | 641 * for delayed creation of the regexp property |
| 647 * @type {string} | 642 * @type {string} |
| 648 */ | 643 */ |
| 649 regexpSource: null, | 644 regexpSource: null, |
| 650 /** | 645 /** |
| 651 * Regular expression to be used when testing against this filter | 646 * Regular expression to be used when testing against this filter |
| 652 * @type {RegExp} | 647 * @type {RegExp} |
| 653 */ | 648 */ |
| 654 get regexp() | 649 get regexp() |
| 655 { | 650 { |
| 656 let source = Filter.toRegExp(this.regexpSource); | 651 let source = filterToRegExp(this.regexpSource); |
| 657 let regexp = new RegExp(source, this.matchCase ? "" : "i"); | 652 let regexp = new RegExp(source, this.matchCase ? "" : "i"); |
| 658 Object.defineProperty(this, "regexp", {value: regexp}); | 653 Object.defineProperty(this, "regexp", {value: regexp}); |
| 659 this.regexpSource = null; | 654 this.regexpSource = null; |
| 660 return regexp; | 655 return regexp; |
| 661 }, | 656 }, |
| 662 /** | 657 /** |
| 663 * Content types the filter applies to, combination of values from | 658 * Content types the filter applies to, combination of values from |
| 664 * RegExpFilter.typeMap | 659 * RegExpFilter.typeMap |
| 665 * @type {number} | 660 * @type {number} |
| 666 */ | 661 */ |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 | 1177 |
| 1183 /** | 1178 /** |
| 1184 * Script that should be executed | 1179 * Script that should be executed |
| 1185 * @type {string} | 1180 * @type {string} |
| 1186 */ | 1181 */ |
| 1187 get script() | 1182 get script() |
| 1188 { | 1183 { |
| 1189 return this.body; | 1184 return this.body; |
| 1190 } | 1185 } |
| 1191 }); | 1186 }); |
| OLD | NEW |