From e3cd8ed8797d0e76e0ee6fe0d9acf7c8ccc34c89 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Sat, 7 Jan 2023 09:03:18 +0100 Subject: [PATCH] Remove (custom) Substack (fix obsolete) --- README.md | 6 ++---- background.js | 6 ++++-- changelog.txt | 3 ++- contentScript.js | 36 +----------------------------------- manifest.json | 1 - sites.js | 12 +----------- 6 files changed, 10 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 83265ad..e0d15ad 100644 --- a/README.md +++ b/README.md @@ -169,13 +169,11 @@ Grouped in options:\ [StuDocu](https://www.studocu.com) ##### Magazines/Blogs -[Medium](https://www.medium.com) - -[Substack](https://substack.com)\ +[Medium](https://www.medium.com)\ Grouped in options:\ *Medium custom domains* like (opt-in to custom sites for unlisted)\ [Better Programming](https://betterprogramming.pub) - -[Towards Data Science](https://towardsdatascience.com)\ -*Substack custom domains* (opt-in to custom sites) +[Towards Data Science](https://towardsdatascience.com) [Apollo Magazine](https://www.apollo-magazine.com) - [Artforum](https://www.artforum.com) - diff --git a/background.js b/background.js index ba8ebe5..0ab3b6b 100644 --- a/background.js +++ b/background.js @@ -816,7 +816,7 @@ if (typeof browser !== 'object') { let tabId = tab.id; let url = tab.url; // load contentScript_once.js to identify custom site (flex) of group - if (!(matchUrlDomain(custom_flex_domains.concat(custom_flex_not_domains, customSites_domains, updatedSites_domains_new, excludedSites), url) || matchUrlDomain(defaultSites_domains, url))) { + if (!(matchUrlDomain(custom_flex_domains.concat(custom_flex_not_domains, customSites_domains, updatedSites_domains_new, excludedSites, nofix_sites), url) || matchUrlDomain(defaultSites_domains, url))) { ext_api.tabs.executeScript(tabId, { file: 'contentScript_once.js', runAt: 'document_start' @@ -1336,10 +1336,12 @@ ext_api.runtime.onMessage.addListener(function (message, sender) { let custom_domain = message.data.domain; let group = message.data.group; if (group) { - if (enabledSites.includes(group) && custom_domain && !custom_flex_domains.includes(custom_domain)) { + if (enabledSites.concat(['###_substack_custom']).includes(group) && custom_domain && !custom_flex_domains.includes(custom_domain)) { let rules; if (group === 'elmercurio.com') rules = {block_regex: "(\\.{domain}\\/impresa\\/.+\\/assets\\/(vendor|\\d)\\.js|pram\\.pasedigital\\.cl\\/API\\/User\\/Status\\?)"}; + else if (group === '###_substack_custom') + nofix_sites.push(custom_domain); else { rules = Object.values(defaultSites).filter(x => x.domain === group)[0]; if (group === '###_usa_gannett') diff --git a/changelog.txt b/changelog.txt index 5a56f55..5d8e39e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -9,11 +9,12 @@ Add PhiloMag.de Add The Quint Add ZeroHedge Remove Entrepreneur (fix obsolete) +Remove (custom) Substack (fix obsolete) Remove The-Village.ru (fix obsolete) Fix Aftonbladet.se (link to archive.is) Fix Boston Globe (css) Fix Nordwest Zeitung -Fix Substack (split content) +Fix Substack (split content - fix obsolete) Fix Telegraaf.nl Fix The Seattle Times (comments) Fix TheSaturdayPaper.com.au diff --git a/contentScript.js b/contentScript.js index 9d80faa..fcf07c8 100644 --- a/contentScript.js +++ b/contentScript.js @@ -41,7 +41,7 @@ var usa_outside_mag_domains = ["backpacker.com", "betamtb.com", "betternutrition 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) -var arr_localstorage_hold = ['aachener-nachrichten.de', 'aachener-zeitung.de', 'allgaeuer-zeitung.de', 'augsburger-allgemeine.de', 'barrons.com', 'businessoffashion.com', 'challenges.fr', 'charliehebdo.fr', 'cmjornal.pt', 'corriere.it', 'corrieredellosport.it', 'cyclingtips.com', 'economictimes.com', 'eldiario.es', 'elespanol.com', 'elle.fr', 'elpais.com', 'elperiodico.com', 'enotes.com', 'estadao.com.br', 'forbes.com', 'fortune.com', 'freiepresse.de', 'ilfoglio.it', 'inc42.com', 'indianexpress.com', 'ksta.de', 'lanouvellerepublique.fr', 'latimes.com', 'lesechos.fr', 'livemint.com', 'mid-day.com', 'nknews.org', 'nw.de', 'nytimes.com', 'nzherald.co.nz', 'nwzonline.de', 'rundschau-online.de', 'sandiegouniontribune.com', 'scmp.com', 'seekingalpha.com', 'substack.com', 'telegraph.co.uk', 'tes.com', 'theatlantic.com', 'thebulletin.org', 'thecritic.co.uk', 'thetimes.co.uk', 'uol.com.br', 'wsj.com'].concat(ca_gcm_domains, de_funke_medien_domains, de_westfalen_medien_domains, es_epiberica_domains, es_epiberica_custom_domains, es_grupo_vocento_domains, es_unidad_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, fr_groupe_nice_matin_domains, it_gedi_domains, it_quotidiano_domains, ca_gcm_domains, nl_dpg_media_domains, no_nhst_media_domains, usa_hearst_comm_domains); +var arr_localstorage_hold = ['aachener-nachrichten.de', 'aachener-zeitung.de', 'allgaeuer-zeitung.de', 'augsburger-allgemeine.de', 'barrons.com', 'businessoffashion.com', 'challenges.fr', 'charliehebdo.fr', 'cmjornal.pt', 'corriere.it', 'corrieredellosport.it', 'cyclingtips.com', 'economictimes.com', 'eldiario.es', 'elespanol.com', 'elle.fr', 'elpais.com', 'elperiodico.com', 'enotes.com', 'estadao.com.br', 'forbes.com', 'fortune.com', 'freiepresse.de', 'ilfoglio.it', 'inc42.com', 'indianexpress.com', 'ksta.de', 'lanouvellerepublique.fr', 'latimes.com', 'lesechos.fr', 'livemint.com', 'mid-day.com', 'nknews.org', 'nw.de', 'nytimes.com', 'nzherald.co.nz', 'nwzonline.de', 'rundschau-online.de', 'sandiegouniontribune.com', 'scmp.com', 'seekingalpha.com', 'telegraph.co.uk', 'tes.com', 'theatlantic.com', 'thebulletin.org', 'thecritic.co.uk', 'thetimes.co.uk', 'uol.com.br', 'wsj.com'].concat(ca_gcm_domains, de_funke_medien_domains, de_westfalen_medien_domains, es_epiberica_domains, es_epiberica_custom_domains, es_grupo_vocento_domains, es_unidad_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, fr_groupe_nice_matin_domains, it_gedi_domains, it_quotidiano_domains, ca_gcm_domains, nl_dpg_media_domains, no_nhst_media_domains, usa_hearst_comm_domains); if (!matchDomain(arr_localstorage_hold)) { window.localStorage.clear(); } @@ -4343,40 +4343,6 @@ else if (matchDomain('wsj.com')) { } } -else if (matchDomain('substack.com') || document.querySelector('script[src*="/substackcdn.com/"], link[rel="stylesheet"][href*="/substackcdn.com/"]')) { - let paywall = document.querySelector('div.paywall:not(.modal-paywall)'); - let article_sel = 'div.available-content'; - if (paywall) { - let article = document.querySelector(article_sel); - let msg = document.querySelector('div#bpc_msg'); - if (article && !msg) { - msg = document.createElement('div'); - msg.id = 'bpc_msg'; - msg.innerText = 'BPC > no fix !'; - msg.setAttribute('style', 'margin: 20px; width: 20em; font-weight: bold; color: red;'); - article.insertBefore(msg, article.firstChild); - } - } else { - let lock = document.querySelector('path.lock-body'); - let paywall_content_sel = 'div.paywall-content'; - let redundant_sel; - if (lock) { - let intro = document.querySelectorAll(article_sel + ' > div > p'); - if (intro.length) { - let intro_last = intro.length - 1; - if (!intro[intro_last].innerText.match(/…(")?/)) - redundant_sel = article_sel; - } - } else - redundant_sel = paywall_content_sel; - if (redundant_sel) { - let redundant_elem = document.querySelector(redundant_sel); - removeDOMElement(redundant_elem); - waitDOMElement(redundant_sel, 'DIV', removeDOMElement, true); - } - } -} - else if (matchDomain('zerohedge.com')) { let paywall = document.querySelector('div[class^="PremiumOverlay_container__"]'); if (paywall) { diff --git a/manifest.json b/manifest.json index 08a7c02..0cc78d1 100644 --- a/manifest.json +++ b/manifest.json @@ -564,7 +564,6 @@ "*://*.stocknews.com/*", "*://*.stratfor.com/*", "*://*.studocu.com/*", - "*://*.substack.com/*", "*://*.sudinfo.be/*", "*://*.sudouest.fr/*", "*://*.sueddeutsche.de/*", diff --git a/sites.js b/sites.js index 76c7cb6..41cb1b2 100644 --- a/sites.js +++ b/sites.js @@ -1697,15 +1697,6 @@ var defaultSites = { domain: "studocu.com", allow_cookies: 1 }, - "Substack (paywall-content only)": { - domain: "substack.com", - useragent: "googlebot" - }, - "Substack custom domains (paywall-content only; opt-in to custom sites)": { - domain: "###_substack_custom", - group: [], - useragent: "googlebot" - }, "Süddeutsche Zeitung (link to archive.is)": { domain: "sueddeutsche.de", allow_cookies: 1 @@ -2396,7 +2387,6 @@ var custom_flex_not = { "###_nl_mediahuis_noord": ["dvhn.nl"], "###_wp_leaky_paywall": ["griffithreview.com", "nknews.org", "thewirechina.com"], "###_medium_custom": ["medium.com"], - "###_substack_custom": ["substack.com"], "###_uk_axate.io": ["thinkofx.net"], "###_usa_gannett": ["usatoday.com"], "###_usa_hearst_comm": ["sfgate.com"], @@ -2416,4 +2406,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'].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', 'substack.com', '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);