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)) { if (hostname.includes(match)) {
switch (action) { switch (action) {
case "click": case "click": {
const submit = document.querySelector(selector);
submit?.click?.();
break;
case "reset":
const node = document.querySelector(selector); const node = document.querySelector(selector);
node?.style?.setProperty?.(property, "initial", "important"); node?.click();
break; }
case "resetAll": 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); const nodes = document.querySelectorAll(selector);
nodes.forEach((node) => // prettier-ignore
node?.style?.setProperty?.(property, "initial", "important") nodes.forEach((node) => node?.style?.setProperty(property, "initial", "important"));
); }
break;
default: default:
break; break;
} }