diff --git a/README.md b/README.md index de49690..c5c2f8e 100755 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Windows Registry Editor Version 5.00 #### Android 1. Install [Kiwi Browser](https://play.google.com/store/apps/details?id=com.kiwibrowser.browser&hl=nl) or [Yandex Browser](https://play.google.com/store/apps/details?id=com.yandex.browser&hl=en) from the Google PlayStore. 2. For Kiwi Browser load the CRX-file in releases (auto-updating, no whitelist needed, opt-in for custom sites not working (use kiwi-custom crx; updates to latest regular version)). -3. For Yandex Browser follow Chrome instructions above (load unpacked; step 6: pick manifest.json instead of the folder). If it fails try Total Commander (as file manager).\ +3. For Yandex Browser follow Chrome instructions above (load unpacked; step 6: pick manifest.json instead of the folder). If it fails try a few times or use Total Commander (as file manager). You can use a Git client like MGit to clone (and update) this repository on your mobile device.\ For custom sites copy manifest.json from custom folder to the main extension folder (optional permissions are lost on reload). #### Firefox diff --git a/background.js b/background.js index f2198dc..8da3383 100755 --- 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 65687d7..b698dd5 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 fa97b94..5574ab4 100755 --- 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/)) {