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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 // | 18 // |
19 // This file has been generated automatically, relevant repositories: | 19 // This file has been generated automatically, relevant repositories: |
| 20 // * https://hg.adblockplus.org/adblockplus/ |
20 // * https://hg.adblockplus.org/jshydra/ | 21 // * https://hg.adblockplus.org/jshydra/ |
21 // | 22 // |
22 | |
23 var FilterNotifier = require("filterNotifier").FilterNotifier; | |
24 var Utils = require("utils").Utils; | |
25 | 23 |
26 function Filter(text) | 24 function Filter(text) |
27 { | 25 { |
28 this.text = text; | 26 this.text = text; |
29 this.subscriptions = []; | 27 this.subscriptions = []; |
30 } | 28 } |
31 exports.Filter = Filter; | 29 exports.Filter = Filter; |
32 Filter.prototype = { | 30 Filter.prototype = { |
33 text: null, | 31 text: null, |
34 subscriptions: null, | 32 subscriptions: null, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 get disabled() | 161 get disabled() |
164 { | 162 { |
165 return this._disabled; | 163 return this._disabled; |
166 }, | 164 }, |
167 set disabled(value) | 165 set disabled(value) |
168 { | 166 { |
169 if (value != this._disabled) | 167 if (value != this._disabled) |
170 { | 168 { |
171 var oldValue = this._disabled; | 169 var oldValue = this._disabled; |
172 this._disabled = value; | 170 this._disabled = value; |
173 FilterNotifier.triggerListeners("filter.disabled", this, value, oldValue); | |
174 } | 171 } |
175 return this._disabled; | 172 return this._disabled; |
176 }, | 173 }, |
177 get hitCount() | 174 get hitCount() |
178 { | 175 { |
179 return this._hitCount; | 176 return this._hitCount; |
180 }, | 177 }, |
181 set hitCount(value) | 178 set hitCount(value) |
182 { | 179 { |
183 if (value != this._hitCount) | 180 if (value != this._hitCount) |
184 { | 181 { |
185 var oldValue = this._hitCount; | 182 var oldValue = this._hitCount; |
186 this._hitCount = value; | 183 this._hitCount = value; |
187 FilterNotifier.triggerListeners("filter.hitCount", this, value, oldValue); | |
188 } | 184 } |
189 return this._hitCount; | 185 return this._hitCount; |
190 }, | 186 }, |
191 get lastHit() | 187 get lastHit() |
192 { | 188 { |
193 return this._lastHit; | 189 return this._lastHit; |
194 }, | 190 }, |
195 set lastHit(value) | 191 set lastHit(value) |
196 { | 192 { |
197 if (value != this._lastHit) | 193 if (value != this._lastHit) |
198 { | 194 { |
199 var oldValue = this._lastHit; | 195 var oldValue = this._lastHit; |
200 this._lastHit = value; | 196 this._lastHit = value; |
201 FilterNotifier.triggerListeners("filter.lastHit", this, value, oldValue); | |
202 } | 197 } |
203 return this._lastHit; | 198 return this._lastHit; |
204 }, | 199 }, |
205 domainSource: null, | 200 domainSource: null, |
206 domainSeparator: null, | 201 domainSeparator: null, |
207 ignoreTrailingDot: true, | 202 ignoreTrailingDot: true, |
208 domainSourceIsUpperCase: false, | 203 domainSourceIsUpperCase: false, |
209 get domains() | 204 get domains() |
210 { | 205 { |
211 var prop = Object.getOwnPropertyDescriptor(this, "domains"); | 206 var prop = Object.getOwnPropertyDescriptor(this, "domains"); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 var separatorPos = rule.indexOf("="); | 629 var separatorPos = rule.indexOf("="); |
635 if (separatorPos > 0) | 630 if (separatorPos > 0) |
636 { | 631 { |
637 rule = rule.replace(/=/, "=\"") + "\""; | 632 rule = rule.replace(/=/, "=\"") + "\""; |
638 additional += "[" + rule + "]"; | 633 additional += "[" + rule + "]"; |
639 } | 634 } |
640 else | 635 else |
641 { | 636 { |
642 if (id) | 637 if (id) |
643 { | 638 { |
644 return new InvalidFilter(text, Utils.getString("filter_elemhide_dupl
icate_id")); | 639 return new InvalidFilter(text); |
645 } | 640 } |
646 id = rule; | 641 id = rule; |
647 } | 642 } |
648 } | 643 } |
649 } | 644 } |
650 if (id) | 645 if (id) |
651 { | 646 { |
652 selector = tagName + "." + id + additional + "," + tagName + "#" + id + ad
ditional; | 647 selector = tagName + "." + id + additional + "," + tagName + "#" + id + ad
ditional; |
653 } | 648 } |
654 else if (tagName || additional) | 649 else if (tagName || additional) |
655 { | 650 { |
656 selector = tagName + additional; | 651 selector = tagName + additional; |
657 } | 652 } |
658 else | 653 else |
659 { | 654 { |
660 return new InvalidFilter(text, Utils.getString("filter_elemhide_nocriteria
")); | 655 return new InvalidFilter(text); |
661 } | 656 } |
662 } | 657 } |
663 if (isException) | 658 if (isException) |
664 { | 659 { |
665 return new ElemHideException(text, domain, selector); | 660 return new ElemHideException(text, domain, selector); |
666 } | 661 } |
667 var match = Filter.csspropertyRegExp.exec(selector); | 662 var match = Filter.csspropertyRegExp.exec(selector); |
668 if (match) | 663 if (match) |
669 { | 664 { |
670 if (!/,[^~][^,.]*\.[^,]/.test("," + domain)) | 665 if (!/,[^~][^,.]*\.[^,]/.test("," + domain)) |
671 { | 666 { |
672 return new InvalidFilter(text, Utils.getString("filter_cssproperty_nodomai
n")); | 667 return new InvalidFilter(text); |
673 } | 668 } |
674 return new CSSPropertyFilter(text, domain, selector, match[2], selector.subs
tr(0, match.index), selector.substr(match.index + match[0].length)); | 669 return new CSSPropertyFilter(text, domain, selector, match[2], selector.subs
tr(0, match.index), selector.substr(match.index + match[0].length)); |
675 } | 670 } |
676 return new ElemHideFilter(text, domain, selector); | 671 return new ElemHideFilter(text, domain, selector); |
677 }; | 672 }; |
678 | 673 |
679 function ElemHideFilter(text, domains, selector) | 674 function ElemHideFilter(text, domains, selector) |
680 { | 675 { |
681 ElemHideBase.call(this, text, domains, selector); | 676 ElemHideBase.call(this, text, domains, selector); |
682 } | 677 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 return prop.value; | 713 return prop.value; |
719 } | 714 } |
720 var regexp = Filter.toRegExp(this.regexpSource); | 715 var regexp = Filter.toRegExp(this.regexpSource); |
721 Object.defineProperty(this, "regexpString", | 716 Object.defineProperty(this, "regexpString", |
722 { | 717 { |
723 value: regexp | 718 value: regexp |
724 }); | 719 }); |
725 return regexp; | 720 return regexp; |
726 } | 721 } |
727 }; | 722 }; |
728 | |
LEFT | RIGHT |