From a5526e436b96ea2958474a6f5607c52dd8caffef Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Sat, 22 Jan 2022 18:37:56 +0100 Subject: [PATCH] Fix El Pais (menu subdomains) --- README.md | 2 +- background.js | 10 +++++++--- changelog.txt | 1 + contentScript.js | 8 ++++---- sites.js | 2 +- sites_updated.json | 28 ++++++---------------------- 6 files changed, 20 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index bbde21d7..a64228c3 100644 --- a/README.md +++ b/README.md @@ -597,7 +597,7 @@ Grouped in options:\ #### East Asia [Asia Times](https://asiatimes.com) - -[CommonWealth Magazine Taiwan](https://www.cw.com.tw) - +[CommonWealth Magazine Taiwan](https://www.cw.com.tw)* - [DealStreetAsia](https://www.dealstreetasia.com) - [Harvard Business Review China](https://www.hbrchina.org) - [Harvard Business Review Taiwan](https://www.hbrtaiwan.com) - diff --git a/background.js b/background.js index db6e575f..3effd182 100644 --- a/background.js +++ b/background.js @@ -21,7 +21,7 @@ var restrictions = { 'bloomberg.com': /^((?!\.bloomberg\.com\/news\/terminal\/).)*$/, 'economictimes.com': /\.economictimes\.com($|\/($|(__assets|prime)(\/.+)?|.+\.cms))/, 'elespanol.com': /^((?!\/cronicaglobal\.elespanol\.com\/).)*$/, - 'elpais.com': /(\/elpais\.com\/$|(static|imagenes(\.\w+)?)\.elpais\.com|\/(.+\.)?elpais\.com\/.+\.html)/, + '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\/).)*$/, @@ -39,6 +39,10 @@ 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']) + restrictions[domain] = new RegExp('((\\/|\\.)' + domain.replace(/\./g, '\\.') + '\\/$|' + restrictions[domain].toString().replace(/(^\/|\/$)/g, '') + ')'); +} // Don't remove cookies before/after page load var allow_cookies = []; @@ -598,7 +602,7 @@ ext_api.webRequest.onHeadersReceived.addListener(function (details) { ['blocking', 'responseHeaders']); // block inline script -var block_js_inline = ["*://elviajero.elpais.com/*", "*://retina.elpais.com/*", "*://verne.elpais.com/*", "*://*.medianama.com/*"]; +var block_js_inline = ["*://*.medianama.com/*"]; ext_api.webRequest.onHeadersReceived.addListener(function (details) { if (!isSiteEnabled(details)) { return; @@ -686,7 +690,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { break; } } - var blocked_referer_domains = ['foreignaffairs.com', 'timeshighereducation.com']; + var blocked_referer_domains = ['elpais.com', '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)) { diff --git a/changelog.txt b/changelog.txt index d95bda0d..facf3bde 100644 --- a/changelog.txt +++ b/changelog.txt @@ -8,6 +8,7 @@ Fix Asia Times Fix Cairns Post, Code Sports & The Advertiser Fix Challenges.fr Fix Clarin +Fix El Pais (menu subdomains) Fix The New Yorker (update) * v2.5.2.0 (2022-01-16) diff --git a/contentScript.js b/contentScript.js index d29320c5..82b3a51c 100644 --- a/contentScript.js +++ b/contentScript.js @@ -189,9 +189,9 @@ else if (domain = matchDomain(["brisbanetimes.com.au", "smh.com.au", "theage.com else { // Australian Community Media newspapers - let au_cm_sites = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'portnews.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au', 'westernadvocate.com.au']; + let au_comm_media_domains = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'portnews.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au', 'westernadvocate.com.au']; let au_piano_script = document.querySelector('script[src="https://cdn-au.piano.io/api/tinypass.min.js"]'); - if (matchDomain(au_cm_sites) || au_piano_script) { + if (matchDomain(au_comm_media_domains) || au_piano_script) { let subscribe_truncate = document.querySelector('.subscribe-truncate'); if (subscribe_truncate) subscribe_truncate.classList.remove('subscribe-truncate'); @@ -206,8 +206,8 @@ else { removeDOMElement(story_generic_iframe, blocker); } else if (window.location.hostname.endsWith('.com.au')) { // Australia News Corp - let au_nc_sites = ['adelaidenow.com.au', 'cairnspost.com.au', 'codesports.com.au', 'couriermail.com.au', 'dailytelegraph.com.au', 'geelongadvertiser.com.au', 'goldcoastbulletin.com.au', 'heraldsun.com.au', 'ntnews.com.au', 'theaustralian.com.au', 'thechronicle.com.au', 'themercury.com.au', 'townsvillebulletin.com.au', 'weeklytimesnow.com.au']; - if (domain = matchDomain(au_nc_sites)) { + let au_news_corp_domains = ['adelaidenow.com.au', 'cairnspost.com.au', 'codesports.com.au', 'couriermail.com.au', 'dailytelegraph.com.au', 'geelongadvertiser.com.au', 'goldcoastbulletin.com.au', 'heraldsun.com.au', 'ntnews.com.au', 'theaustralian.com.au', 'thechronicle.com.au', 'themercury.com.au', 'townsvillebulletin.com.au', 'weeklytimesnow.com.au']; + if (domain = matchDomain(au_news_corp_domains)) { let header_ads = document.querySelector('.header_ads-container'); removeDOMElement(header_ads); let amp_ads_sel = 'amp-ad, amp-embed, [id^="ad-mrec-"], .story-ad-container'; diff --git a/sites.js b/sites.js index d485d2be..9ab1dfa1 100644 --- a/sites.js +++ b/sites.js @@ -245,7 +245,7 @@ var defaultSites = { domain: "commentary.org", block_regex: /\.commentary\.org\/.+\/js\/dg-locker-public\.js/ }, - "CommonWealth Magazine Taiwan": { + "CommonWealth Magazine Taiwan (free articles only)": { domain: "cw.com.tw" }, "Correio da Manhã": { diff --git a/sites_updated.json b/sites_updated.json index 9020c697..607329f5 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -1,26 +1,4 @@ { - "Australia News Corp": { - "domain": "###_au_news_corp", - "group": [ - "adelaidenow.com.au", - "cairnspost.com.au", - "codesports.com.au", - "couriermail.com.au", - "dailytelegraph.com.au", - "geelongadvertiser.com.au", - "goldcoastbulletin.com.au", - "heraldsun.com.au", - "ntnews.com.au", - "theaustralian.com.au", - "thechronicle.com.au", - "themercury.com.au", - "townsvillebulletin.com.au", - "weeklytimesnow.com.au" - ], - "allow_cookies": 1, - "useragent": "googlebot", - "block_regex": "(\\.com\\.au\\/remote\\/identity\\/rampart\\/latest\\/rampart\\.js|cdn\\.ampproject\\.org\\/v\\d\\/amp-(access|ad)-.+\\.js)" - }, "Clarín": { "domain": "clarin.com", "allow_cookies": 1, @@ -30,6 +8,12 @@ "domain": "huffingtonpost.it", "group_rule": "###_gr_it_repubblica_domains" }, + "###_gr_it_repubblica_domains": { + "group_rule_domains": ["gelocal.it", "huffingtonpost.it", "ilsecoloxix.it", "italian.tech", "lanuovasardegna.it", "lastampa.it", "lescienze.it", "limesonline.com", "repubblica.it"], + "allow_cookies": 1, + "block_regex": "(scripts\\.repubblica\\.it\\/pw\\/pw\\.js|cdn\\.ampproject\\.org\\/v\\d\\/amp-(access|ad|user-notification)-.+\\.js)", + "useragent": "googlebot" + }, "Mainichi Shimbun": { "domain": "mainichi.jp", "allow_cookies": 1,