This commit is contained in:
magnolia1234 2022-02-04 08:50:55 +01:00
parent b07383671b
commit e444baaa52
6 changed files with 17 additions and 21 deletions

View file

@ -572,7 +572,7 @@ ext_api.webRequest.onBeforeRequest.addListener(function (details) {
// Australia News Corp redirect subscribe to amp // Australia News Corp redirect subscribe to amp
var au_news_corp_subscr = au_news_corp_domains.map(domain => '*://www.' + domain + '/subscribe/*'); var au_news_corp_subscr = au_news_corp_domains.map(domain => '*://www.' + domain + '/subscribe/*');
ext_api.webRequest.onBeforeRequest.addListener(function (details) { ext_api.webRequest.onBeforeRequest.addListener(function (details) {
if (!isSiteEnabled(details) || details.url.includes('/digitalprinteditions') || !details.url.includes('dest=')) { if (!isSiteEnabled(details) || details.url.includes('/digitalprinteditions') || !(details.url.includes('dest=') && details.url.split('dest=')[1].split('&')[0])) {
return; return;
} }
var updatedUrl = decodeURIComponent(details.url.split('dest=')[1].split('&')[0]); var updatedUrl = decodeURIComponent(details.url.split('dest=')[1].split('&')[0]);
@ -913,14 +913,16 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
var useUserAgentMobile = false; var useUserAgentMobile = false;
var setReferer = false; var setReferer = false;
if (matchUrlDomain(change_headers, details.url) && !['font', 'image', 'stylesheet'].includes(details.type)) {
var mobile = details.requestHeaders.filter(x => x.name.toLowerCase() === "user-agent" && x.value.toLowerCase().includes("mobile")).length;
var googlebotEnabled = matchUrlDomain(use_google_bot, details.url) && var googlebotEnabled = matchUrlDomain(use_google_bot, details.url) &&
!(matchUrlDomain('barrons.com', details.url) && enabledSites.includes('#options_disable_gb_barrons')) && !(matchUrlDomain('barrons.com', details.url) && enabledSites.includes('#options_disable_gb_barrons')) &&
!(matchUrlDomain('thetimes.co.uk', details.url) && !details.url.match(/\/epaper\.thetimes\.co\.uk\/article\//)) && !(matchUrlDomain('thetimes.co.uk', details.url) && !(details.url.match(/\/epaper\.thetimes\.co\.uk\/article\//) || mobile)) &&
!(matchUrlDomain('wsj.com', details.url) && enabledSites.includes('#options_disable_gb_wsj')); !(matchUrlDomain('wsj.com', details.url) && enabledSites.includes('#options_disable_gb_wsj'));
var bingbotEnabled = matchUrlDomain(use_bing_bot, details.url) && var bingbotEnabled = matchUrlDomain(use_bing_bot, details.url) &&
!(matchUrlDomain('stratfor.com', details.url) && details.url.match(/(\/(\d){4}-([a-z]||-)+-forecast(-([a-z]|-)+)?|-forecast-(\d){4}-([a-z]|[0-9]||-)+)$/)); !(matchUrlDomain('stratfor.com', details.url) && details.url.match(/(\/(\d){4}-([a-z]||-)+-forecast(-([a-z]|-)+)?|-forecast-(\d){4}-([a-z]|[0-9]||-)+)$/));
if (matchUrlDomain(change_headers, details.url) && !['font', 'image', 'stylesheet'].includes(details.type)) {
// if referer exists, set it // if referer exists, set it
requestHeaders = requestHeaders.map(function (requestHeader) { requestHeaders = requestHeaders.map(function (requestHeader) {
if (requestHeader.name === 'Referer') { if (requestHeader.name === 'Referer') {

View file

@ -8,6 +8,7 @@ Fix La Tercera (js)
Fix MIT Technology Review (TinyPass) Fix MIT Technology Review (TinyPass)
Fix TheTimes.co.uk (epaper) Fix TheTimes.co.uk (epaper)
Fix Times Literary Supplement (set referer Google) Fix Times Literary Supplement (set referer Google)
Fix WaPo
* v2.5.4.0 (2022-01-30) * v2.5.4.0 (2022-01-30)
Add group Outside magazines Add group Outside magazines

View file

@ -218,13 +218,17 @@ else {
let header_ads = document.querySelector('.header_ads-container'); let header_ads = document.querySelector('.header_ads-container');
removeDOMElement(header_ads); removeDOMElement(header_ads);
let amp_ads_sel = 'amp-ad, amp-embed, [id^="ad-mrec-"], .story-ad-container'; let amp_ads_sel = 'amp-ad, amp-embed, [id^="ad-mrec-"], .story-ad-container';
let comments;
if (window.location.hostname.startsWith('amp.')) { if (window.location.hostname.startsWith('amp.')) {
amp_unhide_access_hide('="access AND subscriber"', '', amp_ads_sel, true, true, 'resourcesssl.newscdn.com.au'); amp_unhide_access_hide('="access AND subscriber"', '', amp_ads_sel, true, true, 'resourcesssl.newscdn.com.au');
comments = document.querySelector('#story-comments, .comments-wrapper');
} else if (window.location.href.includes('?amp')) { } else if (window.location.href.includes('?amp')) {
amp_unhide_access_hide('="subscriber AND status=\'logged-in\'"', '', amp_ads_sel, true, true, 'resourcesssl.newscdn.com.au'); amp_unhide_access_hide('="subscriber AND status=\'logged-in\'"', '', amp_ads_sel, true, true, 'resourcesssl.newscdn.com.au');
comments = document.querySelector('#comments-load');
let amp_iframe_sizers = document.querySelectorAll('amp-iframe > i-amphtml-sizer'); let amp_iframe_sizers = document.querySelectorAll('amp-iframe > i-amphtml-sizer');
removeDOMElement(...amp_iframe_sizers) removeDOMElement(...amp_iframe_sizers)
} }
removeDOMElement(comments);
} else { } else {
// Australian Seven West Media // Australian Seven West Media
let swm_image = document.querySelector('img[src^="https://images.thewest.com.au"]'); let swm_image = document.querySelector('img[src^="https://images.thewest.com.au"]');

View file

@ -613,5 +613,5 @@
"*://*.wallkit.net/*", "*://*.wallkit.net/*",
"*://*.wsj.net/*" "*://*.wsj.net/*"
], ],
"version": "2.5.4.3" "version": "2.5.4.4"
} }

View file

@ -1648,7 +1648,7 @@ var defaultSites = {
"The Washington Post": { "The Washington Post": {
domain: "washingtonpost.com", domain: "washingtonpost.com",
allow_cookies: 1, allow_cookies: 1,
block_regex: /\.washingtonpost\.com\/pwapiv2\/article/ block_regex: /\.washingtonpost\.com\/tetro\/evaluate/
}, },
"The West Australian (+ regional/opt-in to custom sites)": { "The West Australian (+ regional/opt-in to custom sites)": {
domain: "thewest.com.au", domain: "thewest.com.au",

View file

@ -20,16 +20,6 @@
"allow_cookies": 1, "allow_cookies": 1,
"block_regex": "(\\.com\\.au\\/remote\\/identity\\/rampart\\/latest\\/rampart\\.js|cdn\\.ampproject\\.org\\/v\\d\\/amp-(access|(sticky-)?ad)-.+\\.js)" "block_regex": "(\\.com\\.au\\/remote\\/identity\\/rampart\\/latest\\/rampart\\.js|cdn\\.ampproject\\.org\\/v\\d\\/amp-(access|(sticky-)?ad)-.+\\.js)"
}, },
"Clarín": {
"domain": "clarin.com",
"allow_cookies": 1,
"block_regex": "\\.clarin\\.com\\/commons\\/js\\/auth0\\.js"
},
"Huffingtonpost.it": {
"domain": "huffingtonpost.it",
"group_rule": "###_gr_it_repubblica_domains"
},
"La Tercera": { "La Tercera": {
"domain": "latercera.com", "domain": "latercera.com",
"allow_cookies": 1, "allow_cookies": 1,
@ -40,12 +30,6 @@
"allow_cookies": 1, "allow_cookies": 1,
"block_regex": "(\\.tinypass\\.com\\/|cdn\\.ampproject\\.org\\/v\\d\\/amp-(access|ad)-.+\\.mjs)" "block_regex": "(\\.tinypass\\.com\\/|cdn\\.ampproject\\.org\\/v\\d\\/amp-(access|ad)-.+\\.mjs)"
}, },
"###_gr_it_repubblica_domains": {
"group_rule_domains": ["gelocal.it", "huffingtonpost.it", "ilsecoloxix.it", "italian.tech", "lanuovasardegna.it", "lastampa.it", "lescienze.it", "limesonline.com", "repubblica.it"],
"allow_cookies": 1,
"block_regex": "(scripts\\.repubblica\\.it\\/pw\\/pw\\.js|cdn\\.ampproject\\.org\\/v\\d\\/amp-(access|ad|user-notification)-.+\\.js)",
"useragent": "googlebot"
},
"The Seattle Times": { "The Seattle Times": {
"domain": "seattletimes.com", "domain": "seattletimes.com",
"allow_cookies": 1, "allow_cookies": 1,
@ -59,5 +43,10 @@
"The Times Literary Supplement": { "The Times Literary Supplement": {
"domain": "the-tls.co.uk", "domain": "the-tls.co.uk",
"referer": "google" "referer": "google"
},
"The Washington Post": {
"domain": "washingtonpost.com",
"allow_cookies": 1,
"block_regex": "\\.washingtonpost\\.com\\/tetro\\/evaluate"
} }
} }