Fix technologyreview.com, wapo.com

This commit is contained in:
Adam 2020-10-25 09:40:21 -07:00
parent 044ed46fde
commit c0fc6a98cd
2 changed files with 16 additions and 17 deletions

View File

@ -204,7 +204,8 @@ const blockedRegexes = {
'latercera.com': /.+\.cxense\.com\/+/,
'lesechos.fr': /.+\.tinypass\.com\/.+/,
'washingtonpost.com': /.+\.washingtonpost\.com\/.+\/pwapi-proxy\.min\.js/,
'thehindu.com': /ajax\.cloudflare\.com\/cdn-cgi\/scripts\/.+\/cloudflare-static\/rocket-loader\.min\.js/
'thehindu.com': /ajax\.cloudflare\.com\/cdn-cgi\/scripts\/.+\/cloudflare-static\/rocket-loader\.min\.js/,
'technologyreview.com': /.+\.blueconic\.net\/.+/
};
const userAgentDesktop = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';

View File

@ -77,24 +77,17 @@ if (matchDomain('elmercurio.com')) {
const paywall = document.querySelector('.article__component.article__component--paywall-module-notification');
removeDOMElement(paywall);
} else if (matchDomain('washingtonpost.com')) {
// Remove all elements with the id contains 'paywall'
document.querySelectorAll('div[id^="paywall"]').forEach(function (el) {
removeDOMElement(el);
});
const html = document.querySelector('html');
html.removeAttribute('style');
const body = document.querySelector('body');
body.removeAttribute('style');
const leaderboard = document.querySelector('#leaderboard-wrapper');
const adverts = document.querySelectorAll('div[data-qa="article-body-ad"]');
removeDOMElement(leaderboard, ...adverts);
if (window.location.href.includes('/gdpr-consent/')) {
const freeButton = document.querySelector('.gdpr-consent-container .continue-btn.button.free');
if (freeButton) { freeButton.click(); }
setTimeout(function () {
window.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)
@ -300,11 +293,16 @@ if (matchDomain('elmercurio.com')) {
}
});
} else if (matchDomain('technologyreview.com')) {
// The class of banner is like 'overlayFooter__wrapper--3DhFn', which is hard to select exactly
const subscribeBanner = document.querySelector('[class*=overlayFooter__wrapper]');
removeDOMElement(subscribeBanner);
const body = document.querySelector('body');
removeClassesByPrefix(body, 'body__obscureContent');
window.setTimeout(function () {
const bodyObscured = document.querySelector('body[class*="body__obscureContent"]');
if (bodyObscured) { removeClassesByPrefix(bodyObscured, 'body__obscureContent'); }
const overlay = document.querySelector('div[class*="overlayFooter__wrapper"]');
if (overlay) { overlay.setAttribute('style', 'display:none'); }
const contentBodyHidden = document.querySelector('div[class*="contentBody__contentHidden"]');
if (contentBodyHidden) { removeClassesByPrefix(contentBodyHidden, 'contentBody__contentHidden'); }
const contentBodyOverlay = document.querySelector('div[class*="contentBody__overlay"]');
if (contentBodyOverlay) { contentBodyOverlay.removeAttribute('class'); }
}, 500);
} else if (matchDomain('leparisien.fr')) {
window.removeEventListener('scroll', this.scrollListener);
const paywall = document.querySelector('.relative.piano-paywall.below_nav.sticky');