diff --git a/background.js b/background.js index ecd35e7..5228aa8 100755 --- a/background.js +++ b/background.js @@ -84,7 +84,9 @@ var blockedRegexes = { 'haaretz.com': /haaretz\.com\/hdc\/web\/js\/minified\/header-scripts-int.js.+/, 'nzherald.co.nz': /nzherald\.co\.nz\/.+\/headjs\/.+\.js/, 'businessinsider.com': /(.+\.tinypass\.com\/.+|cdn\.onesignal\.com\/sdks\/.+\.js)/, -'bostonglobe.com': /meter\.bostonglobe\.com\/js\/.+/ +'bostonglobe.com': /meter\.bostonglobe\.com\/js\/.+/, +'afr.com': /afr\.com\/assets\/vendorsReactRedux_client.+\.js/, +'theglobeandmail.com': /theglobeandmail\.com\/pb\/resources\/scripts\/build\/chunk-bootstraps\/.+\.js/ }; /** obsolete 'economist.com': /.+\.tinypass\.com\/.+/, @@ -205,8 +207,7 @@ chrome.webRequest.onBeforeRequest.addListener(function(details) { return {cancel: true}; }, { - urls: ["*://*.theglobeandmail.com/*", "*://*.afr.com/*", - "*://*.tinypass.com/*", "*://*.poool.fr/*"], + urls: ["*://*.tinypass.com/*", "*://*.poool.fr/*"], types: ["script"] }, ["blocking"] diff --git a/contentScript.js b/contentScript.js index de5648c..a872296 100755 --- a/contentScript.js +++ b/contentScript.js @@ -209,15 +209,15 @@ if (window.location.href.indexOf("leparisien.fr") !== -1) { if (window.location.href.indexOf("economist.com") !== -1) { document.addEventListener('DOMContentLoaded', () => { - const wrapper = document.getElementById('bottom-page-wrapper'); - removeDOMElement(wrapper); - setTimeout(function () { - const paywall = document.querySelector('.layout-article-regwall');; - if (paywall) { - window.location.reload(true); - } - }, 300); // Delay (in milliseconds) - }); + const wrapper = document.getElementById('bottom-page-wrapper'); + removeDOMElement(wrapper); + setTimeout(function () { + const paywall = document.querySelector('.layout-article-regwall'); ; + if (paywall) { + window.location.reload(true); + } + }, 300); // Delay (in milliseconds) + }); } if (window.location.href.indexOf("bizjournals.com") !== -1) { @@ -319,6 +319,40 @@ if (window.location.href.indexOf("thestar.com") !== -1) { } } +if (window.location.href.indexOf("afr.com") !== -1) { + document.addEventListener('DOMContentLoaded', () => { + const hidden_image = document.querySelectorAll('img'); + for (let i = 0; i < hidden_image.length; i++) { + var src = hidden_image[i].src; + if ('src: ' + src.indexOf(".gif") !== -1) { + var data_src = hidden_image[i].getAttribute("data-src"); + if (data_src) + hidden_image[i].setAttribute('src', data_src); + } + } + const plista = document.querySelector('div[data-plista-placement="underArticle_Group"]'); + removeDOMElement(plista); + }); +} + +if (window.location.href.indexOf("theglobeandmail.com") !== -1) { + document.addEventListener('DOMContentLoaded', () => { + const lazy_image = document.querySelectorAll('.js-lazyimage'); + for (let i = 0; i < lazy_image.length; i++) { + lazy_image[i].classList.remove('js-lazyimage'); + } + const hidden_image = document.querySelectorAll('img'); + for (let i = 0; i < hidden_image.length; i++) { + var src = hidden_image[i].src; + if ('src: ' + src.indexOf("image/gif") !== -1) { + var data_src = hidden_image[i].getAttribute("data-src"); + if (data_src) + hidden_image[i].setAttribute('src', data_src); + } + } + }); +} + // General Functions function removeDOMElement(...elements) { for (let element of elements) { diff --git a/sites.json b/sites.json index 20fec2a..a1bf911 100644 --- a/sites.json +++ b/sites.json @@ -58,7 +58,7 @@ "The Age": "theage.com.au", "The American Interest": "the-american-interest.com", "The Atlantic": "theatlantic.com", - "The Australian Financial Review (javascript disabled)": "afr.com", + "The Australian Financial Review": "afr.com", "The Australian": "theaustralian.com.au", "The Boston Globe": "bostonglobe.com", "The Business Journals": "bizjournals.com", @@ -66,7 +66,7 @@ "The Denver Post": "denverpost.com", "The Diplomat": "thediplomat.com", "The Economist": "economist.com", - "The Globe and Mail (javascript disabled)": "theglobeandmail.com", + "The Globe and Mail": "theglobeandmail.com", "The Hindu": "thehindu.com", "The Irish Times (free articles only)": "irishtimes.com", "The Japan Times": "japantimes.co.jp",