diff --git a/README.md b/README.md index 6638f6f9..2b60f8bb 100644 --- a/README.md +++ b/README.md @@ -937,6 +937,12 @@ Grouped in options:\ [Globes](https://www.globes.co.il) - [The Jerusalem Post](https://www.jpost.com) +Grouped in options:\ +*Haaretz Group* sites like\ +[Haaretz.co.il](https://www.haaretz.co.il) - +[Haaretz.com](https://www.haaretz.com) - +[The Marker](https://www.themarker.com) + #### Latin America ##### Argentina diff --git a/background.js b/background.js index 269f2382..04a68530 100644 --- a/background.js +++ b/background.js @@ -503,7 +503,7 @@ ext_api.storage.local.get({ } else { ext_api.management.getSelf(function (result) { if ((result.installType === 'development' || (result.installType !== 'development' && !enabledSites.includes('#options_on_update')))) { - let new_groups = ['###_au_investsmart', '###_es_epiberica']; + let new_groups = ['###_au_investsmart', '###_es_epiberica, ###_il_haaretz_group']; let open_options = new_groups.some(group => !enabledSites.includes(group) && grouped_sites[group].some(domain => enabledSites.includes(domain) && !customSites_domains.includes(domain))); if (open_options) ext_api.runtime.openOptionsPage(); diff --git a/changelog.txt b/changelog.txt index 6ec4c0ae..ef9cade4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -6,8 +6,8 @@ Post-release Add Business Insider Nederland Add Business Insider Polska Add Huffingtonpost.it -Remove Haaretz Group (fix obsolete) Fix elDiario.es (amp-redirect) +Fix Haaretz Group (fetch from archive.is) Fix Inc42 (css) Fix Independent.co.uk (fetch from archive.is) Fix S&P Global (js-inline) diff --git a/contentScript.js b/contentScript.js index acd87f08..62441cd8 100644 --- a/contentScript.js +++ b/contentScript.js @@ -4014,6 +4014,31 @@ else if (matchDomain('ftm.eu')) { removeDOMElement(...banners); } +else if (matchDomain(['haaretz.co.il', 'haaretz.com', 'themarker.com'])) { + let paywall_sel = 'div[data-test="paywallMidpage"]'; + let paywall = document.querySelector(paywall_sel); + if (paywall) { + removeDOMElement(paywall); + let url = window.location.href; + let article_link_sel = 'article header'; + let article = document.querySelector(article_link_sel); + if (article) { + if (matchDomain('haaretz.co.il')) + article.firstChild.before(googleSearchToolLink(url)); + else { + getArchive(url, 'div[data-test="articleBody"]'); + window.setTimeout(function () { + let paywall = document.querySelector(paywall_sel); + if (paywall) { + removeDOMElement(paywall); + article.firstChild.before(googleSearchToolLink(url)); + } + }, 2000); + } + } + } +} + else if (matchDomain('hbr.org')) { function hbr_main() { window.top.postMessage({type: 'article-paywall:full-content'}, '*'); @@ -5912,6 +5937,12 @@ function replaceDomElementExt(url, proxy, base64, selector, text_fail = '', sele } } +function getSelectorLevel(selector) { + if (selector.replace(/,\s+/g, ',').match(/[>\s]+/)) + selector = selector.replace(/,\s+/g, ',').split(',').map(x => x.match(/[>\s]+/) ? x + ', ' + x.split(/[>\s]+/).pop() : x).join(', '); + return selector; +} + function replaceDomElementExtSrc(url, url_src, html, proxy, base64, selector, text_fail = '', selector_source = selector, selector_archive = selector) { let article = document.querySelector(selector); if (html) { @@ -5928,7 +5959,7 @@ function replaceDomElementExtSrc(url, url_src, html, proxy, base64, selector, te } let doc = parser.parseFromString(DOMPurify.sanitize(html, dompurify_options), 'text/html'); //console.log(DOMPurify.removed); - let article_new = doc.querySelector(selector_source); + let article_new = doc.querySelector(getSelectorLevel(selector_source)); if (article_new) { if (article && article.parentNode) { if (url.startsWith('https://archive.')) { @@ -5937,13 +5968,15 @@ function replaceDomElementExtSrc(url, url_src, html, proxy, base64, selector, te arch_dom.firstChild.before(archiveLink_renew(window.location.href)); arch_dom.firstChild.before(archiveLink(window.location.href, 'BPC > Try when layout issues (no need to report issue for external site):\r\n')); } - window.setTimeout(function () { - let targets = document.querySelectorAll('a[target="_blank"][href^="https://' + window.location.hostname + '"]'); - for (let elem of targets) - elem.removeAttribute('target'); - }, 1500); + let targets = article_new.querySelectorAll('a[target="_blank"][href^="https://' + window.location.hostname + '"]'); + for (let elem of targets) + elem.removeAttribute('target'); + let invalid_links = article_new.querySelectorAll('link[rel="preload"]:not([href]'); + removeDOMElement(...invalid_links); } - article.parentNode.replaceChild(article_new, article); + window.setTimeout(function () { + article.parentNode.replaceChild(article_new, article); + }, 200); } } else replaceTextFail(url, article, proxy, text_fail); diff --git a/custom/manifest.json b/custom/manifest.json index 9abb95f6..ef0abd61 100644 --- a/custom/manifest.json +++ b/custom/manifest.json @@ -51,5 +51,5 @@ "webRequestBlocking", "*://*/*" ], - "version": "3.4.8.7" + "version": "3.4.8.8" } diff --git a/custom/sites_custom.json b/custom/sites_custom.json index eec2540a..90ad395c 100644 --- a/custom/sites_custom.json +++ b/custom/sites_custom.json @@ -1,6 +1,6 @@ { "###_remove_sites": { - "cs_code": "al-monitor.com, arkansasonline.com, bild.de, doorbraak.be, gp.se, handelsblatt.com, interestingengineering.com, lastampa.it, politiken.dk, repubblica.it, rp-online.de, sueddeutsche.de, theepochtimes.com, theinformation.com", + "cs_code": "al-monitor.com, arkansasonline.com, bild.de, doorbraak.be, gp.se, group_haaretz, handelsblatt.com, interestingengineering.com, lastampa.it, politiken.dk, repubblica.it, rp-online.de, sueddeutsche.de, theepochtimes.com, theinformation.com", "domain": "###" }, "Abajournal.com": { @@ -246,12 +246,6 @@ "domain": "gramophone.co.uk", "useragent": "googlebot" }, - "Group_haaretz": { - "add_ext_link": "meta[property='og:url'][content*='/.']|article p", - "add_ext_link_type": "google_search_tool", - "domain": "group_haaretz", - "group": "haaretz.co.il,haaretz.com,themarker.com" - }, "Group_media_source_inc": { "allow_cookies": 1, "block_regex": "\\.com\\/.+\\/js\\/metering\\.js", diff --git a/manifest.json b/manifest.json index 9ede6841..024df794 100644 --- a/manifest.json +++ b/manifest.json @@ -298,6 +298,8 @@ "*://*.granta.com/*", "*://*.groene.nl/*", "*://*.grubstreet.com/*", + "*://*.haaretz.co.il/*", + "*://*.haaretz.com/*", "*://*.handelszeitung.ch/*", "*://*.harpers.org/*", "*://*.harpersbazaar.com/*", @@ -678,6 +680,7 @@ "*://*.theintercept.com/*", "*://*.thejuggernaut.com/*", "*://*.thelawyersdaily.ca/*", + "*://*.themarker.com/*", "*://*.themarket.ch/*", "*://*.themercury.com.au/*", "*://*.thenation.com/*", @@ -824,5 +827,5 @@ "*://archive.vn/*", "*://webcache.googleusercontent.com/*" ], - "version": "3.4.8.7" + "version": "3.4.8.8" } diff --git a/sites.js b/sites.js index a0d5354e..e2324aee 100644 --- a/sites.js +++ b/sites.js @@ -1045,6 +1045,21 @@ var defaultSites = { "lanuovasardegna.it" ] }, + "Haaretz Group": { + domain: "###_il_haaretz_group", + group: [ + "haaretz.co.il", + "haaretz.com", + "themarker.com" + ], + allow_cookies: 1, + cs_dompurify: 1, + exception: [{ + domain: "haaretz.co.il", + allow_cookies: 1 + } + ] + }, "Haas Mediengruppe (opt-in to custom sites)": { domain: "###_de_haas_medien", group: [ @@ -2931,7 +2946,6 @@ var de_funke_medien_nofix_domains = ['braunschweiger-zeitung.de', 'harzkurier.de var de_rp_aachen_medien_nofix_domains = ['aachener-nachrichten.de', 'aachener-zeitung.de', 'ga.de', 'rp-online.de', 'saarbruecker-zeitung.de', 'volksfreund.de']; var fr_groupe_ebra_nofix_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.fr', 'lalsace.fr', 'ledauphine.com', 'lejsl.com', 'leprogres.fr', 'republicain-lorrain.fr', 'vosgesmatin.fr']; var fr_indigo_nofix_domains = ['africaintelligence.com', 'africaintelligence.fr', 'glitz.paris', 'intelligenceonline.com', 'intelligenceonline.fr', 'lalettre.fr']; -var il_haaretz_group_nofix_domains = ['haaretz.co.il', 'haaretz.com', 'themarker.com']; var it_gedi_nofix_domains = ['gelocal.it', 'limesonline.com']; var nl_mediahuis_region_nofix_domains = ['gooieneemlander.nl', 'haarlemsdagblad.nl', 'ijmuidercourant.nl', 'leidschdagblad.nl', 'noordhollandsdagblad.nl']; -var nofix_sites = ['11freunde.de', 'aamulehti.fi', 'aftenposten.no', 'aftonbladet.se', 'allgaeuer-zeitung.de', 'asahi.com', 'asiatimes.com', 'autosport.com', 'aviationweek.com', 'badische-zeitung.de', 'bloomberglaw.com', 'bloombergtax.com', 'bnn.de', 'borsen.dk', 'businessinsider.de', 'businessinsider.jp', 'businesslive.co.za', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'chegg.com', 'codesports.com.au', 'compactmag.com', 'courrierinternational.com', 'coursehero.com', 'deutsche-wirtschafts-nachrichten.de', 'die-glocke.de', 'dn.no', 'dn.se', 'elordenmundial.com', 'entrepreneur.com', 'epw.in', 'expresso.pt', 'falter.at', 'finance.si', 'ftchinese.com', 'ftchineselive.com', 'gamestar.de', 'geo.de', 'golem.de', 'gp.se', 'handelsblatt.com', 'hbrchina.org', 'hbrfrance.fr', 'heise.de', 'hln.be', 'hs.fi', 'ilsole24ore.com', 'information.dk', 'investors.com', 'iltalehti.fi', 'jacobin.com', 'jeuneafrique.com', 'jungefreiheit.de', 'kleinezeitung.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.co.uk', 'law360.com', 'le1hebdo.fr', 'leconomiste.com', 'lefilmfrancais.com', 'lequipe.fr', 'lesjours.fr', 'letemps.ch', 'liberation.fr', 'limburger.nl', 'main-echo.de', 'mainpost.de', 'manager-magazin.de', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'monde-diplomatique.fr', 'mondediplo.com', 'money.it', 'moneycontrol.com', 'moodys.com', 'morningstar.com', 'moz.de', 'nachrichten.at', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'newslaundry.com', 'nn.de', 'nwzonline.de', 'observador.pt', 'ouest-france.fr', 'philonomist.com', 'pnp.de', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'quillette.com', 'republic.ru', 'rheinpfalz.de', 'risk.net', 'rnz.de', 'saechsische.de', 'schwarzwaelder-bote.de', 'sciencedirect.com', 'springer.com', 'statnews.com', 'stern.de', 'stimme.de', 'straitstimes.com', 'stratfor.com', 'streetinsider.com', 'substack.com', 'suedkurier.de', 'swp.de', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'theinitium.com', 'themorningcontext.com', 'theparisreview.org', 'thestar.com.my', 'thewirechina.com', 'weltwoche.ch', 'weltwoche.de', 'wissenschaft.de', 'wiwo.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(be_mediahuis_nofix_domains, de_funke_medien_nofix_domains, de_rp_aachen_medien_nofix_domains, fr_groupe_ebra_nofix_domains, fr_indigo_nofix_domains, il_haaretz_group_nofix_domains, it_gedi_nofix_domains, nl_mediahuis_region_nofix_domains); +var nofix_sites = ['11freunde.de', 'aamulehti.fi', 'aftenposten.no', 'aftonbladet.se', 'allgaeuer-zeitung.de', 'asahi.com', 'asiatimes.com', 'autosport.com', 'aviationweek.com', 'badische-zeitung.de', 'bloomberglaw.com', 'bloombergtax.com', 'bnn.de', 'borsen.dk', 'businessinsider.de', 'businessinsider.jp', 'businesslive.co.za', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'chegg.com', 'codesports.com.au', 'compactmag.com', 'courrierinternational.com', 'coursehero.com', 'deutsche-wirtschafts-nachrichten.de', 'die-glocke.de', 'dn.no', 'dn.se', 'elordenmundial.com', 'entrepreneur.com', 'epw.in', 'expresso.pt', 'falter.at', 'finance.si', 'ftchinese.com', 'ftchineselive.com', 'gamestar.de', 'geo.de', 'golem.de', 'gp.se', 'handelsblatt.com', 'hbrchina.org', 'hbrfrance.fr', 'heise.de', 'hln.be', 'hs.fi', 'ilsole24ore.com', 'information.dk', 'investors.com', 'iltalehti.fi', 'jacobin.com', 'jeuneafrique.com', 'jungefreiheit.de', 'kleinezeitung.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.co.uk', 'law360.com', 'le1hebdo.fr', 'leconomiste.com', 'lefilmfrancais.com', 'lequipe.fr', 'lesjours.fr', 'letemps.ch', 'liberation.fr', 'limburger.nl', 'main-echo.de', 'mainpost.de', 'manager-magazin.de', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'monde-diplomatique.fr', 'mondediplo.com', 'money.it', 'moneycontrol.com', 'moodys.com', 'morningstar.com', 'moz.de', 'nachrichten.at', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'newslaundry.com', 'nn.de', 'nwzonline.de', 'observador.pt', 'ouest-france.fr', 'philonomist.com', 'pnp.de', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'quillette.com', 'republic.ru', 'rheinpfalz.de', 'risk.net', 'rnz.de', 'saechsische.de', 'schwarzwaelder-bote.de', 'sciencedirect.com', 'springer.com', 'statnews.com', 'stern.de', 'stimme.de', 'straitstimes.com', 'stratfor.com', 'streetinsider.com', 'substack.com', 'suedkurier.de', 'swp.de', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'theinitium.com', 'themorningcontext.com', 'theparisreview.org', 'thestar.com.my', 'thewirechina.com', 'weltwoche.ch', 'weltwoche.de', 'wissenschaft.de', 'wiwo.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(be_mediahuis_nofix_domains, de_funke_medien_nofix_domains, de_rp_aachen_medien_nofix_domains, fr_groupe_ebra_nofix_domains, fr_indigo_nofix_domains, it_gedi_nofix_domains, nl_mediahuis_region_nofix_domains); diff --git a/sites_updated.json b/sites_updated.json index 3a75115b..a4292996 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -53,14 +53,14 @@ "Haaretz": { "domain": "haaretz.co.il", "allow_cookies": 1, - "add_ext_link": "meta[property='og:url'][content*='/.']|article p", + "add_ext_link": "meta[property='og:url'][content*='/.']|article header", "add_ext_link_type": "google_search_tool", "upd_version": "3.4.7.7" }, "Haaretz English": { "domain": "haaretz.com", "allow_cookies": 1, - "add_ext_link": "meta[property='og:url'][content*='/.']|article p", + "add_ext_link": "meta[property='og:url'][content*='/.']|article header", "add_ext_link_type": "google_search_tool", "upd_version": "3.4.7.7" }, @@ -72,15 +72,16 @@ "themarker.com" ], "allow_cookies": 1, - "add_ext_link": "meta[property='og:url'][content*='/.']|article p", + "add_ext_link": "meta[property='og:url'][content*='/.']|article header", "add_ext_link_type": "google_search_tool", "exception": [{ "domain": "themarker.com", "allow_cookies": 1, - "add_ext_link": "meta[property='og:url'][content*='/.']|article p", + "add_ext_link": "meta[property='og:url'][content*='/.']|article header", "add_ext_link_type": "archive.is" } - ] + ], + "upd_version": "3.4.8.8" }, "Inc42": { "domain": "inc42.com", @@ -158,7 +159,7 @@ "The Marker": { "domain": "themarker.com", "allow_cookies": 1, - "add_ext_link": "meta[property='og:url'][content*='/.']|article p", + "add_ext_link": "meta[property='og:url'][content*='/.']|article header", "add_ext_link_type": "archive.is", "upd_version": "3.4.7.7" },