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> : { // <hostname> : {
// status: <option> // should extension work on this site? // status: <option> // should extension work on this site?
// arStatus: <option> // should we do autodetection 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 // stretch? <stretch mode> // automatically stretch video on this site in this manner
// videoAlignment? <left|center|right> // videoAlignment? <left|center|right>
// //

View File

@ -210,13 +210,13 @@ class ActionHandler {
this.settings.save(); this.settings.save();
} else if (action.scope === 'global') { } else if (action.scope === 'global') {
if (cmd.action === "set-stretch") { 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") { } 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") { } else if (cmd.action === "set-extension-mode") {
this.settings.active.sites['@global'] = cmd.arg; this.settings.active.sites['@global'] = cmd.arg;
} else if (cmd.action === "set-autoar-mode") { } 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(); this.settings.save();
} }

View File

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