diff --git a/README.md b/README.md index d630431..1b2fc5b 100644 --- a/README.md +++ b/README.md @@ -289,6 +289,7 @@ So don't update to Firefox 79 or use F-droid's [Fennec-release](https://f-droid. [Valor Econômico](https://valor.globo.com)* ##### Chile [El Mercurio](https://digital.elmercurio.com) - +[El Mercurio de Valparaíso](https://www.mercuriovalpo.cl) - [La Segunda](https://digital.lasegunda.com) - [La Tercera](https://www.latercera.com) ##### Mexico diff --git a/background.js b/background.js index 78f749c..987b505 100644 --- a/background.js +++ b/background.js @@ -29,6 +29,7 @@ var allow_cookies = [ 'dn.se', 'dvhn.nl', 'elmercurio.com', +'mercuriovalpo.cl', 'eurekareport.com.au', 'faz.net', 'folha.uol.com.br', @@ -184,6 +185,7 @@ var blockedRegexes = { 'livemint.com': /(.+\.livemint\.com\/js\/localWorker\.js|analytics\.htmedia\.in\/analytics-js\/.+\.js)/, 'lopinion.fr': /.+\.poool\.fr\/.+/, 'lrb.co.uk': /.+\.tinypass\.com\/.+/, +'mercuriovalpo.cl': /(.+\.mercuriovalpo\.cl\/impresa\/wp-content\/themes\/papel-digital-2019-desktop\/assets\/(vendor|\d)\.js|pram\.pasedigital\.cl\/API\/User\/Status\?)/, 'modernhealthcare.com': /.+\.tinypass\.com\/.+/, 'nationalgeographic.com': /.+\.blueconic\.net\/.+/, 'nationalreview.com': /.+\.blueconic\.net\/.+/, @@ -569,21 +571,24 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { }); } - if (tabId !== -1) { - ext_api.tabs.get(tabId, function (currentTab) { - if (isSiteEnabled(currentTab) || medium_custom_domain) { + ext_api.tabs.query({ + active: true, + currentWindow: true + }, function (tabs) { + if (tabs.length > 0 && tabs[0].url && tabs[0].url.indexOf("http") !== -1) { + if (isSiteEnabled({url: tabs[0].url}) || medium_custom_domain) { // run contentScript inside tab - ext_api.tabs.executeScript(tabId, { + ext_api.tabs.executeScript({ file: 'contentScript.js', runAt: 'document_start' - }, function(res) { + }, function (res) { if (ext_api.runtime.lastError || res[0]) { return; } }); } - }); - } + } + }); return { requestHeaders: requestHeaders }; }, { diff --git a/contentScript.js b/contentScript.js index ef9f0e2..5e8fd2a 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1011,6 +1011,17 @@ else if (matchDomain("limesonline.com")) { }, 500); // Delay (in milliseconds) } +else if (matchDomain("mercuriovalpo.cl")) { + let content = document.querySelector('div.content'); + if (content) + content.setAttribute('id', 'content_new'); + let modal_wrapper = document.querySelector('div.modal-wrapper'); + removeDOMElement(modal_wrapper); + let body_modal = document.querySelector('body.modal-open'); + if (body_modal) + body_modal.classList.remove('modal-open'); +} + // General Functions function removeDOMElement(...elements) { for (let element of elements) { diff --git a/lp/manifest.json b/lp/manifest.json index f2e37af..058c49d 100644 --- a/lp/manifest.json +++ b/lp/manifest.json @@ -159,6 +159,7 @@ "*://*.lrb.co.uk/*", "*://*.mcall.com/*", "*://*.medium.com/*", + "*://*.mercuriovalpo.cl/*", "*://*.mercurynews.com/*", "*://*.mexiconewsdaily.com/*", "*://*.miamiherald.com/*", diff --git a/sites.js b/sites.js index 604d324..da7194c 100644 --- a/sites.js +++ b/sites.js @@ -38,6 +38,7 @@ var defaultSites = "Discover Magazine": "discovermagazine.com", "El Comercio": "elcomercio.pe", "El Mercurio": "elmercurio.com", + "El Mercurio de Valparaíso": "mercuriovalpo.cl", "El Mundo": "elmundo.es", "El País": "elpais.com", "Encyclopedia Britannica": "britannica.com",