From cdcf16f3a82bc8f3eb2e67d4cd9e066fcc7dfafe Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Fri, 30 Dec 2022 12:35:13 +0100 Subject: [PATCH] Add ZeroHedge --- README.md | 3 ++- background.js | 2 +- changelog.txt | 1 + contentScript.js | 28 +++++++++++++++++++++++++++- contentScript_once.js | 2 +- manifest.json | 1 + sites.js | 6 +++++- 7 files changed, 38 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7a3e2518..0b9b92db 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,8 @@ Grouped in options:\ [The Daily Wire](https://www.dailywire.com) - [The New Atlantis](https://www.thenewatlantis.com) - [The Point Magazine](https://thepointmag.com) - -[The Wrap](https://www.thewrap.com) +[The Wrap](https://www.thewrap.com) - +[ZeroHedge](https://www.zerohedge.com) Grouped in options:\ *Condé Nast magazines* sites like\ diff --git a/background.js b/background.js index d20f136d..8525e385 100644 --- a/background.js +++ b/background.js @@ -12,7 +12,7 @@ if (typeof ext_api.action !== 'object') { ext_api.action = ext_api.browserAction; } -const dompurify_sites = ['arcinfo.ch', 'asiatimes.com', 'bloomberg.com', 'cicero.de', 'dn.no', 'ilmanifesto.it', 'iltalehti.fi', 'iltirreno.it', 'ipolitics.ca', 'italiaoggi.it', 'lanuovasardegna.it', 'lequipe.fr', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newscientist.com', 'nzherald.co.nz', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'sloanreview.mit.edu', 'stratfor.com', 'techinasia.com', 'thebulletin.org', 'timesofindia.com', 'valor.globo.com', 'vn.nl'].concat(nl_mediahuis_region_domains, no_nhst_media_domains); +const dompurify_sites = ['arcinfo.ch', 'asiatimes.com', 'bloomberg.com', 'cicero.de', 'dn.no', 'ilmanifesto.it', 'iltalehti.fi', 'iltirreno.it', 'ipolitics.ca', 'italiaoggi.it', 'lanuovasardegna.it', 'lequipe.fr', 'lesechos.fr', 'marianne.net', 'newleftreview.org', 'newscientist.com', 'nzherald.co.nz', 'outlookbusiness.com', 'prospectmagazine.co.uk', 'sloanreview.mit.edu', 'stratfor.com', 'techinasia.com', 'thebulletin.org', 'timesofindia.com', 'valor.globo.com', 'vn.nl', 'zerohedge.com'].concat(nl_mediahuis_region_domains, no_nhst_media_domains); var optin_setcookie = false; var optin_update = true; var blocked_referer = false; diff --git a/changelog.txt b/changelog.txt index 04faa2dc..bbd7bda9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release Add McClatchy DC +Add ZeroHedge Fix TheSaturdayPaper.com.au * v2.9.9.0 (2022-12-27) diff --git a/contentScript.js b/contentScript.js index ce181f4c..f674a354 100644 --- a/contentScript.js +++ b/contentScript.js @@ -2696,7 +2696,7 @@ else if (matchDomain('bostonglobe.com')) { else if (matchDomain('bqprime.com')) { if (window.location.pathname.startsWith('/amp/')) { - amp_unhide_subscr_section(); + amp_unhide_subscr_section('.ad-container'); } } @@ -4298,6 +4298,32 @@ else if (matchDomain('substack.com') || document.querySelector('script[src^="htt } } +else if (matchDomain('zerohedge.com')) { + let paywall = document.querySelector('div[class^="PremiumOverlay_container__"]'); + if (paywall) { + removeDOMElement(paywall); + let json_script = document.querySelector('script#__NEXT_DATA__'); + if (json_script && dompurify_loaded) { + try { + let json = JSON.parse(json_script.innerText); + if (json && json.props.pageProps.node.body) { + let article_new = parseHtmlEntities(decode_utf8(atob(json.props.pageProps.node.body.substring(21)))); + let article = document.querySelector('div[class^="NodeContent_mainContent__"'); + if (article) { + article.innerHTML = ''; + let parser = new DOMParser(); + let doc = parser.parseFromString('
' + DOMPurify.sanitize(article_new) + '
', 'text/html'); + let content_new = doc.querySelector('div'); + article.appendChild(content_new); + } + } + } catch (err) { + console.log(err); + } + } + } +} + else if ((domain = matchDomain(usa_lee_ent_domains)) || document.querySelector('script[src*=".townnews.com/"][src*="/tncms/"]')) { if (window.location.pathname.endsWith('.amp.html')) { amp_unhide_access_hide('="hasAccess"', '="NOT hasAccess"', 'amp-ad, amp-embed, .amp-ads-container'); diff --git a/contentScript_once.js b/contentScript_once.js index a94bd683..4a2dfd65 100644 --- a/contentScript_once.js +++ b/contentScript_once.js @@ -91,7 +91,7 @@ window.setTimeout(function () { group = '###_usa_lee_ent'; else if (document.querySelector('script[src*=".townnews.com/"][src*="/tncms/"]')) group = '###_usa_townnews'; - else if (document.querySelector('meta[content^="https://www.mcclatchy-wires.com/"], a[href^="https://classifieds.mcclatchy.com/"]')) + else if (document.querySelector('meta[content^="https://www.mcclatchy-wires.com/"], a[href^="https://classifieds.mcclatchy.com/"], script[src*=".mcclatchyinteractive.com/"]')) group = '###_usa_mcc'; else if (document.querySelector('script[src*=".com/wp-content/plugins/dfm"], amp-img#paywall[src*=".com/wp-content/plugins/dfm-amp-mods/"]')) group = '###_usa_mng'; diff --git a/manifest.json b/manifest.json index c320aeeb..01375c31 100644 --- a/manifest.json +++ b/manifest.json @@ -683,6 +683,7 @@ "*://*.wz.de/*", "*://*.yogajournal.com/*", "*://*.zeit.de/*", + "*://*.zerohedge.com/*", "*://*.ampproject.org/*", "*://*.axate.io/*", "*://*.blueconic.net/*", diff --git a/sites.js b/sites.js index 41e87309..c6ab115e 100644 --- a/sites.js +++ b/sites.js @@ -2174,6 +2174,10 @@ var defaultSites = { allow_cookies: 1, useragent: "facebookbot" }, + "ZeroHedge": { + domain: "zerohedge.com", + allow_cookies: 1 + }, "* Block general paywall-scripts (opt-in to custom sites to enable also for unlisted sites)": { domain: "###" }, @@ -2404,4 +2408,4 @@ init_custom_flex_domains(); var au_news_corp_nofix_domains = ['cairnspost.com.au', 'geelongadvertiser.com.au', 'goldcoastbulletin.com.au', 'thechronicle.com.au', 'townsvillebulletin.com.au', 'weeklytimesnow.com.au']; var be_mediahuis_nofix_domains = ['gva.be', 'hbvl.be', 'nieuwsblad.be', 'standaard.be']; var it_gedi_nofix_domains = ['gelocal.it', 'huffingtonpost.it', 'ilsecoloxix.it', 'lastampa.it', 'limesonline.com']; -var nofix_sites = ['africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'badische-zeitung.de', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'catalyst-journal.com', 'courrierinternational.com', 'dn.se', 'dvhn.nl', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'ftchinese.com', 'golem.de', 'heise.de', 'hs.fi', 'ilsole24ore.com', 'jacobinmag.com', 'jeuneafrique.com', 'kurier.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.com', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lepoint.fr', 'letemps.ch', 'liberation.fr', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mondediplo.com', 'moneycontrol.com', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'nn.de', 'ouest-france.fr', 'philonomist.com', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'saechsische.de', 'schwarzwaelder-bote.de', 'statnews.com', 'stern.de', 'straitstimes.com', 'stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 'suedkurier.de', 'swp.de', 'tagesanzeiger.ch', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'weser-kurier.de', 'worldpoliticsreview.com', 'ynet.co.il', 'zerohedge.com'].concat(au_news_corp_nofix_domains, be_mediahuis_nofix_domains, it_gedi_nofix_domains); +var nofix_sites = ['africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'badische-zeitung.de', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'catalyst-journal.com', 'courrierinternational.com', 'dn.se', 'dvhn.nl', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'ftchinese.com', 'golem.de', 'heise.de', 'hs.fi', 'ilsole24ore.com', 'jacobinmag.com', 'jeuneafrique.com', 'kurier.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.com', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lepoint.fr', 'letemps.ch', 'liberation.fr', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mondediplo.com', 'moneycontrol.com', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'nn.de', 'ouest-france.fr', 'philonomist.com', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'saechsische.de', 'schwarzwaelder-bote.de', 'statnews.com', 'stern.de', 'straitstimes.com', 'stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 'suedkurier.de', 'swp.de', 'tagesanzeiger.ch', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'weser-kurier.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(au_news_corp_nofix_domains, be_mediahuis_nofix_domains, it_gedi_nofix_domains);