fix(script): solve null errors
This commit is contained in:
parent
58f52777bd
commit
2e3274c71a
@ -6,7 +6,7 @@ if (!!window.chrome && navigator.vendor.includes("Google")) {
|
||||
|
||||
// Create logic script
|
||||
const script = document.createElement("script");
|
||||
script.setAttribute("src", chrome.runtime.getURL("modules/script.js"));
|
||||
script.setAttribute("src", chrome.runtime.getURL("js/modules/script.js"));
|
||||
script.setAttribute("type", "module");
|
||||
|
||||
// Inject logic script
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { notRemovable, removable } from 'js/modules/elements.js';
|
||||
import { notRemovable, removable } from './elements.js';
|
||||
|
||||
// Observer
|
||||
const observer = new MutationObserver((mutations, observer) => {
|
||||
@ -26,7 +26,16 @@ const doMagic = () => {
|
||||
});
|
||||
|
||||
// Remove irritating elements
|
||||
removable.forEach(element => !!element && element.remove());
|
||||
removable.forEach(element => {
|
||||
if (!!element) {
|
||||
const exists =
|
||||
document.getElementById(element.id)
|
||||
|| document.getElementsByName(element.name).length > 0
|
||||
|| document.getElementsByClassName(element.className).length > 0;
|
||||
|
||||
if (exists) element.remove();
|
||||
};
|
||||
});
|
||||
|
||||
// Fix stucked pages
|
||||
if (document.body.style) {
|
||||
|
Loading…
Reference in New Issue
Block a user