From 4974f8dfea1a905d141b40a80eed5af982c550f8 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Sat, 27 Jun 2020 11:18:01 +0200 Subject: [PATCH] Fix-update WSJ (snippet) --- contentScript.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/contentScript.js b/contentScript.js index 0eb2f0e..891698f 100644 --- a/contentScript.js +++ b/contentScript.js @@ -121,9 +121,16 @@ else if (matchDomain("wsj.com")) { close_button.click(); } document.addEventListener('DOMContentLoaded', () => { - 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'); + let url = window.location.href; + let snippet = document.querySelector('.snippet-promotion'); + if (snippet) { + if (!window.location.hash) { + if (url.includes('?')) { + window.location.href = url.replace('?', '#refreshed?'); + } else + window.location.href = url + '#refreshed'; + } else + window.location.href = window.location.href.replace('wsj.com', 'wsj.com/amp').replace('#refreshed', ''); } }); }