| 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-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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 collapse = true; | 697 collapse = true; |
| 698 else if (option == "~COLLAPSE") | 698 else if (option == "~COLLAPSE") |
| 699 collapse = false; | 699 collapse = false; |
| 700 else if (option == "SITEKEY" && typeof value != "undefined") | 700 else if (option == "SITEKEY" && typeof value != "undefined") |
| 701 sitekeys = value; | 701 sitekeys = value; |
| 702 else | 702 else |
| 703 return new InvalidFilter(origText, "Unknown option " + option.toLowerCas
e()); | 703 return new InvalidFilter(origText, "Unknown option " + option.toLowerCas
e()); |
| 704 } | 704 } |
| 705 } | 705 } |
| 706 | 706 |
| 707 if (!blocking && (contentType == null || (contentType & RegExpFilter.typeMap.D
OCUMENT)) && | |
| 708 (!options || options.indexOf("DOCUMENT") < 0) && !/^\|?[\w\-]+:/.test(text
)) | |
| 709 { | |
| 710 // Exception filters shouldn't apply to pages by default unless they start w
ith a protocol name | |
| 711 if (contentType == null) | |
| 712 contentType = RegExpFilter.prototype.contentType; | |
| 713 contentType &= ~RegExpFilter.typeMap.DOCUMENT; | |
| 714 } | |
| 715 | |
| 716 try | 707 try |
| 717 { | 708 { |
| 718 if (blocking) | 709 if (blocking) |
| 719 return new BlockingFilter(origText, text, contentType, matchCase, domains,
thirdParty, sitekeys, collapse); | 710 return new BlockingFilter(origText, text, contentType, matchCase, domains,
thirdParty, sitekeys, collapse); |
| 720 else | 711 else |
| 721 return new WhitelistFilter(origText, text, contentType, matchCase, domains
, thirdParty, sitekeys); | 712 return new WhitelistFilter(origText, text, contentType, matchCase, domains
, thirdParty, sitekeys); |
| 722 } | 713 } |
| 723 catch (e) | 714 catch (e) |
| 724 { | 715 { |
| 725 return new InvalidFilter(origText, e); | 716 return new InvalidFilter(origText, e); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 744 DTD: 1, | 735 DTD: 1, |
| 745 MEDIA: 16384, | 736 MEDIA: 16384, |
| 746 FONT: 32768, | 737 FONT: 32768, |
| 747 | 738 |
| 748 BACKGROUND: 4, // Backwards compat, same as IMAGE | 739 BACKGROUND: 4, // Backwards compat, same as IMAGE |
| 749 | 740 |
| 750 POPUP: 0x10000000, | 741 POPUP: 0x10000000, |
| 751 ELEMHIDE: 0x40000000 | 742 ELEMHIDE: 0x40000000 |
| 752 }; | 743 }; |
| 753 | 744 |
| 754 // ELEMHIDE, POPUP option shouldn't be there by default | 745 // DOCUMENT, ELEMHIDE, POPUP options shouldn't be there by default |
| 755 RegExpFilter.prototype.contentType &= ~(RegExpFilter.typeMap.ELEMHIDE | RegExpFi
lter.typeMap.POPUP); | 746 RegExpFilter.prototype.contentType &= ~(RegExpFilter.typeMap.DOCUMENT | RegExpFi
lter.typeMap.ELEMHIDE | RegExpFilter.typeMap.POPUP); |
| 756 | 747 |
| 757 /** | 748 /** |
| 758 * Class for blocking filters | 749 * Class for blocking filters |
| 759 * @param {String} text see Filter() | 750 * @param {String} text see Filter() |
| 760 * @param {String} regexpSource see RegExpFilter() | 751 * @param {String} regexpSource see RegExpFilter() |
| 761 * @param {Number} contentType see RegExpFilter() | 752 * @param {Number} contentType see RegExpFilter() |
| 762 * @param {Boolean} matchCase see RegExpFilter() | 753 * @param {Boolean} matchCase see RegExpFilter() |
| 763 * @param {String} domains see RegExpFilter() | 754 * @param {String} domains see RegExpFilter() |
| 764 * @param {Boolean} thirdParty see RegExpFilter() | 755 * @param {Boolean} thirdParty see RegExpFilter() |
| 765 * @param {String} sitekeys see RegExpFilter() | 756 * @param {String} sitekeys see RegExpFilter() |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 function ElemHideException(text, domains, selector) | 930 function ElemHideException(text, domains, selector) |
| 940 { | 931 { |
| 941 ElemHideBase.call(this, text, domains, selector); | 932 ElemHideBase.call(this, text, domains, selector); |
| 942 } | 933 } |
| 943 exports.ElemHideException = ElemHideException; | 934 exports.ElemHideException = ElemHideException; |
| 944 | 935 |
| 945 ElemHideException.prototype = | 936 ElemHideException.prototype = |
| 946 { | 937 { |
| 947 __proto__: ElemHideBase.prototype | 938 __proto__: ElemHideBase.prototype |
| 948 }; | 939 }; |
| OLD | NEW |