| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 | 468 |
| 469 if (this.ignoreTrailingDot) | 469 if (this.ignoreTrailingDot) |
| 470 docDomain = docDomain.replace(/\.+$/, ""); | 470 docDomain = docDomain.replace(/\.+$/, ""); |
| 471 docDomain = docDomain.toUpperCase(); | 471 docDomain = docDomain.toUpperCase(); |
| 472 | 472 |
| 473 for (let domain in this.domains) | 473 for (let domain in this.domains) |
| 474 if (this.domains[domain] && domain != docDomain && (domain.length <= docDo
main.length || domain.indexOf("." + docDomain) != domain.length - docDomain.leng
th - 1)) | 474 if (this.domains[domain] && domain != docDomain && (domain.length <= docDo
main.length || domain.indexOf("." + docDomain) != domain.length - docDomain.leng
th - 1)) |
| 475 return false; | 475 return false; |
| 476 | 476 |
| 477 return true; | 477 return true; |
| 478 }, |
| 479 |
| 480 /** |
| 481 * Checks whether this filter is generic or specific |
| 482 */ |
| 483 isGeneric: function() /**Boolean*/ |
| 484 { |
| 485 return !(this.sitekeys && this.sitekeys.length) && |
| 486 (!this.domains || this.domains[""]); |
| 478 }, | 487 }, |
| 479 | 488 |
| 480 /** | 489 /** |
| 481 * See Filter.serialize() | 490 * See Filter.serialize() |
| 482 */ | 491 */ |
| 483 serialize: function(buffer) | 492 serialize: function(buffer) |
| 484 { | 493 { |
| 485 if (this._disabled || this._hitCount || this._lastHit) | 494 if (this._disabled || this._hitCount || this._lastHit) |
| 486 { | 495 { |
| 487 Filter.prototype.serialize.call(this, buffer); | 496 Filter.prototype.serialize.call(this, buffer); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 FONT: 32768, | 761 FONT: 32768, |
| 753 | 762 |
| 754 BACKGROUND: 4, // Backwards compat, same as IMAGE | 763 BACKGROUND: 4, // Backwards compat, same as IMAGE |
| 755 | 764 |
| 756 POPUP: 0x10000000, | 765 POPUP: 0x10000000, |
| 757 GENERICBLOCK: 0x20000000, | 766 GENERICBLOCK: 0x20000000, |
| 758 ELEMHIDE: 0x40000000, | 767 ELEMHIDE: 0x40000000, |
| 759 GENERICHIDE: 0x80000000 | 768 GENERICHIDE: 0x80000000 |
| 760 }; | 769 }; |
| 761 | 770 |
| 762 // DOCUMENT, ELEMHIDE, POPUP, GENERICHIDE and GENERICBLOCK options shouldn't be
there by default | 771 // DOCUMENT, ELEMHIDE, POPUP, GENERICHIDE and GENERICBLOCK options shouldn't |
| 772 // be there by default |
| 763 RegExpFilter.prototype.contentType &= ~(RegExpFilter.typeMap.DOCUMENT | | 773 RegExpFilter.prototype.contentType &= ~(RegExpFilter.typeMap.DOCUMENT | |
| 764 RegExpFilter.typeMap.ELEMHIDE | | 774 RegExpFilter.typeMap.ELEMHIDE | |
| 765 RegExpFilter.typeMap.POPUP | | 775 RegExpFilter.typeMap.POPUP | |
| 766 RegExpFilter.typeMap.GENERICHIDE | | 776 RegExpFilter.typeMap.GENERICHIDE | |
| 767 RegExpFilter.typeMap.GENERICBLOCK); | 777 RegExpFilter.typeMap.GENERICBLOCK); |
| 768 | 778 |
| 769 /** | 779 /** |
| 770 * Class for blocking filters | 780 * Class for blocking filters |
| 771 * @param {String} text see Filter() | 781 * @param {String} text see Filter() |
| 772 * @param {String} regexpSource see RegExpFilter() | 782 * @param {String} regexpSource see RegExpFilter() |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 // several times on Safari, due to WebKit bug 132872 | 1037 // several times on Safari, due to WebKit bug 132872 |
| 1028 let prop = Object.getOwnPropertyDescriptor(this, "regexpString"); | 1038 let prop = Object.getOwnPropertyDescriptor(this, "regexpString"); |
| 1029 if (prop) | 1039 if (prop) |
| 1030 return prop.value; | 1040 return prop.value; |
| 1031 | 1041 |
| 1032 let regexp = Filter.toRegExp(this.regexpSource); | 1042 let regexp = Filter.toRegExp(this.regexpSource); |
| 1033 Object.defineProperty(this, "regexpString", {value: regexp}); | 1043 Object.defineProperty(this, "regexpString", {value: regexp}); |
| 1034 return regexp; | 1044 return regexp; |
| 1035 } | 1045 } |
| 1036 }; | 1046 }; |
| LEFT | RIGHT |