Update options: enable new sites by default

This commit is contained in:
magnolia1234 2021-10-15 15:11:10 +02:00
parent e722fb2945
commit 877d1ee7e4
4 changed files with 21 additions and 1 deletions

View file

@ -659,10 +659,12 @@ function add_grouped_sites(init_rules) {
// Add googlebot- and block_javascript-settings for custom sites
ext_api.storage.local.get({
sites: {},
sites_default: Object.keys(defaultSites).filter(x => !defaultSites[x].match(/^(#options_|###$)/)),
sites_custom: {},
sites_excluded: []
}, function (items) {
var sites = items.sites;
var sites_default = items.sites_default;
var sites_custom = items.sites_custom;
excludedSites = items.sites_excluded;
@ -671,6 +673,22 @@ ext_api.storage.local.get({
}).map(function (key) {
return sites[key].toLowerCase();
});
// Enable new sites by default (opt-in)
if (enabledSites.includes('#options_enable_new_sites')) {
var sites_new = Object.keys(defaultSites).filter(x => !defaultSites[x].match(/^(#options_|###$)/) && !sites_default.includes(x));
for (let site_new of sites_new) {
sites[site_new] = defaultSites[site_new];
}
ext_api.storage.local.set({
sites: sites
});
}
sites_default = Object.keys(defaultSites).filter(x => !defaultSites[x].match(/^(#options_|###$)/));
ext_api.storage.local.set({
sites_default: sites_default
});
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 !== '###');

View file

@ -6,6 +6,7 @@ Add Westfaelische Nachrichten (Germany)
Fix GElocal.it
Fix National Review
Fix Ruhr Nachrichten (amp)
Update options: enable new sites by default
* v2.3.9.0 (2021-10-10)
Add Lee Enterprises Group (local USA)

View file

@ -566,5 +566,5 @@
"*://*.wallkit.net/*",
"*://*.wsj.net/*"
],
"version": "2.3.9.3"
"version": "2.3.9.4"
}

View file

@ -319,6 +319,7 @@ var defaultSites =
"TribDss": "tribdss.com",
"* BPC settings": "###",
"Show options on update": "#options_on_update",
"Enable new sites by default": "#options_enable_new_sites",
"Restore opt-in for custom sites (on reload; Chrome-only)": "#options_restore_custom",
"Barron's - no Googlebot (http error 500)": "#options_disable_gb_barrons",
"The Australian - no Googlebot (http error 403)": "#options_disable_gb_theaustralian",