feat(content): add support for onetrust
This commit is contained in:
parent
f3cf94afa7
commit
74120d382a
@ -1,38 +1,43 @@
|
||||
if (typeof chrome.app.isInstalled !== 'undefined') {
|
||||
// Observer
|
||||
const observer = new MutationObserver((mutations, observer) => {
|
||||
for (let mutation of mutations) {
|
||||
if (mutation.type === 'childList') {
|
||||
observer.disconnect();
|
||||
doMagic();
|
||||
observe();
|
||||
}
|
||||
// Observer
|
||||
const observer = new MutationObserver((mutations, observer) => {
|
||||
for (let mutation of mutations) {
|
||||
if (mutation.type === 'childList') {
|
||||
observer.disconnect();
|
||||
doMagic();
|
||||
observe();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Inject buttons
|
||||
const doMagic = () => {
|
||||
// Quantcast
|
||||
const notRemovableElements = Array.from(document.getElementsByClassName("qc-cmp-ui-showing"));
|
||||
notRemovableElements.forEach(element => {
|
||||
element.classList.remove("qc-cmp-ui-showing");
|
||||
});
|
||||
|
||||
// Inject buttons
|
||||
const doMagic = () => {
|
||||
const notRemovableElements = Array.from(document.getElementsByClassName("qc-cmp-ui-showing"));
|
||||
notRemovableElements.forEach(element => {
|
||||
element.classList.remove("qc-cmp-ui-showing");
|
||||
});
|
||||
|
||||
const removableElements = Array.from(document.getElementsByClassName("qc-cmp-ui-container"));
|
||||
removableElements.forEach(element => {
|
||||
element.remove();
|
||||
});
|
||||
};
|
||||
|
||||
// Observer starts observe when call this function
|
||||
const observe = () => {
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
//...
|
||||
});
|
||||
};
|
||||
|
||||
// Then...
|
||||
doMagic();
|
||||
observe();
|
||||
}
|
||||
|
||||
const removableElements = Array.from(document.getElementsByClassName("qc-cmp-ui-container"));
|
||||
removableElements.forEach(element => {
|
||||
element.remove();
|
||||
});
|
||||
|
||||
// OneTrust
|
||||
const removableElement = document.getElementById("onetrust-consent-sdk");
|
||||
if (!!removableElement) removableElement.remove();
|
||||
};
|
||||
|
||||
// Observer starts observe when call this function
|
||||
const observe = () => {
|
||||
observer.observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
//...
|
||||
});
|
||||
};
|
||||
|
||||
// Then...
|
||||
doMagic();
|
||||
observe();
|
||||
}
|
Loading…
Reference in New Issue
Block a user