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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 | 980 |
981 // We don't allow ElemHide filters which have any empty domains. | 981 // We don't allow ElemHide filters which have any empty domains. |
982 // Note: The ElemHide.prototype.domainSeparator is duplicated here, if that | 982 // Note: The ElemHide.prototype.domainSeparator is duplicated here, if that |
983 // changes this must be changed too. | 983 // changes this must be changed too. |
984 if (domain && /(^|,)~?(,|$)/.test(domain)) | 984 if (domain && /(^|,)~?(,|$)/.test(domain)) |
985 return new InvalidFilter(text, "filter_invalid_domain"); | 985 return new InvalidFilter(text, "filter_invalid_domain"); |
986 | 986 |
987 if (isException) | 987 if (isException) |
988 return new ElemHideException(text, domain, selector); | 988 return new ElemHideException(text, domain, selector); |
989 | 989 |
990 if (selector.indexOf("[-abp-properties") != -1) | 990 if (selector.indexOf("[-abp-properties=") != -1) |
991 { | 991 { |
992 // Element hiding emulation filters are inefficient so we need to make sure | 992 // Element hiding emulation filters are inefficient so we need to make sure |
993 // that they're only applied if they specify active domains | 993 // that they're only applied if they specify active domains |
994 if (!/,[^~][^,.]*\.[^,]/.test("," + domain)) | 994 if (!/,[^~][^,.]*\.[^,]/.test("," + domain)) |
995 return new InvalidFilter(text, "filter_elemhideemulation_nodomain"); | 995 return new InvalidFilter(text, "filter_elemhideemulation_nodomain"); |
996 | 996 |
997 return new ElemHideEmulationFilter(text, domain, selector); | 997 return new ElemHideEmulationFilter(text, domain, selector); |
998 } | 998 } |
999 | 999 |
1000 return new ElemHideFilter(text, domain, selector); | 1000 return new ElemHideFilter(text, domain, selector); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 */ | 1046 */ |
1047 function ElemHideEmulationFilter(text, domains, selector) | 1047 function ElemHideEmulationFilter(text, domains, selector) |
1048 { | 1048 { |
1049 ElemHideBase.call(this, text, domains, selector); | 1049 ElemHideBase.call(this, text, domains, selector); |
1050 } | 1050 } |
1051 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; | 1051 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; |
1052 | 1052 |
1053 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { | 1053 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { |
1054 type: "elemhideemulation" | 1054 type: "elemhideemulation" |
1055 }); | 1055 }); |
OLD | NEW |