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

Delta Between Two Patch Sets: lib/common.js

Issue 29361668: Issue 4394 - Create a filter class for element hiding emulation filters (Closed) Base URL: https://bitbucket.org/fhd/adblockpluscore
Left Patch Set: Address kzar's comments Created Nov. 11, 2016, 11:44 a.m.
Right Patch Set: Improve compliance with the 80 column rule Created Nov. 21, 2016, 8:10 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 | « chrome/content/elemHideEmulation.js ('k') | lib/elemHideEmulation.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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17
18 /**
19 * Map of features supported by element hiding emulation filters
20 */
21 var elemHideEmulationFeatureMap = {
22 PROPERTY_SELECTOR: 1,
23 HAS_PSEUDO_CLASS: 2
24 };
25 17
26 /** 18 /**
27 * Converts filter text into regular expression string 19 * Converts filter text into regular expression string
28 * @param {String} text as in Filter() 20 * @param {String} text as in Filter()
29 * @return {String} regular expression representation of filter text 21 * @return {String} regular expression representation of filter text
30 */ 22 */
31 function filterToRegExp(text) 23 function filterToRegExp(text)
32 { 24 {
33 return text 25 return text
34 // remove multiple wildcards 26 // remove multiple wildcards
(...skipping 13 matching lines...) Expand all
48 .replace(/^\\\|/, "^") 40 .replace(/^\\\|/, "^")
49 // process anchor at expression end 41 // process anchor at expression end
50 .replace(/\\\|$/, "$") 42 .replace(/\\\|$/, "$")
51 // remove leading wildcards 43 // remove leading wildcards
52 .replace(/^(\.\*)/, "") 44 .replace(/^(\.\*)/, "")
53 // remove trailing wildcards 45 // remove trailing wildcards
54 .replace(/(\.\*)$/, ""); 46 .replace(/(\.\*)$/, "");
55 } 47 }
56 48
57 if (typeof exports != "undefined") 49 if (typeof exports != "undefined")
58 {
59 exports.filterToRegExp = filterToRegExp; 50 exports.filterToRegExp = filterToRegExp;
60 exports.elemHideEmulationFeatureMap = elemHideEmulationFeatureMap;
61 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld