From 23bf64ce61b5a15523caa69ee4d6ba0eafc6c2ce Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 30 Mar 2020 20:50:55 +0200 Subject: [PATCH] Fix Barron's links to sign in/read more articles Bottom (recommendation) article-link stays unaltered (probably timing issue). Sometimes article holds on to multiple recommendations layout (only intros). --- contentScript.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/contentScript.js b/contentScript.js index 8f3e7c6..4cba7b8 100644 --- a/contentScript.js +++ b/contentScript.js @@ -489,6 +489,21 @@ else if (matchDomain('challenges.fr')) { }); } +else if (window.location.href.indexOf("barrons.com") !== -1) { + var href = ''; + const signin_links = document.querySelectorAll('a.primary-button--link'); + for (let i = 0; i < signin_links.length; i++) { + href = signin_links[i].href; + if (href.includes('target=')) { + href = href.split('target')[1].split('%3F')[0]; + href = href.replace('=', '').replace('%3A', ':'); + href = href.replace('%2F', '/').replace('%2F', '/').replace('%2F', '/').replace('%2F', '/'); + signin_links[i].href = href; + signin_links[i].text = 'Click'; + } + } +} + // General Functions function removeDOMElement(...elements) { for (let element of elements) {