fix: add polling fallback and debug logging

This commit is contained in:
Eddy de Vink 2026-05-20 04:31:49 +02:00
commit 006d6dcab8

View file

@ -1,6 +1,11 @@
if (!document.body) return; if (!document.body) return;
console.log('[Buienradar Clicker] Content script loaded');
let handled = false;
function handleOverlay() { function handleOverlay() {
if (handled) return;
const overlay = document.querySelector('.payok__wrap'); const overlay = document.querySelector('.payok__wrap');
if (!overlay) return; if (!overlay) return;
@ -8,6 +13,9 @@ function handleOverlay() {
const submitBtn = overlay.querySelector('button.payok__submit'); const submitBtn = overlay.querySelector('button.payok__submit');
if (!freeRadio || !submitBtn) return; if (!freeRadio || !submitBtn) return;
console.log('[Buienradar Clicker] Overlay found, clicking free option');
handled = true;
clearInterval(pollInterval);
observer.disconnect(); observer.disconnect();
freeRadio.click(); freeRadio.click();
setTimeout(() => submitBtn.click(), 100); setTimeout(() => submitBtn.click(), 100);
@ -15,4 +23,7 @@ function handleOverlay() {
const observer = new MutationObserver(handleOverlay); const observer = new MutationObserver(handleOverlay);
observer.observe(document.body, { childList: true, subtree: true }); observer.observe(document.body, { childList: true, subtree: true });
const pollInterval = setInterval(handleOverlay, 500);
handleOverlay(); handleOverlay();