| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of the Adblock Plus extension, | 2 * This file is part of the Adblock Plus extension, |
| 3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 this._getRuleDomains(filter, rule.options); | 155 this._getRuleDomains(filter, rule.options); |
| 156 this._getRuleThirdParty(filter, rule.options); | 156 this._getRuleThirdParty(filter, rule.options); |
| 157 return rule; | 157 return rule; |
| 158 }, | 158 }, |
| 159 | 159 |
| 160 add: function(filter) | 160 add: function(filter) |
| 161 { | 161 { |
| 162 if (filter.text in this._rules) | 162 if (filter.text in this._rules) |
| 163 return; | 163 return; |
| 164 | 164 |
| 165 if (!filter.regexpSource) // Regular expressions aren't supported | |
|
Felix Dahlke
2012/11/14 12:45:26
So it's a regular expression if regexpSource is fa
Wladimir Palant
2012/11/14 13:25:30
Yes - for raw regexps we calculate the regexp prop
| |
| 166 return; | |
| 167 | |
| 165 var rule = this._generateRule(filter); | 168 var rule = this._generateRule(filter); |
| 166 opera.extension.urlfilter[rule.type].add(rule.text, rule.options); | 169 opera.extension.urlfilter[rule.type].add(rule.text, rule.options); |
| 167 this._rules[filter.text] = rule; | 170 this._rules[filter.text] = rule; |
| 168 }, | 171 }, |
| 169 | 172 |
| 170 remove: function(filter) | 173 remove: function(filter) |
| 171 { | 174 { |
| 172 if (!(filter.text in this._rules)) | 175 if (!(filter.text in this._rules)) |
| 173 return; | 176 return; |
| 174 | 177 |
| 175 var rule = this._rules[filter.text]; | 178 var rule = this._rules[filter.text]; |
| 176 opera.extension.urlfilter[rule.type].remove(rule.text); | 179 opera.extension.urlfilter[rule.type].remove(rule.text); |
| 177 delete this._rules[filter.text]; | 180 delete this._rules[filter.text]; |
| 178 }, | 181 }, |
| 179 | 182 |
| 180 clear: function() | 183 clear: function() |
| 181 { | 184 { |
| 182 for (var text in this._rules) | 185 for (var text in this._rules) |
| 183 { | 186 { |
| 184 var rule = this._rules[text]; | 187 var rule = this._rules[text]; |
| 185 opera.extension.urlfilter[rule.type].remove(rule.text); | 188 opera.extension.urlfilter[rule.type].remove(rule.text); |
| 186 } | 189 } |
| 187 this._rules = {}; | 190 this._rules = {}; |
| 188 } | 191 } |
| 189 } | 192 } |
| 190 }; | 193 }; |
| 191 })(); | 194 })(); |
| OLD | NEW |