Fix-update Globe and Mail

Premium articles have no video and photo gallery
master
magnolia1234 2020-09-19 10:15:24 +02:00
parent c6ffbad985
commit 574b9db518
2 changed files with 25 additions and 6 deletions

View File

@ -217,6 +217,7 @@ var blockedRegexes = {
'telegraph.co.uk': /.+\.tinypass\.com\/.+/,
'theage.com.au': /cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js/,
'thedailybeast.com': /.+\.tinypass\.com\/.+/,
'theglobeandmail.com': /theglobeandmail\.com\/pb\/resources\/scripts\/build\/chunk-common-vendor.+\.js/,
'thehindu.com': /ajax\.cloudflare\.com\/cdn-cgi\/scripts\/.+\/cloudflare-static\/rocket-loader\.min\.js/,
'thenation.com': /.+\.tinypass\.com\/.+/,
'valeursactuelles.com': /.+\.qiota\.com\/.+/,
@ -517,8 +518,12 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
// check for blocked regular expression: domain enabled, match regex, block on an internal or external regex
var blockedDomains = Object.keys(blockedRegexes);
var domain = matchUrlDomain(blockedDomains, header_referer);
var block_regex = true;
if (domain && details.url.match(blockedRegexes[domain]) && isSiteEnabled({url: header_referer})) {
return { cancel: true };
if (domain === 'theglobeandmail.com' && !(header_referer.includes('?ref=premium')))
block_regex = false;
if (block_regex)
return { cancel: true };
}
let inkl_site = (matchUrlDomain('cdn.jsdelivr.net', details.url) && matchUrlDomain('inkl.com', header_referer) && isSiteEnabled({url: header_referer}));

View File

@ -430,18 +430,32 @@ else if (matchDomain("afr.com")) {
}
else if (matchDomain("theglobeandmail.com")) {
document.addEventListener('DOMContentLoaded', () => {
let subscribed = document.querySelector('html.story-subscribed');
if (subscribed && !window.location.href.includes('?ref=premium')) {
window.setTimeout(function () {
window.location.href = new URL(window.location.href).pathname + '?ref=premium';
}, 100);
}
});
let lazy_images = document.querySelectorAll('.js-lazyimage');
for (let lazy_image of lazy_images) {
lazy_image.classList.remove('js-lazyimage');
}
let 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);
}
}
let c_cards = document.querySelectorAll('div.c-card');
for (c_card of c_cards) {
for (let c_card of c_cards) {
var a_link = c_card.querySelector('a');
var subscr_key = c_card.querySelector('span.c-indicator-icon--key');
var subscr_key = c_card.querySelector('span.c-indicator-icon--key');
if (subscr_key && a_link && !a_link.href.includes('?ref=premium')) {
a_link.href = a_link.href + '?ref=premium';
}
@ -827,7 +841,7 @@ else if (matchDomain('ilfattoquotidiano.it')) {
else if (matchDomain('qz.com')) {
window.setTimeout(function () {
if (pageContains('._33dc2 h2', 'Become a member, and we promise').length)
document.location.reload(true);
window.location.reload(true);
}, 500); // Delay (in milliseconds)
}