From c7b0de8ff023c023df380f424878aa444ecb11da Mon Sep 17 00:00:00 2001 From: Stanislav A Date: Tue, 15 Nov 2022 13:51:15 +0300 Subject: [PATCH] fix throttle imports --- src/scriptlets/hide-in-shadow-dom.js | 10 ++++++++-- src/scriptlets/prevent-xhr.js | 8 ++++---- src/scriptlets/remove-attr.js | 6 ++++++ src/scriptlets/remove-class.js | 6 ++++++ src/scriptlets/remove-in-shadow-dom.js | 10 ++++++++-- src/scriptlets/set-attr.js | 16 +++++++++++++--- src/scriptlets/set-popads-dummy.js | 2 +- 7 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/scriptlets/hide-in-shadow-dom.js b/src/scriptlets/hide-in-shadow-dom.js index bfc25588a..dc0a68de5 100644 --- a/src/scriptlets/hide-in-shadow-dom.js +++ b/src/scriptlets/hide-in-shadow-dom.js @@ -1,9 +1,12 @@ import { hit, observeDOMChanges, - flatten, findHostElements, pierceShadowDom, + // following helpers should be imported and injected + // because they are used by helpers above + flatten, + throttle, } from '../helpers/index'; /** @@ -85,7 +88,10 @@ hideInShadowDom.names = [ hideInShadowDom.injections = [ hit, observeDOMChanges, - flatten, findHostElements, pierceShadowDom, + // following helpers should be imported and injected + // because they are used by helpers above + flatten, + throttle, ]; diff --git a/src/scriptlets/prevent-xhr.js b/src/scriptlets/prevent-xhr.js index 30fa5c4eb..f90061a8a 100644 --- a/src/scriptlets/prevent-xhr.js +++ b/src/scriptlets/prevent-xhr.js @@ -1,8 +1,6 @@ import { hit, objectToString, - getRandomIntInclusive, - getRandomStrByLength, generateRandomResponse, matchRequestProps, logMessage, @@ -20,6 +18,8 @@ import { parseMatchProps, validateParsedData, getMatchPropsData, + getRandomIntInclusive, + getRandomStrByLength, } from '../helpers/index'; /* eslint-disable max-len */ @@ -191,8 +191,6 @@ preventXHR.injections = [ logVerbose, objectToString, matchRequestProps, - getRandomIntInclusive, - getRandomStrByLength, generateRandomResponse, toRegExp, isValidStrPattern, @@ -205,4 +203,6 @@ preventXHR.injections = [ parseMatchProps, validateParsedData, getMatchPropsData, + getRandomIntInclusive, + getRandomStrByLength, ]; diff --git a/src/scriptlets/remove-attr.js b/src/scriptlets/remove-attr.js index 4d72cfbe9..c665db8da 100644 --- a/src/scriptlets/remove-attr.js +++ b/src/scriptlets/remove-attr.js @@ -3,6 +3,9 @@ import { observeDOMChanges, parseFlags, logVerbose, + // following helpers should be imported and injected + // because they are used by helpers above + throttle, } from '../helpers/index'; /* eslint-disable max-len */ @@ -144,4 +147,7 @@ removeAttr.injections = [ observeDOMChanges, parseFlags, logVerbose, + // following helpers should be imported and injected + // because they are used by helpers above + throttle, ]; diff --git a/src/scriptlets/remove-class.js b/src/scriptlets/remove-class.js index d5e714276..de83ed37a 100644 --- a/src/scriptlets/remove-class.js +++ b/src/scriptlets/remove-class.js @@ -3,6 +3,9 @@ import { logVerbose, observeDOMChanges, parseFlags, + // following helpers should be imported and injected + // because they are used by helpers above + throttle, } from '../helpers/index'; /* eslint-disable max-len */ @@ -170,4 +173,7 @@ removeClass.injections = [ logVerbose, observeDOMChanges, parseFlags, + // following helpers should be imported and injected + // because they are used by helpers above + throttle, ]; diff --git a/src/scriptlets/remove-in-shadow-dom.js b/src/scriptlets/remove-in-shadow-dom.js index e263b1a49..94ef38aad 100644 --- a/src/scriptlets/remove-in-shadow-dom.js +++ b/src/scriptlets/remove-in-shadow-dom.js @@ -1,9 +1,12 @@ import { hit, observeDOMChanges, - flatten, findHostElements, pierceShadowDom, + // following helpers should be imported and injected + // because they are used by helpers above + flatten, + throttle, } from '../helpers/index'; /** @@ -84,7 +87,10 @@ removeInShadowDom.names = [ removeInShadowDom.injections = [ hit, observeDOMChanges, - flatten, findHostElements, pierceShadowDom, + // following helpers should be imported and injected + // because they are used by helpers above + flatten, + throttle, ]; diff --git a/src/scriptlets/set-attr.js b/src/scriptlets/set-attr.js index 8cef2dfb8..fd4fd5b2b 100644 --- a/src/scriptlets/set-attr.js +++ b/src/scriptlets/set-attr.js @@ -2,6 +2,9 @@ import { hit, observeDOMChanges, nativeIsNaN, + // following helpers should be imported and injected + // because they are used by helpers above + throttle, } from '../helpers/index'; /* eslint-disable max-len */ @@ -57,8 +60,8 @@ export function setAttr(source, selector, attr, value = '') { // Drop strings that cant be parsed into number, negative numbers and numbers below 32767 if (value.length !== 0 && (nativeIsNaN(parseInt(value, 10)) - || parseInt(value, 10) < 0 - || parseInt(value, 10) > 0x7FFF)) { + || parseInt(value, 10) < 0 + || parseInt(value, 10) > 0x7FFF)) { return; } @@ -82,4 +85,11 @@ setAttr.names = [ 'set-attr', ]; -setAttr.injections = [hit, observeDOMChanges, nativeIsNaN]; +setAttr.injections = [ + hit, + observeDOMChanges, + nativeIsNaN, + // following helpers should be imported and injected + // because they are used by helpers above + throttle, +]; diff --git a/src/scriptlets/set-popads-dummy.js b/src/scriptlets/set-popads-dummy.js index 6e191a621..1792e5147 100644 --- a/src/scriptlets/set-popads-dummy.js +++ b/src/scriptlets/set-popads-dummy.js @@ -1,4 +1,4 @@ -/* eslint-disable no-console, func-names, no-multi-assign */ +/* eslint-disable func-names, no-multi-assign */ import { hit } from '../helpers/index'; /**