Fix El Pais (amp/video)

This commit is contained in:
magnolia1234 2022-04-21 19:52:47 +02:00
parent 7ef21bcf36
commit afc185a2dc
6 changed files with 18 additions and 15 deletions

View file

@ -19,7 +19,6 @@ var restrictions = {
'bloomberg.com': /^((?!\.bloomberg\.com\/news\/terminal\/).)*$/,
'economictimes.com': /\.economictimes\.com($|\/($|(__assets|prime)(\/.+)?|.+\.cms))/,
'elespanol.com': /^((?!\/cronicaglobal\.elespanol\.com\/).)*$/,
'elpais.com': /(\/(.+\.)?elpais\.com\/.+\.html|(static|imagenes(\.\w+)?)\.elpais\.com)/,
'faz.net': /^((?!\.faz\.net\/aktuell\/(\?switchfaznet)?$).)*$/,
'foreignaffairs.com': /\.foreignaffairs\.com\/((articles|fa-caching|interviews|reviews|sites)\/)/,
'lastampa.it': /^((?!\/video\.lastampa\.it\/).)*$/,
@ -36,7 +35,7 @@ var restrictions = {
for (let domain of au_news_corp_domains)
restrictions[domain] = new RegExp('^((?!todayspaper\\.' + domain.replace(/\./g, '\\.') + '\\/).)*$');
if (typeof browser !== 'object') {
for (let domain of['elpais.com'])
for (let domain of [])
restrictions[domain] = new RegExp('((\\/|\\.)' + domain.replace(/\./g, '\\.') + '\\/$|' + restrictions[domain].toString().replace(/(^\/|\/$)/g, '') + ')');
}
@ -618,10 +617,12 @@ ext_api.webRequest.onHeadersReceived.addListener(function (details) {
['blocking', 'responseHeaders']);
// block inline script
var block_js_inline = ["*://*.theglobeandmail.com/*"];
var block_js_inline = ["*://*.elpais.com/*", "*://*.theglobeandmail.com/*"];
if (block_js_inline.length)
ext_api.webRequest.onHeadersReceived.addListener(function (details) {
let excluded = matchUrlDomain('theglobeandmail.com', details.url) && (enabledSites.includes('#options_optin_tgam_media') || !details.url.includes('?rel=premium'));
let url_path = details.url.split('?')[0];
let excluded = (matchUrlDomain('elpais.com', details.url) && (url_path.includes('/elpais.com') || !url_path.includes('.html')))
|| (matchUrlDomain('theglobeandmail.com', details.url) && (enabledSites.includes('#options_optin_tgam_media') || !details.url.includes('?rel=premium')));
if (!isSiteEnabled(details) || excluded)
return;
var headers = details.responseHeaders;
@ -715,7 +716,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
break;
}
}
var blocked_referer_domains = ['elpais.com', 'foreignaffairs.com', 'timeshighereducation.com'];
var blocked_referer_domains = ['foreignaffairs.com', 'timeshighereducation.com'];
if (!header_referer && details.initiator) {
header_referer = details.initiator;
if (!blocked_referer && matchUrlDomain(blocked_referer_domains, details.url) && ['script', 'xmlhttprequest'].includes(details.type)) {

View file

@ -8,6 +8,7 @@ Add Gym Climber
Add Peloton
Add Podium Runner
Add Rock and Ice
Fix El Pais (amp/video)
* v2.6.5.0 (2022-04-18)
Add Aftonbladet.se

View file

@ -1106,23 +1106,21 @@ else if (matchDomain(es_unidad_domains)) {
}
else if (matchDomain('elpais.com')) {
let url = window.location.href;
let login_register = document.querySelector('.login_register');
if (url.includes('.amp.html') || url.includes('?outputType=amp')) {
amp_unhide_access_hide('="vip"', '="NOT vip"');
if (window.location.pathname.endsWith('.amp.html') || window.location.search.match(/(\?|&)outputType=amp/)) {
amp_unhide_access_hide('="vip"], [amp-access="success"', '="NOT vip"], [amp-access="NOT success"');
removeDOMElement(login_register);
} else {
let counter = document.querySelector('#counterLayerDiv');
removeDOMElement(counter);
let video = document.querySelector('div.videoTop');
let amphtml = document.querySelector('link[rel="amphtml"]');
if ((login_register || video) && amphtml) {
if (login_register && amphtml) {
removeDOMElement(login_register, video);
window.location.href = amphtml.href;
}
}
let paywall_offer = document.querySelector('.paywallOffer');
let ctn_closed_article = document.querySelector('#ctn_closed_article, #ctn_freemium_article');
let ctn_closed_article = document.querySelector('#ctn_closed_article, #ctn_freemium_article, #ctn_premium_article');
removeDOMElement(paywall_offer, ctn_closed_article);
}
@ -1179,8 +1177,7 @@ else if (matchDomain(es_epiberica_domains)) {
let truncated = document.querySelector('div.article-body--truncated');
if (truncated)
truncated.classList.remove('article-body--truncated');
amp_unhide_access_hide('="NOT access"', '="access"');
amp_unhide_access_hide('="FALSE"');
amp_unhide_access_hide('="NOT access"], [amp-access="FALSE"', '="access"');
} else if (window.location.hostname === 'amp.epe.es') {
amp_unhide_access_hide('="loggedIn"', '="NOT loggedIn"', 'amp-ad, amp-embed, amp-next-page');
} else {

View file

@ -652,7 +652,6 @@
"*://*.eestatic.com/*",
"*://*.emol.cl/*",
"*://*.ensighten.com/*",
"*://*.epimg.net/*",
"*://*.flip-pay.com/*",
"*://*.funkedigital.de/*",
"*://*.gannett-cdn.com/*",

View file

@ -391,7 +391,7 @@ var defaultSites = {
"El País": {
domain: "elpais.com",
allow_cookies: 1,
block_regex: /(\.epimg\.net\/js\/.+\/(noticia|user)\.min\.js|\/elpais\.com\/arc\/subs\/p\.min\.js|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad)-.+\.js)/
block_regex: /(\/elpais\.com\/arc\/subs\/p\.min\.js|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad)-.+\.js)/
},
"El Periódico (de Catalunya)": {
domain: "elperiodico.com",

View file

@ -25,6 +25,11 @@
"domain": "betternutrition.com",
"group_rule": "###_gr_usa_outside_mag_domains"
},
"El País": {
"domain": "elpais.com",
"allow_cookies": 1,
"block_regex": "(\\/elpais\\.com\\/arc\\/subs\\/p\\.min\\.js|cdn\\.ampproject\\.org\\/v\\d\\/amp-(access|(sticky-)?ad)-.+\\.js)"
},
"Gym Climber": {
"domain": "gymclimber.com",
"group_rule": "###_gr_usa_outside_mag_domains"