feat(content): code improvements

This commit is contained in:
wanhose 2020-04-25 13:18:00 +02:00 committed by wanhose
parent ffdb020708
commit 93284105a5

View File

@ -18,8 +18,12 @@ if (typeof chrome.app.isInstalled !== 'undefined') {
]); ]);
const removableElements = Array.from([ const removableElements = Array.from([
// ENS
document.getElementById("ensNotifyBanner"),
// Quantcast // Quantcast
...document.getElementsByClassName("qc-cmp-ui-container"), ...document.getElementsByClassName("qc-cmp-ui-container"),
// OneTrust
document.getElementById("onetrust-consent-sdk"),
// Optanon // Optanon
...document.getElementsByClassName("optanon-alert-box-wrapper"), ...document.getElementsByClassName("optanon-alert-box-wrapper"),
]); ]);
@ -29,19 +33,7 @@ if (typeof chrome.app.isInstalled !== 'undefined') {
element.classList.remove("qc-cmp-ui-showing"); element.classList.remove("qc-cmp-ui-showing");
}); });
removableElements.forEach(element => { removableElements.forEach(element => !!element && element.remove());
element.remove();
});
let removableElement = null;
// ENS
removableElement = document.getElementById("ensNotifyBanner");
if (!!removableElement) removableElement.remove();
// OneTrust
removableElement = document.getElementById("onetrust-consent-sdk");
if (!!removableElement) removableElement.remove();
}; };
// Observer starts observe when call this function // Observer starts observe when call this function