Left: | ||
Right: |
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 * | 116 * |
117 * @param {string} text as in Filter() | 117 * @param {string} text as in Filter() |
118 * @return {Filter} | 118 * @return {Filter} |
119 */ | 119 */ |
120 Filter.fromText = function(text) | 120 Filter.fromText = function(text) |
121 { | 121 { |
122 let filter = Filter.knownFilters.get(text); | 122 let filter = Filter.knownFilters.get(text); |
123 if (filter) | 123 if (filter) |
124 return filter; | 124 return filter; |
125 | 125 |
126 let match = text.includes("#") ? Filter.contentRegExp.exec(text) : null; | 126 if (text[0] == "!") |
Jon Sonesen
2018/08/29 15:01:36
Is there any difference performance wise between t
Manish Jethani
2018/08/29 15:50:15
In my tests, which was a while ago, I had found th
| |
127 if (match) | 127 { |
128 filter = ContentFilter.fromText(text, match[1], match[2], match[3]); | |
129 else if (text[0] == "!") | |
130 filter = new CommentFilter(text); | 128 filter = new CommentFilter(text); |
129 } | |
131 else | 130 else |
132 filter = RegExpFilter.fromText(text); | 131 { |
132 let match = text.includes("#") ? Filter.contentRegExp.exec(text) : null; | |
133 if (match) | |
134 filter = ContentFilter.fromText(text, match[1], match[2], match[3]); | |
135 else | |
136 filter = RegExpFilter.fromText(text); | |
137 } | |
133 | 138 |
134 Filter.knownFilters.set(filter.text, filter); | 139 Filter.knownFilters.set(filter.text, filter); |
135 return filter; | 140 return filter; |
136 }; | 141 }; |
137 | 142 |
138 /** | 143 /** |
139 * Deserializes a filter | 144 * Deserializes a filter |
140 * | 145 * |
141 * @param {Object} obj map of serialized properties and their values | 146 * @param {Object} obj map of serialized properties and their values |
142 * @return {Filter} filter or null if the filter couldn't be created | 147 * @return {Filter} filter or null if the filter couldn't be created |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1177 | 1182 |
1178 /** | 1183 /** |
1179 * Script that should be executed | 1184 * Script that should be executed |
1180 * @type {string} | 1185 * @type {string} |
1181 */ | 1186 */ |
1182 get script() | 1187 get script() |
1183 { | 1188 { |
1184 return this.body; | 1189 return this.body; |
1185 } | 1190 } |
1186 }); | 1191 }); |
OLD | NEW |