Hi tested this one and it doesn't seem to work (anymore?) in Firefox while being activated. The event listener is triggered too early.
In the past I made myself a script for the same purpose, less efficient in programming, but certainly does the job. The current ad layers are a bit adamant and resurrect one time, therefore an interval timer.
let htmlElement = document.body.parentElement;
function removeAdConsentLayer() {
let adConsentLayer = document.body.querySelector(`[id*=sp_message_container]`);
if (adConsentLayer?.style?.display === "none") return true;
console.debug(`remove Ad Consent Layer`);
if (adConsentLayer) adConsentLayer.style.display = "none";
}
function removeAntiAdBlockLayer() {
let antiAdBlockLayer = document.body.querySelector(`#aab-overlay`)?.parentElement;
if (antiAdBlockLayer?.style?.display === "none") return true;
console.debug(`remove Anti Ad Block Layer`);
if (antiAdBlockLayer) antiAdBlockLayer.style.display = "none";
}
function closeSpMessage() {
if (!htmlElement.classList.contains('sp-message-open')) return true;
console.debug(`close SP Message`);
document.body.setAttribute('style', 'overflow: scroll !important; position: static !important');
document.body.parentElement.classList.remove('sp-message-open'); // sufficient to recover the scroll bar in Firefox
}
let repeatedAction = setInterval(() => {
if ( removeAdConsentLayer() & removeAntiAdBlockLayer() & closeSpMessage() )
clearTimeout(repeatedAction);
}, 1000);
Hi tested this one and it doesn't seem to work (anymore?) in Firefox while being activated. The event listener is triggered too early.
In the past I made myself a script for the same purpose, less efficient in programming, but certainly does the job. The current ad layers are a bit adamant and resurrect one time, therefore an interval timer.