| Left: | ||
| Right: |
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 725 RegExpFilter.fromText = function(text) | 725 RegExpFilter.fromText = function(text) |
| 726 { | 726 { |
| 727 let blocking = true; | 727 let blocking = true; |
| 728 let origText = text; | 728 let origText = text; |
| 729 if (text.indexOf("@@") == 0) | 729 if (text.indexOf("@@") == 0) |
| 730 { | 730 { |
| 731 blocking = false; | 731 blocking = false; |
| 732 text = text.substr(2); | 732 text = text.substr(2); |
| 733 } | 733 } |
| 734 | 734 |
| 735 let contentType = null; | 735 let contentType = null; |
|
kzar
2018/06/07 13:34:55
It's kinda confusing to reason about, but I wonder
Manish Jethani
2018/06/07 14:23:31
In theory one could write a filter that specifical
kzar
2018/06/07 14:32:32
Yea, I guess you're right. It seems kind of unlike
Manish Jethani
2018/06/07 14:38:22
If every single type is excluded the final value o
| |
| 736 let matchCase = null; | 736 let matchCase = null; |
| 737 let domains = null; | 737 let domains = null; |
| 738 let sitekeys = null; | 738 let sitekeys = null; |
| 739 let thirdParty = null; | 739 let thirdParty = null; |
| 740 let collapse = null; | 740 let collapse = null; |
| 741 let csp = null; | 741 let csp = null; |
| 742 let rewrite = null; | 742 let rewrite = null; |
| 743 let options; | 743 let options; |
| 744 let match = (text.indexOf("$") >= 0 ? Filter.optionsRegExp.exec(text) : null); | 744 let match = (text.indexOf("$") >= 0 ? Filter.optionsRegExp.exec(text) : null); |
| 745 if (match) | 745 if (match) |
| 746 { | 746 { |
| 747 options = match[1].split(","); | 747 options = match[1].split(","); |
| 748 text = match.input.substr(0, match.index); | 748 text = match.input.substr(0, match.index); |
| 749 for (let option of options) | 749 for (let option of options) |
| 750 { | 750 { |
| 751 let value = null; | 751 let value = null; |
| 752 let separatorIndex = option.indexOf("="); | 752 let separatorIndex = option.indexOf("="); |
| 753 if (separatorIndex >= 0) | 753 if (separatorIndex >= 0) |
| 754 { | 754 { |
| 755 value = option.substr(separatorIndex + 1); | 755 value = option.substr(separatorIndex + 1); |
| 756 option = option.substr(0, separatorIndex); | 756 option = option.substr(0, separatorIndex); |
| 757 } | 757 } |
| 758 option = option.replace(/-/, "_").toUpperCase(); | 758 option = option.replace(/-/, "_").toUpperCase(); |
| 759 if (option in RegExpFilter.typeMap) | 759 if (option in RegExpFilter.typeMap) |
| 760 { | 760 { |
| 761 if (contentType == null) | |
| 762 contentType = 0; | |
| 763 contentType |= RegExpFilter.typeMap[option]; | 761 contentType |= RegExpFilter.typeMap[option]; |
| 764 | 762 |
| 765 if (option == "CSP" && value) | 763 if (option == "CSP" && value) |
| 766 csp = value; | 764 csp = value; |
| 767 } | 765 } |
| 768 else if (option[0] == "~" && option.substr(1) in RegExpFilter.typeMap) | 766 else if (option[0] == "~" && option.substr(1) in RegExpFilter.typeMap) |
| 769 { | 767 { |
| 770 if (contentType == null) | 768 if (contentType == null) |
| 771 ({contentType} = RegExpFilter.prototype); | 769 ({contentType} = RegExpFilter.prototype); |
| 772 contentType &= ~RegExpFilter.typeMap[option.substr(1)]; | 770 contentType &= ~RegExpFilter.typeMap[option.substr(1)]; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1082 */ | 1080 */ |
| 1083 function ElemHideEmulationFilter(text, domains, selector) | 1081 function ElemHideEmulationFilter(text, domains, selector) |
| 1084 { | 1082 { |
| 1085 ElemHideBase.call(this, text, domains, selector); | 1083 ElemHideBase.call(this, text, domains, selector); |
| 1086 } | 1084 } |
| 1087 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; | 1085 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; |
| 1088 | 1086 |
| 1089 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { | 1087 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { |
| 1090 type: "elemhideemulation" | 1088 type: "elemhideemulation" |
| 1091 }); | 1089 }); |
| OLD | NEW |