Fix The Athletic (single domain)

This commit is contained in:
magnolia1234 2022-06-30 20:26:07 +02:00
parent 0eacc5bfaa
commit 3fbbef936e
6 changed files with 35 additions and 38 deletions

View file

@ -355,7 +355,6 @@ Grouped in options:\
[London Review of Books](https://www.lrb.co.uk) -
[New Left Review](https://newleftreview.org) -
[Prospect Magazine](https://www.prospectmagazine.co.uk) -
[The Athletic UK](https://theathletic.co.uk) -
[The Economist](https://www.economist.com) -
[The Independent](https://www.independent.co.uk) -
[The Irish Times](https://www.irishtimes.com) -

View file

@ -6,7 +6,7 @@ var ext_name = manifestData.name;
var ext_version = manifestData.version;
const cs_limit_except = ['elespanol.com', 'faz.net', 'nation.africa', 'nationalgeographic.com', 'thetimes.co.uk'];
const dompurify_sites = ['asiatimes.com', 'bloomberg.com', 'cicero.de', 'economictimes.com', 'hs.fi', 'ilmanifesto.it', 'iltalehti.fi', 'ipolitics.ca', 'italiaoggi.it', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'stratfor.com', 'techinasia.com', 'timesofindia.com', 'vn.nl'].concat(be_mediahuis_domains, nl_mediahuis_region_domains, no_nhst_media_domains, usa_theathletic_domains);
const dompurify_sites = ['asiatimes.com', 'bloomberg.com', 'cicero.de', 'economictimes.com', 'hs.fi', 'ilmanifesto.it', 'iltalehti.fi', 'ipolitics.ca', 'italiaoggi.it', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'stratfor.com', 'techinasia.com', 'theathletic.com', 'timesofindia.com', 'vn.nl'].concat(be_mediahuis_domains, nl_mediahuis_region_domains, no_nhst_media_domains);
var currentTabUrl = '';
var csDone = false;
var optin_setcookie = false;

View file

@ -10,6 +10,7 @@ Fix Financial Times (cookie-banner)
Fix Groupe SudOuest.fr
Fix Iltalehti.fi (videos)
Fix Knack.be & LeVif.be
Fix The Athletic (single domain)
Fix Times of India (no amp)
Remove block general paywall script (GoogleTagManager)

View file

@ -2133,7 +2133,7 @@ else if (matchDomain('vn.nl')) {
else
csDone = true;
} else if (window.location.hostname.match(/\.(ie|uk)$/) || matchDomain(['theathletic.com'])) {//united kingdom/ireland
} else if (window.location.hostname.match(/\.(ie|uk)$/)) {//united kingdom/ireland
if (matchDomain('independent.co.uk')) {
let url = window.location.href;
@ -2205,37 +2205,6 @@ else if (matchDomain('the-tls.co.uk')) {
removeDOMElement(paywall);
}
else if (matchDomain(['theathletic.com', 'theathletic.co.uk'])) {
if (!window.location.search.match(/(\?|&)amp/)) {
let paywall = document.querySelectorAll('div#paywall-container, div[subscriptions-action="subscribe"], a.headline-paywall, div#slideup-paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall.length && amphtml) {
removeDOMElement(...paywall);
window.setTimeout(function () {
window.location.href = amphtml.href;
}, 500);
}
} else {
amp_unhide_subscr_section();
let subscr_actions = document.querySelectorAll('[subscriptions-actions]');
removeDOMElement(...subscr_actions);
let layout_fail = document.querySelectorAll('.col-sm-12');
for (let elem of layout_fail) {
elem.classList.remove('col-sm-12');
elem.style = 'padding: 0px 15px;';
}
let podcast = document.querySelector('div[id^="podcast-clip-"]');
if (podcast) {
let podcast_src = podcast.innerHTML.replace(/<amp-/g, '<').replace(/<\/amp-/g, '</');
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(podcast_src, {ADD_TAGS: ['iframe'], ADD_ATTR: ['layout', 'sandbox']}) + '</div>', 'text/html');
let podcast_new = doc.querySelector('div');
if (podcast_new)
podcast.parentNode.replaceChild(podcast_new, podcast);
}
}
}
else if (matchDomain('thetimes.co.uk')) {
let url = window.location.href;
if (window.location.hostname !== 'epaper.thetimes.co.uk') {
@ -3552,6 +3521,37 @@ else if (matchDomain('the-american-interest.com')) {
removeDOMElement(counter);
}
else if (matchDomain('theathletic.com')) {
if (!window.location.search.match(/(\?|&)amp/)) {
let paywall = document.querySelectorAll('div#paywall-container, div[subscriptions-action="subscribe"], a.headline-paywall, div#slideup-paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall.length && amphtml) {
removeDOMElement(...paywall);
window.setTimeout(function () {
window.location.href = amphtml.href;
}, 500);
}
} else {
amp_unhide_subscr_section();
let subscr_actions = document.querySelectorAll('[subscriptions-actions]');
removeDOMElement(...subscr_actions);
let layout_fail = document.querySelectorAll('.col-sm-12');
for (let elem of layout_fail) {
elem.classList.remove('col-sm-12');
elem.style = 'padding: 0px 15px;';
}
let podcast = document.querySelector('div[id^="podcast-clip-"]');
if (podcast) {
let podcast_src = podcast.innerHTML.replace(/<amp-/g, '<').replace(/<\/amp-/g, '</');
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(podcast_src, {ADD_TAGS: ['iframe'], ADD_ATTR: ['layout', 'sandbox']}) + '</div>', 'text/html');
let podcast_new = doc.querySelector('div');
if (podcast_new)
podcast.parentNode.replaceChild(podcast_new, podcast);
}
}
}
else if (matchDomain('theatlantic.com')) {
let banner = document.querySelector('.c-nudge__container,.c-non-metered-nudge');
removeDOMElement(banner);

View file

@ -546,7 +546,6 @@
"*://*.theadvocate.com/*",
"*://*.theage.com.au/*",
"*://*.theartnewspaper.com/*",
"*://*.theathletic.co.uk/*",
"*://*.theathletic.com/*",
"*://*.theatlantic.com/*",
"*://*.theaustralian.com.au/*",

View file

@ -1595,8 +1595,7 @@ var defaultSites = {
"The Athletic": {
domain: "###_usa_theathletic",
group: [
"theathletic.com",
"theathletic.co.uk"
"theathletic.com"
],
allow_cookies: 1,
block_regex: /cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js/
@ -2151,7 +2150,6 @@ var it_repubblica_domains = defaultSites['###_gr_it_repubblica_domains']['group_
var medium_custom_domains = grouped_sites['###_medium_custom'];
var nl_mediahuis_region_domains = grouped_sites['###_nl_mediahuis_region'];
var no_nhst_media_domains = grouped_sites['###_no_nhst_media'];
var usa_theathletic_domains = grouped_sites['###_usa_theathletic'];
// sites with no fix (background)
var nl_ad_region_domains = ['ad.nl', 'bd.nl', 'ed.nl', 'tubantia.nl', 'bndestem.nl', 'pzc.nl', 'destentor.nl', 'gelderlander.nl'];