2019-01-20 22:59:06 +01:00
|
|
|
<template>
|
2019-06-02 23:49:31 +02:00
|
|
|
<div class="w100 flex flex-column" style="padding-bottom: 20px">
|
|
|
|
<!-- <ShortcutButton class="button"
|
2019-05-09 23:40:56 +02:00
|
|
|
@click.native="wipeSettings()"
|
2019-02-15 00:00:22 +01:00
|
|
|
label="Wipe settings"
|
2019-06-02 23:49:31 +02:00
|
|
|
/> -->
|
|
|
|
|
2019-01-20 22:59:06 +01:00
|
|
|
<!-- ENABLE EXTENSION -->
|
2019-06-02 23:49:31 +02:00
|
|
|
<div v-if="settings && extensionActions.length"
|
|
|
|
class="w100"
|
|
|
|
>
|
2019-06-08 03:45:35 +02:00
|
|
|
<div class="label">Enable extension <template v-if="scope === 'site'">for {{site}}</template>:</div>
|
2019-01-20 22:59:06 +01:00
|
|
|
<div class="flex flex-row flex-wrap">
|
2019-06-02 23:49:31 +02:00
|
|
|
<ShortcutButton v-for="(action, index) of extensionActions"
|
|
|
|
class="flex flex-grow button"
|
|
|
|
:key="index"
|
|
|
|
:class="{'setting-selected': getCurrent('mode') === action.cmd[0].arg }"
|
|
|
|
:label="(action.scopes[scope] && action.scopes[scope].label) ? action.scopes[scope].label : action.label"
|
|
|
|
:shortcut="parseShortcut(action)"
|
|
|
|
@click.native="execAction(action)"
|
|
|
|
>
|
|
|
|
</ShortcutButton>
|
2019-01-20 22:59:06 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- ENABLE AUTODETECTION -->
|
2019-06-02 23:49:31 +02:00
|
|
|
<div v-if="aardActions.length"
|
2019-01-20 22:59:06 +01:00
|
|
|
class="w100"
|
|
|
|
>
|
2019-06-08 03:45:35 +02:00
|
|
|
<div class="label">Enable autodetection <template v-if="scope === 'site'">for {{site}}</template>:</div>
|
2019-01-20 22:59:06 +01:00
|
|
|
<div class="flex flex-row flex-wrap">
|
2019-06-02 23:49:31 +02:00
|
|
|
<ShortcutButton v-for="(action, index) of aardActions"
|
|
|
|
class="flex flex-grow button"
|
|
|
|
:class="{'setting-selected': getCurrent('autoar') === action.cmd[0].arg}"
|
|
|
|
:key="index"
|
|
|
|
:label="(action.scopes[scope] && action.scopes[scope].label) ? action.scopes[scope].label : action.label"
|
|
|
|
:shortcut="parseShortcut(action)"
|
|
|
|
@click.native="execAction(action)"
|
|
|
|
>
|
|
|
|
</ShortcutButton>
|
2019-02-13 16:15:56 +01:00
|
|
|
<div class="info"><small>Note: some sites implement restrictions that make autodetection a fair bit less reliable in Firefox and outright impossible in anything else.</small></div>
|
2019-01-20 22:59:06 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- DEFAULT SETTINGS -->
|
2019-06-02 23:49:31 +02:00
|
|
|
<div v-if="stretchActions.length">
|
2019-01-20 22:59:06 +01:00
|
|
|
<div class="label">Default stretching mode:</div>
|
|
|
|
<div class="flex flex-row flex-wrap">
|
2019-06-02 23:49:31 +02:00
|
|
|
<ShortcutButton v-for="(action, index) of stretchActions"
|
|
|
|
class="flex b3 flex-grow button"
|
|
|
|
:class="{'setting-selected': getCurrent('stretch') === action.cmd[0].arg}"
|
|
|
|
:key="index"
|
|
|
|
:label="(action.scopes[scope] && action.scopes[scope].label) ? action.scopes[scope].label : action.label"
|
|
|
|
:shortcut="parseShortcut(action)"
|
|
|
|
@click.native="execAction(action)"
|
|
|
|
>
|
|
|
|
</ShortcutButton>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-06-02 23:54:32 +02:00
|
|
|
|
|
|
|
<div v-if="keyboardActions.length">
|
|
|
|
<div class="label experimental">Enable/disable keyboard shortcuts</div>
|
|
|
|
<div class="flex flex-row flex-wrap">
|
|
|
|
<ShortcutButton v-for="(action, index) of keyboardActions"
|
|
|
|
class="flex b3 flex-grow button"
|
|
|
|
:class="{'setting-selected': getCurrent('keyboardShortcutsEnabled') === action.cmd[0].arg}"
|
|
|
|
:key="index"
|
|
|
|
:label="(action.scopes[scope] && action.scopes[scope].label) ? action.scopes[scope].label : action.label"
|
|
|
|
:shortcut="parseShortcut(action)"
|
|
|
|
@click.native="execAction(action)"
|
|
|
|
>
|
|
|
|
</ShortcutButton>
|
2019-01-20 22:59:06 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-06-02 23:49:31 +02:00
|
|
|
<div v-if="alignmentActions.length">
|
2019-01-20 22:59:06 +01:00
|
|
|
<div class="label">Video alignment:</div>
|
|
|
|
<div class="flex flex-row flex-wrap">
|
2019-06-02 23:49:31 +02:00
|
|
|
<ShortcutButton v-for="(action, index) of alignmentActions"
|
|
|
|
class="flex b3 flex-grow button"
|
|
|
|
:class="{'setting-selected': getCurrent('videoAlignment') === action.cmd[0].arg}"
|
|
|
|
:key="index"
|
|
|
|
:label="(action.scopes[scope] && action.scopes[scope].label) ? action.scopes[scope].label : action.label"
|
|
|
|
:shortcut="parseShortcut(action)"
|
|
|
|
@click.native="execAction(action)"
|
|
|
|
>
|
|
|
|
</ShortcutButton>
|
2019-01-20 22:59:06 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-06-02 23:49:31 +02:00
|
|
|
<div v-if="otherActions.length">
|
|
|
|
<div class="label">Other actions:</div>
|
2019-01-20 22:59:06 +01:00
|
|
|
<div class="flex flex-row flex-wrap">
|
2019-06-02 23:49:31 +02:00
|
|
|
<ShortcutButton v-for="(action, index) of otherActions"
|
|
|
|
class="flex b3 flex-grow button"
|
|
|
|
:key="index"
|
|
|
|
:label="(action.scopes[scope] && action.scopes[scope].label) ? action.scopes[scope].label : action.label"
|
|
|
|
:shortcut="parseShortcut(action)"
|
|
|
|
@click.native="execAction(action)"
|
|
|
|
>
|
|
|
|
</ShortcutButton>
|
|
|
|
</div>
|
2019-01-20 22:59:06 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-06-02 23:49:31 +02:00
|
|
|
import ExecAction from '../js/ExecAction';
|
|
|
|
import KeyboardShortcutParser from '../../common/js/KeyboardShortcutParser';
|
|
|
|
import ShortcutButton from '../../common/components/ShortcutButton';
|
|
|
|
import ComputeActionsMixin from '../../common/mixins/ComputeActionsMixin';
|
2019-01-20 22:59:06 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
}
|
|
|
|
},
|
2019-06-02 23:49:31 +02:00
|
|
|
mixins: [
|
|
|
|
ComputeActionsMixin
|
|
|
|
],
|
2019-02-13 23:58:19 +01:00
|
|
|
props: {
|
|
|
|
settings: Object,
|
|
|
|
scope: String,
|
|
|
|
site: String,
|
|
|
|
},
|
2019-01-20 22:59:06 +01:00
|
|
|
created() {
|
2019-02-13 23:58:19 +01:00
|
|
|
this.exec = new ExecAction(this.settings, this.site);
|
2019-01-20 22:59:06 +01:00
|
|
|
},
|
|
|
|
components: {
|
|
|
|
ShortcutButton,
|
|
|
|
},
|
2019-06-02 23:49:31 +02:00
|
|
|
|
2019-02-13 23:58:19 +01:00
|
|
|
watch: {
|
|
|
|
settings: {
|
|
|
|
deep: true,
|
|
|
|
handler: function(val) {
|
|
|
|
this.$forceUpdate();
|
|
|
|
this.exec.setSettings(val);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
site: function(val){
|
|
|
|
this.exec.setSite(val);
|
|
|
|
}
|
|
|
|
},
|
2019-01-20 22:59:06 +01:00
|
|
|
methods: {
|
|
|
|
execAction(action) {
|
2019-01-21 00:07:11 +01:00
|
|
|
this.exec.exec(action, this.scope);
|
2019-01-20 22:59:06 +01:00
|
|
|
},
|
2019-02-13 23:58:19 +01:00
|
|
|
getCurrent(option) {
|
|
|
|
if (!this.settings) {
|
|
|
|
return undefined;
|
|
|
|
}
|
2019-01-20 22:59:06 +01:00
|
|
|
|
2019-02-13 23:58:19 +01:00
|
|
|
let site;
|
|
|
|
if (this.scope === 'global') {
|
|
|
|
site = '@global'
|
|
|
|
this.site = site;
|
|
|
|
} else {
|
|
|
|
if (!this.site) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
site = this.site;
|
|
|
|
}
|
|
|
|
// console.log("SETTINGS FOR SITE", site, "option", option, JSON.parse(JSON.stringify(this.settings.active.sites)))
|
|
|
|
if (this.settings.active.sites[site]) {
|
|
|
|
return this.settings.active.sites[site][option];
|
|
|
|
} else {
|
|
|
|
return this.settings.getDefaultOption(option);
|
|
|
|
}
|
2019-01-20 22:59:06 +01:00
|
|
|
},
|
|
|
|
parseShortcut(action) {
|
|
|
|
if (! action.scopes[this.scope].shortcut) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
return KeyboardShortcutParser.parseShortcut(action.scopes[this.scope].shortcut[0]);
|
|
|
|
},
|
2019-05-09 23:40:56 +02:00
|
|
|
wipeSettings() {
|
|
|
|
settings.setDefaultSettings();
|
|
|
|
}
|
2019-01-20 22:59:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|