Rounded up some stragglers from refactor

This commit is contained in:
Tamius Han 2019-01-20 23:36:08 +01:00
parent 9ec6973cc0
commit e0482084f0
3 changed files with 22 additions and 23 deletions

View File

@ -732,9 +732,8 @@ var ExtensionConf = {
// <hostname> : {
// status: <option> // should extension work on this site?
// arStatus: <option> // should we do autodetection on this site?
// statusEmbedded: <option> // reserved for future... maybe
//
// defaultAar?: <ratio> // automatically apply this aspect ratio on this side. Use extension defaults if undefined.
// defaultAr?: <ratio> // automatically apply this aspect ratio on this side. Use extension defaults if undefined.
// stretch? <stretch mode> // automatically stretch video on this site in this manner
// videoAlignment? <left|center|right>
//

View File

@ -210,13 +210,13 @@ class ActionHandler {
this.settings.save();
} else if (action.scope === 'global') {
if (cmd.action === "set-stretch") {
this.settings.active.site['@global'].stretch = cmd.arg;
this.settings.active.stretch.initialMode = cmd.arg;
} else if (cmd.action === "set-alignment") {
this.settings.active.site['@global'].videoAlignment = cmd.arg;
this.settings.active.miscSettings.videoAlignment = cmd.arg;
} else if (cmd.action === "set-extension-mode") {
this.settings.active.sites['@global'] = cmd.arg;
} else if (cmd.action === "set-autoar-mode") {
this.settings.active.site['@global'].autoar.arStatus = cmd.arg;
this.settings.active.arDetect.mode.arStatus = cmd.arg;
}
this.settings.save();
}

View File

@ -237,22 +237,22 @@ class Settings {
try {
// if site-specific settings don't exist for the site, we use default mode:
if (! this.active.sites[site]) {
if (this.active.sites['@global'] === "blacklist") {
if (this.active.sites['@global'] === ExtensionMode.Enable) {
return ExtensionMode.Enabled;
} else {
return this.active.basicExtensionMode === "blacklist" ? ExtensionMode.Basic : ExtensionMode.Disabled;
return this.active.basicExtensionMode === ExtensionMode.Enable ? ExtensionMode.Basic : ExtensionMode.Disabled;
}
}
if (this.active.sites[site].status === 'enabled') {
if (this.active.sites[site].mode === ExtensionMode.Enabled) {
return ExtensionMode.Enabled;
} else if (this.active.sites[site].status === 'basic') {
} else if (this.active.sites[site].mode === ExtensionMode.Basic) {
return ExtensionMode.Basic;
} else if (this.active.sites[site].status === 'default') {
if (this.active.sites['@global'] === "blacklist") {
} else if (this.active.sites[site].mode === ExtensionMode.Default) {
if (this.active.sites['@global'] === ExtensionMode.Enable) {
return ExtensionMode.Enabled;
} else {
return this.active.basicExtensionMode === "blacklist" ? ExtensionMode.Basic : ExtensionMode.Disabled;
return this.active.basicExtensionMode === ExtensionMode.Enable ? ExtensionMode.Basic : ExtensionMode.Disabled;
}
} else {
return ExtensionMode.Disabled;
@ -289,13 +289,13 @@ class Settings {
try{
// if site is not defined, we use default mode:
if (! this.active.sites[site]) {
return this.active.sites['@global'] === "blacklist";
return this.active.sites['@global'] === ExtensionMode.Enable;
}
if(this.active.sites['@global'] === "blacklist") {
return this.active.sites[site].status !== "disabled";
} else if (this.active.sites['@global'] === "whitelist") {
return this.active.sites[site].status === "enabled";
if(this.active.sites['@global'] === ExtensionMode.Enable) {
return this.active.sites[site].mode !== ExtensionMode.Disabled;
} else if (this.active.sites['@global'] === ExtensionMode.Whitelist) {
return this.active.sites[site].mode === ExtensionMode.Enabled;
} else {
return false;
}
@ -308,7 +308,7 @@ class Settings {
}
extensionEnabled(){
return this.active.sites['@global'] !== 'disabled'
return this.active.sites['@global'] !== ExtensionMode.Disabled
}
extensionEnabledForSite(site) {
@ -341,13 +341,13 @@ class Settings {
// if site is not defined, we use default mode:
if (! this.active.sites[site]) {
return this.active.sites['@global'].autoar === "blacklist";
return this.active.sites['@global'].autoar === ExtensionMode.Enable;
}
if (this.active.sites['@global'].autoar === "blacklist") {
return this.active.sites[site].arStatus !== "disabled";
} else if (this.active.sites['@global'].autoar === "whitelist") {
return this.active.sites[site].arStatus === "enabled";
if (this.active.sites['@global'].autoar === ExtensionMode.Enable) {
return this.active.sites[site].autoar !== ExtensionMode.Disabled;
} else if (this.active.sites['@global'].autoar === ExtensionMode.Whitelist) {
return this.active.sites[site].autoar === ExtensionMode.Enable;
} else {
return false;
}