chrome-buienradar-clicker/content.js

35 lines
958 B
JavaScript

console.log('[Buienradar Clicker] Content script loaded');
let handled = false;
function dismissPaywall() {
if (handled) return;
const overlay = document.querySelector('.payok__wrap');
if (!overlay) return;
console.log('[Buienradar Clicker] Dismissing paywall');
handled = true;
clearInterval(pollInterval);
observer.disconnect();
const script = document.createElement('script');
script.textContent = `
(function() {
var w = document.querySelector('.payok__wrap');
if (w && window.Optanon && typeof window.Optanon.AllowAll === 'function') {
window.Optanon.AllowAll();
document.body.style.overflow = '';
w.remove();
}
})();
`;
document.body.appendChild(script);
script.remove();
}
const observer = new MutationObserver(dismissPaywall);
observer.observe(document.body, { childList: true, subtree: true });
const pollInterval = setInterval(dismissPaywall, 500);
dismissPaywall();