From 7508a2e4fc1a92f464f8239774b54c6e3917bb79 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 15 Nov 2021 18:13:46 +0100 Subject: [PATCH] Add Italian.tech --- README.md | 1 + background.js | 2 +- changelog.txt | 1 + contentScript.js | 6 ++++-- manifest.json | 3 ++- options/options_custom.js | 18 ++++++++++-------- sites.js | 8 ++++++-- sites_updated.json | 4 ++++ 8 files changed, 29 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 4a09056..c1ce9bd 100644 --- a/README.md +++ b/README.md @@ -399,6 +399,7 @@ Grouped in options:\ [Il Fatto Quotidiano](https://www.ilfattoquotidiano.it) - [Il Manifesto](https://ilmanifesto.it) - [Il Secolo XIX](https://www.ilsecoloxix.it) - +[Italian.tech](https://www.italian.tech) - [La Nuova Sardegna](https://www.lanuovasardegna.it) - [La Repubblica](https://www.repubblica.it) - [La Stampa](https://www.lastampa.it) - diff --git a/background.js b/background.js index 1447146..2849105 100644 --- a/background.js +++ b/background.js @@ -841,7 +841,7 @@ if (matchUrlDomain(change_headers, details.url) && (!['font', 'image', 'styleshe setReferer = true; } if (requestHeader.name === 'User-Agent') { - useUserAgentMobile = requestHeader.value.toLowerCase().includes("mobile") && !matchUrlDomain(['telerama.fr'], details.url); + useUserAgentMobile = requestHeader.value.toLowerCase().includes("mobile") && !matchUrlDomain(['telerama.fr'].concat(it_repubblica_domains), details.url); } return requestHeader; }); diff --git a/changelog.txt b/changelog.txt index 9ad0d1a..0b47da0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Add Italian.tech * v2.4.4.0 (2021-11-14) Fix Nikkei Asian Review (cookies) diff --git a/contentScript.js b/contentScript.js index 3d84416..1bfd35c 100644 --- a/contentScript.js +++ b/contentScript.js @@ -14,7 +14,7 @@ var es_unidad_domains = ['elmundo.es', 'expansion.com', 'marca.com']; var fi_alma_talent_domains = ['arvopaperi.fi', 'iltalehti.fi', 'kauppalehti.fi', 'marmai.fi', 'mediuutiset.fi', 'mikrobitti.fi', 'talouselama.fi', 'tekniikkatalous.fi', 'tivi.fi', 'uusisuomi.fi']; var fr_groupe_ebra_domains = ['bienpublic.com', 'dna.fr', 'estrepublicain.fr', 'lalsace.fr', 'ledauphine.com', 'lejsl.com', 'leprogres.fr', 'republicain-lorrain.fr', 'vosgesmatin.fr']; var fr_groupe_la_depeche_domains = ['centrepresseaveyron.fr', 'ladepeche.fr', 'lindependant.fr', 'midi-olympique.fr', 'midilibre.fr', 'nrpyrenees.fr', 'petitbleu.fr']; -var it_repubblica_domains = ['gelocal.it', 'ilsecoloxix.it', 'lanuovasardegna.it', 'lastampa.it', 'limesonline.com', 'repubblica.it']; +var it_repubblica_domains = ['gelocal.it', 'ilsecoloxix.it', 'italian.tech', 'lanuovasardegna.it', 'lastampa.it', 'repubblica.it']; var it_quotidiano_domains = ['ilgiorno.it', 'ilrestodelcarlino.it', 'iltelegrafolivorno.it', 'lanazione.it', 'quotidiano.net']; var nl_mediahuis_region_domains = ['gooieneemlander.nl', 'haarlemsdagblad.nl', 'ijmuidercourant.nl', 'leidschdagblad.nl', 'noordhollandsdagblad.nl']; var no_nhst_media_domains = ['intrafish.com', 'rechargenews.com', 'tradewindsnews.com', 'upstreamonline.com']; @@ -1068,7 +1068,7 @@ else if (matchDomain('sudouest.fr')) { else csDone = true; -} else if (window.location.hostname.endsWith('.it') || matchDomain(['limesonline.com', 'quotidiano.net'])) {//italy +} else if (window.location.hostname.endsWith('.it') || matchDomain(['italian.tech', 'limesonline.com', 'quotidiano.net'])) {//italy if (matchDomain('corriere.it')) { let url = window.location.href; @@ -1171,6 +1171,8 @@ else if (domain = matchDomain(it_repubblica_domains)) { }, 1000); // Delay (in milliseconds) } } + let ads = document.querySelectorAll('div[id^="adv"]'); + removeDOMElement(...ads); } else { let paywall; if (['lastampa.it', 'repubblica.it'].includes(domain)) { diff --git a/manifest.json b/manifest.json index aeea384..38d871c 100644 --- a/manifest.json +++ b/manifest.json @@ -246,6 +246,7 @@ "*://*.inquirer.com/*", "*://*.intelligentinvestor.com.au/*", "*://*.intrafish.com/*", + "*://*.italian.tech/*", "*://*.japantimes.co.jp/*", "*://*.journaldunet.com/*", "*://*.journalnow.com/*", @@ -558,5 +559,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.4.4.0" + "version": "2.4.4.1" } \ No newline at end of file diff --git a/options/options_custom.js b/options/options_custom.js index 364f9ef..b55cd16 100644 --- a/options/options_custom.js +++ b/options/options_custom.js @@ -229,7 +229,7 @@ function renderOptions() { }, function (items) { var sites_custom = items.sites_custom; var sites_updated = items.sites_updated; - var sites_updated_new = Object.keys(sites_updated).filter(x => !defaultSites_domains.includes(x.domain)); + var sites_updated_domains_new = Object.values(sites_updated).filter(x => (x.domain && !defaultSites_domains.includes(x.domain) || x.group)).map(x => x.group ? x.group.filter(y => !defaultSites_domains.includes(y)) : x.domain).flat(); var sitesEl = document.getElementById('bypass_sites'); sitesEl.innerHTML = ''; var labelEl = document.createElement('label'); @@ -301,7 +301,7 @@ function renderOptions() { for (let key in sites_custom) { optionEl = document.createElement('option'); let domain = sites_custom[key]['domain']; - perm_origins.push('*://*.' + domain + '/*'); + perm_origins.push(domain); let isDefaultSite = defaultSites_domains.includes(domain); optionEl.text = isDefaultSite ? '*' : ''; optionEl.text += key + ': ' + domain + @@ -318,11 +318,13 @@ function renderOptions() { } labelEl.appendChild(selectEl); custom_sitesEl.appendChild(labelEl); - - for (let key in sites_updated_new) { - let domain = sites_updated_new[key]['domain']; - if (!perm_origins.includes(domain)) - perm_origins.push('*://*.' + domain + '/*'); + + if (sites_updated_domains_new.length > 0) { + labelEl = document.createElement('p'); + labelEl.appendChild(document.createElement('label')); + labelEl.appendChild(document.createTextNode('Updated sites: ' + sites_updated_domains_new.join())); + custom_sitesEl.appendChild(labelEl); + perm_origins = perm_origins.concat(sites_updated_domains_new).map(x => '*://*.' + x + '/*'); } var perm_custom = document.getElementById('perm-custom'); @@ -335,7 +337,7 @@ function renderOptions() { perm_custom.innerText = 'NO'; } }); - }); + }); var custom_enabled = document.getElementById('custom-enabled'); ext_api.permissions.contains({ diff --git a/sites.js b/sites.js index aefc88d..c10adcc 100644 --- a/sites.js +++ b/sites.js @@ -689,6 +689,10 @@ var defaultSites = { allow_cookies: 1, block_regex: /(cdn\.flip-pay\.com\/clients\/inm\/flip-pay\.js|cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js)/ }, + "Italian.tech": { + domain: "italian.tech", + group_rule: "###_gr_it_repubblica_domains" + }, "Knack.be": { domain: "knack.be", allow_cookies: 1, @@ -1617,7 +1621,7 @@ var defaultSites = { block_regex: /cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|consent|subscriptions)-.+\.js/ }, "###_gr_it_repubblica_domains": { - group_rule_domains: ["gelocal.it", "ilsecoloxix.it", "lanuovasardegna.it", "lastampa.it", "limesonline.com", "repubblica.it"], + group_rule_domains: ["gelocal.it", "ilsecoloxix.it", "italian.tech", "lanuovasardegna.it", "lastampa.it", "lescienze.it", "limesonline.com", "repubblica.it"], allow_cookies: 1, block_regex: /(scripts\.repubblica\.it\/pw\/pw\.js|cdn\.ampproject\.org\/v\d\/amp-(access|ad|user-notification)-.+\.js)/, useragent: "googlebot" @@ -1754,7 +1758,7 @@ var grouped_sites = {}; expandSiteRules(defaultSites); // grouped domains (background) -var it_repubblica_domains = defaultSites['###_gr_it_repubblica_domains']['group_rule_domains'].concat(['lescienze.it']); +var it_repubblica_domains = defaultSites['###_gr_it_repubblica_domains']['group_rule_domains']; var nl_mediahuis_region_domains = grouped_sites['###_nl_mediahuis_region']; var no_nhst_media_domains = grouped_sites['###_no_nhst_media']; var usa_theathletic_domains = grouped_sites['###_usa_theathletic']; diff --git a/sites_updated.json b/sites_updated.json index 2c63c08..82c0f32 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -1,2 +1,6 @@ { + "Italian.tech": { + "domain": "italian.tech", + "group_rule": "###_gr_it_repubblica_domains" + } }