fix: call AllowAll directly instead of clicking UI elements
This commit is contained in:
parent
80bb473eb4
commit
c31fb3d617
1 changed files with 10 additions and 10 deletions
20
content.js
20
content.js
|
|
@ -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();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue