Fix-update Globe and Mail (cleanup)

This commit is contained in:
magnolia1234 2020-06-09 11:57:07 +02:00
parent 4d04b3f1fc
commit 2d3dd9c77a
2 changed files with 3 additions and 29 deletions

View File

@ -13,8 +13,7 @@ const restrictions = {
'elcomercio.pe': /.+\/elcomercio.pe\/.+((\w)+(\-)+){3,}.+/, 'elcomercio.pe': /.+\/elcomercio.pe\/.+((\w)+(\-)+){3,}.+/,
'gestion.pe': /.+\/gestion.pe\/.+((\w)+(\-)+){3,}.+/, 'gestion.pe': /.+\/gestion.pe\/.+((\w)+(\-)+){3,}.+/,
'quora.com': /^((?!quora\.com\/search\?q=).)*$/, 'quora.com': /^((?!quora\.com\/search\?q=).)*$/,
'seekingalpha.com': /.+seekingalpha\.com\/article\/.+/, 'seekingalpha.com': /.+seekingalpha\.com\/article\/.+/
'theglobeandmail.com': /(.+theglobeandmail\.com\/.+\/article-.+|.+theglobeandmail\.com\/pb\/resources\/scripts\/build\/.+\.js)/
} }
// Don't remove cookies before page load // Don't remove cookies before page load
@ -198,7 +197,6 @@ var blockedRegexes = {
'theadvocate.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/, 'theadvocate.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/,
'thecourier.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/, 'thecourier.com.au': /.+cdn-au\.piano\.io\/api\/tinypass.+\.js/,
'thedailybeast.com': /.+\.tinypass\.com\/.+/, 'thedailybeast.com': /.+\.tinypass\.com\/.+/,
'theglobeandmail.com': /theglobeandmail\.com\/pb\/resources\/scripts\/build\/chunk-common-vendor.+\.js/,
'thenation.com': /.+\.tinypass\.com\/.+/, 'thenation.com': /.+\.tinypass\.com\/.+/,
'valeursactuelles.com': /.+\.poool\.fr\/.+/ 'valeursactuelles.com': /.+\.poool\.fr\/.+/
}; };
@ -394,12 +392,8 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
// check for blocked regular expression: domain enabled, match regex, block on an internal or external regex // check for blocked regular expression: domain enabled, match regex, block on an internal or external regex
var blockedDomains = Object.keys(blockedRegexes); var blockedDomains = Object.keys(blockedRegexes);
var domain = matchUrlDomain(blockedDomains, header_referer); var domain = matchUrlDomain(blockedDomains, header_referer);
var block_regex = true;
if (domain && details.url.match(blockedRegexes[domain]) && isSiteEnabled({url: header_referer})) { if (domain && details.url.match(blockedRegexes[domain]) && isSiteEnabled({url: header_referer})) {
if (domain === 'theglobeandmail.com' && !(header_referer.includes('?ref=premium'))) { return { cancel: true };
block_regex = false;
}
if (block_regex) return { cancel: true };
} }
if (!isSiteEnabled(details)) { if (!isSiteEnabled(details)) {

View File

@ -379,29 +379,9 @@ else if (matchDomain("theglobeandmail.com")) {
if (paywall) { if (paywall) {
window.setTimeout(function () { window.setTimeout(function () {
if (!window.location.href.includes('?ref=premium')) if (!window.location.href.includes('?ref=premium'))
window.location.href = window.location.href + '?ref=premium'; window.location.href = new URL(window.location.href).pathname + '?ref=premium';
else
window.location.reload(true);
}, 500); }, 500);
} }
document.addEventListener('DOMContentLoaded', () => {
const lazy_images = document.querySelectorAll('.js-lazyimage');
for (let lazy_image of lazy_images) {
lazy_image.classList.remove('js-lazyimage');
}
const hidden_images = document.querySelectorAll('img');
for (let hidden_image of hidden_images) {
var src = hidden_image.src;
if (src.includes("data:image/gif")) {
var data_src = hidden_image.getAttribute("data-src");
if (data_src)
hidden_image.setAttribute('src', data_src);
var data_bg = hidden_image.getAttribute("data-bg");
if (data_bg)
hidden_image.setAttribute('src', data_bg);
}
}
});
} }
else if (matchDomain("sofrep.com")) { else if (matchDomain("sofrep.com")) {