Fix Globe and Mail

Enable Javascript/photos, no video and photo gallery though
This commit is contained in:
magnolia1234 2020-01-05 17:23:28 +01:00 committed by GitHub
parent d562914762
commit 4479d243a1
4 changed files with 24 additions and 4 deletions

View file

@ -259,7 +259,8 @@ const blockedRegexes = {
'inquirer.com': /.+\.tinypass\.com\/.+/,
'spectator.co.uk': /.+\.tinypass\.com\/.+/,
'newcastleherald.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/,
'afr.com': /afr\.com\/assets\/vendorsReactRedux_client.+\.js/
'afr.com': /afr\.com\/assets\/vendorsReactRedux_client.+\.js/,
'theglobeandmail.com': /theglobeandmail\.com\/pb\/resources\/scripts\/build\/chunk-bootstraps\/.+\.js/
};
const userAgentDesktop = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
@ -308,7 +309,7 @@ chrome.webRequest.onBeforeRequest.addListener(function(details) {
return {cancel: true};
},
{
urls: ["*://*.theglobeandmail.com/*", "*://*.newstatesman.com/*"],
urls: ["*://*.newstatesman.com/*"],
types: ["script"]
},
["blocking"]

View file

@ -273,6 +273,24 @@ if (window.location.href.indexOf("afr.com") !== -1) {
});
}
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);
}
}
});
}
function removeDOMElement(...elements) {
for (let element of elements) {
if (element) element.remove();

View file

@ -29,7 +29,8 @@
"*://*.techinasia.com/*",
"*://*.newcastleherald.com.au/*",
"*://*.thestar.com/*",
"*://*.afr.com/*"
"*://*.afr.com/*",
"*://*.theglobeandmail.com/*"
],
"js": ["contentScript.js"]
}

View file

@ -71,7 +71,7 @@ var defaultSites = {
'The Boston Globe': 'bostonglobe.com',
'The Business Journals': 'bizjournals.com',
'The Diplomat': 'thediplomat.com',
'The Globe and Mail (javascript disabled)': 'theglobeandmail.com',
'The Globe and Mail': 'theglobeandmail.com',
'The Hindu': 'thehindu.com',
'The Japan Times': 'japantimes.co.jp',
'TheMarker': 'themarker.com',