Fix The Globe and Mail (images)

master
magnolia1234 2022-09-04 09:12:52 +02:00
parent 45fef25ada
commit 4702da24c5
6 changed files with 19 additions and 28 deletions

View File

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

View File

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

View File

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

View File

@ -43,5 +43,5 @@
"webRequestBlocking", "webRequestBlocking",
"<all_urls>" "<all_urls>"
], ],
"version": "2.8.2.6" "version": "2.8.2.7"
} }

View File

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

View File

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