LEFT | RIGHT |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 */ | 57 */ |
58 function trueSlice(string) | 58 function trueSlice(string) |
59 { | 59 { |
60 return JSON.parse(JSON.stringify(string)); | 60 return JSON.parse(JSON.stringify(string)); |
61 } | 61 } |
62 | 62 |
63 /** | 63 /** |
64 * Optimizes content filter text. | 64 * Optimizes content filter text. |
65 * | 65 * |
66 * @param {string} text The filter text. | 66 * @param {string} text The filter text. |
67 * @param {string} domains The domains part of the filter text. | 67 * @param {?string} [domains] The domains part of the filter text. |
68 * @param {?string} [type] The type part of the filter text, either | 68 * @param {?string} [type] The type part of the filter text, either |
69 * <code>null</code> or <code>undefined</code>, or one of <code>@</code>, | 69 * <code>null</code> or <code>undefined</code>, or one of <code>@</code>, |
70 * <code>?</code>, and <code>$</code>. | 70 * <code>?</code>, and <code>$</code>. |
71 * @param {string} body The body part of the filter text. | 71 * @param {string} body The body part of the filter text. |
72 * | 72 * |
73 * @returns {Array.<string>} An array containing the optimized filter text and | 73 * @returns {Array.<string>} An array containing the optimized filter text and |
74 * its optimized parts. | 74 * its optimized parts. |
75 */ | 75 */ |
76 function optimizeContentFilterText(text, domains, type, body) | 76 function optimizeContentFilterText(text, domains, type, body) |
77 { | 77 { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 else | 149 else |
150 { | 150 { |
151 strings.set(domains, domains); | 151 strings.set(domains, domains); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 return [text, pattern, domains, sitekeys, csp, rewrite]; | 155 return [text, pattern, domains, sitekeys, csp, rewrite]; |
156 } | 156 } |
157 | 157 |
158 exports.optimizeRegExpFilterText = optimizeRegExpFilterText; | 158 exports.optimizeRegExpFilterText = optimizeRegExpFilterText; |
LEFT | RIGHT |