From 703d24a22ddc50b92873084b8d8c861a18249e97 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Sun, 5 Jan 2020 16:48:54 +0100 Subject: [PATCH] Fix Newcastle Herald (+ new domain) --- README.md | 2 +- background.js | 6 +++++- contentScript.js | 10 ++++++++++ manifest.json | 6 +++--- options.js | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index afab1ea..61db3e7 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ [New Statesman](https://www.newstatesman.com)\ [New York Magazine](https://www.nymag.com)\ [New Zealand Herald](https://www.nzherald.co.nz)\ +[Newcastle Herald](https://www.newcastleherald.com.au)\ [Nikkei Asian Review](https://asia.nikkei.com)\ [NK News](https://www.nknews.org)\ [NRC](https://www.nrc.nl)\ @@ -76,7 +77,6 @@ [The Business Journals](https://www.bizjournals.com)\ [The Diplomat](https://www.thediplomat.com)\ [The Globe and Mail](https://www.theglobeandmail.com)\ -[The Herald](https://www.theherald.com.au)\ [The Hindu](https://www.thehindu.com)\ [The Japan Times](https://www.japantimes.co.jp)\ [TheMarker](https://www.themarker.com)\ diff --git a/background.js b/background.js index bd0cf6e..92a1ab9 100644 --- a/background.js +++ b/background.js @@ -48,10 +48,13 @@ var defaultSites = { 'National Post': 'nationalpost.com', 'New Statesman': 'newstatesman.com', 'New York Magazine': 'nymag.com', + 'New Zealand Herald': 'nzherald.co.nz', + 'Newscastle Herald': 'newcastleherald.com.au', 'Nikkei Asian Review': 'asia.nikkei.com', 'NK News': 'nknews.org', 'NRC': 'nrc.nl', 'New Zealand Herald': 'nzherald.co.nz', + 'Newcastle Herald': 'newcastleherald.com.au', 'Orange County Register': 'ocregister.com', 'Orlando Sentinel': 'orlandosentinel.com', 'Palo Alto Online': 'paloaltoonline.com', @@ -256,7 +259,8 @@ const blockedRegexes = { 'bostonglobe.com': /meter\.bostonglobe\.com\/js\/.+/, 'foreignpolicy.com': /.+\.tinypass\.com\/.+/, 'inquirer.com': /.+\.tinypass\.com\/.+/, -'spectator.co.uk': /.+\.tinypass\.com\/.+/ +'spectator.co.uk': /.+\.tinypass\.com\/.+/, +'newcastleherald.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/ }; const userAgentDesktop = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" diff --git a/contentScript.js b/contentScript.js index 2a7c7fd..b4ad9ae 100644 --- a/contentScript.js +++ b/contentScript.js @@ -238,6 +238,16 @@ if (window.location.href.indexOf("techinasia.com") !== -1) { removeDOMElement(splash_subscribe, paywall_hard); } +if (window.location.href.indexOf("newcastleherald.com.au") !== -1) { + const subscribe_truncate = document.querySelector('.subscribe-truncate'); + if (subscribe_truncate) + subscribe_truncate.classList.remove('subscribe-truncate'); + const subscriber_hider = document.querySelectorAll('.subscriber-hider'); + for (let i = 0; i < subscriber_hider.length; i++) { + subscriber_hider[i].classList.remove('subscriber-hider'); + } +} + function removeDOMElement(...elements) { for (let element of elements) { if (element) element.remove(); diff --git a/manifest.json b/manifest.json index 1e020e3..95e7c47 100644 --- a/manifest.json +++ b/manifest.json @@ -26,7 +26,8 @@ "*://*.leparisien.fr/*", "*://*.nrc.nl/*", "*://*.theathletic.com/*", - "*://*.techinasia.com/*" + "*://*.techinasia.com/*", + "*://*.newcastleherald.com.au/*" ], "js": ["contentScript.js"] } @@ -117,7 +118,7 @@ "*://*.bostonglobe.com/*", "*://*.bizjournals.com/*", "*://*.theglobeandmail.com/*", - "*://*.theherald.com.au/*", + "*://*.newcastleherald.com.au/*", "*://*.japantimes.co.jp/*", "*://*.themarker.com/*", "*://*.mercurynews.com/*", @@ -166,4 +167,3 @@ ], "version": "1.6.3" } - diff --git a/options.js b/options.js index 9fa2040..32e61f3 100644 --- a/options.js +++ b/options.js @@ -47,6 +47,7 @@ var defaultSites = { 'New Statesman (javascript disabled)': 'newstatesman.com', 'New York Magazine': 'nymag.com', 'New Zealand Herald': 'nzherald.co.nz', + 'Newcastle Herald': 'newcastleherald.com.au', 'Nikkei Asian Review': 'asia.nikkei.com', 'NK News': 'nknews.org', 'NRC': 'nrc.nl', @@ -71,7 +72,6 @@ var defaultSites = { 'The Business Journals': 'bizjournals.com', 'The Diplomat': 'thediplomat.com', 'The Globe and Mail (javascript disabled)': 'theglobeandmail.com', - 'The Herald': 'theherald.com.au', 'The Hindu': 'thehindu.com', 'The Japan Times': 'japantimes.co.jp', 'TheMarker': 'themarker.com',