remove redundant code

This commit is contained in:
Tamius Han 2023-01-15 22:10:17 +01:00
parent a30a70c6b5
commit 30b028d836

View File

@ -284,36 +284,11 @@ class Settings {
}
}
fixSitesSettings(sites) {
for (const site in sites) {
if (site === '@global') {
continue;
}
if (sites[site].mode === undefined) {
sites[site].mode = ExtensionMode.Default;
}
if (sites[site].autoar === undefined) {
sites[site].autoar = ExtensionMode.Default;
}
if (sites[site].stretch === undefined) {
sites[site].stretch = StretchType.Default;
}
if (sites[site].videoAlignment === undefined) {
sites[site].videoAlignment = VideoAlignmentType.Default;
}
if (sites[site].keyboardShortcutsEnabled === undefined) {
sites[site].keyboardShortcutsEnabled = ExtensionMode.Default;
}
}
}
async set(extensionConf, options?) {
if (!options || !options.forcePreserveVersion) {
extensionConf.version = this.version;
}
this.fixSitesSettings(extensionConf.sites);
this.logger?.log('info', 'settings', "[Settings::set] setting new settings:", extensionConf)
return browser.storage.local.set( {'uwSettings': JSON.stringify(extensionConf)});