From af350e41a93f9fddc111dbf1b2fd03e9a59491d1 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Sat, 18 Jul 2020 08:42:02 +0200 Subject: [PATCH] Fix-update Irish Times (amp for premium) --- README.md | 2 +- background.js | 1 + contentScript.js | 9 +++++++++ sites.js | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37cc7e4..5c508cc 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ Install add-on by downloading xpi-file. [London Review of Books](https://www.lrb.co.uk) - [The Athletic UK](https://theathletic.com) - [The Economist](https://www.economist.com) - -[The Irish Times](https://www.irishtimes.com)* - +[The Irish Times](https://www.irishtimes.com) - [The New Statesman](https://www.newstatesman.com) - [The Spectator](https://www.spectator.co.uk) - [The Telegraph](https://www.telegraph.co.uk) - diff --git a/background.js b/background.js index cad0f71..7a1ded5 100644 --- a/background.js +++ b/background.js @@ -168,6 +168,7 @@ var blockedRegexes = { 'ilmessaggero.it': /(utils\.cedsdigital\.it\/js\/PaywallMeter\.js|static\.viralize\.tv\/viralize_player)/, 'independent.ie': /cdn\.flip-pay\.com\/clients\/inm\/flip-pay\.js/, 'inquirer.com': /.+\.tinypass\.com\/.+/, +'irishtimes.com': /cdn\.ampproject\.org\/v\d\/amp-access-.+\.js/, 'knack.be': /.+\.knack\.be\/js\/responsive\/rmgModal\.js/, 'ladepeche.fr': /.+\.poool\.fr\/.+/, 'lastampa.it': /.+\.repstatic\.it\/minify\/sites\/lastampa\/.+\/config\.cache\.php\?name=social_js/, diff --git a/contentScript.js b/contentScript.js index 88f55e2..21c2c62 100644 --- a/contentScript.js +++ b/contentScript.js @@ -854,6 +854,15 @@ else if (matchDomain("harpers.org")) { removeDOMElement(overlay); } +else if (matchDomain("irishtimes.com")) { + document.addEventListener('DOMContentLoaded', () => { + let stub_article_msg = document.querySelector('div.stub-article-msg'); + let url = window.location.href; + if (url.includes('mode=sample') || stub_article_msg) + window.location.href = new URL(url).pathname + '?mode=amp'; + }); +} + // General Functions function removeDOMElement(...elements) { for (let element of elements) { diff --git a/sites.js b/sites.js index a036971..a52ce38 100644 --- a/sites.js +++ b/sites.js @@ -148,7 +148,7 @@ var defaultSites = "The Economist": "economist.com", "The Globe and Mail": "theglobeandmail.com", "The Hindu": "thehindu.com", - "The Irish Times (free articles only)": "irishtimes.com", + "The Irish Times": "irishtimes.com", "The Japan Times": "japantimes.co.jp", "The Marker": "themarker.com", "The Mercury News": "mercurynews.com",