| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 return result; | 397 return result; |
| 398 | 398 |
| 399 let candidates = pattern.toLowerCase().match(allKeywordsRegExp); | 399 let candidates = pattern.toLowerCase().match(allKeywordsRegExp); |
| 400 if (!candidates) | 400 if (!candidates) |
| 401 return result; | 401 return result; |
| 402 | 402 |
| 403 let resultCount = 0xFFFFFF; | 403 let resultCount = 0xFFFFFF; |
| 404 let resultLength = 0; | 404 let resultLength = 0; |
| 405 for (let i = 0, l = candidates.length; i < l; i++) | 405 for (let i = 0, l = candidates.length; i < l; i++) |
| 406 { | 406 { |
| 407 let candidate = candidates[i].substr(1); | 407 let candidate = candidates[i].substring(1); |
| 408 let simpleFilters = this._simpleFiltersByKeyword.get(candidate); | 408 let simpleFilters = this._simpleFiltersByKeyword.get(candidate); |
| 409 let complexFilters = this._complexFiltersByKeyword.get(candidate); | 409 let complexFilters = this._complexFiltersByKeyword.get(candidate); |
| 410 let count = (typeof simpleFilters != "undefined" ? | 410 let count = (typeof simpleFilters != "undefined" ? |
| 411 simpleFilters.size : 0) + | 411 simpleFilters.size : 0) + |
| 412 (typeof complexFilters != "undefined" ? | 412 (typeof complexFilters != "undefined" ? |
| 413 complexFilters.size : 0); | 413 complexFilters.size : 0); |
| 414 if (count < resultCount || | 414 if (count < resultCount || |
| 415 (count == resultCount && candidate.length > resultLength)) | 415 (count == resultCount && candidate.length > resultLength)) |
| 416 { | 416 { |
| 417 result = candidate; | 417 result = candidate; |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 | 876 |
| 877 exports.CombinedMatcher = CombinedMatcher; | 877 exports.CombinedMatcher = CombinedMatcher; |
| 878 | 878 |
| 879 /** | 879 /** |
| 880 * Shared {@link CombinedMatcher} instance that should usually be used. | 880 * Shared {@link CombinedMatcher} instance that should usually be used. |
| 881 * @type {CombinedMatcher} | 881 * @type {CombinedMatcher} |
| 882 */ | 882 */ |
| 883 let defaultMatcher = new CombinedMatcher(); | 883 let defaultMatcher = new CombinedMatcher(); |
| 884 | 884 |
| 885 exports.defaultMatcher = defaultMatcher; | 885 exports.defaultMatcher = defaultMatcher; |
| OLD | NEW |