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