Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/filterClasses.js

Issue 29737558: Issue 6538, 6781 - Implement support for snippet filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Rename script to body in ContentFilter Created July 11, 2018, 12:48 p.m.
Right Patch Set: Improve comment formatting Created July 11, 2018, 1:02 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | lib/filterListener.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 body: null 1022 body: null
1023 }); 1023 });
1024 1024
1025 /** 1025 /**
1026 * Creates a content filter from a pre-parsed text representation 1026 * Creates a content filter from a pre-parsed text representation
1027 * 1027 *
1028 * @param {string} text same as in Filter() 1028 * @param {string} text same as in Filter()
1029 * @param {string} [domains] 1029 * @param {string} [domains]
1030 * domains part of the text representation 1030 * domains part of the text representation
1031 * @param {string} [type] 1031 * @param {string} [type]
1032 * rule type, either empty or @ (exception) or ? (emulation rule) or 1032 * rule type, either:
1033 * $ (snippet) 1033 * <li>"" for an element hiding filter</li>
Manish Jethani 2018/07/11 13:04:26 Using just "-" doesn't work in the HTML version, b
kzar 2018/07/11 17:17:52 Acknowledged.
1034 * <li>"@" for an element hiding exception filter</li>
1035 * <li>"?" for an element hiding emulation filter</li>
1036 * <li>"$" for a snippet filter</li>
1034 * @param {string} body 1037 * @param {string} body
1035 * body part of the text representation, either a CSS selector or a snippet 1038 * body part of the text representation, either a CSS selector or a snippet
1036 * script 1039 * script
1037 * @return {ElemHideFilter|ElemHideException| 1040 * @return {ElemHideFilter|ElemHideException|
1038 * ElemHideEmulationFilter|SnippetFilter|InvalidFilter} 1041 * ElemHideEmulationFilter|SnippetFilter|InvalidFilter}
1039 */ 1042 */
1040 ContentFilter.fromText = function(text, domains, type, body) 1043 ContentFilter.fromText = function(text, domains, type, body)
1041 { 1044 {
1042 // We don't allow content filters which have any empty domains. 1045 // We don't allow content filters which have any empty domains.
1043 // Note: The ContentFilter.prototype.domainSeparator is duplicated here, if 1046 // Note: The ContentFilter.prototype.domainSeparator is duplicated here, if
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 } 1162 }
1160 exports.SnippetFilter = SnippetFilter; 1163 exports.SnippetFilter = SnippetFilter;
1161 1164
1162 SnippetFilter.prototype = extend(ContentFilter, { 1165 SnippetFilter.prototype = extend(ContentFilter, {
1163 type: "snippet", 1166 type: "snippet",
1164 1167
1165 /** 1168 /**
1166 * Script that should be executed 1169 * Script that should be executed
1167 * @type {string} 1170 * @type {string}
1168 */ 1171 */
1169 get script() 1172 get script()
Manish Jethani 2018/07/11 13:04:25 I would prefer to stick to this terminology for Sn
kzar 2018/07/11 17:17:52 Yes, I agree, "script" makes sense for snippet fil
1170 { 1173 {
1171 return this.body; 1174 return this.body;
1172 } 1175 }
1173 }); 1176 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld