From d54f7aa6d12eda35bd3a3315c433ce97652ed5e1 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Tue, 22 Sep 2020 21:06:28 +0200 Subject: [PATCH] Fix-update National Review (amp for plus) Plus minor update opt-in UI --- background.js | 2 +- contentScript.js | 15 +++++++++++++++ lp/manifest.json | 2 +- manifest.json | 2 +- optin/opt-in.html | 2 +- optin/opt-in.js | 23 ++++++++++------------- 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/background.js b/background.js index 4890ef3..f61b214 100644 --- a/background.js +++ b/background.js @@ -197,7 +197,7 @@ var blockedRegexes = { 'mercuriovalpo.cl': /(.+\.mercuriovalpo\.cl\/impresa\/wp-content\/themes\/papel-digital-2019-desktop\/assets\/(vendor|\d)\.js|pram\.pasedigital\.cl\/API\/User\/Status\?)/, 'modernhealthcare.com': /.+\.tinypass\.com\/.+/, 'nationalgeographic.com': /.+\.blueconic\.net\/.+/, -'nationalreview.com': /.+\.blueconic\.net\/.+/, +'nationalreview.com': /(.+\.blueconic\.net\/.+|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/, 'newrepublic.com': /.+\.onecount\.net\/js\/.+/, 'newsweek.com': /.+\.googletagmanager\.com\/gtm\.js/, 'newyorker.com': /.+\.newyorker\.com\/verso\/static\/presenter-articles.+\.js/, diff --git a/contentScript.js b/contentScript.js index 490fea8..59de822 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1087,6 +1087,21 @@ else if (domain = matchDomain("businesstimes.com.sg")) { cx_custom.setAttribute('style', 'display:none'); } +else if (matchDomain("nationalreview.com")) { + document.addEventListener('DOMContentLoaded', () => { + let url = window.location.href; + let article_truncated = document.querySelector('div#article-content-truncate-wrap'); + window.setTimeout(function () { + if (article_truncated && !url.includes('/amp/')) { + if (url.includes('?')) + window.location.href = url.replace('?', 'amp/?') + else + window.location.href = url + 'amp'; + } + }, 500); // Delay (in milliseconds) + }); +} + // General Functions function removeDOMElement(...elements) { for (let element of elements) { diff --git a/lp/manifest.json b/lp/manifest.json index 83fb5bf..03e5ff6 100644 --- a/lp/manifest.json +++ b/lp/manifest.json @@ -309,5 +309,5 @@ "webRequest", "webRequestBlocking" ], - "version": "1.8.7.0" + "version": "1.8.7.1" } \ No newline at end of file diff --git a/manifest.json b/manifest.json index 4acd1e7..1faeccf 100644 --- a/manifest.json +++ b/manifest.json @@ -40,5 +40,5 @@ "webRequest", "webRequestBlocking" ], - "version": "1.8.7.0" + "version": "1.8.7.1" } \ No newline at end of file diff --git a/optin/opt-in.html b/optin/opt-in.html index 3aee92d..4035217 100644 --- a/optin/opt-in.html +++ b/optin/opt-in.html @@ -16,7 +16,7 @@ Boston Globe Irish Independent The Belfast Telegraph
-+
SetCookie opt-in enabled: