2020-01-15 18:58:10 +01:00
|
|
|
/* Please respect alphabetical order when adding a site in any list */
|
|
|
|
|
2017-07-08 19:40:29 +02:00
|
|
|
'use strict';
|
2020-05-01 12:58:36 +02:00
|
|
|
var ext_api = (typeof browser === 'object') ? browser : chrome;
|
2020-10-20 17:00:14 +02:00
|
|
|
var ext_name = ext_api.runtime.getManifest().name;
|
2017-07-08 19:40:29 +02:00
|
|
|
|
2021-07-07 18:30:24 +02:00
|
|
|
const cs_limit_except = ['elespanol.com', 'faz.net', 'inkl.com', 'la-croix.com', 'nation.africa', 'nationalgeographic.com'];
|
2020-12-04 16:14:23 +01:00
|
|
|
var currentTabUrl = '';
|
|
|
|
var csDone = false;
|
|
|
|
|
2020-01-14 20:02:04 +01:00
|
|
|
// Cookies from this list are blocked by default (obsolete)
|
2020-02-25 22:47:05 +01:00
|
|
|
// defaultSites are loaded from sites.js at installation extension
|
|
|
|
// var defaultSites = {};
|
2017-07-08 19:40:29 +02:00
|
|
|
|
2018-01-31 06:08:11 +01:00
|
|
|
const restrictions = {
|
2021-01-28 17:34:00 +01:00
|
|
|
'adweek.com': /^((?!\.adweek\.com\/(.+\/)?(amp|agencyspy|tvnewser|tvspy)\/).)*$/,
|
2020-12-15 17:03:17 +01:00
|
|
|
'barrons.com': /.+\.barrons\.com\/(amp\/)?article(s)?\/.+/,
|
2021-08-03 20:03:11 +02:00
|
|
|
'bloomberg.com': /^((?!\.bloomberg\.com\/news\/terminal\/).)*$/,
|
2020-09-24 20:50:29 +02:00
|
|
|
'bloombergquint.com': /^((?!\.bloombergquint\.com\/bq-blue-exclusive\/).)*$/,
|
2021-05-21 08:04:59 +02:00
|
|
|
'economictimes.com': /.+\.economictimes\.com\/($|(__assets|prime)(\/.+)?|.+\.cms)/,
|
2021-03-13 16:49:58 +01:00
|
|
|
'elespanol.com': /^((?!\/cronicaglobal\.elespanol\.com\/).)*$/,
|
2021-01-19 18:46:06 +01:00
|
|
|
'elpais.com': /(\/elpais\.com\/$|\/(.+\.)?elpais\.com\/.+\.html)/,
|
2021-01-11 18:49:09 +01:00
|
|
|
'faz.net': /^((?!\/.+\.faz\.net\/aktuell\/(\?switchfaznet)?$).)*$/,
|
2020-12-16 18:38:05 +01:00
|
|
|
'foreignaffairs.com': /.+\.foreignaffairs\.com\/(articles|fa-caching|interviews|reviews|sites)\/.+/,
|
2021-05-18 17:12:15 +02:00
|
|
|
'ft.com': /.+\.ft\.com\/content\//,
|
2021-09-25 08:35:14 +02:00
|
|
|
'lastampa.it': /^((?!\/video\.lastampa\.it\/).)*$/,
|
2021-08-10 17:24:03 +02:00
|
|
|
'medianama.com': /\.medianama\.com\/((\d){4}\/(\d){2}|wp-content)\//,
|
2021-05-21 08:04:59 +02:00
|
|
|
'timesofindia.com': /.+\.timesofindia\.com\/($|toi-plus(\/.+)?|.+\.cms)/,
|
2021-03-28 19:03:33 +02:00
|
|
|
'nknews.org': /^((?!nknews\.org\/pro\/).)*$/,
|
2020-05-27 17:11:31 +02:00
|
|
|
'quora.com': /^((?!quora\.com\/search\?q=).)*$/,
|
2021-09-25 08:35:14 +02:00
|
|
|
'repubblica.it': /^((?!\/video\.repubblica\.it\/).)*$/,
|
2021-01-10 20:21:18 +01:00
|
|
|
'seekingalpha.com': /.+\/seekingalpha\.com\/($|(amp\/)?(article|news)\/|samw\/)/,
|
2021-08-10 17:24:03 +02:00
|
|
|
'statista.com': /^((?!\.statista\.com\/(outlook|study)\/).)*$/,
|
2021-09-25 08:35:14 +02:00
|
|
|
'sueddeutsche.de': /^((?!(projekte|zeitung)\.sueddeutsche\.de\/).)*$/,
|
2021-02-15 19:06:51 +01:00
|
|
|
'techinasia.com': /\.techinasia\.com\/.+/,
|
2020-08-20 19:01:12 +02:00
|
|
|
'wsj.com': /^((?!\/cn\.wsj\.com\/).)*$/
|
2017-07-08 19:40:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Don't remove cookies before page load
|
2021-07-27 23:47:05 +02:00
|
|
|
// allow_cookies are completed with domains in custom sites (default allow/remove_cookies)
|
2020-11-10 18:15:18 +01:00
|
|
|
var allow_cookies_default = [
|
2021-09-25 09:35:48 +02:00
|
|
|
'aachener-zeitung.de',
|
2020-10-24 16:38:01 +02:00
|
|
|
'abc.es',
|
2021-05-30 07:41:23 +02:00
|
|
|
'abril.com.br',
|
2021-06-05 09:12:21 +02:00
|
|
|
'ajc.com',
|
2021-03-27 08:49:01 +01:00
|
|
|
'apollo-magazine.com',
|
2021-05-09 14:51:15 +02:00
|
|
|
'asiatimes.com',
|
2021-03-01 18:04:43 +01:00
|
|
|
'atlantico.fr',
|
2021-02-13 18:11:58 +01:00
|
|
|
'augsburger-allgemeine.de',
|
2020-10-24 16:38:01 +02:00
|
|
|
'belfasttelegraph.co.uk',
|
2021-03-20 17:16:30 +01:00
|
|
|
'berliner-zeitung.de',
|
2020-12-12 13:15:50 +01:00
|
|
|
'berlingske.dk',
|
2021-04-03 09:37:45 +02:00
|
|
|
'billboard.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'bostonglobe.com',
|
|
|
|
'business-standard.com',
|
2021-08-08 10:02:24 +02:00
|
|
|
'businessoffashion.com',
|
2020-12-04 16:25:11 +01:00
|
|
|
'charliehebdo.fr',
|
2021-07-27 23:47:05 +02:00
|
|
|
'chronicle.com',
|
2021-01-11 21:00:41 +01:00
|
|
|
'cicero.de',
|
2020-10-24 16:38:01 +02:00
|
|
|
'clarin.com',
|
2021-01-20 20:26:35 +01:00
|
|
|
'cmjornal.pt',
|
2021-08-29 15:15:40 +02:00
|
|
|
'corriere.it',
|
2021-03-21 09:52:42 +01:00
|
|
|
'dallasnews.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'df.cl',
|
2021-04-10 09:09:44 +02:00
|
|
|
'di.se',
|
2020-10-24 16:38:01 +02:00
|
|
|
'dn.se',
|
|
|
|
'dvhn.nl',
|
|
|
|
'editorialedomani.it',
|
2021-07-28 18:59:35 +02:00
|
|
|
'elcomercio.pe',
|
2021-01-24 11:06:57 +01:00
|
|
|
'elconfidencial.com',
|
2021-03-13 16:49:58 +01:00
|
|
|
'elespanol.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'elmercurio.com',
|
|
|
|
'elpais.com',
|
2020-11-23 18:12:40 +01:00
|
|
|
'elperiodico.com',
|
2021-03-16 18:10:55 +01:00
|
|
|
'entrepreneur.com',
|
2020-12-03 16:52:33 +01:00
|
|
|
'esprit.presse.fr',
|
2020-12-12 13:28:25 +01:00
|
|
|
'euobserver.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'eurekareport.com.au',
|
|
|
|
'faz.net',
|
2020-11-15 14:37:30 +01:00
|
|
|
'financialpost.com',
|
2021-08-28 09:25:17 +02:00
|
|
|
'forbes.com',
|
2020-12-04 16:14:23 +01:00
|
|
|
'fortune.com',
|
2020-12-24 13:30:55 +01:00
|
|
|
'freiepresse.de',
|
2021-07-27 23:47:05 +02:00
|
|
|
'ftm.nl',
|
2020-10-24 16:38:01 +02:00
|
|
|
'gestion.pe',
|
|
|
|
'haaretz.co.il',
|
|
|
|
'haaretz.com',
|
|
|
|
'handelsblatt.com',
|
2021-01-25 20:39:20 +01:00
|
|
|
'hilltimes.com',
|
2021-05-25 19:28:02 +02:00
|
|
|
'hindustantimes.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'ilfattoquotidiano.it',
|
2021-08-05 19:43:10 +02:00
|
|
|
'inc42.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'independent.ie',
|
2021-07-19 17:54:59 +02:00
|
|
|
'infzm.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'intelligentinvestor.com.au',
|
2021-01-26 21:27:43 +01:00
|
|
|
'jpost.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'knack.be',
|
|
|
|
'kurier.at',
|
2020-11-26 20:18:11 +01:00
|
|
|
'la-croix.com',
|
2021-04-11 11:17:37 +02:00
|
|
|
'lanouvellerepublique.fr',
|
2021-04-02 13:21:25 +02:00
|
|
|
'latribune.fr',
|
2020-12-31 09:45:01 +01:00
|
|
|
'lavanguardia.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'lc.nl',
|
2020-12-04 16:14:23 +01:00
|
|
|
'lejdd.fr',
|
2020-10-24 16:38:01 +02:00
|
|
|
'lesechos.fr',
|
2021-04-02 16:09:00 +02:00
|
|
|
'letelegramme.fr',
|
2021-04-19 19:28:05 +02:00
|
|
|
'lexpress.fr',
|
2021-08-13 17:29:49 +02:00
|
|
|
'livelaw.in',
|
2021-04-30 17:25:41 +02:00
|
|
|
'loeildelaphotographie.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'lrb.co.uk',
|
2021-01-24 10:25:55 +01:00
|
|
|
'marketwatch.com',
|
2021-05-18 17:12:15 +02:00
|
|
|
'medianama.com',
|
2021-02-04 21:44:25 +01:00
|
|
|
'medium.com',
|
2021-02-18 19:47:12 +01:00
|
|
|
'nation.africa',
|
2020-10-24 16:38:01 +02:00
|
|
|
'nationalgeographic.com',
|
2020-11-15 14:37:30 +01:00
|
|
|
'nationalpost.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'nationalreview.com',
|
2021-01-09 17:45:21 +01:00
|
|
|
'newleftreview.org',
|
2020-10-24 16:38:01 +02:00
|
|
|
'newrepublic.com',
|
2021-03-08 18:43:38 +01:00
|
|
|
'newsday.com',
|
2020-12-20 21:28:12 +01:00
|
|
|
'nouvelobs.com',
|
2021-02-13 17:46:39 +01:00
|
|
|
'noz.de',
|
2021-03-28 16:05:06 +02:00
|
|
|
'nwzonline.de',
|
2020-10-24 16:38:01 +02:00
|
|
|
'nybooks.com',
|
2021-04-16 19:45:11 +02:00
|
|
|
'nyteknik.se',
|
2020-10-24 16:38:01 +02:00
|
|
|
'nytimes.com',
|
|
|
|
'nzz.ch',
|
2021-01-19 18:46:06 +01:00
|
|
|
'observador.pt',
|
2020-12-21 19:33:09 +01:00
|
|
|
'parismatch.com',
|
2020-12-19 16:27:30 +01:00
|
|
|
'piqd.de',
|
2021-03-07 14:03:22 +01:00
|
|
|
'politicaexterior.com',
|
2021-01-22 13:58:54 +01:00
|
|
|
'prospectmagazine.co.uk',
|
2020-10-24 16:38:01 +02:00
|
|
|
'quora.com',
|
2021-04-15 18:32:33 +02:00
|
|
|
'reuters.com',
|
2021-02-28 17:26:04 +01:00
|
|
|
'rhein-zeitung.de',
|
|
|
|
'rheinpfalz.de',
|
2020-10-24 16:38:01 +02:00
|
|
|
'rollingstone.com',
|
2021-01-18 20:12:02 +01:00
|
|
|
'ruhrnachrichten.de',
|
2020-11-15 14:49:53 +01:00
|
|
|
'saechsische.de',
|
2021-07-31 10:29:47 +02:00
|
|
|
'scientificamerican.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'scribd.com',
|
|
|
|
'seekingalpha.com',
|
2021-02-18 16:50:37 +01:00
|
|
|
'shz.de',
|
2021-02-18 17:11:07 +01:00
|
|
|
'si.com',
|
2021-05-27 20:22:45 +02:00
|
|
|
'staradvertiser.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'startribune.com',
|
|
|
|
'stocknews.com',
|
2021-01-31 10:54:06 +01:00
|
|
|
'stratfor.com',
|
2021-08-08 20:39:12 +02:00
|
|
|
'study.com',
|
2021-01-16 10:58:06 +01:00
|
|
|
'sudouest.fr',
|
2020-11-01 12:03:16 +01:00
|
|
|
'sueddeutsche.de',
|
2021-01-14 19:26:20 +01:00
|
|
|
'svz.de',
|
2021-09-26 08:54:14 +02:00
|
|
|
'tampabay.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'techinasia.com',
|
2021-04-11 11:17:37 +02:00
|
|
|
'telegraaf.nl',
|
2021-09-26 15:56:59 +02:00
|
|
|
'telerama.fr',
|
2020-10-24 16:38:01 +02:00
|
|
|
'the-american-interest.com',
|
2021-02-07 10:58:10 +01:00
|
|
|
'theartnewspaper.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'thehindu.com',
|
2020-11-25 17:29:48 +01:00
|
|
|
'thehindubusinessline.com',
|
2021-08-20 12:21:06 +02:00
|
|
|
'theintercept.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'themarker.com',
|
2021-09-26 17:46:37 +02:00
|
|
|
'themarket.ch',
|
2021-04-28 09:14:47 +02:00
|
|
|
'thenewatlantis.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'thewest.com.au',
|
2021-06-12 18:19:48 +02:00
|
|
|
'thewrap.com',
|
2021-02-10 19:18:29 +01:00
|
|
|
'time.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'timeshighereducation.com',
|
2021-02-04 21:44:25 +01:00
|
|
|
'towardsdatascience.com',
|
2021-05-06 19:50:12 +02:00
|
|
|
'usatoday.com',
|
2021-01-13 21:54:29 +01:00
|
|
|
'usinenouvelle.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'variety.com',
|
2021-04-10 09:49:45 +02:00
|
|
|
'velonews.com',
|
2021-02-27 14:20:30 +01:00
|
|
|
'venturebeat.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'washingtonpost.com',
|
|
|
|
'worldpoliticsreview.com',
|
|
|
|
'zeit.de',
|
2020-11-10 18:15:18 +01:00
|
|
|
];
|
|
|
|
var allow_cookies = allow_cookies_default.slice();
|
2017-07-08 19:40:29 +02:00
|
|
|
|
2019-10-25 15:00:08 +02:00
|
|
|
// select specific cookie(s) to hold from remove_cookies domains
|
2021-07-27 23:47:05 +02:00
|
|
|
var remove_cookies_select_hold = {
|
2020-10-24 16:38:01 +02:00
|
|
|
'barrons.com': ['wsjregion'],
|
2021-08-23 21:31:44 +02:00
|
|
|
'bloomberg.com': ['bb_geo_info'],
|
2020-11-27 19:34:15 +01:00
|
|
|
'groene.nl': ['accept-cookies', 'popunder-hidden'],
|
2020-10-24 16:38:01 +02:00
|
|
|
'newstatesman.com': ['STYXKEY_nsversion'],
|
|
|
|
'qz.com': ['gdpr'],
|
2021-01-06 19:50:12 +01:00
|
|
|
'seattletimes.com': ['st_newsletter_splash_seen'],
|
2020-11-11 17:19:13 +01:00
|
|
|
'wsj.com': ['wsjregion', 'ResponsiveConditional_initialBreakpoint']
|
2019-10-25 15:00:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// select only specific cookie(s) to drop from remove_cookies domains
|
2020-04-13 19:11:29 +02:00
|
|
|
var remove_cookies_select_drop = {
|
2021-01-22 14:44:36 +01:00
|
|
|
'ambito.com': ['TDNotesRead'],
|
2020-10-24 16:38:01 +02:00
|
|
|
'caixinglobal.com': ['CAIXINGLB_LOGIN_UUID'],
|
|
|
|
'fd.nl': ['socialread'],
|
2021-01-30 12:55:39 +01:00
|
|
|
'griffithreview.com': ['issuem_lp'],
|
2020-10-24 16:38:01 +02:00
|
|
|
'nrc.nl': ['counter'],
|
2021-01-22 14:33:25 +01:00
|
|
|
'theatlantic.com': ['articleViews'],
|
|
|
|
'thepointmag.com': ['monthly_history']
|
2019-10-25 15:00:08 +02:00
|
|
|
}
|
|
|
|
|
2021-07-27 23:47:05 +02:00
|
|
|
var cookies_select_domains = Object.keys(remove_cookies_select_hold).concat(Object.keys(remove_cookies_select_drop));
|
|
|
|
|
|
|
|
// Removes cookies after page load
|
|
|
|
// remove_cookies are completed with domains of custom sites (default allow/remove_cookies)
|
2021-07-31 10:29:47 +02:00
|
|
|
var remove_cookies_default = ['scientificamerican.com'];
|
2021-07-27 23:47:05 +02:00
|
|
|
var remove_cookies = remove_cookies_default.concat(cookies_select_domains);
|
|
|
|
|
|
|
|
allow_cookies = allow_cookies.concat(cookies_select_domains);
|
|
|
|
|
2019-05-12 22:44:03 +02:00
|
|
|
// Override User-Agent with Googlebot
|
2020-07-06 19:30:48 +02:00
|
|
|
var use_google_bot_default = [
|
2020-10-24 16:38:01 +02:00
|
|
|
'abc.es',
|
|
|
|
'barrons.com',
|
2020-12-12 13:15:50 +01:00
|
|
|
'berlingske.dk',
|
2020-10-26 22:21:32 +01:00
|
|
|
'deutsche-wirtschafts-nachrichten.de',
|
2020-10-24 16:38:01 +02:00
|
|
|
'df.cl',
|
2021-04-10 09:09:44 +02:00
|
|
|
'di.se',
|
2020-10-24 16:38:01 +02:00
|
|
|
'dn.se',
|
|
|
|
'editorialedomani.it',
|
2021-05-04 20:14:56 +02:00
|
|
|
'elmercurio.com',
|
2020-12-12 13:28:25 +01:00
|
|
|
'euobserver.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'eurekareport.com.au',
|
2021-07-28 18:33:12 +02:00
|
|
|
'fnlondon.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'ft.com',
|
|
|
|
'handelsblatt.com',
|
2021-01-25 20:39:20 +01:00
|
|
|
'hilltimes.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'intelligentinvestor.com.au',
|
2021-04-11 11:17:37 +02:00
|
|
|
'lanouvellerepublique.fr',
|
2021-07-02 15:11:37 +02:00
|
|
|
'leparisien.fr',
|
2021-01-16 10:58:06 +01:00
|
|
|
'newleftreview.org',
|
2021-03-28 19:03:33 +02:00
|
|
|
'nknews.org',
|
2020-12-20 21:28:12 +01:00
|
|
|
'nouvelobs.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'nzz.ch',
|
2020-12-19 16:27:30 +01:00
|
|
|
'piqd.de',
|
2020-10-24 16:38:01 +02:00
|
|
|
'quora.com',
|
|
|
|
'republic.ru',
|
2021-02-28 17:26:04 +01:00
|
|
|
'rhein-zeitung.de',
|
|
|
|
'rheinpfalz.de',
|
2021-01-18 20:12:02 +01:00
|
|
|
'ruhrnachrichten.de',
|
2020-10-24 16:38:01 +02:00
|
|
|
'seekingalpha.com',
|
2021-09-26 15:56:59 +02:00
|
|
|
'telerama.fr',
|
2021-09-26 17:46:37 +02:00
|
|
|
'themarket.ch',
|
2020-10-24 16:38:01 +02:00
|
|
|
'thetimes.co.uk',
|
2021-05-06 19:50:12 +02:00
|
|
|
'usatoday.com',
|
2021-01-13 21:54:29 +01:00
|
|
|
'usinenouvelle.com',
|
2021-03-24 17:55:25 +01:00
|
|
|
'wired.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'worldpoliticsreview.com',
|
2020-10-27 18:04:42 +01:00
|
|
|
'wsj.com',
|
2020-10-24 16:38:01 +02:00
|
|
|
'zeit.de',
|
2020-02-28 16:23:17 +01:00
|
|
|
];
|
2020-11-10 18:15:18 +01:00
|
|
|
var use_google_bot = use_google_bot_default.slice();
|
2020-03-10 19:12:25 +01:00
|
|
|
|
2020-11-02 18:52:40 +01:00
|
|
|
// Override User-Agent with Bingbot
|
2021-06-22 21:54:00 +02:00
|
|
|
var use_bing_bot_default = [
|
2020-11-02 18:52:40 +01:00
|
|
|
'haaretz.co.il',
|
|
|
|
'haaretz.com',
|
2021-08-31 18:57:40 +02:00
|
|
|
'nzherald.co.nz',
|
2021-04-05 19:56:50 +02:00
|
|
|
'stratfor.com',
|
2020-11-02 18:52:40 +01:00
|
|
|
'themarker.com',
|
|
|
|
];
|
2021-06-22 21:54:00 +02:00
|
|
|
var use_bing_bot = use_bing_bot_default.slice();
|
2020-11-02 18:52:40 +01:00
|
|
|
|
2021-02-07 08:41:41 +01:00
|
|
|
var use_facebook_referer_default = ['clarin.com', 'fd.nl', 'ilmanifesto.it', 'law.com', 'sloanreview.mit.edu'];
|
2021-02-06 21:37:52 +01:00
|
|
|
var use_facebook_referer = use_facebook_referer_default.slice();
|
2021-07-24 10:07:06 +02:00
|
|
|
var use_google_referer_default = ['statista.com'];
|
2021-02-06 21:37:52 +01:00
|
|
|
var use_google_referer = use_google_referer_default.slice();
|
2021-08-27 08:37:12 +02:00
|
|
|
var use_twitter_referer_default = ['law360.com', 'medium.com', 'towardsdatascience.com'];
|
2021-02-06 21:37:52 +01:00
|
|
|
var use_twitter_referer = use_twitter_referer_default.slice();
|
2021-08-22 08:18:10 +02:00
|
|
|
var use_random_ip = ['esprit.presse.fr'];
|
2021-02-06 21:37:52 +01:00
|
|
|
var change_headers = use_google_bot.concat(use_bing_bot, use_facebook_referer, use_google_referer, use_twitter_referer, use_random_ip);
|
2021-01-12 21:46:50 +01:00
|
|
|
|
2020-01-28 23:06:25 +01:00
|
|
|
// block paywall-scripts individually
|
|
|
|
var blockedRegexes = {
|
2021-09-25 09:35:48 +02:00
|
|
|
'aachener-zeitung.de': /cdn\.ampproject\.org\/v\d\/amp-(ad|analytics|consent|subscriptions)-.+\.js/,
|
2021-05-30 07:41:23 +02:00
|
|
|
'abril.com.br': /\.abril\.com\.br\/.+\/abril-paywall\/js\/abril-paywall\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'adweek.com': /\.lightboxcdn\.com\//,
|
2021-05-29 08:00:38 +02:00
|
|
|
'afr.com': /api\.afr\.com\/graphql\?query=.+PaywallRuleQuery/,
|
2021-06-05 09:12:21 +02:00
|
|
|
'ajc.com': /loader-cdn\.azureedge\.net\//,
|
2021-03-01 18:04:43 +01:00
|
|
|
'alternatives-economiques.fr': /\.poool\.fr\//,
|
|
|
|
'americanbanker.com': /\.tinypass\.com\//,
|
2021-07-30 08:52:20 +02:00
|
|
|
'apollo-magazine.com': /\.tinypass\.com\//,
|
2021-05-09 14:51:15 +02:00
|
|
|
'asiatimes.com': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|analytics)-.+\.(m)?js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'atlantico.fr': /\.poool\.fr\//,
|
2021-07-30 08:52:20 +02:00
|
|
|
'augsburger-allgemeine.de':/(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-(ad|subscriptions)-.+\.js)/,
|
2021-09-23 22:57:33 +02:00
|
|
|
'barrons.com': /(cdn\.cxense\.com\/.+|cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent|subscriptions)-.+\.js)/,
|
2021-01-01 12:23:29 +01:00
|
|
|
'belfasttelegraph.co.uk': /(cdn\.flip-pay\.com\/clients\/inm\/flip-pay\.js|cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js)/,
|
2021-04-03 09:37:45 +02:00
|
|
|
'billboard.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'bizjournals.com': /(assets\.bizjournals\.com\/static\/js\/app\/cxense\.js|cdn\.cxense\.com\/)/,
|
2021-08-06 13:25:43 +02:00
|
|
|
'bloomberg.com': /\.tinypass\.com\//,
|
2021-06-14 21:45:26 +02:00
|
|
|
'bostonglobe.com': /\.blueconic\.net\//,
|
2021-03-01 18:04:43 +01:00
|
|
|
'businessinsider.com': /\.tinypass\.com\//,
|
|
|
|
'challenges.fr': /\.poool\.fr\//,
|
|
|
|
'charliehebdo.fr': /\.poool\.fr\//,
|
2021-03-02 18:50:49 +01:00
|
|
|
'chronicle.com': /(\.blueconic\.net\/|\.chronicle\.com\/(common\/)?(che-auth0-user|script)\.js)/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'clarin.com': /js\.matheranalytics\.com\//,
|
2021-01-20 20:26:35 +01:00
|
|
|
'cmjornal.pt': /cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad)-.+\.js/,
|
2021-08-01 10:30:10 +02:00
|
|
|
'commentary.org': /\.commentary\.org\/.+\/js\/dg-locker-public\.js/,
|
2021-08-29 15:15:40 +02:00
|
|
|
'corriere.it': /(\.tinypass\.com\/|\.corriereobjects\.it\/.+\/js\/_paywall\.sjs)/,
|
2021-03-21 09:52:42 +01:00
|
|
|
'dallasnews.com': /(\.blueconic\.net\/|js\.matheranalytics\.com\/)/,
|
2021-07-27 23:47:05 +02:00
|
|
|
'digiday.com': /cdn.\.tinypass\.com\//,
|
2021-03-01 18:04:43 +01:00
|
|
|
'dvhn.nl': /\.evolok\.net\/.+\/authorize\//,
|
|
|
|
'economist.com': /\.tinypass\.com\//,
|
|
|
|
'editorialedomani.it': /(\.editorialedomani\.it\/pelcro\.js|js\.pelcro\.com\/)/,
|
2021-09-05 09:18:08 +02:00
|
|
|
'elcomercio.pe': /\/elcomercio\.pe\/pf\/dist\/engine\/react\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'elconfidencial.com': /\.tinypass\.com\//,
|
2021-03-13 16:49:58 +01:00
|
|
|
'elespanol.com': /\.eestatic\.com\/assets_js\/web\/v\d\/historia.*\.min\.js/,
|
2020-12-22 07:45:05 +01:00
|
|
|
'elmercurio.com': /\.(elmercurio\.com|emol\.cl)\/(.+\/)?js\/(.+\/)?(modal|merPramV\d|PramModal\.min)\.js/,
|
2021-04-07 19:43:00 +02:00
|
|
|
'elpais.com': /(\.epimg\.net\/js\/.+\/(noticia|user)\.min\.js|\/elpais\.com\/arc\/subs\/p\.min\.js|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|consent)-.+\.js)/,
|
2021-01-02 12:48:07 +01:00
|
|
|
'elperiodico.com': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
|
2021-08-31 08:34:48 +02:00
|
|
|
'estadao.com.br': /acesso\.estadao\.com\.br\/paywall\/.+\/.+\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'estrellavalpo.cl': /(\.mercuriovalpo\.cl\/impresa\/.+\/assets\/(vendor|\d)\.js|pram\.pasedigital\.cl\/API\/User\/Status\?)/,
|
2021-05-28 18:31:38 +02:00
|
|
|
'exame.com': /\/exame\.com\/.+\/js\/pywll-dyn\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'financialpost.com': /\.tinypass\.com\//,
|
2021-08-28 09:25:17 +02:00
|
|
|
'forbes.com': /\.tinypass\.com\//,
|
2021-03-01 18:04:43 +01:00
|
|
|
'foreignaffairs.com': /\.foreignaffairs\.com\/sites\/default\/files\/js\/js_[^y].+\.js/,
|
2021-04-29 19:35:59 +02:00
|
|
|
'foreignpolicy.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'fortune.com': /\.tinypass\.com\//,
|
2021-01-02 12:48:07 +01:00
|
|
|
'freiepresse.de': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'ftm.nl': /\.ftm\.nl\/js\/routing\?/,
|
2021-09-05 09:18:08 +02:00
|
|
|
'gestion.pe': /\/gestion\.pe\/pf\/dist\/engine\/react\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'globes.co.il': /\.tinypass\.com\//,
|
|
|
|
'globo.com': /\.tinypass\.com\//,
|
2021-01-30 12:55:39 +01:00
|
|
|
'griffithreview.com': /\.griffithreview\.com\/.+\/leaky-paywall\//,
|
2020-10-24 16:38:01 +02:00
|
|
|
'haaretz.co.il': /haaretz\.co\.il\/htz\/js\/inter\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'haaretz.com': /haaretz\.com\/hdc\/web\/js\/minified\/header-scripts-int.js/,
|
|
|
|
'hbr.org': /\.tinypass\.com\//,
|
2021-04-25 13:45:36 +02:00
|
|
|
'hilltimes.com': /\.hilltimes\.com\/.+\/js\/loadingoverlay\/loadingoverlay\.min\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'historyextra.com': /\.evolok\.net\/.+\/authorize\//,
|
2021-02-21 17:22:06 +01:00
|
|
|
'houstonchronicle.com': /\.blueconic\.net\//,
|
2021-09-03 12:35:25 +02:00
|
|
|
'ilfattoquotidiano.it': /cdn\.ampproject\.org\/v\d\/amp-(ad|subscriptions)-.+\.js/,
|
2021-08-04 19:57:08 +02:00
|
|
|
'inc.com': /\.tinypass\.com\//,
|
2021-08-05 19:43:10 +02:00
|
|
|
'inc42.com': /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|ad|analytics)-.+\.(m)?js)/,
|
2021-01-01 12:23:29 +01:00
|
|
|
'independent.ie': /(cdn\.flip-pay\.com\/clients\/inm\/flip-pay\.js|cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js)/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'inquirer.com': /\.tinypass\.com\//,
|
2021-01-02 12:48:07 +01:00
|
|
|
'irishtimes.com': /cdn\.ampproject\.org\/v\d\/amp-(access|ad)-.+\.js/,
|
2021-02-01 17:21:49 +01:00
|
|
|
'japantimes.co.jp': /\.piano\.io\//,
|
2021-01-26 21:27:43 +01:00
|
|
|
'jpost.com': /\.jpost\.com\/bundles\/js_article\?/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'knack.be': /\.knack\.be\/js\/responsive\/rmgModal\.js/,
|
|
|
|
'kurier.at': /\.tinypass\.com\//,
|
2021-01-02 12:48:07 +01:00
|
|
|
'la-croix.com': /cdn\.ampproject\.org\/v\d\/amp-(access|ad)-.+\.js/,
|
2020-12-22 07:45:05 +01:00
|
|
|
'lasegunda.com': /\.(lasegunda\.com|emol\.cl)\/(.+\/)?js\/(.+\/)?(modal|merPramV\d|PramModal\.min)\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'latercera.com': /(\.latercera\.com\/arc\/subs\/p\.js|cdn\.cxense\.com\/)/,
|
2021-08-08 18:09:48 +02:00
|
|
|
'latimes.com': /metering\.platform\.latimes\.com\/v\d\/meter/,
|
2021-04-02 13:21:25 +02:00
|
|
|
'latribune.fr': /\.poool\.fr\//,
|
2020-12-31 09:45:01 +01:00
|
|
|
'lavanguardia.com': /(\.evolok\.net\/.+\/authorize\/|\.lavanguardia\.com\/(js\/)?godo-)/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'lc.nl': /\.evolok\.net\/.+\/authorize\//,
|
|
|
|
'lejdd.fr': /\.poool\.fr\//,
|
|
|
|
'leparisien.fr': /\.tinypass\.com\//,
|
|
|
|
'lesechos.fr': /\.tinypass\.com\//,
|
2021-04-02 16:09:00 +02:00
|
|
|
'letelegramme.fr': /\.poool\.fr\//,
|
2021-04-19 19:28:05 +02:00
|
|
|
'lexpress.fr': /\.poool\.fr\//,
|
2021-03-01 18:04:43 +01:00
|
|
|
'livemint.com': /(\.livemint\.com\/js\/localWorker\.js|analytics\.htmedia\.in\/analytics-js\/.+\.js)/,
|
2021-04-30 17:25:41 +02:00
|
|
|
'loeildelaphotographie.com': /cdn\.loeildelaphotographie\.com\/wp-content\/.+\/hague-child\/js\/script-.+\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'lopinion.fr': /\.poool\.fr\//,
|
|
|
|
'lrb.co.uk': /\.tinypass\.com\//,
|
2021-01-24 10:25:55 +01:00
|
|
|
'marketwatch.com': /(cdn\.cxense\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|ad)-.+\.js)/,
|
2020-11-12 19:26:54 +01:00
|
|
|
'mercuriovalpo.cl': /(.+\.mercuriovalpo\.cl\/impresa\/.+\/assets\/(vendor|\d)\.js|pram\.pasedigital\.cl\/API\/User\/Status\?)/,
|
2021-03-30 20:52:32 +02:00
|
|
|
'mexiconewsdaily.com': /\.mexiconewsdaily\.com\/c\/assets\/pigeon\.js/,
|
2021-02-18 19:47:12 +01:00
|
|
|
'nation.africa': /(\.evolok\.net\/|nation\.africa\/resource\/themes\/nation-.+\/js\/.+\.js)/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'nationalgeographic.com': /\.blueconic\.net\//,
|
|
|
|
'nationalpost.com': /\.tinypass\.com\//,
|
|
|
|
'nationalreview.com': /(\.blueconic\.net\/|cdn\.ampproject\.org\/v\d\/amp-(access|ad)-.+\.js)/,
|
|
|
|
'newrepublic.com': /\.onecount\.net\/js\//,
|
2021-03-08 18:43:38 +01:00
|
|
|
'newsday.com': /(loader-cdn\.azureedge\.net\/|js\.matheranalytics\.com\/)/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'newsweek.com': /js\.pelcro\.com\//,
|
|
|
|
'newyorker.com': /\.newyorker\.com\/verso\/static\/presenter-articles.+\.js/,
|
2021-03-28 19:03:33 +02:00
|
|
|
'nknews.org': /\.nknews\.org\/wp-content\/themes\/nknews\/js\/bootstrap\.min\.js/,
|
2021-02-13 17:46:39 +01:00
|
|
|
'noz.de': /cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|fx-flying-carpet)-.+\.js/,
|
2021-03-28 16:05:06 +02:00
|
|
|
'nwzonline.de': /cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|fx-flying-carpet)-.+\.js/,
|
2021-04-16 19:45:11 +02:00
|
|
|
'nyteknik.se': /\.nyteknik\.se\/.+\/static\/js\/site\.min\.js/,
|
2020-11-25 17:29:48 +01:00
|
|
|
'nytimes.com': /(meter-svc\.nytimes\.com\/meter\.js|mwcm\.nyt\.com\/.+\.js)/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'observador.pt': /\.tinypass\.com\//,
|
|
|
|
'parismatch.com': /\.poool\.fr\//,
|
2021-08-17 18:37:06 +02:00
|
|
|
'post-gazette.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/,
|
2021-06-29 21:13:53 +02:00
|
|
|
'qz.com': /\.tinypass\.com\//,
|
2021-05-05 17:11:38 +02:00
|
|
|
'reuters.com': /\.reuters\.com\/(arc\/subs\/p\.min|pf\/resources\/dist\/reuters\/js\/index)\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'rollingstone.com': /cdn\.cxense\.com\//,
|
|
|
|
'ruhrnachrichten.de': /\.tinypass\.com\//,
|
|
|
|
'saechsische.de': /\.tinypass\.com\//,
|
2021-08-08 18:09:48 +02:00
|
|
|
'sandiegouniontribune.com': /metering\.platform\.sandiegouniontribune\.com\/v\d\/meter/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'science-et-vie.com': /\.qiota\.com\//,
|
|
|
|
'sciencesetavenir.fr': /\.poool\.fr\//,
|
2021-05-10 18:12:59 +02:00
|
|
|
'scmp.com': /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|ad|analytics|consent|fx-flying-carpet)-.+\.js)/,
|
2021-01-18 20:35:56 +01:00
|
|
|
'seekingalpha.com': /(\.tinypass\.com\/|cdn\.ampproject\.org(\/.+)?\/v\d\/amp-(access|ad|loader)-.+\.js)/,
|
2021-02-21 17:22:06 +01:00
|
|
|
'sfchronicle.com': /\.blueconic\.net\//,
|
2021-02-18 16:50:37 +01:00
|
|
|
'shz.de': /cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|fx-flying-carpet)-.+\.js/,
|
2021-02-18 17:11:07 +01:00
|
|
|
'si.com': /\.blueconic\.net\//,
|
2021-03-01 18:04:43 +01:00
|
|
|
'slate.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/,
|
|
|
|
'sloanreview.mit.edu': /(\.tinypass\.com\/|\/sloanreview\.mit\.edu\/.+\/welcome-ad\.js)/,
|
|
|
|
'spectator.co.uk': /\.tinypass\.com\//,
|
|
|
|
'spectator.com.au': /\.tinypass\.com\//,
|
2021-06-19 19:04:34 +02:00
|
|
|
'spectator.us': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/,
|
2021-02-18 16:50:37 +01:00
|
|
|
'svz.de': /cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|fx-flying-carpet)-.+\.js/,
|
2021-09-26 08:54:14 +02:00
|
|
|
'tampabay.com': /(loader-cdn\.azureedge\.net\/|js\.matheranalytics\.com\/)/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'technologyreview.com': /\.blueconic\.net\//,
|
2021-01-18 20:35:56 +01:00
|
|
|
'telegraph.co.uk': /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js|\.telegraph\.co\.uk\/.+\/piano.+\.js|assets\.adobedtm\.com\/.+\.js)/,
|
2021-02-07 10:58:10 +01:00
|
|
|
'theartnewspaper.com': /\.amazonaws.com\/production-website-scripts\/bouncer\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'thedailybeast.com': /\.tinypass\.com\//,
|
2021-06-19 19:04:34 +02:00
|
|
|
'theglobeandmail.com': /smartwall\.theglobeandmail\.com\//,
|
2021-03-01 18:04:43 +01:00
|
|
|
'thehindu.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/,
|
|
|
|
'thehindubusinessline.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/,
|
2021-08-20 12:21:06 +02:00
|
|
|
'theintercept.com': /\.theintercept\.com\/api\/tinypass\.min\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'thenation.com': /\.tinypass\.com\//,
|
2021-04-28 09:14:47 +02:00
|
|
|
'thenewatlantis.com': /\.thenewatlantis\.com\/.+\/thenewatlantis\/js\/(gate|donate)\.js/,
|
2021-07-30 08:52:20 +02:00
|
|
|
'thesaturdaypaper.com.au': /\.thesaturdaypaper\.com\.au\/sites\/all\/modules\/custom\/node_meter\/pw\.js/,
|
2021-06-12 18:19:48 +02:00
|
|
|
'thewrap.com': /\.wallkit\.net\/js\//,
|
2021-02-10 19:18:29 +01:00
|
|
|
'time.com': /\/time\.com\/dist\/meter-wall-client-js\..+\.js/,
|
2020-12-05 18:12:05 +01:00
|
|
|
'timeshighereducation.com': /\.timeshighereducation\.com\/sites\/default\/files\/js\/js_bbCGL.+\.js/,
|
2021-03-01 18:04:43 +01:00
|
|
|
'valeursactuelles.com': /\.qiota\.com\//,
|
|
|
|
'variety.com': /cdn\.cxense\.com\//,
|
2021-04-10 09:49:45 +02:00
|
|
|
'velonews.com': /\.velonews\.com\/.+\/scripts\/contentGate.+\.js/,
|
2021-02-27 14:20:30 +01:00
|
|
|
'venturebeat.com': /\.wallkit\.net\/js\//,
|
2021-08-20 12:21:06 +02:00
|
|
|
'washingtonpost.com': /(\.washingtonpost\.com\/.+\/(default-article\/.+\/load_immediately|jqmodal)\/.+\.js|cdn\.ampproject\.org\/.+\/v\d\/amp-(access|(sticky-)?ad|subscriptions)-.+\.js)/,
|
2021-09-23 22:57:33 +02:00
|
|
|
'wsj.com': /(cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent|subscriptions)-.+\.js|cdn\.cxense\.com\/)/
|
2019-11-27 19:23:00 +01:00
|
|
|
};
|
2017-07-08 19:40:29 +02:00
|
|
|
|
2021-02-25 21:05:01 +01:00
|
|
|
// grouped domains in sites.js (for options)
|
2021-01-02 14:03:52 +01:00
|
|
|
|
|
|
|
// grouped domains (rules only)
|
|
|
|
const au_nine_domains = ['brisbanetimes.com.au', 'smh.com.au', 'theage.com.au', 'watoday.com.au'];
|
2021-07-30 19:20:35 +02:00
|
|
|
const es_unidad_domains = ['elmundo.es', 'expansion.com', 'marca.com'];
|
2021-05-11 19:24:21 +02:00
|
|
|
const it_repubblica_domains = ['gelocal.it', 'ilsecoloxix.it', 'lanuovasardegna.it', 'lastampa.it', 'limesonline.com', 'repubblica.it'].concat(['lescienze.it']);
|
2021-01-02 14:03:52 +01:00
|
|
|
const nl_pg_domains = ['parool.nl', 'trouw.nl', 'volkskrant.nl', 'humo.be', 'demorgen.be'];
|
2021-05-01 11:22:06 +02:00
|
|
|
const usa_genomeweb_domains = ['genomeweb.com', '360dx.com', 'precisiononcologynews.com'];
|
2020-07-06 19:30:48 +02:00
|
|
|
|
2020-11-02 18:52:40 +01:00
|
|
|
const userAgentDesktopG = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
|
|
|
|
const userAgentMobileG = "Chrome/80.0.3987.92 Mobile Safari/537.36 (compatible ; Googlebot/2.1 ; +http://www.google.com/bot.html)"
|
|
|
|
|
|
|
|
const userAgentDesktopB = "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
|
|
|
|
const userAgentMobileB = "Chrome/80.0.3987.92 Mobile Safari/537.36 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
|
2019-04-07 01:34:30 +02:00
|
|
|
|
2017-07-08 19:40:29 +02:00
|
|
|
var enabledSites = [];
|
2020-08-20 19:01:12 +02:00
|
|
|
var disabledSites = [];
|
|
|
|
var customSites = {};
|
|
|
|
var customSites_domains = [];
|
2021-01-05 18:53:59 +01:00
|
|
|
var excludedSites = [];
|
2017-07-08 19:40:29 +02:00
|
|
|
|
2020-01-28 23:06:25 +01:00
|
|
|
function setDefaultOptions() {
|
2020-10-31 20:06:38 +01:00
|
|
|
ext_api.storage.local.set({
|
2021-03-26 13:05:20 +01:00
|
|
|
sites: filterObject(defaultSites, function (val, key) {
|
|
|
|
return !val.includes('#options_disable_')
|
|
|
|
})
|
2020-10-24 16:38:01 +02:00
|
|
|
}, function () {
|
2020-03-25 19:31:28 +01:00
|
|
|
ext_api.runtime.openOptionsPage();
|
2020-01-28 23:06:25 +01:00
|
|
|
});
|
2020-03-27 19:02:27 +01:00
|
|
|
}
|
2020-03-25 19:31:28 +01:00
|
|
|
|
2020-12-07 18:10:59 +01:00
|
|
|
var grouped_sites = {
|
|
|
|
'###_au_comm_media': au_comm_media_domains,
|
|
|
|
'###_au_news_corp': au_news_corp_domains,
|
|
|
|
'###_au_prov_news': au_prov_news_domains,
|
2021-06-12 09:40:10 +02:00
|
|
|
'###_br_folha': br_folha_domains,
|
2021-01-08 18:40:14 +01:00
|
|
|
'###_ca_torstar': ca_torstar_domains,
|
2020-12-10 20:23:12 +01:00
|
|
|
'###_de_funke_medien': de_funke_media_domains,
|
2020-12-08 20:13:27 +01:00
|
|
|
'###_de_madsack': de_madsack_domains,
|
2021-05-21 08:04:59 +02:00
|
|
|
'###_economictimes': economictimes_domains,
|
2021-09-24 16:09:54 +02:00
|
|
|
'###_es_epiberica': es_epiberica_domains,
|
2020-12-07 18:10:59 +01:00
|
|
|
'###_es_grupo_vocento': es_grupo_vocento_domains,
|
|
|
|
'###_fi_alma_talent': fi_alma_talent_domains,
|
2021-08-14 17:48:33 +02:00
|
|
|
'###_fi_sanoma': fi_sanoma_domains,
|
2020-12-07 18:10:59 +01:00
|
|
|
'###_fr_be_groupe_rossel': fr_be_groupe_rossel_domains,
|
|
|
|
'###_fr_groupe_ebra': fr_groupe_ebra_domains,
|
|
|
|
'###_fr_groupe_la_depeche': fr_groupe_la_depeche_domains,
|
2021-01-05 18:53:59 +01:00
|
|
|
'###_it_ilmessaggero': it_ilmessaggero_domains,
|
2021-07-30 08:52:20 +02:00
|
|
|
'###_it_quotidiano': it_quotidiano_domains,
|
2021-01-05 18:53:59 +01:00
|
|
|
'###_nl_ad_region': nl_ad_region_domains,
|
2021-06-20 21:41:11 +02:00
|
|
|
'###_nl_mediahuis_region': nl_mediahuis_region_domains,
|
2021-07-23 16:12:10 +02:00
|
|
|
'###_no_nhst_media': no_nhst_media_domains,
|
2021-05-13 21:52:59 +02:00
|
|
|
'###_timesofindia': timesofindia_domains,
|
2021-08-17 22:45:11 +02:00
|
|
|
'###_usa_craincomm': usa_craincomm_domains,
|
2021-02-12 19:22:15 +01:00
|
|
|
'###_usa_mcc': usa_mcc_domains,
|
2021-08-16 22:49:58 +02:00
|
|
|
'###_usa_mng': usa_mng_domains,
|
2021-02-26 17:43:36 +01:00
|
|
|
'###_usa_nymag': usa_nymag_domains,
|
2021-04-25 13:45:36 +02:00
|
|
|
'###_usa_tribune': usa_tribune_domains,
|
|
|
|
'###_usa_theathletic': usa_theathletic_domains
|
2020-12-07 18:10:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
function add_grouped__enabled_domains(groups) {
|
|
|
|
for (let key in groups) {
|
|
|
|
if (enabledSites.includes(key))
|
|
|
|
enabledSites = enabledSites.concat(groups[key]);
|
|
|
|
else
|
|
|
|
disabledSites = disabledSites.concat(groups[key]);
|
2021-01-05 18:53:59 +01:00
|
|
|
for (let site of excludedSites) {
|
|
|
|
if (enabledSites.includes(site)) {
|
|
|
|
enabledSites.splice(enabledSites.indexOf(site), 1);
|
|
|
|
disabledSites.push(site);
|
|
|
|
}
|
|
|
|
}
|
2020-12-07 18:10:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-15 21:10:03 +01:00
|
|
|
// add grouped sites to en/disabledSites & init rules (optional)
|
|
|
|
function add_grouped_sites(init_rules) {
|
2020-12-07 18:10:59 +01:00
|
|
|
add_grouped__enabled_domains(grouped_sites);
|
2020-11-21 13:45:18 +01:00
|
|
|
if (init_rules) {
|
|
|
|
for (let domain of au_comm_media_domains) {
|
|
|
|
allow_cookies.push(domain);
|
2021-03-01 18:04:43 +01:00
|
|
|
blockedRegexes[domain] = /cdn-au\.piano\.io\/api\/tinypass.+\.js/;
|
2020-11-21 13:45:18 +01:00
|
|
|
}
|
|
|
|
for (let domain of au_news_corp_domains) {
|
|
|
|
allow_cookies.push(domain);
|
2021-08-22 08:18:10 +02:00
|
|
|
use_google_bot.push(domain);
|
2021-01-02 12:48:07 +01:00
|
|
|
blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-(access|ad|iframe)-.+\.js/;
|
2020-11-21 13:45:18 +01:00
|
|
|
}
|
|
|
|
for (let domain of au_prov_news_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
use_google_bot.push(domain);
|
|
|
|
}
|
2021-06-12 09:40:10 +02:00
|
|
|
for (let domain of br_folha_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
blockedRegexes[domain] = /(\.folha\.uol\.com\.br\/paywall\/js\/.+\/publicidade\.ads\.js|paywall\.folha\.uol\.com\.br\/|js\.matheranalytics\.com\/)/;
|
|
|
|
}
|
2021-01-08 18:40:14 +01:00
|
|
|
for (let domain of ca_torstar_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
blockedRegexes[domain] = /\.(ca|com)\/api\/overlaydata/;
|
|
|
|
}
|
2020-12-10 20:23:12 +01:00
|
|
|
for (let domain of de_funke_media_domains) {
|
|
|
|
allow_cookies.push(domain);
|
2021-03-01 18:04:43 +01:00
|
|
|
blockedRegexes[domain] = /(cdn\.cxense\.com\/|\.tinypass\.com\/)/;
|
2021-03-12 17:03:22 +01:00
|
|
|
use_google_bot.push(domain);
|
2020-12-10 20:23:12 +01:00
|
|
|
}
|
2021-02-05 14:57:27 +01:00
|
|
|
for (let domain of de_madsack_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-(ad|subscriptions)-.+\.js/;
|
|
|
|
}
|
2021-05-21 08:04:59 +02:00
|
|
|
for (let domain of economictimes_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
use_google_bot.push(domain);
|
|
|
|
}
|
2021-09-24 16:09:54 +02:00
|
|
|
for (let domain of es_epiberica_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-(access|analytics|consent)-.+\.js/;
|
|
|
|
}
|
2020-11-21 19:21:29 +01:00
|
|
|
for (let domain of es_grupo_vocento_domains) {
|
|
|
|
allow_cookies.push(domain);
|
2021-03-05 12:21:38 +01:00
|
|
|
blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-(access|ad|subscriptions)-.+\.js/;
|
2020-11-21 19:21:29 +01:00
|
|
|
}
|
2020-11-27 19:34:15 +01:00
|
|
|
for (let domain of fi_alma_talent_domains) {
|
2021-07-23 15:28:22 +02:00
|
|
|
if (!['mediuutiset.fi'].includes(domain))
|
|
|
|
blockedRegexes[domain] = /\.fi\/static\/vendor\..+\.chunk\.js/;
|
2020-11-27 19:34:15 +01:00
|
|
|
use_google_bot.push(domain);
|
|
|
|
}
|
2021-08-16 22:49:58 +02:00
|
|
|
for (let domain of fi_sanoma_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
use_google_bot.push(domain);
|
|
|
|
}
|
2020-12-06 12:43:16 +01:00
|
|
|
for (let domain of fr_be_groupe_rossel_domains) {
|
2020-12-17 18:49:11 +01:00
|
|
|
if (!['lecho.be'].includes(domain)) {
|
2020-12-06 12:43:16 +01:00
|
|
|
allow_cookies.push(domain);
|
|
|
|
use_google_bot.push(domain);
|
|
|
|
}
|
|
|
|
}
|
2020-12-06 22:32:59 +01:00
|
|
|
for (let domain of fr_groupe_ebra_domains) {
|
|
|
|
allow_cookies.push(domain);
|
2021-03-01 18:04:43 +01:00
|
|
|
blockedRegexes[domain] = /(\.poool\.fr\/|cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js)/;
|
2020-12-07 18:10:59 +01:00
|
|
|
}
|
|
|
|
for (let domain of fr_groupe_la_depeche_domains) {
|
2021-02-02 19:17:45 +01:00
|
|
|
allow_cookies.push(domain);
|
2021-03-01 18:04:43 +01:00
|
|
|
blockedRegexes[domain] = /(\.poool\.fr\/|cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent|subscriptions)-.+\.js)/;//|iframe
|
2020-12-06 22:32:59 +01:00
|
|
|
}
|
2021-01-02 14:03:52 +01:00
|
|
|
for (let domain of it_ilmessaggero_domains)
|
2020-11-21 13:45:18 +01:00
|
|
|
blockedRegexes[domain] = /utils\.cedsdigital\.it\/js\/PaywallMeter\.js/;
|
2021-07-27 23:47:05 +02:00
|
|
|
for (let domain of nl_ad_region_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
remove_cookies.push(domain);
|
2021-01-02 14:03:52 +01:00
|
|
|
remove_cookies_select_drop[domain] = ['temptationTrackingId'];
|
2021-07-27 23:47:05 +02:00
|
|
|
}
|
2021-07-30 08:52:20 +02:00
|
|
|
for (let domain of it_quotidiano_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
blockedRegexes[domain] = /(cdn\.cxense\.com\/|\.tinypass\.com\/)/;
|
|
|
|
}
|
2021-06-20 21:41:11 +02:00
|
|
|
for (let domain of nl_mediahuis_region_domains)
|
|
|
|
allow_cookies.push(domain);
|
2021-07-23 16:12:10 +02:00
|
|
|
for (let domain of no_nhst_media_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
use_facebook_referer.push(domain);
|
|
|
|
}
|
2021-05-13 21:52:59 +02:00
|
|
|
for (let domain of timesofindia_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
use_google_bot.push(domain);
|
|
|
|
if (domain === 'timesofindia.com')
|
|
|
|
blockedRegexes[domain] = /\.timesofindia\.com\/jsrender\.cms/;
|
|
|
|
else
|
|
|
|
blockedRegexes[domain] = /timesofindia\.indiatimes\.com\/jsrender\/version-1\.cms/;
|
|
|
|
}
|
2021-08-17 22:45:11 +02:00
|
|
|
for (let domain of usa_craincomm_domains) {
|
|
|
|
if (domain !== 'autonews.com')
|
|
|
|
allow_cookies.push(domain);
|
2021-08-23 20:50:54 +02:00
|
|
|
blockedRegexes[domain] = new RegExp('(\.tinypass\.com\/|\.' + domain + '\/.+\/js\/js_.+\.js)');
|
2021-06-03 08:54:44 +02:00
|
|
|
}
|
2021-02-12 19:22:15 +01:00
|
|
|
for (let domain of usa_mcc_domains)
|
2021-07-30 08:52:20 +02:00
|
|
|
blockedRegexes[domain] = /(js\.matheranalytics\.com\/|cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js)/;
|
2021-02-26 17:43:36 +01:00
|
|
|
for (let domain of usa_tribune_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
blockedRegexes[domain] = /\.tribdss\.com\//;
|
|
|
|
}
|
2021-08-16 22:49:58 +02:00
|
|
|
for (let domain of usa_mng_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
blockedRegexes[domain] = /(\.blueconic\.net\/|\.tinypass\.com\/|\.com\/.+\/loader\.min\.js|cdn\.ampproject\.org\/v\d\/amp-((sticky-)?ad|subscriptions)-.+\.js)/;
|
|
|
|
}
|
2021-09-26 17:25:36 +02:00
|
|
|
for (let domain of usa_nymag_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
remove_cookies.push(domain);
|
|
|
|
remove_cookies_select_drop[domain] = ['nymcid'];
|
|
|
|
blockedRegexes[domain] = /fosse\.nymag\.com\/fosse\/.+\/scripts\/.+\.js/;
|
|
|
|
}
|
2021-04-25 13:45:36 +02:00
|
|
|
for (let domain of usa_theathletic_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js/;
|
|
|
|
}
|
2021-02-26 17:43:36 +01:00
|
|
|
|
2021-01-02 14:03:52 +01:00
|
|
|
// rules only
|
|
|
|
for (let domain of au_nine_domains)
|
2021-07-31 14:11:20 +02:00
|
|
|
blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-((sticky-)?ad|subscriptions)-.+\.js/;
|
2021-07-30 19:20:35 +02:00
|
|
|
for (let domain of es_unidad_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|consent)-.+\.js/;
|
|
|
|
}
|
2021-02-19 19:28:36 +01:00
|
|
|
for (let domain of it_repubblica_domains) {
|
|
|
|
allow_cookies.push(domain);
|
2021-08-29 08:38:59 +02:00
|
|
|
if (['ilsecoloxix.it', 'lastampa.it', 'repubblica.it'].includes(domain))
|
|
|
|
use_google_bot.push(domain);
|
2021-05-25 18:00:57 +02:00
|
|
|
blockedRegexes[domain] = /(scripts\.repubblica\.it\/pw\/pw\.js|cdn\.ampproject\.org\/v\d\/amp-(access|ad|user-notification)-.+\.js)/;
|
2021-02-19 19:28:36 +01:00
|
|
|
}
|
2021-07-27 23:47:05 +02:00
|
|
|
for (let domain of nl_pg_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
remove_cookies.push(domain);
|
2020-11-21 13:45:18 +01:00
|
|
|
remove_cookies_select_drop[domain] = ['TID_ID'];
|
2021-07-27 23:47:05 +02:00
|
|
|
}
|
2021-06-22 21:54:00 +02:00
|
|
|
for (let domain of usa_genomeweb_domains) {
|
|
|
|
allow_cookies.push(domain);
|
|
|
|
blockedRegexes[domain] = /crain-platform-.+-prod\.s3\.amazonaws\.com\/s3fs-public\/js\/js_.+\.js/;
|
|
|
|
}
|
|
|
|
|
2021-01-12 21:46:50 +01:00
|
|
|
use_google_bot_default = use_google_bot.slice();
|
2021-06-22 21:54:00 +02:00
|
|
|
use_bing_bot_default = use_bing_bot.slice();
|
2021-02-06 21:37:52 +01:00
|
|
|
use_facebook_referer_default = use_facebook_referer.slice();
|
|
|
|
use_google_referer_default = use_google_referer.slice();
|
|
|
|
use_twitter_referer_default = use_twitter_referer.slice();
|
|
|
|
change_headers = use_google_bot.concat(use_bing_bot, use_facebook_referer, use_google_referer, use_twitter_referer, use_random_ip);
|
2020-11-21 13:45:18 +01:00
|
|
|
}
|
2020-11-15 21:10:03 +01:00
|
|
|
}
|
|
|
|
|
2020-01-15 18:58:10 +01:00
|
|
|
// Get the enabled sites (from local storage) & add to allow/remove_cookies (if not already in one of these arrays)
|
2020-02-28 16:23:17 +01:00
|
|
|
// Add googlebot- and block_javascript-settings for custom sites
|
2020-10-31 20:06:38 +01:00
|
|
|
ext_api.storage.local.get({
|
2020-10-24 16:38:01 +02:00
|
|
|
sites: {},
|
2021-01-05 18:53:59 +01:00
|
|
|
sites_custom: {},
|
|
|
|
sites_excluded: []
|
2020-02-28 16:23:17 +01:00
|
|
|
}, function (items) {
|
2020-10-24 16:38:01 +02:00
|
|
|
var sites = items.sites;
|
|
|
|
var sites_custom = items.sites_custom;
|
2021-01-05 18:53:59 +01:00
|
|
|
excludedSites = items.sites_excluded;
|
2020-02-28 16:23:17 +01:00
|
|
|
|
2021-06-22 21:54:00 +02:00
|
|
|
enabledSites = Object.keys(sites).filter(function (key) {
|
|
|
|
return (sites[key] !== '' && sites[key] !== '###');
|
|
|
|
}).map(function (key) {
|
|
|
|
return sites[key].toLowerCase();
|
|
|
|
});
|
|
|
|
customSites = sites_custom;
|
|
|
|
customSites_domains = Object.values(sites_custom).map(x => x.domain);
|
|
|
|
disabledSites = defaultSites_domains.concat(customSites_domains).filter(x => !enabledSites.includes(x) && x !== '###');
|
|
|
|
add_grouped_sites(true); //and exclude sites
|
|
|
|
|
2020-10-24 16:38:01 +02:00
|
|
|
for (let key in sites_custom) {
|
|
|
|
var domainVar = sites_custom[key]['domain'].toLowerCase();
|
2020-11-15 21:10:03 +01:00
|
|
|
if (sites_custom[key]['googlebot'] > 0 && !use_google_bot.includes(domainVar))
|
2020-10-24 16:38:01 +02:00
|
|
|
use_google_bot.push(domainVar);
|
2021-06-22 21:54:00 +02:00
|
|
|
switch (sites_custom[key]['useragent']) {
|
|
|
|
case 'googlebot':
|
|
|
|
if (!use_google_bot.includes(domainVar))
|
|
|
|
use_google_bot.push(domainVar);
|
|
|
|
break;
|
|
|
|
case 'bingbot':
|
|
|
|
if (!use_bing_bot.includes(domainVar))
|
|
|
|
use_bing_bot.push(domainVar);
|
|
|
|
break;
|
|
|
|
}
|
2021-07-27 23:47:05 +02:00
|
|
|
if (sites_custom[key]['allow_cookies'] > 0 && !allow_cookies.includes(domainVar) && !defaultSites_domains.includes(domainVar))
|
2020-11-10 18:15:18 +01:00
|
|
|
allow_cookies.push(domainVar);
|
2020-11-15 21:10:03 +01:00
|
|
|
if (sites_custom[key]['block_javascript'] > 0)
|
2020-10-24 16:38:01 +02:00
|
|
|
block_js_custom.push(domainVar);
|
2020-11-15 21:10:03 +01:00
|
|
|
if (sites_custom[key]['block_javascript_ext'] > 0)
|
2020-10-24 16:38:01 +02:00
|
|
|
block_js_custom_ext.push(domainVar);
|
2021-02-06 21:37:52 +01:00
|
|
|
switch (sites_custom[key]['referer']) {
|
|
|
|
case 'facebook':
|
|
|
|
use_facebook_referer.push(domainVar);
|
|
|
|
break;
|
|
|
|
case 'google':
|
|
|
|
use_google_referer.push(domainVar);
|
|
|
|
break;
|
|
|
|
case 'twitter':
|
|
|
|
use_twitter_referer.push(domainVar);
|
|
|
|
}
|
2020-10-24 16:38:01 +02:00
|
|
|
}
|
|
|
|
|
2021-07-27 23:47:05 +02:00
|
|
|
for (let domainVar of enabledSites) {
|
|
|
|
if (!allow_cookies.includes(domainVar) && !remove_cookies.includes(domainVar) && !defaultSites_domains.includes(domainVar)) {
|
|
|
|
allow_cookies.push(domainVar);
|
|
|
|
remove_cookies.push(domainVar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-26 20:02:44 +02:00
|
|
|
change_headers = use_google_bot.concat(use_bing_bot, use_facebook_referer, use_google_referer, use_twitter_referer, use_random_ip);
|
2020-10-24 16:38:01 +02:00
|
|
|
disableJavascriptOnListedSites();
|
|
|
|
});
|
2020-02-28 16:23:17 +01:00
|
|
|
|
2020-10-24 16:38:01 +02:00
|
|
|
// Listen for changes to options
|
|
|
|
ext_api.storage.onChanged.addListener(function (changes, namespace) {
|
2020-10-31 20:06:38 +01:00
|
|
|
if (namespace === 'sync')
|
|
|
|
return;
|
2020-11-10 18:15:18 +01:00
|
|
|
for (let key in changes) {
|
2020-10-24 16:38:01 +02:00
|
|
|
var storageChange = changes[key];
|
|
|
|
if (key === 'sites') {
|
|
|
|
var sites = storageChange.newValue;
|
|
|
|
enabledSites = Object.keys(sites).filter(function (key) {
|
|
|
|
return (sites[key] !== '' && sites[key] !== '###');
|
2020-02-29 20:08:32 +01:00
|
|
|
}).map(function (key) {
|
2020-10-24 16:38:01 +02:00
|
|
|
return sites[key];
|
2020-02-28 16:23:17 +01:00
|
|
|
});
|
2020-10-24 16:38:01 +02:00
|
|
|
disabledSites = defaultSites_domains.concat(customSites_domains).filter(x => !enabledSites.includes(x) && x !== '###');
|
2020-11-15 21:10:03 +01:00
|
|
|
add_grouped_sites(false);
|
|
|
|
|
2020-11-10 18:15:18 +01:00
|
|
|
for (let domainVar of enabledSites) {
|
2021-07-27 23:47:05 +02:00
|
|
|
if (!allow_cookies.includes(domainVar) && !remove_cookies.includes(domainVar) && !defaultSites_domains.includes(domainVar)) {
|
2020-11-10 18:15:18 +01:00
|
|
|
allow_cookies.push(domainVar);
|
|
|
|
remove_cookies.push(domainVar);
|
|
|
|
}
|
|
|
|
}
|
2020-02-28 16:23:17 +01:00
|
|
|
}
|
2020-10-24 16:38:01 +02:00
|
|
|
if (key === 'sites_custom') {
|
2020-11-29 12:08:21 +01:00
|
|
|
var sites_custom = storageChange.newValue ? storageChange.newValue : {};
|
|
|
|
var sites_custom_old = storageChange.oldValue ? storageChange.oldValue : {};
|
2020-10-24 16:38:01 +02:00
|
|
|
customSites = sites_custom;
|
|
|
|
customSites_domains = Object.values(sites_custom).map(x => x.domain);
|
|
|
|
|
|
|
|
// add/remove custom sites in options
|
|
|
|
var sites_custom_added = Object.keys(sites_custom).filter(x => !Object.keys(sites_custom_old).includes(x) && !defaultSites.hasOwnProperty(x));
|
|
|
|
var sites_custom_removed = Object.keys(sites_custom_old).filter(x => !Object.keys(sites_custom).includes(x) && !defaultSites.hasOwnProperty(x));
|
|
|
|
|
2020-10-31 20:06:38 +01:00
|
|
|
ext_api.storage.local.get({
|
2020-10-24 16:38:01 +02:00
|
|
|
sites: {}
|
|
|
|
}, function (items) {
|
|
|
|
var sites = items.sites;
|
2020-11-10 18:15:18 +01:00
|
|
|
for (let key of sites_custom_added)
|
2020-10-24 16:38:01 +02:00
|
|
|
sites[key] = sites_custom[key].domain;
|
2020-11-10 18:15:18 +01:00
|
|
|
for (let key of sites_custom_removed)
|
2020-10-24 16:38:01 +02:00
|
|
|
delete sites[key];
|
|
|
|
|
2020-10-31 20:06:38 +01:00
|
|
|
ext_api.storage.local.set({
|
2020-10-24 16:38:01 +02:00
|
|
|
sites: sites
|
|
|
|
}, function () {
|
|
|
|
true;
|
|
|
|
});
|
|
|
|
});
|
2020-01-14 20:02:04 +01:00
|
|
|
|
2020-10-24 16:38:01 +02:00
|
|
|
use_google_bot = use_google_bot_default.slice();
|
2021-06-22 21:54:00 +02:00
|
|
|
use_bing_bot = use_bing_bot_default.slice();
|
2021-02-06 21:37:52 +01:00
|
|
|
use_facebook_referer = use_facebook_referer_default.slice();
|
|
|
|
use_google_referer = use_google_referer_default.slice();
|
|
|
|
use_twitter_referer = use_twitter_referer_default.slice();
|
2020-10-24 16:38:01 +02:00
|
|
|
block_js_custom = [];
|
|
|
|
block_js_custom_ext = [];
|
|
|
|
for (let key in sites_custom) {
|
|
|
|
var domainVar = sites_custom[key]['domain'].toLowerCase();
|
|
|
|
if (sites_custom[key]['googlebot'] > 0 && !use_google_bot.includes(domainVar)) {
|
|
|
|
use_google_bot.push(domainVar);
|
2020-02-28 16:23:17 +01:00
|
|
|
}
|
2021-06-22 21:54:00 +02:00
|
|
|
switch (sites_custom[key]['useragent']) {
|
|
|
|
case 'googlebot':
|
|
|
|
if (!use_google_bot.includes(domainVar))
|
|
|
|
use_google_bot.push(domainVar);
|
|
|
|
break;
|
|
|
|
case 'bingbot':
|
|
|
|
if (!use_bing_bot.includes(domainVar))
|
|
|
|
use_bing_bot.push(domainVar);
|
|
|
|
break;
|
|
|
|
}
|
2021-07-27 23:47:05 +02:00
|
|
|
if (!defaultSites_domains.includes(domainVar)) {
|
|
|
|
if (sites_custom[key]['allow_cookies'] > 0) {
|
|
|
|
if (allow_cookies.includes(domainVar)) {
|
|
|
|
if (remove_cookies.includes(domainVar))
|
|
|
|
remove_cookies.splice(remove_cookies.indexOf(domainVar), 1);
|
|
|
|
} else
|
|
|
|
allow_cookies.push(domainVar);
|
|
|
|
} else if (allow_cookies.includes(domainVar) && !remove_cookies.includes(domainVar))
|
2020-11-10 18:15:18 +01:00
|
|
|
remove_cookies.push(domainVar);
|
2021-07-27 23:47:05 +02:00
|
|
|
}
|
2020-10-24 16:38:01 +02:00
|
|
|
if (sites_custom[key]['block_javascript'] > 0) {
|
|
|
|
block_js_custom.push(domainVar);
|
2020-02-28 16:23:17 +01:00
|
|
|
}
|
2020-10-24 16:38:01 +02:00
|
|
|
if (sites_custom[key]['block_javascript_ext'] > 0) {
|
|
|
|
block_js_custom_ext.push(domainVar);
|
|
|
|
}
|
2021-02-06 21:37:52 +01:00
|
|
|
switch (sites_custom[key]['referer']) {
|
|
|
|
case 'facebook':
|
|
|
|
use_facebook_referer.push(domainVar);
|
|
|
|
break;
|
|
|
|
case 'google':
|
|
|
|
use_google_referer.push(domainVar);
|
|
|
|
break;
|
|
|
|
case 'twitter':
|
|
|
|
use_twitter_referer.push(domainVar);
|
|
|
|
}
|
2020-10-24 16:38:01 +02:00
|
|
|
}
|
2021-02-06 21:37:52 +01:00
|
|
|
change_headers = use_google_bot.concat(use_bing_bot, use_facebook_referer, use_google_referer, use_twitter_referer, use_random_ip);
|
2017-07-08 19:40:29 +02:00
|
|
|
}
|
2021-01-05 18:53:59 +01:00
|
|
|
if (key === 'sites_excluded') {
|
|
|
|
var sites_excluded = storageChange.newValue ? storageChange.newValue : [];
|
|
|
|
var sites_excluded_old = storageChange.oldValue ? storageChange.oldValue : [];
|
|
|
|
excludedSites = sites_excluded;
|
|
|
|
|
|
|
|
// add/remove excluded sites in en/disabledSites
|
|
|
|
var sites_excluded_added = sites_excluded.filter(x => !sites_excluded_old.includes(x));
|
|
|
|
var sites_excluded_removed = sites_excluded_old.filter(x => !sites_excluded.includes(x));
|
|
|
|
|
|
|
|
for (let site of sites_excluded_added) {
|
|
|
|
if (enabledSites.includes(site)) {
|
|
|
|
enabledSites.splice(enabledSites.indexOf(site), 1);
|
|
|
|
disabledSites.push(site);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (let site of sites_excluded_removed) {
|
|
|
|
if (disabledSites.includes(site)) {
|
|
|
|
disabledSites.splice(disabledSites.indexOf(site), 1);
|
|
|
|
enabledSites.push(site);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-02 07:51:25 +02:00
|
|
|
if (key === 'version_new') {
|
|
|
|
version_new = storageChange.newValue;
|
|
|
|
}
|
2021-01-05 18:53:59 +01:00
|
|
|
// reset disableJavascriptOnListedSites eventListener
|
|
|
|
ext_api.webRequest.onBeforeRequest.removeListener(disableJavascriptOnListedSites);
|
|
|
|
ext_api.webRequest.handlerBehaviorChanged();
|
|
|
|
|
2020-10-24 16:38:01 +02:00
|
|
|
// Refresh the current tab
|
2021-06-12 18:19:48 +02:00
|
|
|
refreshCurrentTab();
|
2020-10-24 16:38:01 +02:00
|
|
|
}
|
2017-07-08 19:40:29 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
// Set and show default options on install
|
2020-03-25 19:31:28 +01:00
|
|
|
ext_api.runtime.onInstalled.addListener(function (details) {
|
2017-07-08 19:40:29 +02:00
|
|
|
if (details.reason == "install") {
|
2020-02-25 22:47:05 +01:00
|
|
|
setDefaultOptions();
|
2017-07-08 19:40:29 +02:00
|
|
|
} else if (details.reason == "update") {
|
2020-08-22 19:21:32 +02:00
|
|
|
ext_api.management.getSelf(function (result) {
|
2020-08-26 17:53:26 +02:00
|
|
|
if (enabledSites.includes('#options_on_update') && result.installType !== 'development')
|
2020-08-22 19:21:32 +02:00
|
|
|
ext_api.runtime.openOptionsPage(); // User updated extension (non-developer mode)
|
|
|
|
});
|
2017-07-08 19:40:29 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-03-03 18:15:21 +01:00
|
|
|
// repubblica.it bypass
|
2020-03-25 19:31:28 +01:00
|
|
|
ext_api.webRequest.onBeforeRequest.addListener(function (details) {
|
2020-03-03 18:15:21 +01:00
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var updatedUrl = details.url.replace('/pwa/', '/ws/detail/');
|
|
|
|
return { redirectUrl: updatedUrl };
|
|
|
|
},
|
|
|
|
{urls:["*://*.repubblica.it/pwa/*"], types:["main_frame"]},
|
2020-10-17 10:51:24 +02:00
|
|
|
["blocking"]
|
|
|
|
);
|
|
|
|
|
|
|
|
// inkl disable newsletter login
|
|
|
|
ext_api.webRequest.onBeforeRequest.addListener(function (details) {
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var updatedUrl = details.url.replace(/etok=[\w]*&/, '');
|
|
|
|
return { redirectUrl: updatedUrl };
|
|
|
|
},
|
|
|
|
{urls:["*://*.inkl.com/*"], types:["main_frame"]},
|
2020-03-03 18:15:21 +01:00
|
|
|
["blocking"]
|
|
|
|
);
|
|
|
|
|
2021-04-11 19:52:54 +02:00
|
|
|
// m.faz.net set user-agent to mobile
|
2020-04-25 17:18:12 +02:00
|
|
|
const faz_uaMobile = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Mobile Safari/537.36";
|
2021-01-01 12:23:29 +01:00
|
|
|
ext_api.webRequest.onBeforeSendHeaders.addListener(function (details) {
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
2021-01-02 14:03:52 +01:00
|
|
|
let headers = details.requestHeaders;
|
|
|
|
headers = headers.map(function (header) {
|
|
|
|
if (header.name.toLowerCase() === 'user-agent')
|
|
|
|
header.value = faz_uaMobile;
|
|
|
|
return header;
|
2020-04-25 17:18:12 +02:00
|
|
|
});
|
2021-01-01 12:23:29 +01:00
|
|
|
return {
|
2021-01-02 14:03:52 +01:00
|
|
|
requestHeaders: headers
|
2021-01-01 12:23:29 +01:00
|
|
|
};
|
2020-04-25 17:18:12 +02:00
|
|
|
}, {
|
2021-01-01 12:23:29 +01:00
|
|
|
urls: ["*://m.faz.net/*"],
|
|
|
|
types: ["xmlhttprequest"]
|
2020-04-25 17:18:12 +02:00
|
|
|
},
|
2021-01-01 12:23:29 +01:00
|
|
|
["blocking", "requestHeaders"]);
|
2020-04-25 17:18:12 +02:00
|
|
|
|
2021-04-11 19:52:54 +02:00
|
|
|
// wap.business-standard.com (mobile) redirect to www (desktop)
|
|
|
|
ext_api.webRequest.onBeforeRequest.addListener(function (details) {
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var updatedUrl = details.url.replace('/wap.', '/www.');
|
|
|
|
return { redirectUrl: updatedUrl };
|
|
|
|
},
|
|
|
|
{urls:["*://wap.business-standard.com/*"], types:["main_frame"]},
|
|
|
|
["blocking"]
|
|
|
|
);
|
|
|
|
|
|
|
|
// www.business-standard.com set user-agent to desktop
|
|
|
|
const business_standard_uaDesktop = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36";
|
|
|
|
ext_api.webRequest.onBeforeSendHeaders.addListener(function (details) {
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let headers = details.requestHeaders;
|
|
|
|
headers = headers.map(function (header) {
|
|
|
|
if (header.name.toLowerCase() === 'user-agent')
|
|
|
|
header.value = business_standard_uaDesktop;
|
|
|
|
return header;
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
requestHeaders: headers
|
|
|
|
};
|
|
|
|
}, {
|
|
|
|
urls: ["*://www.business-standard.com/*"],
|
|
|
|
types: ["main_frame"]
|
|
|
|
},
|
|
|
|
["blocking", "requestHeaders"]);
|
|
|
|
|
2021-05-21 08:04:59 +02:00
|
|
|
// economictimes redirect
|
|
|
|
ext_api.webRequest.onBeforeRequest.addListener(function (details) {
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var updatedUrl = details.url.split('?')[0].replace('economictimes.indiatimes.com', 'm.economictimes.com');
|
|
|
|
return { redirectUrl: updatedUrl };
|
|
|
|
},
|
|
|
|
{urls:["*://economictimes.indiatimes.com/*?from=mdr"], types:["main_frame"]},
|
|
|
|
["blocking"]
|
|
|
|
);
|
|
|
|
|
2021-05-21 18:21:25 +02:00
|
|
|
// saechsische.de amp-redirect
|
|
|
|
ext_api.webRequest.onBeforeRequest.addListener(function (details) {
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var updatedUrl = details.url.replace('-plus-amp.html', '-plus.html');
|
|
|
|
return { redirectUrl: updatedUrl };
|
|
|
|
},
|
|
|
|
{urls:["*://*.saechsische.de/*-plus-amp.html*"], types:["main_frame"]},
|
|
|
|
["blocking"]
|
|
|
|
);
|
|
|
|
|
2021-07-19 17:54:59 +02:00
|
|
|
// infzm.com redirect to wap (mobile)
|
|
|
|
ext_api.webRequest.onBeforeRequest.addListener(function (details) {
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var updatedUrl = details.url.replace('.com/contents/', '.com/wap/#/content/');
|
|
|
|
return { redirectUrl: updatedUrl };
|
|
|
|
},
|
|
|
|
{urls:["*://www.infzm.com/contents/*"], types:["main_frame"]},
|
|
|
|
["blocking"]
|
|
|
|
);
|
|
|
|
|
2021-09-26 10:10:29 +02:00
|
|
|
// theaustralian.com redirect subscribe to amp
|
|
|
|
ext_api.webRequest.onBeforeRequest.addListener(function (details) {
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var updatedUrl = decodeURIComponent(details.url.split('dest=')[1].split('&')[0]).replace('www.', 'amp.');
|
|
|
|
return { redirectUrl: updatedUrl };
|
|
|
|
},
|
|
|
|
{urls:["*://www.theaustralian.com.au/subscribe/*"], types:["main_frame"]},
|
|
|
|
["blocking"]
|
|
|
|
);
|
|
|
|
|
2020-10-21 16:48:59 +02:00
|
|
|
// fix nytimes x-frame-options (hidden iframe content)
|
|
|
|
ext_api.webRequest.onHeadersReceived.addListener(function (details) {
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
2021-01-02 14:03:52 +01:00
|
|
|
var headers = details.responseHeaders;
|
2021-01-06 19:50:12 +01:00
|
|
|
headers = headers.map(function (header) {
|
2021-01-02 14:03:52 +01:00
|
|
|
if (header.name === 'x-frame-options')
|
|
|
|
header.value = 'SAMEORIGIN';
|
|
|
|
return header;
|
2020-10-21 16:48:59 +02:00
|
|
|
});
|
|
|
|
return {
|
2021-01-02 14:03:52 +01:00
|
|
|
responseHeaders: headers
|
2020-10-21 16:48:59 +02:00
|
|
|
};
|
|
|
|
}, {
|
|
|
|
urls: ["*://*.nytimes.com/*"]
|
|
|
|
},
|
|
|
|
['blocking', 'responseHeaders']);
|
|
|
|
|
2021-05-18 17:12:15 +02:00
|
|
|
// block inline script
|
2021-05-23 20:42:28 +02:00
|
|
|
var block_js_inline = ["*://elviajero.elpais.com/*", "*://retina.elpais.com/*", "*://verne.elpais.com/*", "*://*.medianama.com/*"];
|
2021-01-18 18:43:04 +01:00
|
|
|
ext_api.webRequest.onHeadersReceived.addListener(function (details) {
|
|
|
|
if (!isSiteEnabled(details)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var headers = details.responseHeaders;
|
|
|
|
headers.push({
|
|
|
|
'name': 'Content-Security-Policy',
|
|
|
|
'value': "script-src *;"
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
responseHeaders: headers
|
|
|
|
};
|
|
|
|
}, {
|
|
|
|
'types': ['main_frame', 'sub_frame'],
|
2021-05-18 17:12:15 +02:00
|
|
|
'urls': block_js_inline
|
2021-01-18 18:43:04 +01:00
|
|
|
},
|
|
|
|
['blocking', 'responseHeaders']);
|
|
|
|
|
2021-08-10 19:11:51 +02:00
|
|
|
var block_js_default = ["*://cdn.tinypass.com/*", "*://*.piano.io/*", "*://*.poool.fr/*", "*://cdn.ampproject.org/v*/amp-access-*.js", "*://cdn.ampproject.org/v*/amp-subscriptions-*.js", "*://*.blueconic.net/*", "*://*.cxense.com/*", "*://*.evolok.net/*", "*://js.matheranalytics.com/*", "*://*.newsmemory.com/*", "*://*.onecount.net/*", "*://js.pelcro.com/*", "*://*.qiota.com/*", "*://*.tribdss.com/*"];
|
2020-02-28 16:23:17 +01:00
|
|
|
var block_js_custom = [];
|
2020-06-04 09:04:58 +02:00
|
|
|
var block_js_custom_ext = [];
|
2020-03-27 19:02:27 +01:00
|
|
|
var block_js = block_js_default.concat(block_js_custom);
|
2020-03-28 14:59:26 +01:00
|
|
|
|
2020-01-28 23:06:25 +01:00
|
|
|
// Disable javascript for these sites/general paywall-scripts
|
2020-03-28 14:59:26 +01:00
|
|
|
function disableJavascriptOnListedSites() {
|
2020-10-24 16:38:01 +02:00
|
|
|
ext_api.webRequest.onBeforeRequest.addListener(function (details) {
|
2021-01-19 19:41:27 +01:00
|
|
|
let header_referer = details.originUrl ? details.originUrl : details.initiator;
|
|
|
|
if (!isSiteEnabled(details) || matchUrlDomain(excludedSites, header_referer)) {
|
2020-10-24 16:38:01 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
cancel: true
|
|
|
|
};
|
|
|
|
}, {
|
|
|
|
urls: block_js,
|
|
|
|
types: ["script", "xmlhttprequest"]
|
|
|
|
},
|
|
|
|
["blocking"]);
|
2020-03-28 14:59:26 +01:00
|
|
|
}
|
2019-05-13 01:31:18 +02:00
|
|
|
|
2021-02-22 19:49:41 +01:00
|
|
|
if (typeof browser !== 'object') {
|
2021-02-21 09:21:39 +01:00
|
|
|
var focus_changed = false;
|
|
|
|
ext_api.windows.onFocusChanged.addListener((windowId) => {
|
|
|
|
if (windowId > 0)
|
|
|
|
focus_changed = true;
|
|
|
|
});
|
2021-02-22 19:49:41 +01:00
|
|
|
}
|
2021-02-21 09:21:39 +01:00
|
|
|
|
2020-03-25 19:31:28 +01:00
|
|
|
var extraInfoSpec = ['blocking', 'requestHeaders'];
|
|
|
|
if (ext_api.webRequest.OnBeforeSendHeadersOptions.hasOwnProperty('EXTRA_HEADERS'))
|
|
|
|
extraInfoSpec.push('extraHeaders');
|
|
|
|
|
|
|
|
ext_api.webRequest.onBeforeSendHeaders.addListener(function(details) {
|
2020-09-11 16:52:50 +02:00
|
|
|
if (details.type === 'main_frame') {
|
|
|
|
let current_date_str = currentDateStr();
|
|
|
|
if (last_date_str < current_date_str) {
|
|
|
|
bpc_count_daily_users(current_date_str);
|
|
|
|
last_date_str = current_date_str;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 19:23:00 +01:00
|
|
|
var requestHeaders = details.requestHeaders;
|
|
|
|
|
|
|
|
var header_referer = '';
|
2020-11-10 18:15:18 +01:00
|
|
|
for (let n in requestHeaders) {
|
2020-09-11 16:52:50 +02:00
|
|
|
if (requestHeaders[n].name.toLowerCase() == 'referer') {
|
|
|
|
header_referer = requestHeaders[n].value;
|
|
|
|
continue;
|
|
|
|
}
|
2019-11-27 19:23:00 +01:00
|
|
|
}
|
2021-06-21 22:42:46 +02:00
|
|
|
|
|
|
|
// fix blocked referer
|
|
|
|
if (!header_referer) {
|
|
|
|
if (typeof browser !== 'object')
|
2021-06-27 09:56:42 +02:00
|
|
|
header_referer = details.initiator ? details.initiator : '';
|
2021-06-21 22:42:46 +02:00
|
|
|
else
|
2021-06-27 09:56:42 +02:00
|
|
|
header_referer = details.originUrl ? details.originUrl : '';
|
2021-06-21 22:42:46 +02:00
|
|
|
}
|
2020-01-13 19:15:37 +01:00
|
|
|
|
2020-06-04 09:04:58 +02:00
|
|
|
// remove cookies for sites medium platform (custom domains)
|
2021-08-14 17:48:33 +02:00
|
|
|
var medium_custom_domain = (matchUrlDomain('cdn-client.medium.com', details.url) && ['script'].includes(details.type) && !matchUrlDomain(medium_custom_domains.concat(['medium.com', 'towardsdatascience.com']), header_referer) && enabledSites.includes('###_medium_custom'));
|
2020-05-28 16:38:48 +02:00
|
|
|
if (medium_custom_domain) {
|
2021-08-14 17:48:33 +02:00
|
|
|
let mc_domain = urlHost(header_referer).replace(/^(www|m)\./, '');;
|
2021-02-07 09:45:57 +01:00
|
|
|
if (!use_twitter_referer.includes(mc_domain)) {
|
|
|
|
use_twitter_referer.push(mc_domain);
|
|
|
|
change_headers.push(mc_domain);
|
|
|
|
}
|
2021-08-14 17:48:33 +02:00
|
|
|
medium_custom_domains.push(mc_domain);
|
2021-02-07 09:45:57 +01:00
|
|
|
if (!enabledSites.includes(mc_domain))
|
|
|
|
enabledSites.push(mc_domain);
|
2020-01-13 19:15:37 +01:00
|
|
|
}
|
2020-12-04 16:56:48 +01:00
|
|
|
|
2021-02-28 11:32:38 +01:00
|
|
|
// set googlebot-useragent for Gannett sites
|
2021-08-14 17:48:33 +02:00
|
|
|
var usa_gannett_domain = (matchUrlDomain('gannett-cdn.com', details.url) && ['xmlhttprequest'].includes(details.type) && !matchUrlDomain(usa_gannett_domains.concat(['usatoday.com']), header_referer) && enabledSites.includes('###_usa_gannett'));
|
2021-02-28 11:32:38 +01:00
|
|
|
if (usa_gannett_domain) {
|
2021-08-14 17:48:33 +02:00
|
|
|
let gn_domain = urlHost(header_referer).replace(/^(www|eu)\./, '');;
|
2021-02-28 11:32:38 +01:00
|
|
|
if (!use_google_bot.includes(gn_domain)) {
|
|
|
|
use_google_bot.push(gn_domain);
|
|
|
|
change_headers.push(gn_domain);
|
|
|
|
}
|
2021-08-14 17:48:33 +02:00
|
|
|
usa_gannett_domains.push(gn_domain);
|
2021-02-28 11:32:38 +01:00
|
|
|
if (!enabledSites.includes(gn_domain))
|
|
|
|
enabledSites.push(gn_domain);
|
|
|
|
}
|
|
|
|
|
2021-03-27 11:53:38 +01:00
|
|
|
// block script for additional McClatchy sites (opt-in to custom sites)
|
2021-08-10 19:11:51 +02:00
|
|
|
var usa_mcc_domain = ((matchUrlDomain('mcclatchyinteractive.com', details.url) && ['script'].includes(details.type)) ||
|
|
|
|
(matchUrlDomain('mcclatchy-wires.com', details.url) && ['image'].includes(details.type)) &&
|
|
|
|
!matchUrlDomain(usa_mcc_domains, header_referer) && enabledSites.includes('###_usa_mcc'));
|
2021-03-27 11:53:38 +01:00
|
|
|
if (usa_mcc_domain) {
|
2021-08-10 19:11:51 +02:00
|
|
|
let mcc_domain = urlHost(header_referer).replace(/^(account|amp)\./, '');
|
2021-08-14 17:48:33 +02:00
|
|
|
blockedRegexes[mcc_domain] = /(js\.matheranalytics\.com\/|cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js)/;
|
|
|
|
usa_mcc_domains.push(mcc_domain);
|
|
|
|
if (!enabledSites.includes(mcc_domain))
|
|
|
|
enabledSites.push(mcc_domain);
|
2021-03-27 11:53:38 +01:00
|
|
|
}
|
|
|
|
|
2021-08-16 22:49:58 +02:00
|
|
|
// block script for additional MediaNews Group sites (opt-in to custom sites)
|
|
|
|
var usa_mng_domain = (details.url.match(/\.com\/wp-content\/plugins\/dfm(-pushly|_zeus)\/.+\.js/) && ['script'].includes(details.type) &&
|
|
|
|
!matchUrlDomain(usa_mng_domains, header_referer) && enabledSites.includes('###_usa_mng'));
|
|
|
|
if (usa_mng_domain) {
|
|
|
|
let mng_domain = urlHost(header_referer).replace(/^www\./, '');
|
|
|
|
blockedRegexes[mng_domain] = /(\.blueconic\.net\/|\.tinypass\.com\/|\.com\/.+\/loader\.min\.js|cdn\.ampproject\.org\/v\d\/amp-((sticky-)?ad|subscriptions)-.+\.js)/;
|
|
|
|
usa_mng_domains.push(mng_domain);
|
|
|
|
if (!enabledSites.includes(mng_domain))
|
|
|
|
enabledSites.push(mng_domain);
|
|
|
|
}
|
|
|
|
|
2021-04-24 09:37:20 +02:00
|
|
|
// block script for additional Madsack/RND sites (opt-in to custom sites)
|
|
|
|
var de_rnd_domain = (matchUrlDomain('rndtech.de', details.url) && ['script'].includes(details.type) && !matchUrlDomain(de_madsack_domains.concat(['madsack.de', 'madsack-medien-campus.de', 'rnd.de']), header_referer) && enabledSites.includes('###_de_madsack'));
|
|
|
|
if (de_rnd_domain) {
|
|
|
|
let rnd_domain = urlHost(header_referer).replace(/^(www|m)\./, '');
|
|
|
|
if (!de_madsack_domains.includes(rnd_domain)) {
|
|
|
|
allow_cookies.push(rnd_domain);
|
|
|
|
blockedRegexes[rnd_domain] = /(cdn\.cxense\.com\/|\.tinypass\.com\/)/;
|
|
|
|
de_madsack_domains.push(rnd_domain);
|
|
|
|
if (!enabledSites.includes(rnd_domain))
|
|
|
|
enabledSites.push(rnd_domain);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-14 17:48:33 +02:00
|
|
|
// set user-agent to GoogleBot for additional Snamoma Media Finland (opt-in to custom sites)
|
|
|
|
var fi_sanoma_sndp_domain = (matchUrlDomain('sanoma-sndp.fi', details.url) && ['xmlhttprequest'].includes(details.type) && !matchUrlDomain(fi_sanoma_domains, header_referer) && enabledSites.includes('###_fi_sanoma'));
|
|
|
|
if (fi_sanoma_sndp_domain) {
|
|
|
|
let sanoma_domain = urlHost(header_referer).replace(/^www\./, '');
|
|
|
|
if (!fi_sanoma_domains.includes(sanoma_domain)) {
|
|
|
|
allow_cookies.push(sanoma_domain);
|
|
|
|
if (!use_google_bot.includes(sanoma_domain)) {
|
|
|
|
use_google_bot.push(sanoma_domain);
|
|
|
|
change_headers.push(sanoma_domain);
|
|
|
|
}
|
|
|
|
fi_sanoma_domains.push(sanoma_domain);
|
|
|
|
if (!enabledSites.includes(sanoma_domain))
|
|
|
|
enabledSites.push(sanoma_domain);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-01 18:01:43 +02:00
|
|
|
// block external javascript for custom sites (optional)
|
2020-08-22 13:52:43 +02:00
|
|
|
var domain_blockjs_ext = matchUrlDomain(block_js_custom_ext, header_referer);
|
2021-01-26 21:27:43 +01:00
|
|
|
if (domain_blockjs_ext && !matchUrlDomain(domain_blockjs_ext, details.url) && details.type === 'script' && isSiteEnabled({url: header_referer})) {
|
2020-06-01 18:01:43 +02:00
|
|
|
return { cancel: true };
|
|
|
|
}
|
2020-03-27 19:02:27 +01:00
|
|
|
|
2019-11-27 19:23:00 +01:00
|
|
|
// check for blocked regular expression: domain enabled, match regex, block on an internal or external regex
|
2020-05-01 12:58:36 +02:00
|
|
|
var blockedDomains = Object.keys(blockedRegexes);
|
2020-05-06 21:05:34 +02:00
|
|
|
var domain = matchUrlDomain(blockedDomains, header_referer);
|
2020-09-19 10:16:23 +02:00
|
|
|
var block_regex = true;
|
2020-05-06 21:05:34 +02:00
|
|
|
if (domain && details.url.match(blockedRegexes[domain]) && isSiteEnabled({url: header_referer})) {
|
2020-09-19 10:16:23 +02:00
|
|
|
if (block_regex)
|
|
|
|
return { cancel: true };
|
2017-07-08 19:40:29 +02:00
|
|
|
}
|
|
|
|
|
2020-11-03 17:34:30 +01:00
|
|
|
// load toggleIcon.js (icon for dark or incognito mode in Chrome))
|
2021-02-16 17:49:29 +01:00
|
|
|
if (typeof browser !== 'object' && ['main_frame', 'xmlhttprequest'].includes(details.type)) {
|
2020-11-03 17:34:30 +01:00
|
|
|
ext_api.tabs.query({
|
|
|
|
active: true,
|
|
|
|
currentWindow: true
|
|
|
|
}, function (tabs) {
|
2021-05-23 20:42:28 +02:00
|
|
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
2020-11-03 17:34:30 +01:00
|
|
|
ext_api.tabs.executeScript({
|
2021-03-27 08:31:03 +01:00
|
|
|
file: 'options/toggleIcon.js',
|
2020-11-03 17:34:30 +01:00
|
|
|
runAt: 'document_start'
|
|
|
|
}, function (res) {
|
|
|
|
if (ext_api.runtime.lastError || res[0]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-02-23 17:44:54 +01:00
|
|
|
let allow_ext_source = medium_custom_domain;
|
|
|
|
let bpc_amp_site = false;
|
2020-11-04 08:19:51 +01:00
|
|
|
let au_apn_site = (header_referer && (urlHost(header_referer).endsWith('com.au') || urlHost(header_referer).endsWith('net.au')) && details.url.includes('https://media.apnarm.net.au/'));
|
2020-10-15 17:11:03 +02:00
|
|
|
let au_swm_site = (header_referer && urlHost(header_referer).endsWith('com.au') && details.url.includes('https://s.thewest.com.au/'));
|
2021-01-01 12:23:29 +01:00
|
|
|
|
2021-02-23 17:44:54 +01:00
|
|
|
if (isSiteEnabled({url: header_referer})) {
|
|
|
|
let inkl_site = (matchUrlDomain('cdn.jsdelivr.net', details.url) && matchUrlDomain('inkl.com', header_referer));
|
|
|
|
let cl_elmerc_site = (matchUrlDomain('emol.cl', details.url) && matchUrlDomain('elmercurio.com', header_referer));
|
2021-03-13 16:49:58 +01:00
|
|
|
let es_elesp_site = (matchUrlDomain('eestatic.com', details.url) && matchUrlDomain('elespanol.com', header_referer));
|
2021-02-23 17:44:54 +01:00
|
|
|
let it_repubblica_site = (matchUrlDomain(['repstatic.it'], details.url) && matchUrlDomain(it_repubblica_domains, header_referer));
|
2021-08-27 08:37:12 +02:00
|
|
|
let usa_law360_site = (matchUrlDomain('law360news.com', details.url) && matchUrlDomain('law360.com', header_referer));
|
2021-02-23 17:44:54 +01:00
|
|
|
let usa_mw_site = (matchUrlDomain('wsj.net', details.url) && matchUrlDomain('marketwatch.com', header_referer));
|
2021-05-22 11:56:15 +02:00
|
|
|
let usa_natgeo_site = (matchUrlDomain('natgeofe.com', details.url) && matchUrlDomain('nationalgeographic.com', header_referer));
|
2021-05-06 19:50:12 +02:00
|
|
|
let usa_today_site = (matchUrlDomain('gannett-cdn.com', details.url) && matchUrlDomain(['usatoday.com'], header_referer));
|
2021-08-27 08:37:12 +02:00
|
|
|
allow_ext_source = allow_ext_source || inkl_site || cl_elmerc_site || es_elesp_site || it_repubblica_site || usa_law360_site || usa_mw_site || usa_natgeo_site || usa_today_site;
|
2021-01-01 12:23:29 +01:00
|
|
|
|
2021-09-25 09:35:48 +02:00
|
|
|
bpc_amp_site = (matchUrlDomain('cdn.ampproject.org', details.url) && matchUrlDomain(['aachener-zeitung.de', 'asiatimes.com', 'augsburger-allgemeine.de', 'barrons.com', 'belfasttelegraph.co.uk', 'cicero.de', 'cmjornal.pt', 'elpais.com', 'elperiodico.com', 'freiepresse.de', 'handelsblatt.com', 'ilfattoquotidiano.it', 'inc42.com', 'independent.ie', 'irishtimes.com', 'la-croix.com', 'marketwatch.com', 'nationalreview.com', 'noz.de', 'nwzonline.de', 'scmp.com', 'seekingalpha.com', 'shz.de', 'staradvertiser.com', 'sueddeutsche.de', 'svz.de', 'telegraph.co.uk', 'washingtonpost.com', 'wsj.com'].concat(au_news_corp_domains, au_nine_domains, de_madsack_domains, es_epiberica_domains, es_grupo_vocento_domains, es_unidad_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_repubblica_domains, usa_mcc_domains, usa_mng_domains, usa_theathletic_domains), header_referer));
|
2021-02-23 17:44:54 +01:00
|
|
|
}
|
|
|
|
|
2021-07-11 11:21:13 +02:00
|
|
|
if (!isSiteEnabled(details) && !allow_ext_source && !bpc_amp_site && !au_apn_site && !au_swm_site) {
|
2019-11-27 19:23:00 +01:00
|
|
|
return;
|
2018-11-24 23:10:21 +01:00
|
|
|
}
|
|
|
|
|
2020-06-04 09:04:58 +02:00
|
|
|
// block javascript of (sub)domain for custom sites (optional)
|
2020-08-22 13:52:43 +02:00
|
|
|
var domain_blockjs = matchUrlDomain(block_js_custom, details.url);
|
2021-01-26 21:27:43 +01:00
|
|
|
if (domain_blockjs && matchUrlDomain(domain_blockjs, details.url) && details.type === 'script') {
|
2020-06-04 09:04:58 +02:00
|
|
|
return { cancel: true };
|
|
|
|
}
|
|
|
|
|
2017-07-08 19:40:29 +02:00
|
|
|
var tabId = details.tabId;
|
2020-03-27 19:02:27 +01:00
|
|
|
|
2019-04-07 01:34:30 +02:00
|
|
|
var useUserAgentMobile = false;
|
2017-07-08 19:40:29 +02:00
|
|
|
var setReferer = false;
|
2021-07-24 10:07:06 +02:00
|
|
|
var googlebotEnabled = matchUrlDomain(use_google_bot, details.url) &&
|
|
|
|
!(matchUrlDomain('barrons.com', details.url) && enabledSites.includes('#options_disable_gb_barrons')) &&
|
2021-09-26 10:10:29 +02:00
|
|
|
!(matchUrlDomain('theaustralian.com.au', details.url) && enabledSites.includes('#options_disable_gb_theaustralian')) &&
|
2021-07-24 10:07:06 +02:00
|
|
|
!(matchUrlDomain('wsj.com', details.url) && enabledSites.includes('#options_disable_gb_wsj'));
|
2017-07-08 19:40:29 +02:00
|
|
|
|
2021-08-31 18:57:40 +02:00
|
|
|
if (matchUrlDomain(change_headers, details.url) && (!['font', 'image', 'stylesheet'].includes(details.type) || matchUrlDomain(['thetimes.co.uk'], details.url))) {
|
2021-07-24 10:07:06 +02:00
|
|
|
// if referer exists, set it
|
2020-03-27 19:02:27 +01:00
|
|
|
requestHeaders = requestHeaders.map(function (requestHeader) {
|
2017-07-08 19:40:29 +02:00
|
|
|
if (requestHeader.name === 'Referer') {
|
2021-07-24 10:07:06 +02:00
|
|
|
if (googlebotEnabled || matchUrlDomain(use_google_referer, details.url)) {
|
2021-02-06 21:37:52 +01:00
|
|
|
requestHeader.value = 'https://www.google.com/';
|
|
|
|
} else if (matchUrlDomain(use_facebook_referer, details.url)) {
|
2019-02-13 10:33:45 +01:00
|
|
|
requestHeader.value = 'https://www.facebook.com/';
|
2021-02-04 21:44:25 +01:00
|
|
|
} else if (matchUrlDomain(use_twitter_referer, details.url)) {
|
|
|
|
requestHeader.value = 'https://t.co/';
|
2019-02-13 10:33:45 +01:00
|
|
|
}
|
|
|
|
setReferer = true;
|
|
|
|
}
|
2019-04-07 01:34:30 +02:00
|
|
|
if (requestHeader.name === 'User-Agent') {
|
2021-09-27 16:12:00 +02:00
|
|
|
useUserAgentMobile = requestHeader.value.toLowerCase().includes("mobile") && !matchUrlDomain(['telerama.fr'], details.url);
|
2019-04-07 01:34:30 +02:00
|
|
|
}
|
2019-02-13 10:33:45 +01:00
|
|
|
return requestHeader;
|
|
|
|
});
|
2017-07-08 19:40:29 +02:00
|
|
|
|
|
|
|
// otherwise add it
|
|
|
|
if (!setReferer) {
|
2021-07-24 10:07:06 +02:00
|
|
|
if (googlebotEnabled || matchUrlDomain(use_google_referer, details.url)) {
|
2017-07-08 19:40:29 +02:00
|
|
|
requestHeaders.push({
|
|
|
|
name: 'Referer',
|
2021-02-06 21:37:52 +01:00
|
|
|
value: 'https://www.google.com/'
|
2017-07-08 19:40:29 +02:00
|
|
|
});
|
2021-02-06 21:37:52 +01:00
|
|
|
} else if (matchUrlDomain(use_facebook_referer, details.url)) {
|
2021-02-04 21:44:25 +01:00
|
|
|
requestHeaders.push({
|
|
|
|
name: 'Referer',
|
2021-02-06 21:37:52 +01:00
|
|
|
value: 'https://www.facebook.com/'
|
2021-02-04 21:44:25 +01:00
|
|
|
});
|
2021-02-06 21:37:52 +01:00
|
|
|
} else if (matchUrlDomain(use_twitter_referer, details.url)) {
|
2017-07-08 19:40:29 +02:00
|
|
|
requestHeaders.push({
|
|
|
|
name: 'Referer',
|
2021-02-06 21:37:52 +01:00
|
|
|
value: 'https://t.co/'
|
2017-07-08 19:40:29 +02:00
|
|
|
});
|
|
|
|
}
|
2019-04-07 01:34:30 +02:00
|
|
|
}
|
2017-07-08 19:40:29 +02:00
|
|
|
|
2019-05-12 22:44:03 +02:00
|
|
|
// override User-Agent to use Googlebot
|
2021-07-24 10:07:06 +02:00
|
|
|
if (googlebotEnabled) {
|
2019-04-07 01:34:30 +02:00
|
|
|
requestHeaders.push({
|
|
|
|
"name": "User-Agent",
|
2020-11-02 18:52:40 +01:00
|
|
|
"value": useUserAgentMobile ? userAgentMobileG : userAgentDesktopG
|
2019-04-07 01:34:30 +02:00
|
|
|
})
|
2019-05-12 22:44:03 +02:00
|
|
|
requestHeaders.push({
|
|
|
|
"name": "X-Forwarded-For",
|
|
|
|
"value": "66.249.66.1"
|
|
|
|
})
|
2017-07-08 19:40:29 +02:00
|
|
|
}
|
|
|
|
|
2020-11-02 18:52:40 +01:00
|
|
|
// override User-Agent to use Bingbot
|
|
|
|
if (matchUrlDomain(use_bing_bot, details.url)) {
|
|
|
|
requestHeaders.push({
|
|
|
|
"name": "User-Agent",
|
|
|
|
"value": useUserAgentMobile ? userAgentMobileB : userAgentDesktopB
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-01-12 21:46:50 +01:00
|
|
|
// random IP for sites in use_random_ip
|
|
|
|
if (matchUrlDomain(use_random_ip, details.url)) {
|
2020-12-03 16:52:33 +01:00
|
|
|
requestHeaders.push({
|
|
|
|
"name": "X-Forwarded-For",
|
|
|
|
"value": randomIP()
|
|
|
|
})
|
|
|
|
}
|
2021-01-12 21:46:50 +01:00
|
|
|
}
|
2020-12-03 16:52:33 +01:00
|
|
|
|
2017-07-08 19:40:29 +02:00
|
|
|
// remove cookies before page load
|
2020-05-01 12:58:36 +02:00
|
|
|
if (!matchUrlDomain(allow_cookies, details.url)) {
|
|
|
|
requestHeaders = requestHeaders.map(function(requestHeader) {
|
|
|
|
if (requestHeader.name === 'Cookie') {
|
|
|
|
requestHeader.value = '';
|
2017-07-08 19:40:29 +02:00
|
|
|
}
|
2020-05-01 12:58:36 +02:00
|
|
|
return requestHeader;
|
|
|
|
});
|
|
|
|
}
|
2017-07-08 19:40:29 +02:00
|
|
|
|
2020-09-14 21:29:13 +02:00
|
|
|
if (tabId !== -1) {
|
|
|
|
ext_api.tabs.get(tabId, function (currentTab) {
|
2021-06-30 18:20:20 +02:00
|
|
|
if ((currentTab && isSiteEnabled(currentTab)) || medium_custom_domain || au_apn_site || au_swm_site) {
|
2020-12-04 16:14:23 +01:00
|
|
|
if (currentTab.url !== currentTabUrl) {
|
|
|
|
csDone = false;
|
|
|
|
currentTabUrl = currentTab.url;
|
|
|
|
}
|
2021-03-27 11:53:38 +01:00
|
|
|
if ((!['font', 'stylesheet'].includes(details.type) || matchUrlDomain(cs_limit_except, currentTabUrl)) && !csDone) {
|
2021-06-29 19:59:15 +02:00
|
|
|
let lib_file = 'lib/empty.js';
|
2021-09-27 16:31:46 +02:00
|
|
|
if (matchUrlDomain(['bloomberg.com', 'cicero.de', 'economictimes.com', 'lesechos.fr', 'newleftreview.org', 'newyorker.com', 'nzherald.co.nz', 'prospectmagazine.co.uk', 'sudouest.fr', 'techinasia.com', 'valor.globo.com', 'washingtonpost.com'].concat(nl_mediahuis_region_domains, no_nhst_media_domains, usa_theathletic_domains), currentTabUrl))
|
2021-06-29 19:59:15 +02:00
|
|
|
lib_file = 'lib/purify.min.js';
|
2020-12-04 16:14:23 +01:00
|
|
|
ext_api.tabs.executeScript(tabId, {
|
2021-06-29 19:59:15 +02:00
|
|
|
file: lib_file,
|
2020-12-04 16:14:23 +01:00
|
|
|
runAt: 'document_start'
|
2021-06-29 19:59:15 +02:00
|
|
|
}, function () {
|
|
|
|
ext_api.tabs.executeScript(tabId, {
|
|
|
|
file: 'contentScript.js',
|
|
|
|
runAt: 'document_start'
|
|
|
|
}, function (res) {
|
|
|
|
if (ext_api.runtime.lastError || res[0]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
})
|
2020-12-04 16:14:23 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2020-09-14 21:29:13 +02:00
|
|
|
});
|
|
|
|
} else {//mercuriovalpo.cl
|
|
|
|
ext_api.tabs.query({
|
|
|
|
active: true,
|
|
|
|
currentWindow: true
|
|
|
|
}, function (tabs) {
|
2021-05-23 20:42:28 +02:00
|
|
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
2020-11-01 17:46:29 +01:00
|
|
|
if (isSiteEnabled({url: tabs[0].url})) {
|
2020-09-14 21:29:13 +02:00
|
|
|
ext_api.tabs.executeScript({
|
|
|
|
file: 'contentScript.js',
|
|
|
|
runAt: 'document_start'
|
|
|
|
}, function (res) {
|
|
|
|
if (ext_api.runtime.lastError || res[0]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2017-07-08 19:40:29 +02:00
|
|
|
}
|
2020-09-14 21:29:13 +02:00
|
|
|
});
|
|
|
|
}
|
2017-07-08 19:40:29 +02:00
|
|
|
|
|
|
|
return { requestHeaders: requestHeaders };
|
|
|
|
}, {
|
|
|
|
urls: ['<all_urls>']
|
2020-03-25 19:31:28 +01:00
|
|
|
}, extraInfoSpec);
|
|
|
|
// extraInfoSpec is ['blocking', 'requestHeaders'] + possible 'extraHeaders'
|
2017-07-08 19:40:29 +02:00
|
|
|
|
2020-05-01 12:58:36 +02:00
|
|
|
ext_api.tabs.onUpdated.addListener(function (tabId, info, tab) { updateBadge(tab); });
|
|
|
|
ext_api.tabs.onActivated.addListener(function (activeInfo) { ext_api.tabs.get(activeInfo.tabId, updateBadge); });
|
|
|
|
|
2020-11-02 16:57:47 +01:00
|
|
|
function updateBadge(activeTab) {
|
2020-11-15 21:10:03 +01:00
|
|
|
if (ext_api.runtime.lastError || !activeTab)
|
2020-11-02 16:57:47 +01:00
|
|
|
return;
|
2020-08-20 19:01:12 +02:00
|
|
|
let badgeText = '';
|
|
|
|
let color = 'red';
|
|
|
|
let currentUrl = activeTab.url;
|
|
|
|
if (currentUrl) {
|
|
|
|
if (isSiteEnabled({url: currentUrl})) {
|
|
|
|
badgeText = 'ON';
|
|
|
|
color = 'red';
|
|
|
|
} else if (matchUrlDomain(enabledSites, currentUrl)) {
|
|
|
|
badgeText = 'ON-';
|
2020-11-02 16:57:47 +01:00
|
|
|
color = 'orange';
|
2020-08-20 19:01:12 +02:00
|
|
|
} else if (matchUrlDomain(disabledSites, currentUrl)) {
|
|
|
|
badgeText = 'OFF';
|
2020-11-02 16:57:47 +01:00
|
|
|
color = 'blue';
|
2020-08-20 19:01:12 +02:00
|
|
|
}
|
2021-05-02 07:51:25 +02:00
|
|
|
if (version_new)
|
|
|
|
badgeText = '^' + badgeText;
|
2020-11-02 16:57:47 +01:00
|
|
|
let isDefaultSite = matchUrlDomain(defaultSites_domains, currentUrl);
|
|
|
|
let isCustomSite = matchUrlDomain(customSites_domains, currentUrl);
|
|
|
|
if (!isDefaultSite && isCustomSite) {
|
|
|
|
ext_api.permissions.contains({
|
2021-04-29 19:35:59 +02:00
|
|
|
origins: ['*://*.' + isCustomSite + '/*']
|
2020-11-02 16:57:47 +01:00
|
|
|
}, function (result) {
|
|
|
|
if (!result)
|
2021-05-02 07:51:25 +02:00
|
|
|
badgeText = enabledSites.includes(isCustomSite) ? 'C' : '';
|
2020-11-02 16:57:47 +01:00
|
|
|
if (color && badgeText)
|
|
|
|
ext_api.browserAction.setBadgeBackgroundColor({color: color});
|
|
|
|
ext_api.browserAction.setBadgeText({text: badgeText});
|
|
|
|
});
|
2020-11-01 17:46:29 +01:00
|
|
|
} else {
|
2020-11-02 16:57:47 +01:00
|
|
|
if (color && badgeText)
|
|
|
|
ext_api.browserAction.setBadgeBackgroundColor({color: color});
|
2020-11-01 17:46:29 +01:00
|
|
|
ext_api.browserAction.setBadgeText({text: badgeText});
|
2020-11-02 16:57:47 +01:00
|
|
|
}
|
2020-08-20 19:01:12 +02:00
|
|
|
}
|
2020-03-03 22:37:45 +01:00
|
|
|
}
|
|
|
|
|
2021-05-02 07:51:25 +02:00
|
|
|
var version_new;
|
|
|
|
check_update();
|
|
|
|
function check_update() {
|
|
|
|
var manifestData = ext_api.runtime.getManifest();
|
|
|
|
var manifest_new = 'https://bitbucket.org/magnolia1234/bypass-paywalls-firefox-clean/raw/master/manifest.json';
|
|
|
|
fetch(manifest_new)
|
|
|
|
.then(response => {
|
|
|
|
if (response.ok) {
|
|
|
|
response.json().then(json => {
|
|
|
|
ext_api.management.getSelf(function (result) {
|
|
|
|
var installType = result.installType;
|
|
|
|
var version_len = (installType === 'development') ? 7 : 5;
|
|
|
|
version_new = json['version'];
|
|
|
|
if (version_new.substring(0, version_len) <= manifestData.version.substring(0, version_len))
|
|
|
|
version_new = '';
|
|
|
|
ext_api.storage.local.set({
|
|
|
|
version_new: version_new
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-08-20 19:01:12 +02:00
|
|
|
function site_switch() {
|
|
|
|
ext_api.tabs.query({
|
|
|
|
active: true,
|
|
|
|
currentWindow: true
|
|
|
|
}, function (tabs) {
|
2021-05-23 20:42:28 +02:00
|
|
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
2020-08-20 19:01:12 +02:00
|
|
|
let currentUrl = tabs[0].url;
|
2020-11-05 22:21:41 +01:00
|
|
|
let isDefaultSite = matchUrlDomain(defaultSites_grouped_domains, currentUrl);
|
2020-12-09 17:32:30 +01:00
|
|
|
if (!isDefaultSite) {
|
|
|
|
let isDefaultSiteGroup = matchUrlDomain(defaultSites_domains, currentUrl);
|
|
|
|
if (isDefaultSiteGroup)
|
|
|
|
isDefaultSite = Object.keys(grouped_sites).find(key => grouped_sites[key].includes(isDefaultSiteGroup));
|
|
|
|
}
|
2020-08-20 19:01:12 +02:00
|
|
|
let defaultSite_title = isDefaultSite ? Object.keys(defaultSites).find(key => defaultSites[key] === isDefaultSite) : '';
|
|
|
|
let isCustomSite = matchUrlDomain(Object.values(customSites_domains), currentUrl);
|
|
|
|
let customSite_title = isCustomSite ? Object.keys(customSites).find(key => customSites[key].domain === isCustomSite) : '';
|
|
|
|
let site_title = defaultSite_title || customSite_title;
|
|
|
|
let domain = isDefaultSite || isCustomSite;
|
2020-11-04 17:41:48 +01:00
|
|
|
if (domain && site_title) {
|
2020-08-20 19:01:12 +02:00
|
|
|
let added_site = [];
|
|
|
|
let removed_site = [];
|
|
|
|
if (enabledSites.includes(domain))
|
|
|
|
removed_site.push(site_title);
|
|
|
|
else
|
|
|
|
added_site.push(site_title);
|
2020-10-31 20:06:38 +01:00
|
|
|
ext_api.storage.local.get({
|
2020-08-20 19:01:12 +02:00
|
|
|
sites: {}
|
|
|
|
}, function (items) {
|
|
|
|
var sites = items.sites;
|
2020-11-10 18:15:18 +01:00
|
|
|
for (let key of added_site)
|
2020-08-20 19:01:12 +02:00
|
|
|
sites[key] = domain;
|
2020-11-10 18:15:18 +01:00
|
|
|
for (let key of removed_site)
|
2020-08-20 19:01:12 +02:00
|
|
|
delete sites[key];
|
|
|
|
|
2020-10-31 20:06:38 +01:00
|
|
|
ext_api.storage.local.set({
|
2020-08-20 19:01:12 +02:00
|
|
|
sites: sites
|
|
|
|
}, function () {
|
|
|
|
true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2020-03-03 22:37:45 +01:00
|
|
|
}
|
|
|
|
|
2021-02-28 11:32:38 +01:00
|
|
|
function remove_cookies_fn(domainVar, exclusions = false) {
|
2021-02-17 19:11:27 +01:00
|
|
|
ext_api.cookies.getAllCookieStores(function (cookieStores) {
|
|
|
|
ext_api.tabs.query({
|
|
|
|
active: true,
|
|
|
|
currentWindow: true
|
|
|
|
}, function (tabs) {
|
2021-05-23 20:42:28 +02:00
|
|
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
2021-06-16 07:38:22 +02:00
|
|
|
if (ext_api.runtime.lastError)
|
|
|
|
return;
|
2021-02-17 19:11:27 +01:00
|
|
|
let tabId = tabs[0].id;
|
2021-02-28 11:32:38 +01:00
|
|
|
let storeId = '0';
|
2021-02-17 19:11:27 +01:00
|
|
|
for (let store of cookieStores) {
|
|
|
|
if (store.tabIds.includes(tabId))
|
|
|
|
storeId = store.id;
|
|
|
|
}
|
2021-02-22 19:49:41 +01:00
|
|
|
storeId = storeId.toString();
|
|
|
|
var cookie_get_options = {
|
|
|
|
domain: domainVar
|
|
|
|
};
|
|
|
|
if (storeId !== 'null')
|
|
|
|
cookie_get_options.storeId = storeId;
|
|
|
|
var cookie_remove_options = {};
|
|
|
|
ext_api.cookies.getAll(cookie_get_options, function (cookies) {
|
2021-02-17 19:11:27 +01:00
|
|
|
for (let cookie of cookies) {
|
2021-02-28 11:32:38 +01:00
|
|
|
if (exclusions) {
|
|
|
|
var rc_domain = cookie.domain.replace(/^(\.?www\.|\.)/, '');
|
|
|
|
// hold specific cookie(s) from remove_cookies domains
|
|
|
|
if ((rc_domain in remove_cookies_select_hold) && remove_cookies_select_hold[rc_domain].includes(cookie.name)) {
|
|
|
|
continue; // don't remove specific cookie
|
|
|
|
}
|
|
|
|
// drop only specific cookie(s) from remove_cookies domains
|
|
|
|
if ((rc_domain in remove_cookies_select_drop) && !(remove_cookies_select_drop[rc_domain].includes(cookie.name))) {
|
|
|
|
continue; // only remove specific cookie
|
|
|
|
}
|
|
|
|
// hold on to consent-cookie
|
|
|
|
if (cookie.name.match(/(consent|^optanon)/i)) {
|
|
|
|
continue;
|
|
|
|
}
|
2021-02-17 19:11:27 +01:00
|
|
|
}
|
2021-02-23 17:44:54 +01:00
|
|
|
cookie.domain = cookie.domain.replace(/^\./, '');
|
2021-02-22 19:49:41 +01:00
|
|
|
cookie_remove_options = {
|
2021-02-17 19:11:27 +01:00
|
|
|
url: (cookie.secure ? "https://" : "http://") + cookie.domain + cookie.path,
|
2021-02-22 19:49:41 +01:00
|
|
|
name: cookie.name
|
|
|
|
};
|
|
|
|
if (storeId !== 'null')
|
|
|
|
cookie_remove_options.storeId = storeId;
|
|
|
|
ext_api.cookies.remove(cookie_remove_options);
|
2021-02-17 19:11:27 +01:00
|
|
|
}
|
|
|
|
});
|
2021-01-02 12:48:07 +01:00
|
|
|
}
|
2021-02-17 19:11:27 +01:00
|
|
|
});
|
|
|
|
})
|
2021-02-28 11:32:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// remove cookies after page load
|
|
|
|
ext_api.webRequest.onCompleted.addListener(function (details) {
|
|
|
|
let domainVar = matchUrlDomain(remove_cookies, details.url);
|
2021-07-27 23:47:05 +02:00
|
|
|
if (domainVar && ['main_frame', 'sub_frame', 'xmlhttprequest', 'other'].includes(details.type) && enabledSites.includes(domainVar)) {
|
2021-02-28 11:32:38 +01:00
|
|
|
remove_cookies_fn(domainVar, true);
|
2021-07-22 17:09:36 +02:00
|
|
|
}
|
2017-07-08 19:40:29 +02:00
|
|
|
}, {
|
2020-10-24 16:38:01 +02:00
|
|
|
urls: ["<all_urls>"]
|
2018-08-29 01:15:23 +02:00
|
|
|
});
|
2019-02-11 00:43:12 +01:00
|
|
|
|
2020-10-12 17:31:51 +02:00
|
|
|
function clear_cookies() {
|
2020-10-24 16:38:01 +02:00
|
|
|
ext_api.tabs.query({
|
|
|
|
active: true,
|
|
|
|
currentWindow: true
|
|
|
|
}, function (tabs) {
|
2021-05-23 20:42:28 +02:00
|
|
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
2020-10-24 16:38:01 +02:00
|
|
|
ext_api.tabs.executeScript({
|
2021-03-27 08:31:03 +01:00
|
|
|
file: 'options/clearCookies.js',
|
2020-10-24 16:38:01 +02:00
|
|
|
runAt: 'document_start'
|
|
|
|
}, function (res) {
|
|
|
|
if (ext_api.runtime.lastError || res[0]) {
|
|
|
|
return;
|
2020-10-12 17:31:51 +02:00
|
|
|
}
|
2020-10-24 16:38:01 +02:00
|
|
|
});
|
|
|
|
ext_api.tabs.update(tabs[0].id, {
|
|
|
|
url: tabs[0].url
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2020-10-12 17:31:51 +02:00
|
|
|
}
|
|
|
|
|
2020-10-29 18:39:46 +01:00
|
|
|
var chrome_scheme = 'light';
|
2020-09-08 16:38:18 +02:00
|
|
|
ext_api.runtime.onMessage.addListener(function (message, sender) {
|
2020-10-24 16:38:01 +02:00
|
|
|
// check storage for opt in
|
|
|
|
if (message.request === 'optin') {
|
2020-10-31 20:06:38 +01:00
|
|
|
ext_api.storage.local.get("optIn", function (result) {
|
2020-10-24 16:38:01 +02:00
|
|
|
// send message back to content script with value of opt in
|
|
|
|
ext_api.tabs.sendMessage(
|
|
|
|
sender.tab.id, {
|
|
|
|
"optIn": (true == result.optIn)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2021-02-17 19:11:27 +01:00
|
|
|
if (message.request === 'clear_cookies') {
|
|
|
|
clear_cookies();
|
|
|
|
}
|
2020-10-24 16:38:01 +02:00
|
|
|
// clear cookies for domain
|
|
|
|
if (message.domain) {
|
2021-02-28 11:32:38 +01:00
|
|
|
remove_cookies_fn(message.domain);
|
2021-02-17 19:11:27 +01:00
|
|
|
}
|
|
|
|
if (message.request === 'site_switch') {
|
|
|
|
site_switch();
|
|
|
|
}
|
|
|
|
if (message.request === 'popup_show_toggle') {
|
|
|
|
ext_api.tabs.query({
|
|
|
|
active: true,
|
|
|
|
currentWindow: true
|
|
|
|
}, function (tabs) {
|
2021-05-23 20:42:28 +02:00
|
|
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
2021-02-17 19:11:27 +01:00
|
|
|
let currentUrl = tabs[0].url;
|
|
|
|
let domain;
|
|
|
|
let isExcludedSite = matchUrlDomain(excludedSites, currentUrl);
|
|
|
|
if (!isExcludedSite) {
|
|
|
|
let isDefaultSiteGrouped = matchUrlDomain(defaultSites_domains, currentUrl);
|
|
|
|
let isDefaultSite = matchUrlDomain(defaultSites_domains, currentUrl);
|
|
|
|
let isCustomSite = matchUrlDomain(Object.values(customSites_domains), currentUrl);
|
|
|
|
domain = isDefaultSiteGrouped || (!isDefaultSite && isCustomSite);
|
|
|
|
}
|
|
|
|
ext_api.runtime.sendMessage({
|
|
|
|
msg: "popup_show_toggle",
|
|
|
|
data: {
|
|
|
|
domain: domain,
|
|
|
|
enabled: enabledSites.includes(domain)
|
|
|
|
}
|
2020-10-12 17:31:51 +02:00
|
|
|
});
|
2020-10-24 16:38:01 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2021-06-09 21:32:35 +02:00
|
|
|
if (message.request === 'refreshCurrentTab') {
|
|
|
|
refreshCurrentTab();
|
|
|
|
}
|
2021-02-21 09:21:39 +01:00
|
|
|
if (message.scheme && (![chrome_scheme, 'undefined'].includes(message.scheme) || focus_changed)) {
|
2020-10-29 18:39:46 +01:00
|
|
|
let icon_path = {path: {'128': 'bypass.png'}};
|
|
|
|
if (message.scheme === 'dark')
|
|
|
|
icon_path = {path: {'128': 'bypass-dark.png'}};
|
|
|
|
ext_api.browserAction.setIcon(icon_path);
|
|
|
|
chrome_scheme = message.scheme;
|
2021-02-21 09:21:39 +01:00
|
|
|
focus_changed = false;
|
2020-10-29 18:39:46 +01:00
|
|
|
}
|
2020-12-04 16:14:23 +01:00
|
|
|
if (message.csDone) {
|
|
|
|
csDone = true;
|
|
|
|
//console.log('msg.csDone: ' + csDone);
|
|
|
|
}
|
2020-09-08 16:38:18 +02:00
|
|
|
});
|
|
|
|
|
2021-03-07 14:03:22 +01:00
|
|
|
// show the opt-in tab on installation
|
2020-10-31 20:06:38 +01:00
|
|
|
ext_api.storage.local.get(["optInShown", "customShown"], function (result) {
|
2020-10-24 16:38:01 +02:00
|
|
|
if (!result.optInShown || !result.customShown) {
|
|
|
|
ext_api.tabs.create({
|
2021-03-30 20:52:32 +02:00
|
|
|
url: "options/optin/opt-in.html"
|
2020-10-24 16:38:01 +02:00
|
|
|
});
|
2020-10-31 20:06:38 +01:00
|
|
|
ext_api.storage.local.set({
|
2020-10-24 16:38:01 +02:00
|
|
|
"optInShown": true,
|
|
|
|
"customShown": true
|
|
|
|
});
|
|
|
|
}
|
2020-09-08 16:38:18 +02:00
|
|
|
});
|
|
|
|
|
2021-04-03 19:03:46 +02:00
|
|
|
// restore custom sites opt-in on reload (chrome-only, load upacked)
|
|
|
|
if (typeof browser !== 'object') {
|
|
|
|
ext_api.storage.local.get({
|
|
|
|
sites: {},
|
|
|
|
customOptIn: false
|
|
|
|
}, function (result) {
|
|
|
|
let options_restore_custom = Object.values(result.sites).includes('#options_restore_custom');
|
|
|
|
if (result.customOptIn && options_restore_custom) {
|
|
|
|
ext_api.permissions.contains({
|
|
|
|
origins: ["<all_urls>"]
|
|
|
|
}, function (result_perm) {
|
|
|
|
if (!result_perm) {
|
|
|
|
ext_api.tabs.create({
|
|
|
|
url: "options/optin/opt-in.html"
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-26 13:05:20 +01:00
|
|
|
function filterObject(obj, callback) {
|
|
|
|
return Object.fromEntries(Object.entries(obj).
|
|
|
|
filter(([key, val]) => callback(val, key)));
|
|
|
|
}
|
|
|
|
|
2019-02-11 00:43:12 +01:00
|
|
|
function isSiteEnabled(details) {
|
2020-10-24 16:38:01 +02:00
|
|
|
var enabledSite = matchUrlDomain(enabledSites, details.url);
|
2021-03-07 14:03:22 +01:00
|
|
|
if (!ext_name.startsWith('Bypass Paywalls Clean'))
|
2020-10-24 16:38:01 +02:00
|
|
|
enabledSite = '';
|
|
|
|
if (enabledSite in restrictions) {
|
|
|
|
return restrictions[enabledSite].test(details.url);
|
|
|
|
}
|
|
|
|
return !!enabledSite;
|
2020-05-01 12:58:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function matchDomain(domains, hostname) {
|
2020-10-24 16:38:01 +02:00
|
|
|
var matched_domain = false;
|
|
|
|
if (!hostname)
|
|
|
|
hostname = window.location.hostname;
|
|
|
|
if (typeof domains === 'string')
|
|
|
|
domains = [domains];
|
|
|
|
domains.some(domain => (hostname === domain || hostname.endsWith('.' + domain)) && (matched_domain = domain));
|
|
|
|
return matched_domain;
|
2020-05-01 12:58:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function urlHost(url) {
|
2020-10-24 16:38:01 +02:00
|
|
|
if (url && url.startsWith('http')) {
|
|
|
|
try {
|
|
|
|
return new URL(url).hostname;
|
|
|
|
} catch (e) {
|
|
|
|
console.log(`url not valid: ${url} error: ${e}`);
|
2020-05-01 12:58:36 +02:00
|
|
|
}
|
2020-10-24 16:38:01 +02:00
|
|
|
}
|
|
|
|
return url;
|
2020-05-01 12:58:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function matchUrlDomain(domains, url) {
|
2020-10-24 16:38:01 +02:00
|
|
|
return matchDomain(domains, urlHost(url));
|
2019-02-11 00:43:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getParameterByName(name, url) {
|
|
|
|
if (!url) url = window.location.href;
|
|
|
|
name = name.replace(/[\[\]]/g, '\\$&');
|
|
|
|
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
|
|
|
|
results = regex.exec(url);
|
|
|
|
if (!results) return null;
|
|
|
|
if (!results[2]) return '';
|
|
|
|
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
|
|
|
}
|
2020-01-28 23:06:25 +01:00
|
|
|
|
|
|
|
function stripQueryStringAndHashFromPath(url) {
|
|
|
|
return url.split("?")[0].split("#")[0];
|
2020-03-25 19:31:28 +01:00
|
|
|
}
|
2020-12-03 16:52:33 +01:00
|
|
|
|
|
|
|
function randomInt(max) {
|
|
|
|
return Math.floor(Math.random() * Math.floor(max));
|
|
|
|
}
|
|
|
|
|
|
|
|
function randomIP() {
|
|
|
|
let rndmIP = [];
|
|
|
|
for (let n = 0; n < 4; n++)
|
|
|
|
rndmIP.push(randomInt(254) + 1);
|
|
|
|
return rndmIP.join('.');
|
|
|
|
}
|
2021-06-09 21:32:35 +02:00
|
|
|
|
|
|
|
// Refresh the current tab
|
|
|
|
function refreshCurrentTab() {
|
|
|
|
ext_api.tabs.query({
|
|
|
|
active: true,
|
|
|
|
currentWindow: true
|
|
|
|
}, function (tabs) {
|
|
|
|
if (tabs && tabs[0] && tabs[0].url.startsWith('http')) {
|
2021-06-12 18:19:48 +02:00
|
|
|
if (ext_api.runtime.lastError)
|
|
|
|
return;
|
2021-06-09 21:32:35 +02:00
|
|
|
ext_api.tabs.update(tabs[0].id, {
|
|
|
|
url: tabs[0].url
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|