diff --git a/background.js b/background.js index f2198dc1..8da3383f 100644 --- a/background.js +++ b/background.js @@ -283,6 +283,7 @@ var blockedRegexes = { 'chronicle.com': /(\.blueconic\.net\/|\.chronicle\.com\/(common\/)?(che-auth0-user|script)\.js)/, 'clarin.com': /js\.matheranalytics\.com\//, 'cmjornal.pt': /cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad)-.+\.js/, + 'commentary.org': /\.commentary\.org\/.+\/js\/dg-locker-public\.js/, 'corriere.it': /(\.tinypass\.com\/|\.rcsobjects\.it\/rcs_(cpmt|tracking-service)\/|\.corriereobjects\.it\/.+\/js\/(_paywall\.sjs|tracking\/)|\.userzoom\.com\/files\/js\/)/, 'dallasnews.com': /(\.blueconic\.net\/|js\.matheranalytics\.com\/)/, 'digiday.com': /cdn.\.tinypass\.com\//, diff --git a/changelog.txt b/changelog.txt index 4fcc680c..1d428544 100644 --- a/changelog.txt +++ b/changelog.txt @@ -12,6 +12,7 @@ Fix Gestion & El Comercio (Peru) Fix Grupo Vocento (Spain) Fix Financial News (London) Fix The Athletic (podcast) +Fix WSJ (amp homepage link) Update remove cookies (faster) * v2.3.0.1 (2021-07-26) diff --git a/contentScript.js b/contentScript.js index fa97b949..5574ab42 100644 --- a/contentScript.js +++ b/contentScript.js @@ -2660,6 +2660,7 @@ else if (matchDomain('washingtonpost.com')) { } else if (matchDomain('wsj.com') && !matchDomain('cn.wsj.com')) { + let url = window.location.href; if (location.href.includes('/articles/')) { let close_button = document.querySelector('div.close-btn[role="button"]'); if (close_button) @@ -2667,14 +2668,20 @@ else if (matchDomain('wsj.com') && !matchDomain('cn.wsj.com')) { } let wsj_ads = document.querySelectorAll('div.wsj-ad'); removeDOMElement(...wsj_ads); - document.addEventListener('DOMContentLoaded', () => { - let url = window.location.href; - let snippet = document.querySelector('.snippet-promotion'); - let wsj_pro = document.querySelector('meta[name="page.site"][content="wsjpro"]'); - if (snippet || wsj_pro) { - window.location.href = url.replace('wsj.com', 'wsj.com/amp'); - } - }); + if (url.includes('/amp/')) { + let masthead_link = document.querySelector('div.masthead > a[href*="/articles/"]'); + if (masthead_link) + masthead_link.href = 'https://www.wsj.com'; + } else { + document.addEventListener('DOMContentLoaded', () => { + let snippet = document.querySelector('.snippet-promotion'); + let wsj_pro = document.querySelector('meta[name="page.site"][content="wsjpro"]'); + if (snippet || wsj_pro) { + removeDOMElement(snippet, wsj_pro); + window.location.href = url.replace('wsj.com', 'wsj.com/amp'); + } + }); + } } else if ((domain = matchDomain(usa_mcc_domains)) || document.querySelector('script[src^="https://media.mcclatchyinteractive.com/"]') || window.location.href.match(/\/\/amp\..+\.com\/(.+\/)?article(\d){8,}\.html/)) {