From 710ac1645315e729306fccfc8ec67248952f8c32 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 15 Jun 2020 11:59:34 +0200 Subject: [PATCH] Fix-update WSJ (amp for pro/login) --- background.js | 3 ++- contentScript.js | 15 +++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/background.js b/background.js index 919c812..0b4bddf 100644 --- a/background.js +++ b/background.js @@ -197,7 +197,8 @@ var blockedRegexes = { 'thecourier.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/, 'thedailybeast.com': /.+\.tinypass\.com\/.+/, 'thenation.com': /.+\.tinypass\.com\/.+/, -'valeursactuelles.com': /.+\.poool\.fr\/.+/ +'valeursactuelles.com': /.+\.poool\.fr\/.+/, +'wsj.com': /cdn\.ampproject\.org\/v\d\/amp-access-.+\.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 747945f..a67e02e 100644 --- a/contentScript.js +++ b/contentScript.js @@ -121,22 +121,17 @@ else if (matchDomain("wsj.com")) { close_button.click(); } document.addEventListener('DOMContentLoaded', () => { - let wsj_login = document.querySelector('.wsj-snippet-login'); - if (wsj_login && !window.location.hash) { - let url = window.location.href; - if (url.includes('?')) { - window.location.href = url.replace('?', '#refreshed?'); - } else { - window.location.href = url + '#refreshed'; - } + let wsj_login = document.querySelector('.wsj-snippet-login, .wsjpro-label'); + if (wsj_login) { + window.location.href = window.location.href.replace('wsj.com', 'wsj.com/amp'); } }); } else if (matchDomain("sloanreview.mit.edu")) { const read_more = document.querySelector('.btn-read-more'); - if(read_more) - read_more.click(); + if (read_more) + read_more.click(); } else if (matchDomain("mexiconewsdaily.com")) {