Add ElMundo.es (amp for premium)

This commit is contained in:
magnolia1234 2020-05-25 21:01:41 +02:00
parent 8296a94902
commit 50a6d95fae
5 changed files with 24 additions and 0 deletions

View file

@ -205,6 +205,7 @@ Install add-on by downloading xpi-file.
[Volkskrant](https://www.volkskrant.nl) -
[Vrij Nederland](https://www.vn.nl)
##### Spain
[El Mundo](https://www.elmundo.es) -
[El País](https://elpais.com)
##### Sweden
[Aftonbladet](https://www.aftonbladet.se) -

View file

@ -156,6 +156,7 @@ var blockedRegexes = {
'economist.com': /(.+\.tinypass\.com\/.+|economist\.com\/engassets\/_next\/static\/chunks\/framework.+\.js)/,
'elcomercio.pe': /elcomercio\.pe\/pf\/dist\/template\/elcomercio-noticia.+\.js/,
'elmercurio.com': /merreader\.emol\.cl\/assets\/js\/vendor\/modal\.js/,
'elmundo.es': /cdn\.ampproject\.org\/v\d\/amp-access-.+\.js/,
'elpais.com': /.+\.epimg\.net\/js\/.+\/noticia\.min\.js/,
'exame.abril.com.br': /.+\.tinypass\.com\/.+/,
'folha.uol.com.br': /.+\.folha\.uol\.com\.br\/paywall\/js\/.+\/publicidade\.ads\.js/,

View file

@ -636,6 +636,25 @@ else if (matchDomain('lejdd.fr')) {
}
}
else if (matchDomain('elmundo.es')) {
let premium = document.querySelector('.ue-c-article__premium');
window.setTimeout(function () {
if (premium && window.location.href.includes('/www.elmundo.es/')) {
window.location.href = window.location.href.replace('/www.', '/amp.');
}
}, 500); // Delay (in milliseconds)
if (window.location.href.includes('/amp.elmundo.es/')) {
let paywall = document.querySelector('div[amp-access="authorized!=true"]');
if (paywall) {
removeDOMElement(paywall);
let div_hidden = document.querySelector('div[amp-access="authorized=true"]');
if (div_hidden) {
div_hidden.removeAttribute('amp-access-hide');
}
}
}
}
// General Functions
function removeDOMElement(...elements) {
for (let element of elements) {

View file

@ -90,6 +90,7 @@
"*://*.economist.com/*",
"*://*.elcomercio.pe/*",
"*://*.elmercurio.com/*",
"*://*.elmundo.es/*",
"*://*.elpais.com/*",
"*://*.estadao.com.br/*",
"*://*.eurekareport.com.au/*",
@ -236,6 +237,7 @@
"*://*.poool.fr/*",
"*://*.tinypass.com/*",
"*://*.piano.io/*",
"*://*.ampproject.org/*",
"*://*.blueconic.net/*",
"*://*.cedsdigital.it/*",
"*://*.corriereobjects.it/*",

View file

@ -31,6 +31,7 @@ var defaultSites =
"Digiday": "digiday.com",
"El Comercio": "elcomercio.pe",
"El Mercurio": "elmercurio.com",
"El Mundo": "elmundo.es",
"El País": "elpais.com",
"Encyclopedia Britannica": "britannica.com",
"Eureka Report": "eurekareport.com.au",