remove redundant code
This commit is contained in:
parent
a30a70c6b5
commit
30b028d836
@ -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?) {
|
async set(extensionConf, options?) {
|
||||||
if (!options || !options.forcePreserveVersion) {
|
if (!options || !options.forcePreserveVersion) {
|
||||||
extensionConf.version = this.version;
|
extensionConf.version = this.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fixSitesSettings(extensionConf.sites);
|
|
||||||
|
|
||||||
this.logger?.log('info', 'settings', "[Settings::set] setting new settings:", extensionConf)
|
this.logger?.log('info', 'settings', "[Settings::set] setting new settings:", extensionConf)
|
||||||
|
|
||||||
return browser.storage.local.set( {'uwSettings': JSON.stringify(extensionConf)});
|
return browser.storage.local.set( {'uwSettings': JSON.stringify(extensionConf)});
|
||||||
|
Loading…
Reference in New Issue
Block a user