WaPo gdpr timing fix + Bloomberg bot-alert fix

Washington Post gdpr timing fix from Firefox extension.
Also uBlock Origin filter slows down loading of page (trying to load for 100+ times) 
@@||cdn-api.arcpublishing.com/v1.0/loxodo/datapoint/save$xmlhttprequest,domain=www.washingtonpost.com

2nd a Bloomberg fix for bot-alert (captcha pops up).
master
magnolia1234 2019-10-19 18:39:16 +02:00 committed by GitHub
parent 84b38167de
commit 314da393e8
1 changed files with 49 additions and 33 deletions

View File

@ -21,7 +21,7 @@ if (window.location.href.indexOf("americanbanker.com") !== -1) {
const paywall = document.getElementsByClassName(
"embargo-content"
);
if (paywall && paywall.length>0 ) {
if (paywall && paywall.length > 0) {
paywall[0].className = "";
}
}
@ -34,7 +34,7 @@ if (window.location.href.indexOf('telegraaf.nl') !== -1) {
}
if (window.location.href.indexOf('ed.nl') !== -1) {
const paywall = document.querySelector('.article__component.article__component--paywall-module-notification');
let paywall = document.querySelector('.article__component.article__component--paywall-module-notification');
if (paywall) {
paywall.remove();
paywall = null;
@ -43,15 +43,19 @@ if (window.location.href.indexOf('ed.nl') !== -1) {
if (window.location.href.indexOf("washingtonpost.com") !== -1) {
if (location.href.includes('/gdpr-consent/')) {
document.querySelector('.gdpr-consent-container .continue-btn.button.free').click();
const free_button = document.querySelector('.gdpr-consent-container .continue-btn.button.free');
if (free_button)
free_button.click();
const gdprcheckbox = document.querySelector('.gdpr-consent-container .consent-page:not(.hide) #agree');
if (gdprcheckbox) {
gdprcheckbox.checked = true;
gdprcheckbox.dispatchEvent(new Event('change'));
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();
}
document.querySelector('.gdpr-consent-container .consent-page:not(.hide) .continue-btn.button.accept-consent').click();
}
}, 300); // Delay (in milliseconds)
}
}
@ -77,45 +81,57 @@ if (window.location.href.indexOf("mexiconewsdaily.com") !== -1) {
}
if (window.location.href.indexOf("the-american-interest.com") !== -1) {
const counter = document.getElementById('article-counter') || false;
if (counter) {
counter.remove();
counter = false;
}
let counter = document.getElementById('article-counter') || false;
if (counter) {
counter.remove();
counter = false;
}
}
if (window.location.href.indexOf("nzherald.co.nz") !== -1) {
const paywall = document.getElementById(
"article-content"
);
if (paywall) {
paywall.classList.remove('premium-content');
paywall.classList.add('full-content');
var paras = paywall.querySelectorAll("p, span, h2, div");
var delClass = "";
for (var i = paras.length; i--;) {
if (delClass == "") {
delClass = paras[i].className;
const paywall = document.getElementById(
"article-content"
);
if (paywall) {
paywall.classList.remove('premium-content');
paywall.classList.add('full-content');
var paras = paywall.querySelectorAll("p, span, h2, div");
var delClass = "";
for (var i = paras.length; i--;) {
if (delClass == "") {
delClass = paras[i].className;
}
paras[i].classList.remove(delClass);
paras[i].removeAttribute('style');
}
paras[i].classList.remove(delClass);
paras[i].removeAttribute('style');
}
}
}
}
if (window.location.href.indexOf("parool.nl") !== -1 ||
window.location.href.indexOf("trouw.nl") !== -1 ||
window.location.href.indexOf("volkskrant.nl") !== -1) {
if (window.location.href.indexOf("parool.nl") !== -1 || window.location.href.indexOf("trouw.nl") !== -1 || window.location.href.indexOf("volkskrant.nl") !== -1) {
document.addEventListener('DOMContentLoaded', () => {
const paywall = document.querySelector('div[data-temptation-position="ARTICLE_BOTTOM"]');
const hidden_section = document.querySelector('div[data-temptation-position="ARTICLE_INLINE"]');
removeDOMElement(paywall, hidden_section);
});
}
if (window.location.href.indexOf("firstthings.com") !== -1) {
const paywall = document.getElementsByClassName('paywall')[0];
if(paywall) removeDOMElement(paywall);
if (paywall) removeDOMElement(paywall);
}
if (window.location.href.indexOf("bloomberg.com") !== -1) {
document.addEventListener('DOMContentLoaded', () => {
const paywall = document.getElementById('paywall-banner');
removeDOMElement(paywall);
});
}
if (window.location.href.indexOf("bloombergquint.com") !== -1) {
const articlesLeftModal = document.getElementsByClassName('paywall-meter-module__story-paywall-container__1UgCE')[0];
const paywall = document.getElementById('paywallDmp');
removeDOMElement(articlesLeftModal, paywall);
}
function removeDOMElement(...elements) {