From 6cde95d49a74586e7769c22b9d68d447b3d2fffa Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Fri, 8 Oct 2021 08:11:56 +0200 Subject: [PATCH] Fix El Pais (redirect on video only) --- background.js | 2 +- contentScript.js | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/background.js b/background.js index d8b0abc..2d9e7c5 100644 --- a/background.js +++ b/background.js @@ -308,7 +308,7 @@ var blockedRegexes = { 'elconfidencial.com': /\.tinypass\.com\//, 'elespanol.com': /\.eestatic\.com\/assets_js\/web\/v\d\/historia.*\.min\.js/, 'elmercurio.com': /\.(elmercurio\.com|emol\.cl)\/(.+\/)?js\/(.+\/)?(modal|merPramV\d|PramModal\.min)\.js/, - 'elpais.com': /(\/elpais\.com\/arc\/subs\/p\.min\.js|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|consent)-.+\.js)/, + 'elpais.com': /(\.epimg\.net\/js\/.+\/(noticia|user)\.min\.js|\/elpais\.com\/arc\/subs\/p\.min\.js|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|consent)-.+\.js)/, 'elperiodico.com': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/, 'estadao.com.br': /acesso\.estadao\.com\.br\/paywall\/.+\/.+\.js/, 'estrellavalpo.cl': /(\.mercuriovalpo\.cl\/impresa\/.+\/assets\/(vendor|\d)\.js|pram\.pasedigital\.cl\/API\/User\/Status\?)/, diff --git a/contentScript.js b/contentScript.js index e525cab..3a12574 100644 --- a/contentScript.js +++ b/contentScript.js @@ -686,7 +686,7 @@ else if (domain = matchDomain(es_unidad_domains)) { else if (matchDomain('elpais.com')) { let url = window.location.href; - let login_register = document.querySelector('.login_register, #ctn_closed_article'); + let login_register = document.querySelector('.login_register'); if (url.includes('.amp.html') || url.includes('?outputType=amp')) { let preview = document.querySelector('div[amp-access="NOT success"]'); let paywall = document.querySelectorAll('div[amp-access="success"][amp-access-hide]'); @@ -697,14 +697,16 @@ else if (matchDomain('elpais.com')) { } else { let counter = document.querySelector('#counterLayerDiv'); removeDOMElement(counter); - let amphtml = document.querySelector('link[rel="amphtml"]'); - if (login_register && amphtml) { - removeDOMElement(login_register); + let video = document.querySelector('div.videoTop') + let amphtml = document.querySelector('link[rel="amphtml"]'); + if ((login_register || video) && amphtml) { + removeDOMElement(login_register, video); window.location.href = amphtml.href; } } let paywall_offer = document.querySelector('.paywallOffer'); - removeDOMElement(paywall_offer); + let ctn_closed_article = document.querySelector('#ctn_closed_article'); + removeDOMElement(paywall_offer, ctn_closed_article); } else if (matchDomain('elperiodico.com')) {