diff --git a/background.js b/background.js index 0ab3b6b..e5e52c1 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', 'lecourrierdesstrateges.fr', '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); +const dompurify_sites = ['arcinfo.ch', 'asiatimes.com', 'bloomberg.com', 'cicero.de', 'dn.no', 'ilmanifesto.it', 'iltalehti.fi', 'iltirreno.it', 'inc42.com', 'ipolitics.ca', 'italiaoggi.it', 'lanuovasardegna.it', 'lecourrierdesstrateges.fr', '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; @@ -1336,11 +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.concat(['###_substack_custom']).includes(group) && custom_domain && !custom_flex_domains.includes(custom_domain)) { + let nofix_groups = ['###_substack_custom', '###_ch_tamedia']; + if (enabledSites.concat(nofix_groups).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') + else if (nofix_groups.includes(group)) nofix_sites.push(custom_domain); else { rules = Object.values(defaultSites).filter(x => x.domain === group)[0]; diff --git a/changelog.txt b/changelog.txt index 872d2df..89607cd 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Fix Inc42 * v3.0.0.0 (2023-01-08) Add Deutscher Fachverlag Mediengruppe (opt-in to custom sites) diff --git a/contentScript.js b/contentScript.js index 4b9e24e..eeca1ea 100644 --- a/contentScript.js +++ b/contentScript.js @@ -3211,21 +3211,36 @@ else if (matchDomain(usa_hearst_comm_domains)) { else if (matchDomain('inc42.com')) { let url = window.location.href; - if (!url.includes('/amp/')) { - let premium = document.querySelector('div.premium-container'); - if (premium) { - removeDOMElement(premium); - window.location.href = url.split('?')[0] + 'amp/'; - } - } else { - let plus_popup = document.querySelector('div#plus-pop'); - if (plus_popup) { - removeDOMElement(plus_popup); - let expired = document.querySelectorAll('div[amp-access="p.showPageviewExpired"], div[amp-access="cm.maxViews AND NOT loggedIn"]'); - removeDOMElement(...expired); - amp_unhide_access_hide('^="NOT p.showPageviewExpired"') - } + let paywall = document.querySelector('div#inc42_article_content_lock'); + let article_sel = 'div.content-wrapper, section[amp-access="status"]'; + if (paywall) { + removeDOMElement(paywall); + csDoneOnce = true; + let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split('?')[0]; + replaceDomElementExt(url_cache, true, false, article_sel); } + window.setTimeout(function () { + if (window.location.pathname.endsWith('/amp/')) { + let lazy_images = document.querySelectorAll('img.lazyload[src^="data:image/"][data-src]'); + for (let elem of lazy_images) { + elem.src = elem.getAttribute('data-src'); + elem.classList.remove('lazyload'); + if (elem.width > 1000) { + let ratio = elem.width / 640; + if (window.navigator.userAgent.toLowerCase().includes('mobile')) + ratio = elem.width / 320; + elem.width = elem.width / ratio; + elem.height = elem.height / ratio; + } + } + } + let also_read = document.querySelector('div > .also-read'); + if (also_read) { + let article = document.querySelector(article_sel); + if (article) + article.appendChild(also_read.parentNode); + } + }, 1000); } else if (matchDomain('indianexpress.com')) { @@ -4123,7 +4138,7 @@ else if (matchDomain('thewrap.com')) { else if (matchDomain('time.com')) { let body = document.querySelector('body'); - if (body) + if (body && !matchDomain('api.time.com')) body.setAttribute('style', 'position:relative !important;'); } diff --git a/contentScript_once.js b/contentScript_once.js index 27d6568..c37f37d 100644 --- a/contentScript_once.js +++ b/contentScript_once.js @@ -68,6 +68,8 @@ window.setTimeout(function () { group = '###_de_dfv_medien'; else if (document.querySelector('link[href*="/assets.static-chmedia.ch/"]')) group = 'nzz.ch'; + else if (document.querySelector('link[href*=".tamedia.ch/"]')) + group = '###_ch_tamedia'; } else if (hostname.match(/\.(es|cat)$/) || matchDomain(['diariocordoba.com', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info'])) { if (document.querySelector('link[href*="/estaticos-cdn."]')) group = '###_es_epiberica'; diff --git a/sites.js b/sites.js index 03df853..d70faa3 100644 --- a/sites.js +++ b/sites.js @@ -23,7 +23,7 @@ var defaultSites = { "Adweek (free articles only)": { domain: "adweek.com" }, - "Aftonbladet": { + "Aftonbladet (link to archive.is)": { domain: "aftonbladet.se", allow_cookies: 1, useragent: "bingbot" @@ -363,7 +363,7 @@ var defaultSites = { allow_cookies: 1, useragent: "googlebot" }, - "De Limburger": { + "De Limburger (link to archive.is)": { domain: "limburger.nl", allow_cookies: 1 }, @@ -379,7 +379,7 @@ var defaultSites = { domain: "tagesspiegel.de", allow_cookies: 1 }, - "Deutscher Fachverlag Mediengruppe": { + "Deutscher Fachverlag Mediengruppe (opt-in to custom sites)": { domain: "###_de_dfv_medien", group: [], allow_cookies: 1, @@ -927,8 +927,7 @@ var defaultSites = { }, "Inc42": { domain: "inc42.com", - allow_cookies: 1, - block_regex: /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-access-.+\.(m)?js)/ + allow_cookies: 1 }, "India Today": { domain: "indiatoday.in", @@ -2413,4 +2412,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', 'saarbruecker-zeitung.de', '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); +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', 'saarbruecker-zeitung.de', 'saechsische.de', 'schwarzwaelder-bote.de', 'statnews.com', 'stern.de', 'straitstimes.com', 'stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 'substack.com', 'suedkurier.de', 'swp.de', '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); diff --git a/sites_updated.json b/sites_updated.json index 6c57ded..d355f66 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -6,6 +6,11 @@ "ld_google_webcache": "div.article--cropped|div#body-copy", "new_site": 1 }, + "Inc42": { + "domain": "inc42.com", + "allow_cookies": 1, + "ld_google_webcache": "div#inc42_article_content_lock|div.content-wrapper,section[amp-access='status']" + }, "McClatchy DC": { "domain": "mcclatchydc.com", "block_regex": "js\\.matheranalytics\\.com"