diff --git a/background.js b/background.js index 79584bc..4890ef3 100644 --- a/background.js +++ b/background.js @@ -218,7 +218,6 @@ 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\/.+/, @@ -522,8 +521,6 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { var domain = matchUrlDomain(blockedDomains, header_referer); var block_regex = true; if (domain && details.url.match(blockedRegexes[domain]) && isSiteEnabled({url: header_referer})) { - if (domain === 'theglobeandmail.com' && !(header_referer.includes('?ref=premium'))) - block_regex = false; if (block_regex) return { cancel: true }; } diff --git a/contentScript.js b/contentScript.js index 69bebed..490fea8 100644 --- a/contentScript.js +++ b/contentScript.js @@ -430,36 +430,14 @@ else if (matchDomain("afr.com")) { } else if (matchDomain("theglobeandmail.com")) { - 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 (let c_card of c_cards) { - var a_link = c_card.querySelector('a'); - 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'; - } + function tgam_main() { + document.addEventListener('bpc_event', function (e) { + if (window.tgam) + window.tgam.keytar.subscriberPaywallEnabled = false; + }) } + insert_script(tgam_main); + document.dispatchEvent(new CustomEvent('bpc_event', {})); } else if (matchDomain("sofrep.com")) {