This commit is contained in:
Tamius Han 2019-01-20 23:05:04 +01:00
parent 3336e62ae6
commit 9ec6973cc0
6 changed files with 29 additions and 29 deletions

View File

@ -334,19 +334,19 @@ class Settings {
console.log("[Settings::canStartAutoAr] ----------------\nCAN WE START THIS EXTENSION ON SITE", site, console.log("[Settings::canStartAutoAr] ----------------\nCAN WE START THIS EXTENSION ON SITE", site,
"?\n\nsettings.active.sites[site]=", this.active.sites[site], "?\n\nsettings.active.sites[site]=", this.active.sites[site],
"\nExtension mode?", this.active.site['@global'].autoar, "\nExtension mode?", this.active.sites['@global'].autoar,
"\nCan extension be started?", csar "\nCan extension be started?", csar
); );
} }
// 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.site['@global'].autoar === "blacklist"; return this.active.sites['@global'].autoar === "blacklist";
} }
if (this.active.site['@global'].autoar === "blacklist") { if (this.active.sites['@global'].autoar === "blacklist") {
return this.active.sites[site].arStatus !== "disabled"; return this.active.sites[site].arStatus !== "disabled";
} else if (this.active.site['@global'].autoar === "whitelist") { } else if (this.active.sites['@global'].autoar === "whitelist") {
return this.active.sites[site].arStatus === "enabled"; return this.active.sites[site].arStatus === "enabled";
} else { } else {
return false; return false;
@ -368,7 +368,7 @@ class Settings {
if (site.stretch) { if (site.stretch) {
return site.stretch; return site.stretch;
} }
return this.active.site['@global'].stretch; return this.active.sites['@global'].stretch;
} }
getDefaultVideoAlignment(site) { getDefaultVideoAlignment(site) {
@ -377,7 +377,7 @@ class Settings {
if (site.videoAlignment) { if (site.videoAlignment) {
return site.videoAlignment; return site.videoAlignment;
} }
return this.active.site['@global'].videoAlignment; return this.active.sites['@global'].videoAlignment;
} }
} }

View File

@ -225,14 +225,14 @@ class CommsServer {
} }
Promise.resolve(ret); Promise.resolve(ret);
} else if (message.cmd === "autoar-enable") { } else if (message.cmd === "autoar-enable") {
this.settings.active.site['@global'].autoar = "blacklist"; this.settings.active.sites['@global'].autoar = "blacklist";
this.settings.save(); this.settings.save();
this.sendToAll({cmd: "reload-settings", sender: "uwbg"}) this.sendToAll({cmd: "reload-settings", sender: "uwbg"})
if(Debug.debug){ if(Debug.debug){
console.log("[uw-bg] autoar set to enabled (blacklist). evidenz:", this.settings.active); console.log("[uw-bg] autoar set to enabled (blacklist). evidenz:", this.settings.active);
} }
} else if (message.cmd === "autoar-disable") { } else if (message.cmd === "autoar-disable") {
this.settings.active.site['@global'].autoar = "disabled"; this.settings.active.sites['@global'].autoar = "disabled";
if(message.reason){ if(message.reason){
this.settings.active.arDetect.disabledReason = message.reason; this.settings.active.arDetect.disabledReason = message.reason;
} else { } else {
@ -268,14 +268,14 @@ class CommsServer {
sendResponse({extensionConf: JSON.stringify(this.settings.active), site: this.getCurrentTabHostname()}); sendResponse({extensionConf: JSON.stringify(this.settings.active), site: this.getCurrentTabHostname()});
// return true; // return true;
} else if (message.cmd === "autoar-enable") { } else if (message.cmd === "autoar-enable") {
this.settings.active.site['@global'].autoar = "blacklist"; this.settings.active.sites['@global'].autoar = "blacklist";
this.settings.save(); this.settings.save();
this.sendToAll({cmd: "reload-settings", sender: "uwbg"}) this.sendToAll({cmd: "reload-settings", sender: "uwbg"})
if(Debug.debug){ if(Debug.debug){
console.log("[uw-bg] autoar set to enabled (blacklist). evidenz:", this.settings.active); console.log("[uw-bg] autoar set to enabled (blacklist). evidenz:", this.settings.active);
} }
} else if (message.cmd === "autoar-disable") { } else if (message.cmd === "autoar-disable") {
this.settings.active.site['@global'].autoar = "disabled"; this.settings.active.sites['@global'].autoar = "disabled";
if(message.reason){ if(message.reason){
this.settings.active.arDetect.disabledReason = message.reason; this.settings.active.arDetect.disabledReason = message.reason;
} else { } else {

View File

@ -323,7 +323,7 @@ class Resizer {
computeOffsets(stretchFactors){ computeOffsets(stretchFactors){
if (Debug.debug) { if (Debug.debug) {
console.log("[Resizer::_res_computeOffsets] <rid:"+this.resizerId+"> video will be aligned to ", this.settings.active.site['@global'].videoAlignment); console.log("[Resizer::_res_computeOffsets] <rid:"+this.resizerId+"> video will be aligned to ", this.settings.active.sites['@global'].videoAlignment);
} }
const wdiff = this.conf.player.dimensions.width - this.conf.video.offsetWidth; const wdiff = this.conf.player.dimensions.width - this.conf.video.offsetWidth;

View File

@ -31,15 +31,15 @@
</div> </div>
<div class="flex flex-row button-box"> <div class="flex flex-row button-box">
<Button label="Always" <Button label="Always"
:selected="settings.active.site['@global'].autoar === ExtensionMode.Enabled" :selected="settings.active.sites['@global'].autoar === ExtensionMode.Enabled"
@click.native="setDefaultAutodetectionMode(ExtensionMode.Enabled)"> @click.native="setDefaultAutodetectionMode(ExtensionMode.Enabled)">
</Button> </Button>
<Button label="On whitelisted sites" <Button label="On whitelisted sites"
:selected="settings.active.site['@global'].autoar === ExtensionMode.Whitelist" :selected="settings.active.sites['@global'].autoar === ExtensionMode.Whitelist"
@click.native="setDefaultAutodetectionMode(ExtensionMode.Whitelist)"> @click.native="setDefaultAutodetectionMode(ExtensionMode.Whitelist)">
</Button> </Button>
<Button label="Never" <Button label="Never"
:selected="settings.active.site['@global'].autoar === ExtensionMode.Disabled" :selected="settings.active.sites['@global'].autoar === ExtensionMode.Disabled"
@click.native="setDefaultAutodetectionMode('never')"> @click.native="setDefaultAutodetectionMode('never')">
</Button> </Button>
</div> </div>
@ -57,15 +57,15 @@
</div> </div>
<div class="flex flex-row button-box"> <div class="flex flex-row button-box">
<Button label="Left" <Button label="Left"
:selected="settings.active.site['@global'].videoAlignment === VideoAlignment.Left" :selected="settings.active.sites['@global'].videoAlignment === VideoAlignment.Left"
@click.native="setDefaultvideoAlignment(VideoAlignment.Left)"> @click.native="setDefaultvideoAlignment(VideoAlignment.Left)">
</Button> </Button>
<Button label="Center" <Button label="Center"
:selected="settings.active.site['@global'].videoAlignment === VideoAlignment.Center" :selected="settings.active.sites['@global'].videoAlignment === VideoAlignment.Center"
@click.native="setDefaultvideoAlignment(VideoAlignment.Center)"> @click.native="setDefaultvideoAlignment(VideoAlignment.Center)">
</Button> </Button>
<Button label="Right" <Button label="Right"
:selected="settings.active.site['@global'].videoAlignment === VideoAlignment.Right" :selected="settings.active.sites['@global'].videoAlignment === VideoAlignment.Right"
@click.native="setDefaultvideoAlignment(VideoAlignment.Right)"> @click.native="setDefaultvideoAlignment(VideoAlignment.Right)">
</Button> </Button>
</div> </div>
@ -75,19 +75,19 @@
</div> </div>
<div class="flex flex-row button-box"> <div class="flex flex-row button-box">
<Button label="Don't stretch" <Button label="Don't stretch"
:selected="settings.active.site['@global'].stretch === StretchMode.NoStretch" :selected="settings.active.sites['@global'].stretch === StretchMode.NoStretch"
@click.native="setDefaultStretchingMode(StretchMode.NoStretch)"> @click.native="setDefaultStretchingMode(StretchMode.NoStretch)">
</Button> </Button>
<Button label="Basic stretch" <Button label="Basic stretch"
:selected="settings.active.site['@global'].stretch === StretchMode.Basic" :selected="settings.active.sites['@global'].stretch === StretchMode.Basic"
@click.native="setDefaultStretchingMode(StretchMode.Basic)"> @click.native="setDefaultStretchingMode(StretchMode.Basic)">
</Button> </Button>
<Button label="Hybrid stretch" <Button label="Hybrid stretch"
:selected="settings.active.site['@global'].stretch === StretchMode.Hybrid" :selected="settings.active.sites['@global'].stretch === StretchMode.Hybrid"
@click.native="setDefaultStretchingMode(StretchMode.Hybrid)"> @click.native="setDefaultStretchingMode(StretchMode.Hybrid)">
</Button> </Button>
<Button label="Thin borders only" <Button label="Thin borders only"
:selected="settings.active.site['@global'].stretch === StretchMode.Conditional" :selected="settings.active.sites['@global'].stretch === StretchMode.Conditional"
@click.native="setDefaultStretchingMode(StretchMode.Conditional)" @click.native="setDefaultStretchingMode(StretchMode.Conditional)"
> >
</Button> </Button>
@ -143,7 +143,7 @@ export default {
}, },
methods: { methods: {
setDefaultAutodetectionMode(mode) { setDefaultAutodetectionMode(mode) {
this.settings.active.site['@global'].autoar = mode; this.settings.active.sites['@global'].autoar = mode;
this.settings.save(); this.settings.save();
}, },
setDefaultExtensionMode(mode) { setDefaultExtensionMode(mode) {
@ -155,7 +155,7 @@ export default {
this.settings.save(); this.settings.save();
}, },
setDefaultStretchingMode(mode) { setDefaultStretchingMode(mode) {
this.settings.active.site['@global'].stretch = mode; this.settings.active.sites['@global'].stretch = mode;
this.settings.save(); this.settings.save();
}, },
updateStretchTreshold(newTreshold) { updateStretchTreshold(newTreshold) {

View File

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

View File

@ -321,11 +321,11 @@ function configureGlobalTab() {
processButtonsForPopupCategory(GlobalPanel.elements.stretchSettings, stretchButtons); processButtonsForPopupCategory(GlobalPanel.elements.stretchSettings, stretchButtons);
processButtonsForPopupCategory(GlobalPanel.elements.alignmentSettings, alignButtons); processButtonsForPopupCategory(GlobalPanel.elements.alignmentSettings, alignButtons);
selectButton('set-stretch', settings.active.site['@global'].stretch, GlobalPanel.elements.stretchSettings.buttons); selectButton('set-stretch', settings.active.sites['@global'].stretch, GlobalPanel.elements.stretchSettings.buttons);
selectButton('set-alignment', settings.active.site['@global'].videoAlignment, GlobalPanel.elements.alignmentSettings.buttons); selectButton('set-alignment', settings.active.sites['@global'].videoAlignment, GlobalPanel.elements.alignmentSettings.buttons);
selectButton('set-extension-mode', settings.active.sites['@global'], GlobalPanel.elements.extensionSettings.buttons); selectButton('set-extension-mode', settings.active.sites['@global'], GlobalPanel.elements.extensionSettings.buttons);
selectButton('set-extension-mode', settings.active.site['@global'].autoar, GlobalPanel.elements.autoarSettings.buttons); selectButton('set-extension-mode', settings.active.sites['@global'].autoar, GlobalPanel.elements.autoarSettings.buttons);
} }
function configureSitesTab(site) { function configureSitesTab(site) {