From 62f5273c2467ca4f92c07ce4241b2c60d8e69f66 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Thu, 27 May 2021 20:22:34 +0200 Subject: [PATCH] Add Honolulu Star-Advertiser (local USA) --- README.md | 1 + background.js | 3 ++- changelog.txt | 1 + contentScript.js | 22 ++++++++++++++++++++++ custom/manifest.json | 2 +- manifest.json | 3 ++- sites.js | 1 + 7 files changed, 30 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9371cb8..978172f 100755 --- a/README.md +++ b/README.md @@ -168,6 +168,7 @@ _* free articles only._ ##### Local USA news [Crain's Chicago Business](https://www.chicagobusiness.com) - +[Honolulu Star-Advertiser](https://www.staradvertiser.com) - [Houston Chronicle](https://www.houstonchronicle.com) - [Los Angeles Business Journal](https://labusinessjournal.com) - [Los Angeles Times](https://www.latimes.com) - diff --git a/background.js b/background.js index dfd7916..30f5de3 100755 --- a/background.js +++ b/background.js @@ -141,6 +141,7 @@ var allow_cookies_default = [ 'shz.de', 'si.com', 'slader.com', + 'staradvertiser.com', 'startribune.com', 'stocknews.com', 'stratfor.com', @@ -1108,7 +1109,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 || uk_nlr_site || usa_discmag_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', 'elmundo.es', 'elpais.com', 'elperiodico.com', 'expansion.com', 'freiepresse.de', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'marketwatch.com', 'nationalreview.com', 'noz.de', 'nwzonline.de', 'scmp.com', 'seekingalpha.com', 'shz.de', 'sueddeutsche.de', 'svz.de', 'telegraph.co.uk'].concat(au_news_corp_domains, au_nine_domains, de_madsack_domains, es_epiberica_domains, es_grupo_vocento_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', 'elmundo.es', 'elpais.com', 'elperiodico.com', 'expansion.com', 'freiepresse.de', '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'].concat(au_news_corp_domains, au_nine_domains, de_madsack_domains, es_epiberica_domains, es_grupo_vocento_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_repubblica_domains, usa_mcc_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 a6995c0..3f82cc7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Chrome Post-release Add Hindustan Times (India) +Add Honolulu Star-Advertiser (local USA) Fix-update GElocal.it (social) Fix-update WaPo (comments) diff --git a/contentScript.js b/contentScript.js index b82329b..56723e3 100755 --- a/contentScript.js +++ b/contentScript.js @@ -2216,6 +2216,27 @@ else if (matchDomain('sofrep.com')) { removeDOMElement(...banners); } +else if (matchDomain('staradvertiser.com')) { + let url = window.location.href.split('?')[0]; + if (url.endsWith('/amp/')) { + let section_not_granted = document.querySelector('section[subscriptions-section="content-not-granted"]'); + if (section_not_granted) { + removeDOMElement(section_not_granted); + let hidden_content = document.querySelector('section[subscriptions-section="content"]'); + if (hidden_content) + hidden_content.removeAttribute('subscriptions-section'); + } + } else { + let paywall = document.querySelector('div#hsa-paywall-overlay'); + if (paywall) { + removeDOMElement(paywall); + let div_hidden = document.querySelector('div#hsa-paywall-content[style]'); + if (div_hidden) + div_hidden.removeAttribute('style'); + } + } +} + else if (matchDomain('startribune.com')) { document.addEventListener('DOMContentLoaded', () => { let react_modal_portal = document.querySelectorAll('div.ReactModalPortal'); @@ -2253,6 +2274,7 @@ else if (matchDomain('techinasia.com')) { if (response.ok) { response.json().then(json => { let json_text = json.posts[0].content; + json_text = json_text.replace(/width\=\"(\d){3,}\"/g, 'width="100%"').replace(/height\=\"(\d){3,}\"/g, 'height="100%"'); let content = document.querySelector('div.content'); if (json_text && content) { let parser = new DOMParser(); diff --git a/custom/manifest.json b/custom/manifest.json index 7484729..2e15b6e 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -30,5 +30,5 @@ "webRequestBlocking", "" ], - "version": "2.2.2.2" + "version": "2.2.2.3" } \ No newline at end of file diff --git a/manifest.json b/manifest.json index 8e58b05..1ff0177 100755 --- a/manifest.json +++ b/manifest.json @@ -379,6 +379,7 @@ "*://*.spectator.us/*", "*://*.standard.net.au/*", "*://*.star-telegram.com/*", + "*://*.staradvertiser.com/*", "*://*.startribune.com/*", "*://*.statista.com/*", "*://*.stcatharinesstandard.ca/*", @@ -506,5 +507,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.2.2.2" + "version": "2.2.2.3" } \ No newline at end of file diff --git a/sites.js b/sites.js index 3338556..413e2cf 100755 --- a/sites.js +++ b/sites.js @@ -108,6 +108,7 @@ var defaultSites = "Harvard Business Review Taiwan": "hbrtaiwan.com", "Helsingin Sanomat": "hs.fi", "Hindustan Times": "hindustantimes.com", + "Honolulu Star-Advertiser": "staradvertiser.com", "Houston Chronicle": "houstonchronicle.com", "Humo.be": "humo.be", "Il Fatto Quotidiano": "ilfattoquotidiano.it",