feat(scripts): improve content script

This commit is contained in:
wanhose 2022-01-20 15:30:09 +01:00
parent 36c2b6a530
commit e39ad68d26

View File

@ -93,20 +93,23 @@ const fix = () => {
if (hostname.includes(match)) {
switch (action) {
case "click":
const submit = document.querySelector(selector);
submit?.click?.();
break;
case "reset":
case "click": {
const node = document.querySelector(selector);
node?.style?.setProperty?.(property, "initial", "important");
break;
case "resetAll":
node?.click();
}
case "remove": {
const node = document.querySelector(selector);
node?.style?.removeProperty(property);
}
case "reset": {
const node = document.querySelector(selector);
node?.style?.setProperty(property, "initial", "important");
}
case "resetAll": {
const nodes = document.querySelectorAll(selector);
nodes.forEach((node) =>
node?.style?.setProperty?.(property, "initial", "important")
);
break;
// prettier-ignore
nodes.forEach((node) => node?.style?.setProperty(property, "initial", "important"));
}
default:
break;
}