Fix Groupe La Depeche (json)

Update amp-redirect (disable loop)
This commit is contained in:
magnolia1234 2023-09-30 13:08:32 +02:00
parent 22c03a5ee3
commit aaddacb65d
5 changed files with 113 additions and 209 deletions

View file

@ -6,9 +6,11 @@ Post-release
Add Conde Nast Traveler Add Conde Nast Traveler
Add Salzburger Nachrichten Add Salzburger Nachrichten
Add The Columbian Add The Columbian
Fix Groupe La Depeche (json)
Fix Mediahuis Noord (json) Fix Mediahuis Noord (json)
Fix Mexico News Daily Fix Mexico News Daily
Fix New Scientist (text-break) Fix New Scientist (text-break)
Update amp-redirect (disable loop)
Update custom sites (import - remove obsolete) Update custom sites (import - remove obsolete)
* v3.3.5.0 (2023-09-24) * v3.3.5.0 (2023-09-24)

View file

@ -255,14 +255,10 @@ if (bg2csData.amp_unhide) {
if (bg2csData.amp_redirect) { if (bg2csData.amp_redirect) {
window.setTimeout(function () { window.setTimeout(function () {
let amp_script = document.querySelector('script[src^="https://cdn.ampproject.org/"]'); let amp_script = document.querySelector('script[src^="https://cdn.ampproject.org/"]');
let amphtml = document.querySelector('link[rel="amphtml"]'); let amphtml = document.querySelector('head > link[rel="amphtml"]');
let amp_page = amp_script && !amphtml; let amp_page = amp_script && !amphtml;
if (!amp_page) { if (!amp_page) {
let paywall = document.querySelector(bg2csData.amp_redirect); amp_redirect(bg2csData.amp_redirect);
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} }
}, 500); }, 500);
} }
@ -431,12 +427,7 @@ else if (matchDomain('thesaturdaypaper.com.au')) {
else if (matchDomain(['brisbanetimes.com.au', 'smh.com.au', 'theage.com.au', 'watoday.com.au'])) { else if (matchDomain(['brisbanetimes.com.au', 'smh.com.au', 'theage.com.au', 'watoday.com.au'])) {
if (!window.location.hostname.startsWith('amp.')) { if (!window.location.hostname.startsWith('amp.')) {
let paywall = document.querySelector('meta[content^="FOR SUBSCRIBERS"], #paywall_prompt'); amp_redirect('head > meta[content^="FOR SUBSCRIBERS"], #paywall_prompt');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else { } else {
amp_unhide_subscr_section(); amp_unhide_subscr_section();
} }
@ -666,7 +657,7 @@ else if (matchDomain(['arcinfo.ch', 'lacote.ch', 'lenouvelliste.ch'])) {// Group
removeDOMElement(paywall); removeDOMElement(paywall);
let url_id = window.location.pathname.match(/\d+$/).pop(); let url_id = window.location.pathname.match(/\d+$/).pop();
let html = document.documentElement.outerHTML; let html = document.documentElement.outerHTML;
let og_url = document.querySelector('meta[name="og:url"][content]'); let og_url = document.querySelector('head > meta[name="og:url"][content]');
if (og_url && !og_url.content.endsWith(url_id)) if (og_url && !og_url.content.endsWith(url_id))
refreshCurrentTab(); refreshCurrentTab();
let json; let json;
@ -802,7 +793,7 @@ else if (matchDomain('faz.net')) {
let paywall_z = document.querySelector('.c-red-carpet'); let paywall_z = document.querySelector('.c-red-carpet');
if (paywall_z) { if (paywall_z) {
removeDOMElement(paywall_z); removeDOMElement(paywall_z);
let og_url = document.querySelector('meta[property="og:url"][content]'); let og_url = document.querySelector('head > meta[property="og:url"][content]');
if (og_url) if (og_url)
window.location.href = og_url.content; window.location.href = og_url.content;
} }
@ -1030,12 +1021,7 @@ else if (matchDomain(['noz.de', 'shz.de', 'svz.de'])) {
else if (matchDomain('nw.de')) { else if (matchDomain('nw.de')) {
if (!window.location.pathname.endsWith('.amp.html')) { if (!window.location.pathname.endsWith('.amp.html')) {
let paywall = document.querySelector('div[data-tracking-visible^="paywall-"]'); amp_redirect('div[data-tracking-visible^="paywall-"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else { } else {
amp_unhide_access_hide('="loggedIn AND hasAbo"', '', 'amp-ad, amp-embed, .banner'); amp_unhide_access_hide('="loggedIn AND hasAbo"', '', 'amp-ad, amp-embed, .banner');
} }
@ -1245,13 +1231,7 @@ else if (matchDomain(de_westfalen_medien_domains)) {
if (url.includes('/amp/')) { if (url.includes('/amp/')) {
amp_unhide_subscr_section('amp-ad, amp-embed, section[class^="fp-ad"]'); amp_unhide_subscr_section('amp-ad, amp-embed, section[class^="fp-ad"]');
} else { } else {
let paywall = document.querySelector('.fp-article-paywall'); amp_redirect('section.fp-article-paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall) {
removeDOMElement(paywall);
if (amphtml)
window.location.href = amphtml.href;
}
} }
} }
@ -1371,26 +1351,16 @@ else
} else if (window.location.hostname.match(/\.(es|pt|cat)$/) || matchDomain(['diariocordoba.com', 'diariovasco.com', 'elconfidencial.com', 'elcorreo.com', 'elespanol.com', 'elpais.com', 'elperiodico.com', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info', 'expansion.com', 'larioja.com', 'lavanguardia.com', 'levante-emv.com', 'marca.com', 'mundodeportivo.com', 'politicaexterior.com'])) {//spain/portugal } else if (window.location.hostname.match(/\.(es|pt|cat)$/) || matchDomain(['diariocordoba.com', 'diariovasco.com', 'elconfidencial.com', 'elcorreo.com', 'elespanol.com', 'elpais.com', 'elperiodico.com', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info', 'expansion.com', 'larioja.com', 'lavanguardia.com', 'levante-emv.com', 'marca.com', 'mundodeportivo.com', 'politicaexterior.com'])) {//spain/portugal
if (matchDomain(['ara.cat', 'arabalears.cat'])) { if (matchDomain(['ara.cat', 'arabalears.cat'])) {
let url = window.location.href;
if (!window.location.pathname.endsWith('.amp.html')) { if (!window.location.pathname.endsWith('.amp.html')) {
let paywall = document.querySelector('div.paywall'); amp_redirect('div.paywall');
let amphtml = document.querySelector('link[rel="amphtml"]'); let ads = document.querySelectorAll('div.advertising');
if (paywall && amphtml) { hideDOMElement(...ads);
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} }
} }
else if (matchDomain(['cmjornal.pt', 'record.pt', 'sabado.pt'])) { else if (matchDomain(['cmjornal.pt', 'record.pt', 'sabado.pt'])) {
let paywall = document.querySelector('.bloqueio_exclusivos, .container_assinatura, .bloco_bloqueio'); if (!window.location.pathname.includes('/amp/')) {
let amphtml = document.querySelector('link[rel="amphtml"]'); amp_redirect('.bloqueio_exclusivos, .container_assinatura, .bloco_bloqueio');
let url = window.location.href;
if (!url.includes('/amp/')) {
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else { } else {
amp_unhide_access_hide('="subscriber"', '="NOT subscriber"', 'amp-ad, amp-embed, amp-consent, .detalheAds, .exclusivos_bar'); amp_unhide_access_hide('="subscriber"', '="NOT subscriber"', 'amp-ad, amp-embed, amp-consent, .detalheAds, .exclusivos_bar');
let amp_links = document.querySelectorAll('a[href^="https://www-cmjornal-pt.cdn.ampproject.org/c/s/"]'); let amp_links = document.querySelectorAll('a[href^="https://www-cmjornal-pt.cdn.ampproject.org/c/s/"]');
@ -1442,22 +1412,12 @@ else if (matchDomain(es_unidad_domains)) {
} }
else if (matchDomain('elpais.com')) { else if (matchDomain('elpais.com')) {
let login_register = document.querySelector('.login_register');
if (window.location.pathname.endsWith('.amp.html') || window.location.search.match(/(\?|&)outputType=amp/)) { 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"'); amp_unhide_access_hide('="vip"], [amp-access="success"', '="NOT vip"], [amp-access="NOT success"');
removeDOMElement(login_register);
} else { } else {
let counter = document.querySelector('#counterLayerDiv'); let banners = document.querySelectorAll('div#ctn_freemium_article, div#ctn_premium_article, div.ad');
removeDOMElement(counter); hideDOMElement(...banners);
let amphtml = document.querySelector('link[rel="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, #ctn_premium_article');
removeDOMElement(paywall_offer, ctn_closed_article);
} }
else if (matchDomain('elperiodico.com')) { else if (matchDomain('elperiodico.com')) {
@ -1489,18 +1449,14 @@ else if (matchDomain('elperiodico.com')) {
} }
else if (matchDomain(es_grupo_vocento_domains)) { else if (matchDomain(es_grupo_vocento_domains)) {
let paywall = document.querySelector('.voc-paywall, .container-wall-exclusive, .cierre-suscripcion:not([style*="display: none;"])'); let paywall_sel = '.voc-paywall, .container-wall-exclusive, .cierre-suscripcion:not([style*="display: none;"])';
let paywall = document.querySelector(paywall_sel);
if (!window.location.pathname.endsWith('_amp.html')) { if (!window.location.pathname.endsWith('_amp.html')) {
let amphtml = document.querySelector('link[rel="amphtml"]'); if (!matchDomain(['eldiariomontanes.es'])) {
if (!amphtml && !matchDomain(['eldiariomontanes.es'])) amp_redirect(paywall_sel, '', window.location.pathname.replace('.html', '_amp.html'));
amphtml = {href: window.location.pathname.replace('.html', '_amp.html')};
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
} else {
let banners = document.querySelectorAll('.voc-advertising, div.ev-em-modal, span.mega-superior, .v-adv');
hideDOMElement(...banners);
} }
let banners = document.querySelectorAll('.voc-advertising, div.ev-em-modal, span.mega-superior, .v-adv');
hideDOMElement(...banners);
} else { } else {
amp_unhide_access_hide('="result=\'ALLOW_ACCESS\'"', '="result!=\'ALLOW_ACCESS\'"', 'amp-ad, amp-embed, .v-adv'); amp_unhide_access_hide('="result=\'ALLOW_ACCESS\'"', '="result!=\'ALLOW_ACCESS\'"', 'amp-ad, amp-embed, .v-adv');
removeDOMElement(paywall); removeDOMElement(paywall);
@ -1531,12 +1487,9 @@ else if (matchDomain(['lavanguardia.com', 'mundodeportivo.com'])) {
else if (matchDomain('observador.pt')) { else if (matchDomain('observador.pt')) {
if (!window.location.pathname.endsWith('/amp/')) { if (!window.location.pathname.endsWith('/amp/')) {
let paywall = document.querySelector('.premium-article'); amp_redirect('body.premium-article', {rm_class: "premium-article"});
let amphtml = document.querySelector('link[rel="amphtml"]'); let ads = document.querySelectorAll('div.obs-ad-placeholder');
if (paywall && amphtml) { hideDOMElement(...ads);
paywall.classList.remove('premium-article');
window.location.href = amphtml.href;
}
} else { } else {
amp_unhide_subscr_section('amp-ad, amp-consent, section > .modal'); amp_unhide_subscr_section('amp-ad, amp-consent, section > .modal');
} }
@ -1668,12 +1621,9 @@ else if (matchDomain(fr_be_groupe_rossel)) {
else if (matchDomain(fr_groupe_ebra_domains)) { else if (matchDomain(fr_groupe_ebra_domains)) {
if (!window.location.pathname.startsWith('/amp/')) { if (!window.location.pathname.startsWith('/amp/')) {
let paywall = document.querySelector('div.preview'); amp_redirect('div#paywall-dynamic');
let amphtml = document.querySelector('link[rel="amphtml"]'); let ads = document.querySelectorAll('div.wrapperPub');
if (paywall && amphtml) { hideDOMElement(...ads);
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else { } else {
amp_unhide_access_hide('="access"', '="NOT access"', 'amp-ad, amp-embed'); amp_unhide_access_hide('="access"', '="NOT access"', 'amp-ad, amp-embed');
} }
@ -1684,26 +1634,32 @@ else if (matchDomain(fr_groupe_la_depeche_domains)) {
amp_unhide_subscr_section('amp-ad, amp-embed'); amp_unhide_subscr_section('amp-ad, amp-embed');
} else { } else {
let paywall = document.querySelector('div.paywall'); let paywall = document.querySelector('div.paywall');
let amphtml = document.querySelector('link[rel="amphtml"]'); let amphtml = document.querySelector('head > link[rel="amphtml"]');
if (paywall) { if (paywall) {
removeDOMElement(paywall); removeDOMElement(paywall);
if (amphtml) if (amphtml)
window.location.href = amphtml.href; amp_redirect_not_loop(amphtml);
else { else {
let json_script = getArticleJsonScript(); let json_script = getArticleJsonScript();
if (json_script) { if (json_script) {
let json = JSON.parse(json_script.text); try {
if (json) { let json = JSON.parse(json_script.text);
let json_text = parseHtmlEntities(json.articleBody); if (json[0])
let content = document.querySelector('div.article-full__body-content'); json = json[0];
if (json_text && content) { if (json) {
content.innerHTML = ''; let json_text = parseHtmlEntities(json.articleBody);
let article_new = document.createElement('p'); let content = document.querySelector('div.article-full__body-content');
article_new.innerText = json_text; if (json_text && content) {
content.appendChild(article_new); content.innerHTML = '';
content.removeAttribute('style'); let article_new = document.createElement('p');
content.removeAttribute('data-state'); article_new.innerText = json_text;
content.appendChild(article_new);
content.removeAttribute('style');
content.removeAttribute('data-state');
}
} }
} catch (err) {
console.log(err);
} }
} }
} }
@ -1834,11 +1790,7 @@ else if (matchDomain('leparisien.fr')) {
mask.classList.remove('amp-premium-first-content'); mask.classList.remove('amp-premium-first-content');
} }
} else { } else {
let amphtml = document.querySelector('link[rel="amphtml"]'); amp_redirect('div.paywall');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} }
} }
@ -2026,12 +1978,7 @@ if (matchDomain('corriere.it')) {
else if (matchDomain('corrieredellosport.it')) { else if (matchDomain('corrieredellosport.it')) {
if (!window.location.pathname.startsWith('/amp/')) { if (!window.location.pathname.startsWith('/amp/')) {
let paywall = document.querySelector('div[class^="MainTextTruncated_paragraph__"]'); amp_redirect('div[class^="MainTextTruncated_paragraph__"]');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
let ads = document.querySelectorAll('div[class^="AdUnit_placeholder"]'); let ads = document.querySelectorAll('div[class^="AdUnit_placeholder"]');
hideDOMElement(...ads); hideDOMElement(...ads);
} else { } else {
@ -2103,12 +2050,7 @@ else if (matchDomain('ilfoglio.it')) {
if (window.location.pathname.endsWith('/amp/')) { if (window.location.pathname.endsWith('/amp/')) {
amp_unhide_subscr_section('amp-ad, [class^="adv-"], div#gmpVideoContainer'); amp_unhide_subscr_section('amp-ad, [class^="adv-"], div#gmpVideoContainer');
} else { } else {
let paywall = document.querySelector('div.paywall'); amp_redirect('div.paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
let ads = document.querySelectorAll('.advertisement'); let ads = document.querySelectorAll('.advertisement');
hideDOMElement(...ads); hideDOMElement(...ads);
} }
@ -2176,17 +2118,9 @@ else if (matchDomain(it_quotidiano_domains)) {
if (window.location.pathname.endsWith('/amp') || window.location.search.startsWith('?amp')) { if (window.location.pathname.endsWith('/amp') || window.location.search.startsWith('?amp')) {
amp_unhide_access_hide('="c.customGranted"', '="NOT c.customGranted"', 'amp-ad, amp-embed, amp-fx-flying-carpet, .watermark-adv, .amp__watermark'); amp_unhide_access_hide('="c.customGranted"', '="NOT c.customGranted"', 'amp-ad, amp-embed, amp-fx-flying-carpet, .watermark-adv, .amp__watermark');
} else { } else {
let paywall = document.querySelector('div[data-testid="paywall-container"], div[class^="Paywall_paywall_"]'); amp_redirect('div[data-testid="paywall-container"], div[class^="Paywall_paywall_"]', '', window.location.pathname + '/amp');
let amphtml = document.querySelector('link[rel="amphtml"]'); let ads = document.querySelectorAll('div[id^="div-gpt-ad"]');
if (!amphtml) hideDOMElement(...ads);
amphtml = {href: window.location.pathname + '/amp'};
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
} else {
let ads = document.querySelectorAll('div[id^="div-gpt-ad"]');
hideDOMElement(...ads);
}
} }
} }
@ -2220,12 +2154,7 @@ else if (matchDomain('italiaoggi.it')) {
else if (matchDomain(it_gedi_domains)) { else if (matchDomain(it_gedi_domains)) {
if (matchDomain('espresso.repubblica.it')) { if (matchDomain('espresso.repubblica.it')) {
if (!window.location.pathname.match(/\amp(\/)?$/)) { if (!window.location.pathname.match(/\amp(\/)?$/)) {
let paywall = document.querySelector('div#paywall'); amp_redirect('div#paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else { } else {
amp_unhide_access_hide('="showContent"', '="NOT (showContent)"', 'amp-ad, amp-embed'); amp_unhide_access_hide('="showContent"', '="NOT (showContent)"', 'amp-ad, amp-embed');
let logo = document.querySelector('div.logo-container > a'); let logo = document.querySelector('div.logo-container > a');
@ -3250,12 +3179,7 @@ else if (matchDomain('elespectador.com')) {
if (window.location.search.match(/(\?|&)outputType=amp/)) { if (window.location.search.match(/(\?|&)outputType=amp/)) {
amp_unhide_subscr_section('amp-ad, amp-embed, [class^="Widget"], amp-fx-flying-carpet'); amp_unhide_subscr_section('amp-ad, amp-embed, [class^="Widget"], amp-fx-flying-carpet');
} else { } else {
let paywall = document.querySelector('div.exclusive_validation'); amp_redirect('div.exclusive_validation');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} }
} }
@ -3314,12 +3238,7 @@ else if (matchDomain('eltribuno.com')) {
else if (matchDomain('em.com.br')) { else if (matchDomain('em.com.br')) {
if (!window.location.pathname.endsWith('/amp.html')) { if (!window.location.pathname.endsWith('/amp.html')) {
let paywall = document.querySelector('.news-blocked-content'); amp_redirect('.news-blocked-content');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
let ads = document.querySelectorAll('.ads, .containerads'); let ads = document.querySelectorAll('.ads, .containerads');
hideDOMElement(...ads); hideDOMElement(...ads);
} else { } else {
@ -3392,12 +3311,7 @@ else if (matchDomain('lasegunda.com')) {
else if (matchDomain('globo.com')) { else if (matchDomain('globo.com')) {
if (matchDomain('valor.globo.com')) { if (matchDomain('valor.globo.com')) {
if (!window.location.pathname.startsWith('/google/amp/')) { if (!window.location.pathname.startsWith('/google/amp/')) {
let paywall = document.querySelector('div.paywall'); amp_redirect('div.paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else { } else {
amp_unhide_subscr_section('amp-ad, amp-embed'); amp_unhide_subscr_section('amp-ad, amp-embed');
let amp_images = document.querySelectorAll('figure > amp-img[src^="https://"]'); let amp_images = document.querySelectorAll('figure > amp-img[src^="https://"]');
@ -3432,7 +3346,7 @@ else if (matchDomain('revistaoeste.com')) {
} }
} }
else if (window.location.hostname.endsWith('.cl') && document.querySelector('meta[property="og:image"][content*="://impresa.soy-chile.cl/"]')) { else if (window.location.hostname.endsWith('.cl') && document.querySelector('head > meta[property="og:image"][content*="://impresa.soy-chile.cl/"]')) {
window.setTimeout(function () { window.setTimeout(function () {
let content = document.querySelector('div.content'); let content = document.querySelector('div.content');
if (content) if (content)
@ -3455,14 +3369,7 @@ if (matchDomain(usa_adv_local_domains)) {
let amp_ads = document.querySelectorAll('.amp-ad-container, amp-embed'); let amp_ads = document.querySelectorAll('.amp-ad-container, amp-embed');
hideDOMElement(...amp_ads); hideDOMElement(...amp_ads);
} else { } else {
let paywall = document.querySelector('.paywall'); amp_redirect('div.paywall', '', window.location.pathname + '?outputType=amp');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (!amphtml)
amphtml = {href: window.location.pathname + '?outputType=amp'};
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
let ads = document.querySelectorAll('div.ad'); let ads = document.querySelectorAll('div.ad');
hideDOMElement(...ads); hideDOMElement(...ads);
} }
@ -3546,7 +3453,7 @@ else if (matchDomain('barrons.com')) {
let url = window.location.href; let url = window.location.href;
if (!url.includes('barrons.com/amp/')) { if (!url.includes('barrons.com/amp/')) {
let body_continuous = document.querySelector('body.is-continuous'); let body_continuous = document.querySelector('body.is-continuous');
let snippet = document.querySelector('meta[content="snippet"]'); let snippet = document.querySelector('head > meta[content="snippet"]');
if (body_continuous && snippet) { if (body_continuous && snippet) {
removeDOMElement(snippet); removeDOMElement(snippet);
window.location.href = url.replace('barrons.com', 'barrons.com/amp'); window.location.href = url.replace('barrons.com', 'barrons.com/amp');
@ -3784,13 +3691,13 @@ else if (matchDomain('economictimes.com')) {
window.setTimeout(function () { window.setTimeout(function () {
let paywall = document.querySelector('div#blocker_layer'); let paywall = document.querySelector('div#blocker_layer');
let data_prime = document.querySelector('div[data-prime="1"]'); let data_prime = document.querySelector('div[data-prime="1"]');
let amphtml = document.querySelector('link[rel="amphtml"]'); let amphtml = document.querySelector('head > link[rel="amphtml"]');
if (paywall || data_prime) { if (paywall || data_prime) {
removeDOMElement(paywall); removeDOMElement(paywall);
if (data_prime) if (data_prime)
data_prime.removeAttribute('data-prime'); data_prime.removeAttribute('data-prime');
if (amphtml) if (amphtml)
window.location.href = amphtml.href; amp_redirect_not_loop(amphtml);
else if (window.location.pathname.startsWith('/epaper/')) else if (window.location.pathname.startsWith('/epaper/'))
window.location.href = 'https://economictimes.indiatimes.com' + window.location.pathname; window.location.href = 'https://economictimes.indiatimes.com' + window.location.pathname;
} else { } else {
@ -4032,12 +3939,7 @@ else if (matchDomain('hindustantimes.com')) {
else if (matchDomain('hindutamil.in')) { else if (matchDomain('hindutamil.in')) {
if (!window.location.pathname.startsWith('/amp/')) { if (!window.location.pathname.startsWith('/amp/')) {
let paywall = document.querySelector('div.premium-class-bt'); amp_redirect('div.premium-class-bt');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} }
} }
@ -4093,12 +3995,7 @@ else if (matchDomain('indiatoday.in')) {
if (window.location.pathname.match(/(\/amp)?\/magazine\//)) { if (window.location.pathname.match(/(\/amp)?\/magazine\//)) {
let url = window.location.href; let url = window.location.href;
if (!url.includes('/amp/')) { if (!url.includes('/amp/')) {
let paywall = document.querySelector('#csc-paywall'); amp_redirect('div#csc-paywall');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else { } else {
amp_unhide_access_hide('="granted"', '="NOT NOT granted"', 'amp-ad, amp-embed'); amp_unhide_access_hide('="granted"', '="NOT NOT granted"', 'amp-ad, amp-embed');
} }
@ -4259,12 +4156,7 @@ else if (matchDomain('magazine.atavist.com')) {
else if (matchDomain('marketwatch.com')) { else if (matchDomain('marketwatch.com')) {
if (!window.location.pathname.startsWith('/amp/')) { if (!window.location.pathname.startsWith('/amp/')) {
let paywall = document.querySelector('div#cx-snippet'); amp_redirect('div#cx-snippet');
let amphtml = document.querySelector('link[rel="amphtml"]');
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else { } else {
let meter = document.querySelector('div.meter'); let meter = document.querySelector('div.meter');
let container_sponsored = document.querySelector('div.container--sponsored'); let container_sponsored = document.querySelector('div.container--sponsored');
@ -4290,16 +4182,10 @@ else if (matchDomain('mid-day.com')) {
if (window.location.pathname.startsWith('/amp/')) { if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_access_hide('="granted"', '="NOT granted"', 'amp-ad, amp-embed, [class*="BannerAd"]'); amp_unhide_access_hide('="granted"', '="NOT granted"', 'amp-ad, amp-embed, [class*="BannerAd"]');
} else { } else {
let paywall = document.querySelector('div#widget-_csc'); amp_redirect('div#widget-_csc');
let amphtml = document.querySelector('link[rel="amphtml"]'); let read_more = document.querySelector('#read-more-my');
if (paywall && amphtml) { if (read_more)
removeDOMElement(paywall); read_more.click();
window.location.href = amphtml.href;
} else {
let read_more = document.querySelector('#read-more-my');
if (read_more)
read_more.click();
}
} }
} }
@ -4605,16 +4491,10 @@ else if (matchDomain('seattletimes.com')) {
else if (matchDomain('seekingalpha.com')) { else if (matchDomain('seekingalpha.com')) {
if (!window.location.pathname.startsWith('/amp/')) { if (!window.location.pathname.startsWith('/amp/')) {
let locked = document.querySelector('div[data-test-id="post-locked-banner"]'); amp_redirect('div[data-test-id="post-locked-banner"]', {rm_attrib: "data-test-id"});
let amphtml = document.querySelector('link[rel="amphtml"]'); let read_more = document.querySelector('button[id^="continueReadingButton"]');
if (locked && amphtml) { if (read_more)
locked.removeAttribute('data-test-id'); read_more.click();
window.location.href = amphtml.href;
} else {
let read_more = document.querySelector('button[id^="continueReadingButton"]');
if (read_more)
read_more.click();
}
} else { } else {
amp_unhide_access_hide('*="premium_access OR"', '', '.ad-wrap'); amp_unhide_access_hide('*="premium_access OR"', '', '.ad-wrap');
let paywall = document.querySelector('[class*="paywall-container"]'); let paywall = document.querySelector('[class*="paywall-container"]');
@ -5364,14 +5244,7 @@ else if (matchDomain(timesofindia_domains)) {
overflow.removeAttribute('style'); overflow.removeAttribute('style');
} }
if (!window.location.pathname.includes('/amp_')) { if (!window.location.pathname.includes('/amp_')) {
let paywall = document.querySelector('div[id^="story-blocker"]'); amp_redirect('div[id^="story-blocker"]', '', url.replace('/timesofindia.indiatimes.com/', '/m.timesofindia.com/').replace('/articleshow/', '/amp_articleshow/'));
let amphtml = document.querySelector('link[rel="amphtml"]');
if (!amphtml)
amphtml = {href: url.replace('/timesofindia.indiatimes.com/', '/m.timesofindia.com/').replace('/articleshow/', '/amp_articleshow/')};
if (paywall && amphtml) {
removeDOMElement(paywall);
window.location.href = amphtml.href;
}
} else { } else {
let amp_images = document.querySelectorAll('div.inline-image > div.inline-imgecontent > amp-img[src]'); let amp_images = document.querySelectorAll('div.inline-image > div.inline-imgecontent > amp-img[src]');
for (let amp_image of amp_images) { for (let amp_image of amp_images) {
@ -5438,7 +5311,7 @@ else if (matchDomain(uk_incisive_media_domains)) {
if (paywall) { if (paywall) {
removeDOMElement(paywall); removeDOMElement(paywall);
csDoneOnce = true; csDoneOnce = true;
let live_blog = document.querySelector('meta[name="description"][content^="In this live blog"]'); let live_blog = document.querySelector('head > meta[name="description"][content^="In this live blog"]');
let article_sel = 'div.article-content'; let article_sel = 'div.article-content';
let article = document.querySelector('div.article-content'); let article = document.querySelector('div.article-content');
if (article) { if (article) {
@ -5549,11 +5422,11 @@ else if (matchDomain('wsj.com')) {
if (window.location.pathname.startsWith('/livecoverage/')) { if (window.location.pathname.startsWith('/livecoverage/')) {
window.setTimeout(function () { window.setTimeout(function () {
let paywall = document.querySelector('div#cx-lc-snippet'); let paywall = document.querySelector('div#cx-lc-snippet');
let amphtml = document.querySelector('link[rel="amphtml"]'); let amphtml = document.querySelector('head > link[rel="amphtml"]');
if (paywall) { if (paywall) {
removeDOMElement(paywall); removeDOMElement(paywall);
if (amphtml) { if (amphtml) {
window.location.href = amphtml.href; amp_redirect_not_loop(amphtml);
} else if (window.location.pathname.includes('/card/')) { } else if (window.location.pathname.includes('/card/')) {
let article = document.querySelector('div > div[class*="-ParagraphContainer"]'); let article = document.querySelector('div > div[class*="-ParagraphContainer"]');
if (article) { if (article) {
@ -5576,7 +5449,7 @@ else if (matchDomain('wsj.com')) {
masthead_link.href = 'https://www.wsj.com'; masthead_link.href = 'https://www.wsj.com';
} else { } else {
let snippet = document.querySelector('.snippet-promotion, div#cx-snippet-overlay'); let snippet = document.querySelector('.snippet-promotion, div#cx-snippet-overlay');
let wsj_pro = document.querySelector('meta[name="page.site"][content="wsjpro"]'); let wsj_pro = document.querySelector('head > meta[name="page.site"][content="wsjpro"]');
if (snippet || wsj_pro) { if (snippet || wsj_pro) {
removeDOMElement(snippet, wsj_pro); removeDOMElement(snippet, wsj_pro);
if (!matchDomain('www.wsj.com')) { if (!matchDomain('www.wsj.com')) {
@ -5805,12 +5678,12 @@ function matchUrlDomain(domains, url) {
return matchDomain(domains, urlHost(url)); return matchDomain(domains, urlHost(url));
} }
function header_nofix(header) { function header_nofix(header, msg = 'BPC > no fix') {
if (header) { if (header) {
let nofix_div = document.createElement('div'); let nofix_div = document.createElement('div');
nofix_div.setAttribute('style', 'margin: 20px; font-weight: bold; color: red;'); nofix_div.setAttribute('style', 'margin: 20px; font-weight: bold; color: red;');
nofix_div.innerText = 'BPC > no fix'; nofix_div.innerText = msg;
header.appendChild(nofix_div); header.before(nofix_div);
} }
} }
@ -5908,6 +5781,35 @@ function amp_iframes_replace(weblink = false, source = '') {
} }
} }
function amp_redirect_not_loop(amphtml) {
let amp_redirect_date = Number(sessionStorage.getItem('###_amp_redirect'));
if (!(amp_redirect_date && Date.now() - amp_redirect_date < 2000)) {
sessionStorage.setItem('###_amp_redirect', Date.now());
window.location.href = amphtml.href;
} else {
let header = (document.body && document.body.firstChild) || document.documentElement;
header_nofix(header, 'BPC > redirect to amp failed (disable amp-to-html extension/add-on or browser setting)');
}
}
function amp_redirect(paywall_sel, paywall_action = '', amp_url = '') {
let paywall = document.querySelector(paywall_sel);
let amphtml = document.querySelector('head > link[rel="amphtml"]');
if (!amphtml && amp_url)
amphtml = {href: amp_url};
if (paywall && amphtml) {
if (!paywall_action)
removeDOMElement(paywall);
else {
if (paywall_action.rm_class)
paywall.classList.remove(paywall_action.rm_class);
else if (paywall_action.rm_attrib)
paywall.removeAttribute(paywall_action.rm_attrib);
}
amp_redirect_not_loop(amphtml);
}
}
function amp_unhide_subscr_section(amp_ads_sel = 'amp-ad, .ad', replace_iframes = true, amp_iframe_link = false, source = '') { function amp_unhide_subscr_section(amp_ads_sel = 'amp-ad, .ad', replace_iframes = true, amp_iframe_link = false, source = '') {
let preview = document.querySelectorAll('[subscriptions-section="content-not-granted"]'); let preview = document.querySelectorAll('[subscriptions-section="content-not-granted"]');
removeDOMElement(...preview); removeDOMElement(...preview);

View file

@ -51,5 +51,5 @@
"webRequestBlocking", "webRequestBlocking",
"*://*/*" "*://*/*"
], ],
"version": "3.3.5.6" "version": "3.3.5.7"
} }

View file

@ -796,5 +796,5 @@
"*://*.wyleex.com/*", "*://*.wyleex.com/*",
"*://webcache.googleusercontent.com/*" "*://webcache.googleusercontent.com/*"
], ],
"version": "3.3.5.6" "version": "3.3.5.7"
} }

View file

@ -188,7 +188,7 @@ var defaultSites = {
"watoday.com.au" "watoday.com.au"
], ],
allow_cookies: 1, allow_cookies: 1,
block_regex: "(api\\.{domain}\\/graphql\\?query=.+PaywallRuleQuery|cdn\\.ampproject\\.org\\/v\\d\\/amp-subscriptions-.+\\.js)" block_regex: "(api\\.{domain}\\/graphql\\?query=.+PaywallRuleQuery|\\.tinypass\\.com\\/|cdn\\.ampproject\\.org\\/v\\d\\/amp-subscriptions-.+\\.js)"
}, },
"Auto Motor und Sport": { "Auto Motor und Sport": {
domain: "auto-motor-und-sport.de", domain: "auto-motor-und-sport.de",