diff --git a/background.js b/background.js index ae0a2c4..521c359 100755 --- a/background.js +++ b/background.js @@ -885,21 +885,21 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { let allow_ext_source = medium_custom_domain; let bpc_amp_site = false; - if (isSiteEnabled({url: header_referer})) { - let inkl_site = (matchUrlDomain('cdn.jsdelivr.net', details.url) && matchUrlDomain('inkl.com', header_referer)); - let cl_elmerc_site = (matchUrlDomain('emol.cl', details.url) && matchUrlDomain('elmercurio.com', header_referer)); - let es_elesp_site = (matchUrlDomain('eestatic.com', details.url) && matchUrlDomain('elespanol.com', header_referer)); - let it_repubblica_site = (matchUrlDomain(['repstatic.it'], details.url) && matchUrlDomain(it_repubblica_domains, header_referer)); - let usa_law360_site = (matchUrlDomain('law360news.com', details.url) && matchUrlDomain('law360.com', header_referer)); - let usa_mw_site = (matchUrlDomain('wsj.net', details.url) && matchUrlDomain('marketwatch.com', header_referer)); - let usa_natgeo_site = (matchUrlDomain('natgeofe.com', details.url) && matchUrlDomain('nationalgeographic.com', header_referer)); - let usa_today_site = (matchUrlDomain('gannett-cdn.com', details.url) && matchUrlDomain(['usatoday.com'], header_referer)); - allow_ext_source = allow_ext_source || inkl_site || cl_elmerc_site || es_elesp_site || it_repubblica_site || usa_law360_site || usa_mw_site || usa_natgeo_site || usa_today_site; - + if (isSiteEnabled({url: header_referer}) && ['script', 'image'].includes(details.type)) { bpc_amp_site = matchUrlDomain('cdn.ampproject.org', details.url); + 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('inkl.com', header_referer) && matchUrlDomain('cdn.jsdelivr.net', details.url)) || + (matchUrlDomain('law360.com', header_referer) && matchUrlDomain('law360news.com', details.url)) || + (matchUrlDomain('marketwatch.com', header_referer) && matchUrlDomain('wsj.net', details.url)) || + (matchUrlDomain('nationalgeographic.com', header_referer) && matchUrlDomain('natgeofe.com', details.url)) || + (matchUrlDomain('usatoday.com', header_referer) && matchUrlDomain('gannett-cdn.com', details.url)) || + (matchUrlDomain(it_repubblica_domains, header_referer) && matchUrlDomain(['repstatic.it'], details.url)); } - if (!isSiteEnabled(details) && !allow_ext_source && !bpc_amp_site) { + if (!isSiteEnabled(details) && !allow_ext_source) { return; } diff --git a/changelog.txt b/changelog.txt index d8078e0..f71da3d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Chrome Post-release Add Groupe Sud Ouest (France) +Fix TheTimes.co.uk (epaper & archive) Update block general paywall script (limit NewsMemory) * v2.5.5.0 (2022-02-06) diff --git a/contentScript.js b/contentScript.js index 5523009..2333ab7 100755 --- a/contentScript.js +++ b/contentScript.js @@ -1804,18 +1804,37 @@ else if (matchDomain('thetimes.co.uk')) { removeDOMElement(paywall_page); } else { if (url.includes('/textview')) { - function thetimes_link(node) { - let article = node.closest('article[aid]'); + 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) - node.href = 'article/' + article.getAttribute('aid'); + 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('')) { + 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'; } - waitDOMElement('article[aid] > div > div > a.readmore.dis[href="javascript:void(0)"]', 'A', thetimes_link, true); - csDoneOnce = true; - } else { - let pages = document.querySelectorAll('div.page-left, div.page-right'); - for (let page of pages) - page.style.height = 'auto'; - } } } @@ -3425,16 +3444,21 @@ function replaceDomElementExt(url, proxy, base64, selector, text_fail = '', sele } function archiveLink(url) { - let archive_url = 'https://archive.today?run=1&url=' + url.split('?')[0]; let text_fail_div = document.createElement('div'); text_fail_div.id = 'bpc_archive'; text_fail_div.setAttribute('style', 'margin: 20px; font-weight: bold; color:red;'); text_fail_div.appendChild(document.createTextNode('BPC > Full article text:\r\n')); - let a_link = document.createElement('a'); - a_link.innerText = archive_url; - a_link.href = archive_url; - a_link.target = '_blank'; - text_fail_div.appendChild(a_link); + function add_links(domains) { + for (let domain of domains) { + let a_link = document.createElement('a'); + a_link.innerText = domain; + a_link.href = 'https://' + domain + '?run=1&url=' + url.split('?')[0]; + a_link.target = '_blank'; + text_fail_div.appendChild(document.createTextNode(' | ')); + text_fail_div.appendChild(a_link); + } + } + add_links(['archive.today', 'archive.is']); return text_fail_div; } diff --git a/custom/manifest.json b/custom/manifest.json index 35a23e2..228d2c1 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -39,5 +39,5 @@ "webRequestBlocking", "" ], - "version": "2.5.5.2" + "version": "2.5.5.3" } diff --git a/manifest.json b/manifest.json index 877d822..be4731c 100755 --- a/manifest.json +++ b/manifest.json @@ -595,11 +595,12 @@ "*://*.natgeofe.com/*", "*://*.nyt.com/*", "*://*.pasedigital.cl/*", + "*://*.prcdn.co/*", "*://*.repstatic.it/*", "*://*.rndtech.de/*", "*://*.sanoma-sndp.fi/*", "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.5.5.2" + "version": "2.5.5.3" }