2019-06-08 03:45:35 +02:00
|
|
|
<template>
|
|
|
|
<div class="w100 flex flex-column" style="padding-bottom: 20px">
|
2019-06-10 23:45:15 +02:00
|
|
|
<div class="label">
|
|
|
|
Video detection settings<br/><small>for {{site}}</small>
|
|
|
|
</div>
|
2019-06-08 03:45:35 +02:00
|
|
|
<div class="description">Video is just the moving picture bit without the player.</div>
|
2019-06-10 23:45:15 +02:00
|
|
|
<div class="">
|
|
|
|
<div class="">
|
|
|
|
<input :checked="!videoManualQs"
|
|
|
|
@change="toggleVideoManualQs"
|
|
|
|
type="checkbox"
|
|
|
|
/> Detect automatically
|
2019-06-08 03:45:35 +02:00
|
|
|
</div>
|
|
|
|
<div class="flex flex-column">
|
|
|
|
<div class="flex label-secondary form-label">Query selectors</div>
|
2019-06-10 23:45:15 +02:00
|
|
|
<input type="text"
|
|
|
|
v-model="videoQs"
|
|
|
|
:disabled="!videoManualQs"
|
|
|
|
@change="updateVideoQuerySelector"
|
|
|
|
@blur="updateVideoQuerySelector"
|
2019-06-08 03:45:35 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-06-10 23:45:15 +02:00
|
|
|
<div class="label">
|
|
|
|
Player detection settings<br/><small>for {{site}}</small>
|
|
|
|
</div>
|
|
|
|
<div class="description">
|
|
|
|
Player is the frame around the video. Extension crops/stretches the video to fit the player.
|
|
|
|
</div>
|
|
|
|
<div class="">
|
|
|
|
<div class="">
|
|
|
|
<input :checked="!playerManualQs"
|
|
|
|
@change="togglePlayerManualQs"
|
|
|
|
type="checkbox"
|
|
|
|
/> Detect automatically
|
2019-06-08 03:45:35 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="flex flex-column">
|
2019-06-10 23:45:15 +02:00
|
|
|
<div class="">Query selectors:</div>
|
|
|
|
<input type="text"
|
|
|
|
v-model="playerQs"
|
|
|
|
@change="updatePlayerQuerySelector"
|
|
|
|
@blur="updatePlayerQuerySelector"
|
|
|
|
:disabled="playerByNodeIndex || !playerManualQs"
|
2019-06-08 03:45:35 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
2019-06-10 23:45:15 +02:00
|
|
|
<div class="">
|
|
|
|
<input :checked="playerByNodeIndex"
|
|
|
|
:disabled="!playerManualQs"
|
|
|
|
@change="toggleByNodeIndex"
|
|
|
|
type="checkbox"
|
|
|
|
/> Specify player node parent index instead
|
2019-06-08 03:45:35 +02:00
|
|
|
</div>
|
|
|
|
|
2019-06-10 23:45:15 +02:00
|
|
|
<div class="flex flex-column">
|
|
|
|
<div class="">Player node parent index:</div>
|
|
|
|
<input v-model="playerParentNodeIndex"
|
|
|
|
:disabled="!playerByNodeIndex || !playerManualQs"
|
|
|
|
@change="updatePlayerParentNodeIndex"
|
|
|
|
@blur="updatePlayerParentNodeIndex"
|
|
|
|
type="number"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-06-08 03:45:35 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import QuerySelectorSetting from '../../common/components/QuerySelectorSetting.vue';
|
|
|
|
import ExtensionMode from '../../common/enums/extension-mode.enum';
|
|
|
|
import VideoAlignment from '../../common/enums/video-alignment.enum';
|
|
|
|
import Stretch from '../../common/enums/stretch.enum';
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
QuerySelectorSetting,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2019-06-10 23:45:15 +02:00
|
|
|
videoManualQs: false,
|
|
|
|
videoQs: '',
|
|
|
|
playerManualQs: false,
|
|
|
|
playerQs: '',
|
|
|
|
playerByNodeIndex: false,
|
|
|
|
playerParentNodeIndex: undefined,
|
2019-06-08 03:45:35 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
site: String,
|
|
|
|
settings: Object,
|
|
|
|
},
|
2019-06-10 23:45:15 +02:00
|
|
|
created() {
|
|
|
|
try {
|
|
|
|
this.videoManualQs = settings.active.sites[this.site].DOM.video.manual || this.videoManualQs;
|
|
|
|
this.videoQs = settings.active.sites[this.site].DOM.video.querySelectors;
|
|
|
|
} catch (e) {
|
|
|
|
// that's here just in case relevant settings for this site don't exist yet
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
this.playerManualQs = settings.active.sites[this.site].DOM.player.manual || this.playerManualQs;
|
|
|
|
this.playerQs = settings.active.sites[this.site].DOM.player.querySelectors;
|
|
|
|
this.playerByNodeIndex = settings.active.sites[this.site].DOM.player.useRelativeAncestor;
|
|
|
|
this.playerParentNodeIndex = settings.active.sites[this.site].DOM.player.videoAncestor;
|
|
|
|
} catch (e) {
|
|
|
|
// that's here just in case relevant settings for this site don't exist yet
|
2019-06-08 03:45:35 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
ensureSettings(scope) {
|
|
|
|
if (! this.settings.active.sites[this.site]) {
|
|
|
|
this.settings.active.sites[this.site] = {
|
|
|
|
mode: ExtensionMode.Default,
|
|
|
|
autoar: ExtensionMode.Default,
|
|
|
|
type: 'user-added',
|
|
|
|
stretch: Stretch.Default,
|
|
|
|
videoAlignment: VideoAlignment.Default,
|
|
|
|
keyboardShortcutsEnabled: ExtensionMode.Default,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (! this.settings.active.sites[this.site].DOM) {
|
|
|
|
this.settings.active.sites[this.site].DOM = {};
|
|
|
|
}
|
|
|
|
if (! this.settings.active.sites[this.site].DOM[scope]) {
|
|
|
|
this.settings.active.sites[this.site].DOM[scope] = {
|
2019-06-10 23:45:15 +02:00
|
|
|
manual: false,
|
|
|
|
querySelectors: '',
|
|
|
|
useRelativeAncestor: scope === 'player' ? false : undefined,
|
|
|
|
videoAncestor: undefined,
|
|
|
|
playerNodeCss: scope === 'player' ? '' : undefined,
|
2019-06-08 03:45:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-06-10 23:45:15 +02:00
|
|
|
updateVideoQuerySelector() {
|
|
|
|
this.ensureSettings('video');
|
|
|
|
this.settings.active.sites[this.site].DOM.video.querySelectors = this.videoQs;
|
2019-06-08 03:45:35 +02:00
|
|
|
this.settings.save();
|
|
|
|
},
|
2019-06-10 23:45:15 +02:00
|
|
|
updatePlayerQuerySelector() {
|
|
|
|
this.ensureSettings('player');
|
|
|
|
this.settings.active.sites[this.site].DOM.player.querySelectors = this.playerQs;
|
|
|
|
this.settings.save();
|
2019-06-08 03:45:35 +02:00
|
|
|
},
|
2019-06-10 23:45:15 +02:00
|
|
|
updatePlayerParentNodeIndex() {
|
|
|
|
this.ensureSettings('player');
|
|
|
|
this.settings.active.sites[this.site].DOM.player.videoAncestor = this.playerParentNodeIndex;
|
|
|
|
this.settings.save();
|
2019-06-08 03:45:35 +02:00
|
|
|
},
|
2019-06-10 23:45:15 +02:00
|
|
|
toggleVideoManualQs() {
|
2019-06-08 03:45:35 +02:00
|
|
|
this.ensureSettings('video');
|
|
|
|
this.settings.active.sites[this.site].DOM.video.enabled = !this.settings.active.sites[this.site].DOM.video.enabled;
|
2019-06-10 23:45:15 +02:00
|
|
|
this.videoManualQs = !this.videoManualQs;
|
2019-06-08 03:45:35 +02:00
|
|
|
this.settings.save();
|
|
|
|
},
|
2019-06-10 23:45:15 +02:00
|
|
|
togglePlayerManualQs() {
|
2019-06-08 03:45:35 +02:00
|
|
|
this.ensureSettings('player');
|
|
|
|
this.settings.active.sites[this.site].DOM.player.enabled = !this.settings.active.sites[this.site].DOM.player.enabled;
|
2019-06-10 23:45:15 +02:00
|
|
|
this.playerManualQs = !this.playerManualQs;
|
2019-06-08 03:45:35 +02:00
|
|
|
this.settings.save();
|
|
|
|
},
|
2019-06-10 23:45:15 +02:00
|
|
|
toggleByNodeIndex() {
|
2019-06-08 03:45:35 +02:00
|
|
|
this.ensureSettings('player');
|
2019-06-10 23:45:15 +02:00
|
|
|
this.settings.active.sites[this.site].DOM.player.useRelativeAncestor = !this.settings.active.sites[this.site].DOM.player.useRelativeAncestor;
|
|
|
|
this.playerByNodeIndex = !this.playerByNodeIndex;
|
2019-06-08 03:45:35 +02:00
|
|
|
this.settings.save();
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
</style>
|