From 163e95343912595db76c6334afb0826825979587 Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Wed, 26 Jun 2019 15:37:00 +0200 Subject: [PATCH] WashingtonPost.com GDPR bypass with timeout fix I've added a timeout to the GDPR bypass code, now it works properly in Firefox too. --- contentScript.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/contentScript.js b/contentScript.js index a8d81b2..469268b 100644 --- a/contentScript.js +++ b/contentScript.js @@ -50,4 +50,19 @@ if (window.location.href.indexOf("bizjournals.com") !== -1) { document.querySelector('.close-btn').click(); }, 2000); } -} \ No newline at end of file +} else if (window.location.href.indexOf("washingtonpost.com") !== -1) { + if (location.href.includes('/gdpr-consent/')) { + document.querySelector('.gdpr-consent-container .continue-btn.button.free').click(); + + setTimeout(function (){ + + const gdprcheckbox = document.querySelector('.gdpr-consent-container .consent-page:not(.hide) #agree'); + if (gdprcheckbox) { + gdprcheckbox.checked = true; + gdprcheckbox.dispatchEvent(new Event('change')); + + document.querySelector('.gdpr-consent-container .consent-page:not(.hide) .continue-btn.button.accept-consent').click(); + } + }, 300); // Delay (in milliseconds) + } +}