Add theathletic.com/co.uk

This commit is contained in:
Adam 2022-04-11 21:03:06 -07:00
parent dc2da541ad
commit 3a837ab312
4 changed files with 36 additions and 2 deletions

View File

@ -143,6 +143,8 @@
[The Advocate](https://www.theadvocate.com.au)\
[The Age](https://www.theage.com.au)\
[The American Interest](https://www.the-american-interest.com)\
[The Athletic](https://www.theathletic.com)\
[The Athletic (UK)](https://www.theathletic.co.uk)\
[The Atlantic](https://www.theatlantic.com)\
[The Australian Financial Review](https://www.afr.com)\
[The Australian](https://www.theaustralian.com.au)\

View File

@ -73,7 +73,9 @@
"*://*.time.com/*",
"*://*.expansion.com/*",
"*://*.foreignpolicy.com/*",
"*://*.bostonglobe.com/*"
"*://*.bostonglobe.com/*",
"*://*.theathletic.com/*",
"*://*.theathletic.co.uk/*"
],
"js": ["src/js/contentScript.js"]
}
@ -276,7 +278,9 @@
"*://*.zeit.de/*",
"*://*.ampproject.org/*",
"*://*.reuters.com/*",
"*://*.expansion.com/*"
"*://*.expansion.com/*",
"*://*.theathletic.com/*",
"*://*.theathletic.co.uk/*"
],
"version": "1.7.9"
}

View File

@ -476,6 +476,21 @@ 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 {
ampUnhideSubscriptionsSection();
const subscriptionsActions = document.querySelectorAll('[subscriptions-actions]');
removeDOMElement(...subscriptionsActions);
}
} else if (matchDomain('newyorker.com')) {
blockElement('.paywall-bar', true);
blockElement('.paywall-modal');
@ -743,3 +758,14 @@ function blockElement (selector, blockAlways = false) {
}
}).observe(document, { subtree: true, childList: true });
}
function ampUnhideSubscriptionsSection (ampAdsSel = 'amp-ad, .ad') {
const preview = document.querySelector('[subscriptions-section="content-not-granted"]');
removeDOMElement(preview);
const subscriptionsSection = document.querySelectorAll('[subscriptions-section="content"]');
for (const elem of subscriptionsSection) {
elem.removeAttribute('subscriptions-section');
}
const ampAds = document.querySelectorAll(ampAdsSel);
removeDOMElement(...ampAds);
}

View File

@ -122,6 +122,8 @@ const defaultSites = {
'The Advocate': 'theadvocate.com.au',
'The Age': 'theage.com.au',
'The American Interest': 'the-american-interest.com',
'The Athletic': 'theathletic.com',
'The Athletic (UK)': 'theathletic.co.uk',
'The Atlantic': 'theatlantic.com',
'The Australian Financial Review': 'afr.com',
'The Australian': 'theaustralian.com.au',