Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const handleNodes = (nodes: Element[]) => {
const { classes, ids, hrefs } = extractFeaturesFromDOM(nodes);
const newIds: string[] = [];
const newClasses: string[] = [];
const newHrefs: string[] = [];
// Update ids
for (let i = 0; i < ids.length; i += 1) {
const id = ids[i];
if (knownIds.has(id) === false) {
newIds.push(id);
knownIds.add(id);
}
}
for (let i = 0; i < classes.length; i += 1) {
const cls = classes[i];
if (knownClasses.has(cls) === false) {
const handleNodes = (nodes: Element[]) => {
const { classes, ids, hrefs } = extractFeaturesFromDOM(nodes);
const newIds: string[] = [];
const newClasses: string[] = [];
const newHrefs: string[] = [];
// Update ids
for (let i = 0; i < ids.length; i += 1) {
const id = ids[i];
if (knownIds.has(id) === false) {
newIds.push(id);
knownIds.add(id);
}
}
for (let i = 0; i < classes.length; i += 1) {
const cls = classes[i];
if (knownClasses.has(cls) === false) {
hostname,
url,
// DOM information
classes,
hrefs,
ids,
});
// Abort if cosmetics are disabled
if (active === true) {
// Inject scripts
for (let i = 0; i < scripts.length; i += 1) {
frame
.addScriptTag({
content: autoRemoveScript(scripts[i]),
})
.catch(() => {
// Ignore
});
}
// Inject CSS
if (styles.length !== 0) {
frame
.addStyleTag({
content: styles,
})
.catch(() => {
// Ignore
});
}
setTimeout(() => injectScript(scripts[i], window.document), 0);
}
return (window: Window, args: any[]) =>
injectScript(wrapCallableInContext(autoCallFunction(fn, args), deps), window.document);
}
setTimeout(() => injectCSSRule(styles, window.document), 0);
}