fix: call AllowAll directly instead of clicking UI elements

This commit is contained in:
Eddy de Vink 2026-05-20 04:39:00 +02:00
commit c31fb3d617

View file

@ -2,26 +2,26 @@ console.log('[Buienradar Clicker] Content script loaded');
let handled = false; let handled = false;
function handleOverlay() { function dismissPaywall() {
if (handled) return; if (handled) return;
const overlay = document.querySelector('.payok__wrap'); const overlay = document.querySelector('.payok__wrap');
if (!overlay) return; if (!overlay) return;
const freeRadio = overlay.querySelector('input[name="pay-ok"][value="ok"]'); if (typeof window.Optanon?.AllowAll !== 'function') return;
const submitBtn = overlay.querySelector('button.payok__submit');
if (!freeRadio || !submitBtn) return;
console.log('[Buienradar Clicker] Overlay found, clicking free option'); console.log('[Buienradar Clicker] Dismissing paywall');
handled = true; handled = true;
clearInterval(pollInterval); clearInterval(pollInterval);
observer.disconnect(); observer.disconnect();
freeRadio.click();
setTimeout(() => submitBtn.click(), 100); window.Optanon.AllowAll();
document.body.style.overflow = '';
overlay.remove();
} }
const observer = new MutationObserver(handleOverlay); const observer = new MutationObserver(dismissPaywall);
observer.observe(document.body, { childList: true, subtree: true }); observer.observe(document.body, { childList: true, subtree: true });
const pollInterval = setInterval(handleOverlay, 500); const pollInterval = setInterval(dismissPaywall, 500);
handleOverlay(); dismissPaywall();