From 125da7daf5005e68ebecf3ea9f9a70665e462de5 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 16 Aug 2021 22:49:46 +0200 Subject: [PATCH] Add MediaNews Group (local USA) --- README.md | 21 ++++++++++++--------- background.js | 24 +++++++++++++++++++++--- changelog.txt | 1 + contentScript.js | 13 +++++++++++++ custom/manifest.json | 2 +- manifest.json | 5 ++++- sites.js | 7 +++---- 7 files changed, 55 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index dbdd798..8119b13 100755 --- a/README.md +++ b/README.md @@ -184,7 +184,6 @@ NHST Media Group sites like [Mountain View Voice](https://www.mv-voice.com) - [New York Magazine](https://www.nymag.com) (+ [Curbed](https://www.curbed.com/), [Grub Street](https://www.grubstreet.com), [The Cut](https://www.thecut.com) & [Vulture](https://www.vulture.com)) - [Newsday](https://www.newsday.com) - -[Orange County Register](https://www.ocregister.com) - [Palo Alto Online](https://www.paloaltoonline.com) - [Pittsburgh Post Gazette](https://post-gazette.com) - [San Diego Union Tribune](https://sandiegouniontribune.com) - @@ -193,26 +192,23 @@ NHST Media Group sites like [The Atlanta Journal-Constitution](https://www.ajc.com) - [The Boston Globe](https://www.bostonglobe.com) - [The Dallas Morning News](https://www.dallasnews.com) - -[The Denver Post](https://www.denverpost.com) - -[The Mercury News](https://www.mercurynews.com) - [The Seattle Times](https://www.seattletimes.com) - [The Philadelphia Inquirer](https://www.inquirer.com) - [Winston-Salem Journal](https://www.journalnow.com) [USA Today](https://www.usatoday.com)\ Grouped in options:\ -Gannett Group (local USA Today) sites like (opt-in to custom sites) +*Gannett Group (local USA Today)* sites like (opt-in to custom sites) [Detroit Free Press](https://www.freep.com) - [Milwaukee Journal Sentinel](https://www.jsonline.com) - [The Indianapolis Star](https://www.indystar.com) - -[The Record (North Jersey)](https://www.northjersey.com) - -Crain's Business sites like +[The Record (North Jersey)](https://www.northjersey.com)\ +*Crain's Business* sites like [Crain's Chicago Business](https://www.chicagobusiness.com) - [Crain's Cleveland Business](https://www.crainscleveland.com) - [Crain's Detroit Business](https://www.crainsdetroit.com) - [Crain's New York Business](https://www.crainsnewyork.com)\ -McClatchy Group sites like (opt-in to custom sites for unlisted) +*McClatchy Group* sites like (opt-in to custom sites for unlisted) [Belleville News-Democrat](https://www.bnd.com) - [Fort Worth Star-Telegram](https://www.star-telegram.com) - [Lexington Herald-Leader](https://www.kentucky.com) - @@ -225,7 +221,14 @@ McClatchy Group sites like (opt-in to custom sites for unlisted) [The State](https://www.thestate.com) - [The Wichita Eagle](https://www.kansas.com) - [Tri-City Herald](https://www.tri-cityherald.com)\ -Tribune Publishing Company sites like +*MediaNews Group* sites like (opt-in to custom sites for unlisted/local sites): +[East Bay Times](https://www.eastbaytimes.com) - +[Orange County Register](https://www.ocregister.com) - +[St. Paul Pioneer Press](https://www.twincities.com) - +[The Denver Post](https://www.denverpost.com) - +[The Mercury News](https://www.mercurynews.com) - +[The Press-Enterprise](https://www.pe.com)\ +*Tribune Publishing Company* sites like [Baltimore Sun](https://www.baltimoresun.com) - [Chicago Tribune](https://www.chicagotribune.com) - [Daily Press](https://www.dailypress.com) - diff --git a/background.js b/background.js index 2178398..11adf55 100755 --- a/background.js +++ b/background.js @@ -84,7 +84,6 @@ var allow_cookies_default = [ 'handelsblatt.com', 'hilltimes.com', 'hindustantimes.com', - 'hs.fi', 'ilfattoquotidiano.it', 'inc42.com', 'independent.ie', @@ -221,7 +220,6 @@ var use_google_bot_default = [ 'ft.com', 'handelsblatt.com', 'hilltimes.com', - 'hs.fi', 'intelligentinvestor.com.au', 'lanouvellerepublique.fr', 'leparisien.fr', @@ -460,6 +458,7 @@ var grouped_sites = { '###_timesofindia': timesofindia_domains, '###_usa_crainsbiz': usa_crainsbiz_domains, '###_usa_mcc': usa_mcc_domains, +'###_usa_mng': usa_mng_domains, '###_usa_nymag': usa_nymag_domains, '###_usa_tribune': usa_tribune_domains, '###_usa_theathletic': usa_theathletic_domains @@ -527,6 +526,10 @@ function add_grouped_sites(init_rules) { blockedRegexes[domain] = /\.fi\/static\/vendor\..+\.chunk\.js/; use_google_bot.push(domain); } + for (let domain of fi_sanoma_domains) { + allow_cookies.push(domain); + use_google_bot.push(domain); + } for (let domain of fr_be_groupe_rossel_domains) { if (!['lecho.be'].includes(domain)) { allow_cookies.push(domain); @@ -576,6 +579,10 @@ function add_grouped_sites(init_rules) { allow_cookies.push(domain); blockedRegexes[domain] = /\.tribdss\.com\//; } + for (let domain of usa_mng_domains) { + allow_cookies.push(domain); + blockedRegexes[domain] = /(\.blueconic\.net\/|\.tinypass\.com\/|\.com\/.+\/loader\.min\.js|cdn\.ampproject\.org\/v\d\/amp-((sticky-)?ad|subscriptions)-.+\.js)/; + } for (let domain of usa_theathletic_domains) { allow_cookies.push(domain); blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js/; @@ -1077,6 +1084,17 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { enabledSites.push(mcc_domain); } + // block script for additional MediaNews Group sites (opt-in to custom sites) + var usa_mng_domain = (details.url.match(/\.com\/wp-content\/plugins\/dfm(-pushly|_zeus)\/.+\.js/) && ['script'].includes(details.type) && + !matchUrlDomain(usa_mng_domains, header_referer) && enabledSites.includes('###_usa_mng')); + if (usa_mng_domain) { + let mng_domain = urlHost(header_referer).replace(/^www\./, ''); + blockedRegexes[mng_domain] = /(\.blueconic\.net\/|\.tinypass\.com\/|\.com\/.+\/loader\.min\.js|cdn\.ampproject\.org\/v\d\/amp-((sticky-)?ad|subscriptions)-.+\.js)/; + usa_mng_domains.push(mng_domain); + if (!enabledSites.includes(mng_domain)) + enabledSites.push(mng_domain); + } + // block script for additional Madsack/RND sites (opt-in to custom sites) var de_rnd_domain = (matchUrlDomain('rndtech.de', details.url) && ['script'].includes(details.type) && !matchUrlDomain(de_madsack_domains.concat(['madsack.de', 'madsack-medien-campus.de', 'rnd.de']), header_referer) && enabledSites.includes('###_de_madsack')); if (de_rnd_domain) { @@ -1155,7 +1173,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) { let usa_today_site = (matchUrlDomain('gannett-cdn.com', details.url) && matchUrlDomain(['usatoday.com'], header_referer)); allow_ext_source = allow_ext_source || inkl_site || cl_elmerc_site || es_elesp_site || it_repubblica_site || usa_mw_site || usa_natgeo_site || usa_today_site; - bpc_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain(['asiatimes.com', 'augsburger-allgemeine.de', 'barrons.com', 'belfasttelegraph.co.uk', 'cicero.de', 'cmjornal.pt', 'elpais.com', 'elperiodico.com', 'freiepresse.de', 'inc42.com', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'marketwatch.com', 'nationalreview.com', 'noz.de', 'nwzonline.de', 'scmp.com', 'seekingalpha.com', 'shz.de', 'staradvertiser.com', 'sueddeutsche.de', 'svz.de', 'telegraph.co.uk', 'washingtonpost.com'].concat(au_news_corp_domains, au_nine_domains, de_madsack_domains, es_epiberica_domains, es_grupo_vocento_domains, es_unidad_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_repubblica_domains, usa_mcc_domains, usa_theathletic_domains), header_referer)); + bpc_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain(['asiatimes.com', 'augsburger-allgemeine.de', 'barrons.com', 'belfasttelegraph.co.uk', 'cicero.de', 'cmjornal.pt', 'elpais.com', 'elperiodico.com', 'freiepresse.de', 'inc42.com', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'marketwatch.com', 'nationalreview.com', 'noz.de', 'nwzonline.de', 'scmp.com', 'seekingalpha.com', 'shz.de', 'staradvertiser.com', 'sueddeutsche.de', 'svz.de', 'telegraph.co.uk', 'washingtonpost.com'].concat(au_news_corp_domains, au_nine_domains, de_madsack_domains, es_epiberica_domains, es_grupo_vocento_domains, es_unidad_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_repubblica_domains, usa_mcc_domains, usa_mng_domains, usa_theathletic_domains), header_referer)); } if (!isSiteEnabled(details) && !allow_ext_source && !bpc_amp_site && !au_apn_site && !au_swm_site) { diff --git a/changelog.txt b/changelog.txt index 15cad3b..17ff9d4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Chrome Post-release +Add MediaNews Group (local USA) * v2.3.3.0 (2021-08-15) Add Live Law (India) diff --git a/contentScript.js b/contentScript.js index f29eac8..1b169ac 100755 --- a/contentScript.js +++ b/contentScript.js @@ -20,6 +20,7 @@ var no_nhst_media_domains = ['intrafish.com', 'rechargenews.com', 'tradewindsnew var usa_crainsbiz_domains = ['chicagobusiness.com', 'crainscleveland.com', 'crainsdetroit.com', 'crainsnewyork.com']; var timesofindia_domains = ['timesofindia.com', 'timesofindia.indiatimes.com']; var usa_mcc_domains = ['bnd.com', 'charlotteobserver.com', 'fresnobee.com', 'kansas.com', 'kansascity.com', 'kentucky.com', 'miamiherald.com', 'newsobserver.com', 'sacbee.com', 'star-telegram.com', 'thestate.com', 'tri-cityherald.com']; +var usa_mng_domains = ['denverpost.com', 'eastbaytimes.com', 'mercurynews.com', 'ocregister.com', 'pe.com', 'twincities.com']; var usa_tribune_domains = ['baltimoresun.com', 'chicagotribune.com', 'courant.com', 'dailypress.com', 'mcall.com', 'nydailynews.com', 'orlandosentinel.com', 'pilotonline.com', 'sun-sentinel.com']; // clean local storage of sites (with an exemption for hold-list) @@ -2832,6 +2833,18 @@ else if ((domain = matchDomain(usa_mcc_domains)) || document.querySelector('scri } } +else if ((domain = matchDomain(usa_mng_domains)) || (window.location.href.match(/\.com\/(\d){4}\/(\d){2}\/(\d){2}\/.+\/amp\//) && document.querySelector('amp-img#paywall[src*=".com/wp-content/plugins/dfm-amp-mods/"]'))) { + let url = window.location.href; + if (url.split('?')[0].endsWith('/amp/')) { + let subscr_sections = document.querySelectorAll('div[subscriptions-section="content"]'); + for (let subscr_section of subscr_sections) { + subscr_section.removeAttribute('subscriptions-section'); + } + let amp_ads = document.querySelectorAll('amp-ad, amp-embed'); + removeDOMElement(...amp_ads); + } +} + else csDone = true; } diff --git a/custom/manifest.json b/custom/manifest.json index f00dc72..f8b8da7 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -38,5 +38,5 @@ "webRequestBlocking", "" ], - "version": "2.3.3.0" + "version": "2.3.3.1" } \ No newline at end of file diff --git a/manifest.json b/manifest.json index 2603ede..48ab5fb 100755 --- a/manifest.json +++ b/manifest.json @@ -134,6 +134,7 @@ "*://*.dn.se/*", "*://*.dna.fr/*", "*://*.dvhn.nl/*", + "*://*.eastbaytimes.com/*", "*://*.economictimes.com/*", "*://*.economictimes.indiatimes.com/*", "*://*.economist.com/*", @@ -357,6 +358,7 @@ "*://*.paris-normandie.fr/*", "*://*.parismatch.com/*", "*://*.parool.nl/*", + "*://*.pe.com/*", "*://*.petitbleu.fr/*", "*://*.philosophynow.org/*", "*://*.pilotonline.com/*", @@ -470,6 +472,7 @@ "*://*.tri-cityherald.com/*", "*://*.trouw.nl/*", "*://*.tubantia.nl/*", + "*://*.twincities.com/*", "*://*.upstreamonline.com/*", "*://*.usatoday.com/*", "*://*.usinenouvelle.com/*", @@ -536,5 +539,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.3.3.0" + "version": "2.3.3.1" } \ No newline at end of file diff --git a/sites.js b/sites.js index 221be72..50a96de 100755 --- a/sites.js +++ b/sites.js @@ -165,6 +165,7 @@ var defaultSites = "McClatchy Group": "###_usa_mcc", "Mediahuis Nederland Regional": "###_nl_mediahuis_region", "MediaNama": "medianama.com", + "MediaNews Group": "###_usa_mng", "Medium": "medium.com", "Medium custom domains": "###_medium_custom", "Mexico News Daily": "mexiconewsdaily.com", @@ -192,7 +193,6 @@ var defaultSites = "O Estado de S. Paulo": "estadao.com.br", "O Globo (& Valor Econômico)": "globo.com", "Observador.pt": "observador.pt", - "Orange County Register": "ocregister.com", "Palo Alto Online": "paloaltoonline.com", "Paris Match": "parismatch.com", "Parool": "parool.nl", @@ -249,7 +249,6 @@ var defaultSites = "The Christian Science Monitor": "csmonitor.com", "The Daily Beast": "thedailybeast.com", "The Dallas Morning News": "dallasnews.com", - "The Denver Post": "denverpost.com", "The Diplomat": "thediplomat.com", "The Economic Times (ET Prime)": "###_economictimes", "The Economist": "economist.com", @@ -262,7 +261,6 @@ var defaultSites = "The Jerusalem Post": "jpost.com", "The Logic": "thelogic.co", "The Marker": "themarker.com", - "The Mercury News": "mercurynews.com", "The Nation": "thenation.com", "The New Atlantis": "thenewatlantis.com", "The New Republic": "newrepublic.com", @@ -349,9 +347,10 @@ const timesofindia_domains = ['timesofindia.com', 'timesofindia.indiatimes.com'] const usa_crainsbiz_domains = ['chicagobusiness.com', 'crainscleveland.com', 'crainsdetroit.com', 'crainsnewyork.com']; const usa_gannett_domains = []; const usa_mcc_domains = ['bnd.com', 'charlotteobserver.com', 'fresnobee.com', 'kansas.com', 'kansascity.com', 'kentucky.com', 'miamiherald.com', 'newsobserver.com', 'sacbee.com', 'star-telegram.com', 'thestate.com', 'tri-cityherald.com']; +const usa_mng_domains = ['denverpost.com', 'eastbaytimes.com', 'mercurynews.com', 'ocregister.com', 'pe.com', 'twincities.com']; const usa_nymag_domains = ['curbed.com', 'grubstreet.com', 'nymag.com', 'thecut.com', 'vulture.com']; const usa_tribune_domains = ['baltimoresun.com', 'chicagotribune.com', 'courant.com', 'dailypress.com', 'mcall.com', 'nydailynews.com', 'orlandosentinel.com', 'pilotonline.com', 'sun-sentinel.com']; const usa_theathletic_domains = ['theathletic.com', 'theathletic.co.uk']; var defaultSites_grouped_domains = Object.values(defaultSites); -var defaultSites_domains = defaultSites_grouped_domains.concat(au_comm_media_domains, au_news_corp_domains, au_prov_news_domains, br_folha_domains, ca_torstar_domains, de_funke_media_domains, de_madsack_domains, economictimes_domains, es_grupo_vocento_domains, fi_alma_talent_domains, fi_sanoma_domains, fr_be_groupe_rossel_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_ilmessaggero_domains, it_quotidiano_domains, nl_ad_region_domains, nl_mediahuis_region_domains, no_nhst_media_domains, timesofindia_domains, usa_crainsbiz_domains, usa_mcc_domains, usa_nymag_domains, usa_tribune_domains, usa_theathletic_domains); +var defaultSites_domains = defaultSites_grouped_domains.concat(au_comm_media_domains, au_news_corp_domains, au_prov_news_domains, br_folha_domains, ca_torstar_domains, de_funke_media_domains, de_madsack_domains, economictimes_domains, es_grupo_vocento_domains, fi_alma_talent_domains, fi_sanoma_domains, fr_be_groupe_rossel_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_ilmessaggero_domains, it_quotidiano_domains, nl_ad_region_domains, nl_mediahuis_region_domains, no_nhst_media_domains, timesofindia_domains, usa_crainsbiz_domains, usa_mcc_domains, usa_mng_domains, usa_nymag_domains, usa_tribune_domains, usa_theathletic_domains);