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

Side by Side Diff: lib/content/elemHideEmulation.js

Issue 29715555: Issue 6447 - Switch to Harmony modules in lib/* (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created March 6, 2018, 7:42 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 17
18 "use strict"; 18 "use strict";
19 19
20 const {textToRegExp, filterToRegExp, splitSelector} = require("../common"); 20 import {textToRegExp, filterToRegExp, splitSelector} from "../common";
21 21
22 let MIN_INVOCATION_INTERVAL = 3000; 22 let MIN_INVOCATION_INTERVAL = 3000;
23 const MAX_SYNCHRONOUS_PROCESSING_TIME = 50; 23 const MAX_SYNCHRONOUS_PROCESSING_TIME = 50;
24 const abpSelectorRegexp = /:-abp-([\w-]+)\(/i; 24 const abpSelectorRegexp = /:-abp-([\w-]+)\(/i;
25 25
26 /** Return position of node from parent. 26 /** Return position of node from parent.
27 * @param {Node} node the node to find the position of. 27 * @param {Node} node the node to find the position of.
28 * @return {number} One-based index like for :nth-child(), or 0 on error. 28 * @return {number} One-based index like for :nth-child(), or 0 on error.
29 */ 29 */
30 function positionInParent(node) 30 function positionInParent(node)
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 { 403 {
404 // Observe changes to character data only if there's a contains selector in 404 // Observe changes to character data only if there's a contains selector in
405 // one of the patterns. 405 // one of the patterns.
406 return patterns.some( 406 return patterns.some(
407 pattern => pattern.selectors.some( 407 pattern => pattern.selectors.some(
408 selector => selector.dependsOnCharacterData 408 selector => selector.dependsOnCharacterData
409 ) 409 )
410 ); 410 );
411 } 411 }
412 412
413 function ElemHideEmulation(addSelectorsFunc, hideElemsFunc) 413 export function ElemHideEmulation(addSelectorsFunc, hideElemsFunc)
414 { 414 {
415 this.document = document; 415 this.document = document;
416 this.addSelectorsFunc = addSelectorsFunc; 416 this.addSelectorsFunc = addSelectorsFunc;
417 this.hideElemsFunc = hideElemsFunc; 417 this.hideElemsFunc = hideElemsFunc;
418 this.observer = new MutationObserver(this.observe.bind(this)); 418 this.observer = new MutationObserver(this.observe.bind(this));
419 } 419 }
420 420
421 ElemHideEmulation.prototype = { 421 ElemHideEmulation.prototype = {
422 isSameOrigin(stylesheet) 422 isSameOrigin(stylesheet)
423 { 423 {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 childList: true, 710 childList: true,
711 attributes: shouldObserveAttributes(this.patterns), 711 attributes: shouldObserveAttributes(this.patterns),
712 characterData: shouldObserveCharacterData(this.patterns), 712 characterData: shouldObserveCharacterData(this.patterns),
713 subtree: true 713 subtree: true
714 } 714 }
715 ); 715 );
716 this.document.addEventListener("load", this.onLoad.bind(this), true); 716 this.document.addEventListener("load", this.onLoad.bind(this), true);
717 } 717 }
718 } 718 }
719 }; 719 };
720
721 exports.ElemHideEmulation = ElemHideEmulation;
OLDNEW
« lib/common.js ('K') | « lib/common.js ('k') | lib/coreUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld