Fix TheTimes.co.uk (epaper)

This commit is contained in:
magnolia1234 2022-02-03 20:16:59 +01:00
parent bb9ac25e76
commit b07383671b
6 changed files with 35 additions and 17 deletions

View File

@ -47,6 +47,7 @@ Visit the [Chrome repository](https://gitlab.com/magnolia1234/bypass-paywalls-ch
#### Notes
* This add-on works best alongside the adblocker [uBlock Origin](https://addons.mozilla.org/en-US/firefox/addon/ublock-origin).
* You will be logged out for most of the sites you have checked.
* Some sites need to redirect to an amp-page (add an exception in your amp2html add-on).
### List of supported websites

View File

@ -7,7 +7,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', 'inkl.com', 'nation.africa', 'nationalgeographic.com'];
const cs_limit_except = ['elespanol.com', 'faz.net', 'inkl.com', 'nation.africa', 'nationalgeographic.com', 'thetimes.co.uk'];
var currentTabUrl = '';
var csDone = false;
var optin_setcookie = false;
@ -915,7 +915,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
var setReferer = false;
var googlebotEnabled = matchUrlDomain(use_google_bot, details.url) &&
!(matchUrlDomain('barrons.com', details.url) && enabledSites.includes('#options_disable_gb_barrons')) &&
!(matchUrlDomain('thetimes.co.uk', details.url) && !details.url.match(/\/epaper\.thetimes\.co\.uk\//)) &&
!(matchUrlDomain('thetimes.co.uk', details.url) && !details.url.match(/\/epaper\.thetimes\.co\.uk\/article\//)) &&
!(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

@ -6,6 +6,7 @@ Remove The Logic (fix obsolete)
Fix Australia News Corp (video-still)
Fix La Tercera (js)
Fix MIT Technology Review (TinyPass)
Fix TheTimes.co.uk (epaper)
Fix Times Literary Supplement (set referer Google)
* v2.5.4.0 (2022-01-30)
@ -513,7 +514,7 @@ Fix Cors Anywhere (link to allow access)
Fix Il Secolo XIX (amp)
Fix Medium custom domains (meter)
Fix Statista (premium)
Fix The Times (puzzles)
Fix TheTimes.co.uk (puzzles)
Update popup (not closing on switch/clear cookies)
* v2.0.7.0 (2021-02-07)

View File

@ -1784,10 +1784,11 @@ else if (matchDomain(['theathletic.com', 'theathletic.co.uk'])) {
}
else if (matchDomain('thetimes.co.uk')) {
let url = window.location.href;
if (window.location.hostname !== 'epaper.thetimes.co.uk') {
let block = document.querySelector('.subscription-block');
let adverts = document.querySelectorAll('#ad-article-inline, #sticky-ad-header, div[class*="InlineAdWrapper"], div[class*="NativeAd"], div.responsiveweb-sc-1exejum-0');
removeDOMElement(block, ...adverts);
let url = window.location.href;
let paywall = document.querySelector('div#paywall-portal-article-footer');
if (paywall && !url.includes('?shareToken=')) {
removeDOMElement(paywall);
@ -1797,6 +1798,21 @@ else if (matchDomain('thetimes.co.uk')) {
}
let paywall_page = document.querySelector('div#paywall-portal-page-footer');
removeDOMElement(paywall_page);
} else {
if (url.includes('/textview')) {
function thetimes_link(node) {
let article = node.closest('article[aid]');
if (article)
node.href = 'article/' + article.getAttribute('aid');
}
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';
}
}
}
else if (!matchDomain(['belfasttelegraph.co.uk', 'independent.ie']))
@ -1845,7 +1861,7 @@ else if (matchDomain('elmercurio.com')) {
elem.removeAttribute('style');
let page_pdf_content = document.querySelector('div.page_pdf_content');
let close_html = document.querySelector('div.close_html');
removeDOMElement(page_pdf_content, close_html)
removeDOMElement(page_pdf_content, close_html);
}, 1000); // Delay (in milliseconds)
window.setTimeout(function () {
let cont_articlelight = document.querySelector('div.cont_articlelight');

View File

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

View File

@ -149,7 +149,7 @@ var defaultSites = {
"westernadvocate.com.au"
],
allow_cookies: 1,
block_regex: /cdn-au\.piano\.io\/api\/tinypass.+\.js/
block_regex: /(cdn-au\.piano\.io\/api\/tinypass.+\.js|\.com\.au\/static\/.+\/js\/vendor\.js)/
},
"Barron's": {
domain: "barrons.com",