diff --git a/README.md b/README.md index d4e748d..f008f68 100644 --- a/README.md +++ b/README.md @@ -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) - diff --git a/background.js b/background.js index feb8041..6b5d5e7 100644 --- a/background.js +++ b/background.js @@ -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; diff --git a/changelog.txt b/changelog.txt index 7817b35..2c73a3a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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) diff --git a/contentScript.js b/contentScript.js index 63b532f..53437d4 100644 --- a/contentScript.js +++ b/contentScript.js @@ -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(/' + DOMPurify.sanitize(podcast_src, {ADD_TAGS: ['iframe'], ADD_ATTR: ['layout', 'sandbox']}) + '', '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(/' + DOMPurify.sanitize(podcast_src, {ADD_TAGS: ['iframe'], ADD_ATTR: ['layout', 'sandbox']}) + '', '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); diff --git a/manifest.json b/manifest.json index a337901..70632b2 100644 --- a/manifest.json +++ b/manifest.json @@ -546,7 +546,6 @@ "*://*.theadvocate.com/*", "*://*.theage.com.au/*", "*://*.theartnewspaper.com/*", - "*://*.theathletic.co.uk/*", "*://*.theathletic.com/*", "*://*.theatlantic.com/*", "*://*.theaustralian.com.au/*", diff --git a/sites.js b/sites.js index 89e3354..4e31e29 100644 --- a/sites.js +++ b/sites.js @@ -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'];