2020-04-19 13:02:48 +00:00
|
|
|
if (typeof chrome.app.isInstalled !== 'undefined') {
|
2020-04-24 17:42:06 +00:00
|
|
|
// Observer
|
|
|
|
const observer = new MutationObserver((mutations, observer) => {
|
2020-04-24 18:29:38 +00:00
|
|
|
mutations.forEach(mutation => {
|
2020-04-24 17:42:06 +00:00
|
|
|
if (mutation.type === 'childList') {
|
|
|
|
observer.disconnect();
|
|
|
|
doMagic();
|
|
|
|
observe();
|
2020-04-19 13:02:48 +00:00
|
|
|
}
|
2020-04-24 18:29:38 +00:00
|
|
|
});
|
2020-04-24 17:42:06 +00:00
|
|
|
});
|
|
|
|
|
2020-04-24 18:29:38 +00:00
|
|
|
// Remover
|
2020-04-24 17:42:06 +00:00
|
|
|
const doMagic = () => {
|
2020-04-24 18:44:40 +00:00
|
|
|
const notRemovableElements = Array.from([
|
|
|
|
// Quantcast
|
|
|
|
...document.getElementsByClassName("qc-cmp-ui-showing"),
|
|
|
|
]);
|
|
|
|
|
|
|
|
const removableElements = Array.from([
|
2020-04-25 11:18:00 +00:00
|
|
|
// ENS
|
|
|
|
document.getElementById("ensNotifyBanner"),
|
2020-04-24 18:44:40 +00:00
|
|
|
// Quantcast
|
|
|
|
...document.getElementsByClassName("qc-cmp-ui-container"),
|
2020-04-25 11:18:00 +00:00
|
|
|
// OneTrust
|
|
|
|
document.getElementById("onetrust-consent-sdk"),
|
2020-04-24 18:44:40 +00:00
|
|
|
// Optanon
|
|
|
|
...document.getElementsByClassName("optanon-alert-box-wrapper"),
|
|
|
|
]);
|
|
|
|
|
2020-04-24 17:42:06 +00:00
|
|
|
notRemovableElements.forEach(element => {
|
2020-04-24 18:44:40 +00:00
|
|
|
// Quantcast
|
2020-04-24 17:42:06 +00:00
|
|
|
element.classList.remove("qc-cmp-ui-showing");
|
2020-04-19 13:02:48 +00:00
|
|
|
});
|
2020-04-24 17:42:06 +00:00
|
|
|
|
2020-04-25 11:18:00 +00:00
|
|
|
removableElements.forEach(element => !!element && element.remove());
|
2020-04-24 17:42:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Observer starts observe when call this function
|
|
|
|
const observe = () => {
|
|
|
|
observer.observe(document.body, {
|
|
|
|
childList: true,
|
|
|
|
subtree: true,
|
|
|
|
//...
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
// Then...
|
|
|
|
doMagic();
|
|
|
|
observe();
|
|
|
|
}
|