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) => {
|
||||
@ -13,27 +13,36 @@ const observer = new MutationObserver((mutations, observer) => {
|
||||
|
||||
// Remover
|
||||
const doMagic = () => {
|
||||
// Remove irritating styles
|
||||
notRemovable.forEach(element => {
|
||||
// PLO
|
||||
element.classList.remove("plu-no-scroll");
|
||||
// Quantcast
|
||||
element.classList.remove("qc-cmp-ui-showing");
|
||||
// Miscellaneous
|
||||
element.classList.remove("_2LLC6zrbk-vsnF0seit6vi");
|
||||
element.classList.remove("gdpr");
|
||||
element.classList.remove("noScroll");
|
||||
});
|
||||
// Remove irritating styles
|
||||
notRemovable.forEach(element => {
|
||||
// PLO
|
||||
element.classList.remove("plu-no-scroll");
|
||||
// Quantcast
|
||||
element.classList.remove("qc-cmp-ui-showing");
|
||||
// Miscellaneous
|
||||
element.classList.remove("_2LLC6zrbk-vsnF0seit6vi");
|
||||
element.classList.remove("gdpr");
|
||||
element.classList.remove("noScroll");
|
||||
});
|
||||
|
||||
// Remove irritating elements
|
||||
removable.forEach(element => !!element && element.remove());
|
||||
// Remove irritating elements
|
||||
removable.forEach(element => {
|
||||
if (!!element) {
|
||||
const exists =
|
||||
document.getElementById(element.id)
|
||||
|| document.getElementsByName(element.name).length > 0
|
||||
|| document.getElementsByClassName(element.className).length > 0;
|
||||
|
||||
// Fix stucked pages
|
||||
if (document.body.style) {
|
||||
document.body.style.removeProperty("overflow");
|
||||
document.body.style.removeProperty("overflowX");
|
||||
document.body.style.removeProperty("overflowY");
|
||||
};
|
||||
if (exists) element.remove();
|
||||
};
|
||||
});
|
||||
|
||||
// Fix stucked pages
|
||||
if (document.body.style) {
|
||||
document.body.style.removeProperty("overflow");
|
||||
document.body.style.removeProperty("overflowX");
|
||||
document.body.style.removeProperty("overflowY");
|
||||
};
|
||||
};
|
||||
|
||||
// Observer starts observe when call this function
|
||||
|
Loading…
Reference in New Issue
Block a user