Skip to content

Commit

Permalink
fix throttle imports
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Nov 15, 2022
1 parent f18dc3a commit c7b0de8
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 12 deletions.
10 changes: 8 additions & 2 deletions src/scriptlets/hide-in-shadow-dom.js
Original file line number Diff line number Diff line change
@@ -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';

/**
Expand Down Expand Up @@ -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,
];
8 changes: 4 additions & 4 deletions src/scriptlets/prevent-xhr.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
hit,
objectToString,
getRandomIntInclusive,
getRandomStrByLength,
generateRandomResponse,
matchRequestProps,
logMessage,
Expand All @@ -20,6 +18,8 @@ import {
parseMatchProps,
validateParsedData,
getMatchPropsData,
getRandomIntInclusive,
getRandomStrByLength,
} from '../helpers/index';

/* eslint-disable max-len */
Expand Down Expand Up @@ -191,8 +191,6 @@ preventXHR.injections = [
logVerbose,
objectToString,
matchRequestProps,
getRandomIntInclusive,
getRandomStrByLength,
generateRandomResponse,
toRegExp,
isValidStrPattern,
Expand All @@ -205,4 +203,6 @@ preventXHR.injections = [
parseMatchProps,
validateParsedData,
getMatchPropsData,
getRandomIntInclusive,
getRandomStrByLength,
];
6 changes: 6 additions & 0 deletions src/scriptlets/remove-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -144,4 +147,7 @@ removeAttr.injections = [
observeDOMChanges,
parseFlags,
logVerbose,
// following helpers should be imported and injected
// because they are used by helpers above
throttle,
];
6 changes: 6 additions & 0 deletions src/scriptlets/remove-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -170,4 +173,7 @@ removeClass.injections = [
logVerbose,
observeDOMChanges,
parseFlags,
// following helpers should be imported and injected
// because they are used by helpers above
throttle,
];
10 changes: 8 additions & 2 deletions src/scriptlets/remove-in-shadow-dom.js
Original file line number Diff line number Diff line change
@@ -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';

/**
Expand Down Expand Up @@ -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,
];
16 changes: 13 additions & 3 deletions src/scriptlets/set-attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}

Expand All @@ -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,
];
2 changes: 1 addition & 1 deletion src/scriptlets/set-popads-dummy.js
Original file line number Diff line number Diff line change
@@ -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';

/**
Expand Down

0 comments on commit c7b0de8

Please sign in to comment.