Fix The Globe and Mail (images)

merge-requests/8/head
magnolia1234 2 years ago
parent 8b28585d9d
commit 8ea44ffeeb

@ -21,6 +21,7 @@ var restrictions = {
'economictimes.com': /\.economictimes\.com($|\/($|(__assets|prime)(\/.+)?|.+\.cms))/,
'elespanol.com': /^((?!\/cronicaglobal\.elespanol\.com\/).)*$/,
'espn.com': /^((?!espn\.com\/watch).)*$/,
'esquire.com': /^((?!\/classic\.esquire\.com\/).)*$/,
'faz.net': /^((?!\.faz\.net\/aktuell\/(\?switchfaznet)?$).)*$/,
'lastampa.it': /^((?!\/video\.lastampa\.it\/).)*$/,
'nytimes.com': /^((?!\/timesmachine\.nytimes\.com\/).)*$/,
@ -291,8 +292,6 @@ function set_rules(sites, sites_updated, sites_custom) {
}
}
}
if (enabledSites.includes('#options_optin_tgam_premium'))
blockedRegexes['theglobeandmail.com'] = /smartwall\.theglobeandmail\.com\//;
use_random_ip = Object.keys(random_ip);
change_headers = use_google_bot.concat(use_bing_bot, use_facebook_referer, use_google_referer, use_twitter_referer, use_random_ip);
disableJavascriptOnListedSites();
@ -653,14 +652,13 @@ ext_api.webRequest.onHeadersReceived.addListener(function (details) {
['blocking', 'responseHeaders']);
// block inline script
var block_js_inline = ["*://*.crusoe.uol.com.br/*", "*://*.elpais.com/*", "*://*.nautil.us/*", "*://*.theglobeandmail.com/*"];
var block_js_inline = ["*://*.crusoe.uol.com.br/*", "*://*.elpais.com/*", "*://*.nautil.us/*"];
if (block_js_inline.length)
ext_api.webRequest.onHeadersReceived.addListener(function (details) {
let url_path = details.url.split('?')[0];
let excluded = (matchUrlDomain('crusoe.uol.com.br', details.url) && (optin_setcookie || !url_path.match(/\.br\/(diario|edicoes)\/.+/)))
|| (matchUrlDomain('elpais.com', details.url) && (url_path.includes('/elpais.com') || !url_path.includes('.html')))
|| (matchUrlDomain('nautil.us', details.url) && !details.url.match(/((\w)+(\-)+){3,}/))
|| (matchUrlDomain('theglobeandmail.com', details.url) && (!enabledSites.includes('#options_optin_tgam_premium') || !details.url.includes('?rel=premium')));
|| (matchUrlDomain('nautil.us', details.url) && !details.url.match(/((\w)+(\-)+){3,}/));
if (!isSiteEnabled(details) || excluded)
return;
var headers = details.responseHeaders;

@ -8,6 +8,7 @@ Add Popular Science
Remove Dark Reading (no paywall)
Fix Australian Community Media (overlay)
Fix L'Opinion.fr
Fix The Globe and Mail (images)
Fix The Toronto Star
Fix WSJ (mobile layout)

@ -3190,12 +3190,12 @@ else if (matchDomain('nationalgeographic.com')) {
}
else if (matchDomain('nationalreview.com')) {
let url = window.location.href.split('?')[0];
if (!url.includes('/amp/')) {
let continue_reading = document.querySelector('div.continue-reading');
if (continue_reading) {
removeDOMElement(continue_reading);
window.location.href = url + 'amp';
if (!window.location.pathname.endsWith('/amp/')) {
let paywall = document.querySelector('div.continue-reading');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
}
let adverts = document.querySelectorAll('amp-ad, .ad-unit--center, amp-connatix-player');
@ -3711,16 +3711,12 @@ else if (matchDomain('thediplomat.com')) {
}
else if (matchDomain('theglobeandmail.com')) {
let paywall = document.querySelector('div.c-paywall');
if (paywall) {
removeDOMElement(paywall);
let url = window.location.href.split('?')[0];
window.location.href = url + '?rel=premium';
} else {
let article_body_subscribed = document.querySelector('.c-article-body--subscribed');
if (article_body_subscribed)
article_body_subscribed.removeAttribute('class');
}
let article_body_subscribed = document.querySelector('.c-article-body--subscribed');
if (article_body_subscribed)
article_body_subscribed.removeAttribute('class');
let lazy_images = document.querySelectorAll('img.lazyimage[src^="data:image/"][data-src]');
for (let elem of lazy_images)
elem.src = elem.getAttribute('data-src');
let banners = document.querySelectorAll('div.c-ad, div#subscription-pencil-area, div.marketing-container-wrapper');
removeDOMElement(...banners);
}

@ -702,5 +702,5 @@
"*://gcm.omerlocdn.com/*",
"*://webcache.googleusercontent.com/*"
],
"version": "2.8.2.6"
"version": "2.8.2.7"
}

@ -1230,8 +1230,7 @@ var defaultSites = {
"National Review": {
domain: "nationalreview.com",
allow_cookies: 1,
block_regex: /(\.blueconic\.net\/|\.nationalreview\.com\/script\.js|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/,
useragent: "googlebot"
block_regex: /(\.blueconic\.net\/|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/
},
"Nautilus": {
domain: "nautil.us",
@ -2091,9 +2090,6 @@ var defaultSites = {
"The Wall Street Journal - no Googlebot (http error 500)": {
domain: "#options_disable_gb_wsj"
},
"The Globe and Mail premium-only (or when empty sections)": {
domain: "#options_optin_tgam_premium"
},
}
if (typeof browser === 'object') {

Loading…
Cancel
Save