Fix theathletic.com

This commit is contained in:
Adam 2022-09-08 22:29:32 -07:00
parent 17ef75f259
commit 02063e0032
2 changed files with 24 additions and 12 deletions

View File

@ -244,7 +244,8 @@ const blockedRegexes = {
'dailytelegraph.com.au': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
'theglobeandmail.com': /(\.theglobeandmail\.com\/pf\/dist\/engine\/react\.js|smartwall\.theglobeandmail\.com\/)/,
'nytimes.com': /(meter-svc\.nytimes\.com\/meter\.js|mwcm\.nyt\.com\/.+\.js|cooking\.nytimes\.com\/api\/.+\/access)/,
'latimes.com': /(metering\.platform\.latimes\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js)/
'latimes.com': /(metering\.platform\.latimes\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js)/,
'theathletic.com': /cdn\.ampproject\.org\/v\d\/amp-(access|subscriptions)-.+\.js/
};
const userAgentDesktop = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';

View File

@ -461,21 +461,32 @@ if (matchDomain('elmercurio.com')) {
document.querySelectorAll('div[class*="fancybox"]').forEach(function (el) {
removeDOMElement(el);
});
} else if (matchDomain(['theathletic.com', 'theathletic.co.uk'])) {
if (!window.location.href.includes('?amp')) {
const paywall = document.querySelectorAll('div#paywall-container, div[subscriptions-action="subscribe"], a.headline-paywall');
const amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall.length && amphtml) {
removeDOMElement(...paywall);
window.setTimeout(function () {
window.location.href = amphtml.href;
}, 500);
} else if (matchDomain('theathletic.com')) {
if (!window.location.search.match(/(\?|&)amp/)) {
const paywall = document.querySelector('div#slideup-paywall');
if (paywall) {
const overlays = document.querySelectorAll('div[id*="overlay"], div:empty:not([data-rjs])');
removeDOMElement(paywall, ...overlays);
const body = document.querySelector('body');
if (body) {
body.style.overflow = 'visible';
body.style.position = 'relative';
}
} else {
const headlinePaywall = document.querySelectorAll('a.headline-paywall');
const amphtml = document.querySelector('link[rel="amphtml"]');
if (headlinePaywall.length && amphtml) {
removeDOMElement(...headlinePaywall);
window.setTimeout(function () {
window.location.href = amphtml.href;
}, 1000);
}
}
} else {
ampUnhideSubscriptionsSection();
const subscriptionsActions = document.querySelectorAll('[subscriptions-actions]');
removeDOMElement(...subscriptionsActions);
}
const apron = document.querySelector('div#free-apron-cta, div.slideup-free-apron-container');
removeDOMElement(apron);
} else if (matchDomain('newyorker.com')) {
blockElement('.paywall-bar', true);
blockElement('.paywall-modal');