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 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 * restricted to | 989 * restricted to |
990 * @param {string} selector CSS selector for the HTML elements that should be | 990 * @param {string} selector CSS selector for the HTML elements that should be |
991 * hidden | 991 * hidden |
992 * @constructor | 992 * @constructor |
993 * @augments ActiveFilter | 993 * @augments ActiveFilter |
994 */ | 994 */ |
995 function ElemHideBase(text, domains, selector) | 995 function ElemHideBase(text, domains, selector) |
996 { | 996 { |
997 ActiveFilter.call(this, text, domains || null); | 997 ActiveFilter.call(this, text, domains || null); |
998 | 998 |
999 if (domains) | |
1000 { | |
1001 this.selectorDomains = domains.replace(/,~[^,]+/g, "") | |
1002 .replace(/^~[^,]+,?/, "").toLowerCase(); | |
1003 } | |
1004 | |
1005 // Braces are being escaped to prevent CSS rule injection. | 999 // Braces are being escaped to prevent CSS rule injection. |
1006 this.selector = selector.replace("{", "\\7B ").replace("}", "\\7D "); | 1000 this.selector = selector.replace("{", "\\7B ").replace("}", "\\7D "); |
1007 } | 1001 } |
1008 exports.ElemHideBase = ElemHideBase; | 1002 exports.ElemHideBase = ElemHideBase; |
1009 | 1003 |
1010 ElemHideBase.prototype = extend(ActiveFilter, { | 1004 ElemHideBase.prototype = extend(ActiveFilter, { |
1011 /** | 1005 /** |
1012 * @see ActiveFilter.domainSeparator | 1006 * @see ActiveFilter.domainSeparator |
1013 */ | 1007 */ |
1014 domainSeparator: ",", | 1008 domainSeparator: ",", |
1015 | 1009 |
1016 /** | 1010 /** |
1017 * @see ActiveFilter.ignoreTrailingDot | 1011 * @see ActiveFilter.ignoreTrailingDot |
1018 */ | 1012 */ |
1019 ignoreTrailingDot: false, | 1013 ignoreTrailingDot: false, |
1020 | 1014 |
1021 /** | 1015 /** |
1022 * Host names or domains the filter should be restricted to (can be null for | |
1023 * no restriction) | |
1024 * @type {?string} | |
1025 */ | |
1026 selectorDomains: null, | |
1027 /** | |
1028 * CSS selector for the HTML elements that should be hidden | 1016 * CSS selector for the HTML elements that should be hidden |
1029 * @type {string} | 1017 * @type {string} |
1030 */ | 1018 */ |
1031 selector: null | 1019 selector: null |
1032 }); | 1020 }); |
1033 | 1021 |
1034 /** | 1022 /** |
1035 * Creates an element hiding filter from a pre-parsed text representation | 1023 * Creates an element hiding filter from a pre-parsed text representation |
1036 * | 1024 * |
1037 * @param {string} text same as in Filter() | 1025 * @param {string} text same as in Filter() |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 */ | 1101 */ |
1114 function ElemHideEmulationFilter(text, domains, selector) | 1102 function ElemHideEmulationFilter(text, domains, selector) |
1115 { | 1103 { |
1116 ElemHideBase.call(this, text, domains, selector); | 1104 ElemHideBase.call(this, text, domains, selector); |
1117 } | 1105 } |
1118 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; | 1106 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; |
1119 | 1107 |
1120 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { | 1108 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { |
1121 type: "elemhideemulation" | 1109 type: "elemhideemulation" |
1122 }); | 1110 }); |
OLD | NEW |