Fix TheTimes.co.uk (epaper-fix obsolete)

This commit is contained in:
magnolia1234 2022-08-10 19:19:51 +02:00
parent 79b4f4d2f7
commit 925b83eee2
6 changed files with 16 additions and 79 deletions

View File

@ -5,7 +5,7 @@ var manifestData = ext_api.runtime.getManifest();
var ext_name = manifestData.name;
var ext_version = manifestData.version;
const cs_limit_except = ['elespanol.com', 'faz.net', 'nation.africa', 'nationalgeographic.com', 'thetimes.co.uk'].concat(de_westfalen_medien_domains);
const cs_limit_except = ['elespanol.com', 'faz.net', 'nation.africa', 'nationalgeographic.com'].concat(de_westfalen_medien_domains);
const dompurify_sites = ['aachener-nachrichten.de', 'aachener-zeitung.de', 'asiatimes.com', 'bloomberg.com', 'cicero.de', 'golem.de', 'hs.fi', 'ilmanifesto.it', 'iltalehti.fi', 'iltirreno.it', 'ipolitics.ca', 'italiaoggi.it', 'lanuovasardegna.it', 'lesechos.fr', 'limburger.nl', 'marianne.net', 'newleftreview.org', 'nzherald.co.nz', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'spiegel.de', 'stratfor.com', 'tagesspiegel.de', 'techinasia.com', 'thetimes.co.uk', 'timesofindia.com', 'vn.nl', 'welt.de', 'wiwo.de'].concat(be_mediahuis_domains, nl_mediahuis_region_domains, no_nhst_media_domains);
var currentTabUrl = '';
var csDone = false;
@ -34,6 +34,7 @@ var restrictions = {
'statista.com': /^((?!\.statista\.com\/(outlook|study)\/).)*$/,
'techinasia.com': /\.techinasia\.com\/.+/,
'theatlantic.com': /^((?!\/newsletters\.theatlantic\.com\/).)*$/,
'thetimes.co.uk': /^((?!epaper\.thetimes\.co\.uk).)*$/,
'timeshighereducation.com': /\.timeshighereducation\.com\/((features|news|people)\/|.+((\w)+(\-)+){3,}.+|sites\/default\/files\/)/
}
@ -969,7 +970,6 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
allow_ext_source = allow_ext_source || bpc_amp_site ||
(matchUrlDomain('elespanol.com', header_referer) && matchUrlDomain('eestatic.com', details.url)) ||
(matchUrlDomain('elmercurio.com', header_referer) && matchUrlDomain('emol.cl', details.url)) ||
(matchUrlDomain('epaper.thetimes.co.uk', header_referer) && matchUrlDomain(['prcdn.co'], details.url)) ||
(matchUrlDomain('law360.com', header_referer) && matchUrlDomain('law360news.com', details.url)) ||
(matchUrlDomain('lesechos.fr', header_referer) && matchUrlDomain('lesechos.com', details.url)) ||
(matchUrlDomain('marketwatch.com', header_referer) && matchUrlDomain('wsj.net', details.url)) ||
@ -1001,7 +1001,6 @@ if (matchUrlDomain(change_headers, details.url) && !['font', 'image', 'styleshee
!(matchUrlDomain('barrons.com', details.url) && enabledSites.includes('#options_disable_gb_barrons')) &&
!(matchUrlDomain(['economictimes.com', 'economictimes.indiatimes.com'], details.url) && !details.url.split(/\?|#/)[0].endsWith('.cms')) &&
!(matchUrlDomain('theaustralian.com.au', details.url) && !details.url.startsWith('https://www.theaustralian.com.au/the-oz/')) &&
!(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'));
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]||-)+)$/));

View File

@ -5,6 +5,7 @@ Post-release
Add Aachener Nachrichten &Zeitung
Remove World Politics Review (fix obsolete)
Fix Limburger.nl & Mediahuis Belgie (mobile)
Fix TheTimes.co.uk (epaper-fix obsolete)
* v2.7.9.0 (2022-08-07)
Add Limburger.nl

View File

@ -39,7 +39,7 @@ var usa_outside_mag_domains = ["backpacker.com", "betamtb.com", "betternutrition
var usa_tribune_domains = ['baltimoresun.com', 'chicagotribune.com', 'courant.com', 'dailypress.com', 'mcall.com', 'nydailynews.com', 'orlandosentinel.com', 'pilotonline.com', 'sun-sentinel.com'];
// clean local storage of sites (with an exemption for hold-list)
var arr_localstorage_hold = ['aachener-nachrichten.de', 'aachener-zeitung.de', 'abc.es', 'allgaeuer-zeitung.de', 'augsburger-allgemeine.de', 'barrons.com', 'businessoffashion.com', 'challenges.fr', 'charliehebdo.fr', 'cmjornal.pt', 'corriere.it', 'corrieredellosport.it', 'eldiario.es', 'elespanol.com', 'elle.fr', 'elpais.com', 'elperiodico.com', 'enotes.com', 'estadao.com.br', 'forbes.com', 'fortune.com', 'economictimes.com', 'freiepresse.de', 'ilfoglio.it', 'inc42.com', 'lanouvellerepublique.fr', 'lesechos.fr', 'mid-day.com', 'nytimes.com', 'nzherald.co.nz', 'scmp.com', 'seekingalpha.com', 'substack.com', 'telegraph.co.uk', 'thehindu.com', 'thetimes.co.uk', 'wsj.com'].concat(de_funke_medien_domains, de_westfalen_medien_domains, es_epiberica_domains, es_grupo_vocento_domains, es_unidad_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, fr_groupe_nice_matin_domains, it_quotidiano_domains, ca_gcm_domains, nl_dpg_media_domains, no_nhst_media_domains, usa_hearst_comm_domains);
var arr_localstorage_hold = ['aachener-nachrichten.de', 'aachener-zeitung.de', 'abc.es', 'allgaeuer-zeitung.de', 'augsburger-allgemeine.de', 'barrons.com', 'businessoffashion.com', 'challenges.fr', 'charliehebdo.fr', 'cmjornal.pt', 'corriere.it', 'corrieredellosport.it', 'eldiario.es', 'elespanol.com', 'elle.fr', 'elpais.com', 'elperiodico.com', 'enotes.com', 'estadao.com.br', 'forbes.com', 'fortune.com', 'economictimes.com', 'freiepresse.de', 'ilfoglio.it', 'inc42.com', 'lanouvellerepublique.fr', 'lesechos.fr', 'mid-day.com', 'nytimes.com', 'nzherald.co.nz', 'scmp.com', 'seekingalpha.com', 'substack.com', 'telegraph.co.uk', 'theatlantic.com', 'thehindu.com', 'thetimes.co.uk', 'wsj.com'].concat(de_funke_medien_domains, de_westfalen_medien_domains, es_epiberica_domains, es_grupo_vocento_domains, es_unidad_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, fr_groupe_nice_matin_domains, it_quotidiano_domains, ca_gcm_domains, nl_dpg_media_domains, no_nhst_media_domains, usa_hearst_comm_domains);
if (!matchDomain(arr_localstorage_hold)) {
window.localStorage.clear();
}
@ -65,9 +65,9 @@ if ((bg2csData !== undefined) && bg2csData.ld_json && dompurify_loaded) {
let ld_json_split = bg2csData.ld_json.split('|');
let paywall_sel = ld_json_split[0];
let article_sel = ld_json_split[1];
let paywall = document.querySelector(paywall_sel);
if (paywall) {
removeDOMElement(paywall);
let paywall = document.querySelectorAll(paywall_sel);
if (paywall.length) {
removeDOMElement(...paywall);
let json_script = getArticleJsonScript();
if (json_script) {
let json_text = parseHtmlEntities(JSON.parse(json_script.text).articleBody);
@ -92,9 +92,9 @@ if ((bg2csData !== undefined) && bg2csData.ld_google_webcache && dompurify_loade
let ld_google_webcache_split = bg2csData.ld_google_webcache.split('|');
let paywall_sel = ld_google_webcache_split[0];
let article_sel = ld_google_webcache_split[1];
let paywall = document.querySelector(paywall_sel);
if (paywall) {
removeDOMElement(paywall);
let paywall = document.querySelectorAll(paywall_sel);
if (paywall.length) {
removeDOMElement(...paywall);
let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0];
replaceDomElementExt(url_cache, true, false, article_sel);
}
@ -2360,39 +2360,6 @@ else if (matchDomain('thetimes.co.uk')) {
removeDOMElement(...banners, ...ads);
}, 1500);
}
} else {
if (url.includes('/textview')) {
let article_locks = document.querySelectorAll('article[aid] > div > div > a.readmore.dis[href="javascript:void(0)"]');
for (let elem of article_locks) {
let article = elem.closest('article[aid]');
if (article)
elem.href = 'article/' + article.getAttribute('aid');
}
let headers = document.querySelectorAll('article[aid] > header > hgroup > h1');
for (let elem of headers) {
let article = elem.closest('article[aid]');
if (article && !elem.innerHTML.includes('</a>')) {
let new_link = document.createElement('a');
new_link.href = 'article/' + article.getAttribute('aid');
new_link.innerText = elem.innerText;
elem.innerText = '';
elem.appendChild(new_link);
}
}
let continued_links = document.querySelectorAll('a.continued[href="javascript:void(0)"]');
for (let elem of continued_links) {
let pagenr = parseInt(elem.innerText.replace('Continued from ', ''));
if (pagenr)
elem.href = url.replace(/\/page\/(\d)+\/textview/, '/page/' + pagenr + '/textview');
}
let bottom_links = document.querySelectorAll('article > a[id^="athumb_"][article-id][href="javascript:void(0)"]');
for (let elem of bottom_links)
elem.href = 'article/' + elem.getAttribute('article-id');
} else {
let pages = document.querySelectorAll('div.page-left, div.page-right');
for (let page of pages)
page.style.height = 'auto';
}
}
}

View File

@ -704,5 +704,5 @@
"*://gcm.omerlocdn.com/*",
"*://webcache.googleusercontent.com/*"
],
"version": "2.7.9.1"
"version": "2.7.9.2"
}

View File

@ -1864,8 +1864,7 @@ var defaultSites = {
},
"The Times (UK)": {
domain: "thetimes.co.uk",
allow_cookies: 1,
useragent: "googlebot"
allow_cookies: 1
},
"The Times Literary Supplement": {
domain: "the-tls.co.uk",

View File

@ -1,38 +1,13 @@
{
"Belfast Telegraph (setCookie opt-in)": {
"domain": "belfasttelegraph.co.uk",
"allow_cookies": 1,
"block_regex": "(cdn\\.flip-pay\\.com\\/clients\\/inm\\/flip-pay\\.js)",
"cs_code": [{
"cond": "div#flip-pay[style]",
"rm_attrib": "style"
}
]
},
"Groene Amsterdammer": {
"domain": "groene.nl",
"remove_cookies_select_hold": ["accept-cookies", "popunder-hidden"],
"useragent": "googlebot"
},
"Irish Independent (setCookie opt-in)": {
"domain": "independent.ie",
"allow_cookies": 1,
"block_regex": "(cdn\\.flip-pay\\.com\\/clients\\/inm\\/flip-pay\\.js)",
"cs_code": [{
"cond": "div#flip-pay[style]",
"rm_attrib": "style"
}
]
},
"Law.com (free articles only)": {
"domain": "law.com",
"allow_cookies": 1,
"remove_cookies": 1,
"referer": "facebook"
},
"Substack": {
"domain": "substack.com",
"useragent": "googlebot"
"useragent": "googlebot",
"new_site": 1
},
"Suomen Sotilas": {
"domain": "suomensotilas.fi",
@ -42,7 +17,8 @@
"cond": "div.epfl-pw-obscured",
"rm_class": "epfl-pw-obscured"
}
]
],
"new_site": 1
},
"The Athletic": {
"domain": "###_usa_theathletic",
@ -56,10 +32,5 @@
"rm_elem": 1
}
]
},
"Winnipeg Free Press": {
"domain": "winnipegfreepress.com",
"allow_cookies": 1,
"block_regex": "(account\\.winnipegfreepress\\.com\\/api\\/v\\d\\/auth\\/identify|cdn\\.cxense\\.com\\/)"
}
}