2017-11-13 01:23:39 -05:00
|
|
|
<template lang="html">
|
2018-03-30 17:58:56 -04:00
|
|
|
<div
|
2018-07-05 20:27:17 -04:00
|
|
|
:class="{ maximized: maximized || exclusive, exclusive, faded }"
|
2018-03-30 17:58:56 -04:00
|
|
|
class="ffz-main-menu tw-elevation-3 tw-c-background-alt tw-c-text tw-border tw-flex tw-flex-nowrap tw-flex-column"
|
|
|
|
>
|
|
|
|
<header class="tw-c-background tw-full-width tw-align-items-center tw-flex tw-flex-nowrap" @dblclick="resize">
|
|
|
|
<h3 class="ffz-i-zreknarf ffz-i-pd-1">FrankerFaceZ</h3>
|
|
|
|
<div class="tw-flex-grow-1 tw-pd-x-2">
|
2018-07-05 20:27:17 -04:00
|
|
|
<div class="tw-search-input">
|
|
|
|
<label for="ffz-main-menu.search" class="tw-hide-accessible">{{ t('main-menu.search', 'Search Settings') }}</label>
|
|
|
|
<div class="tw-relative">
|
|
|
|
<div class="tw-absolute tw-align-items-center tw-c-text-alt-2 tw-flex tw-full-height tw-input__icon tw-justify-content-center tw-left-0 tw-top-0 tw-z-default">
|
|
|
|
<figure class="ffz-i-search" />
|
2017-11-13 01:23:39 -05:00
|
|
|
</div>
|
2018-07-05 20:27:17 -04:00
|
|
|
<input
|
|
|
|
id="ffz-main-menu.search"
|
|
|
|
v-model="query"
|
|
|
|
:placeholder="t('main-menu.search', 'Search Settings')"
|
|
|
|
type="search"
|
|
|
|
class="tw-block tw-border-radius-medium tw-font-size-6 tw-full-width tw-input tw-pd-l-3 tw-pd-r-1 tw-pd-y-05"
|
|
|
|
autocapitalize="off"
|
|
|
|
autocorrect="off"
|
|
|
|
autocomplete="off"
|
|
|
|
spellcheck="false"
|
|
|
|
>
|
2017-11-13 01:23:39 -05:00
|
|
|
</div>
|
2018-07-05 20:27:17 -04:00
|
|
|
</div>
|
2017-11-13 01:23:39 -05:00
|
|
|
</div>
|
2018-07-05 20:27:17 -04:00
|
|
|
<button v-if="!maximized && !exclusive" class="tw-button-icon tw-mg-x-05" @click="faded = ! faded">
|
|
|
|
<span class="tw-button-icon__icon">
|
|
|
|
<figure :class="faded ? 'ffz-i-eye-off' : 'ffz-i-eye'" />
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
<button v-if="!exclusive" class="tw-button-icon tw-mg-x-05 tw-tooltip-wrapper" @click="popout">
|
|
|
|
<span class="tw-button-icon__icon">
|
|
|
|
<figure class="ffz-i-link-ext" />
|
|
|
|
</span>
|
|
|
|
<div class="tw-tooltip tw-tooltip--down tw-tooltip--align-center">
|
|
|
|
{{ t('main-menu.popout', 'Open Settings in a New Window') }}
|
|
|
|
</div>
|
|
|
|
</button>
|
2018-03-30 17:58:56 -04:00
|
|
|
<button v-if="!exclusive" class="tw-button-icon tw-mg-x-05" @click="resize">
|
|
|
|
<span class="tw-button-icon__icon">
|
|
|
|
<figure :class="{'ffz-i-window-maximize': !maximized, 'ffz-i-window-restore': maximized}" />
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
<button v-if="!exclusive" class="tw-button-icon tw-mg-x-05" @click="close">
|
|
|
|
<span class="tw-button-icon__icon">
|
|
|
|
<figure class="ffz-i-window-close" />
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</header>
|
|
|
|
<section class="tw-border-t tw-full-height tw-full-width tw-flex tw-flex-nowrap tw-overflow-hidden">
|
|
|
|
<nav class="ffz-vertical-nav tw-c-background-alt-2 tw-border-r tw-full-height tw-flex tw-flex-column tw-flex-shrink-0 tw-flex-nowrap">
|
|
|
|
<header class="tw-border-b tw-pd-1">
|
|
|
|
<profile-selector
|
2017-11-13 01:23:39 -05:00
|
|
|
:context="context"
|
|
|
|
@navigate="navigate"
|
|
|
|
/>
|
2018-03-30 17:58:56 -04:00
|
|
|
</header>
|
|
|
|
<div class="tw-full-width tw-full-height tw-overflow-hidden tw-flex tw-flex-nowrap tw-relative">
|
2018-04-28 17:56:03 -04:00
|
|
|
<simplebar classes="ffz-vertical-nav__items tw-full-width tw-flex-grow-1">
|
|
|
|
<menu-tree
|
|
|
|
:current-item="currentItem"
|
|
|
|
:modal="nav"
|
2018-07-05 20:27:17 -04:00
|
|
|
:filter="filter"
|
2018-04-28 17:56:03 -04:00
|
|
|
@change-item="changeItem"
|
|
|
|
@navigate="navigate"
|
|
|
|
/>
|
|
|
|
</simplebar>
|
2017-11-13 01:23:39 -05:00
|
|
|
</div>
|
2018-03-30 17:58:56 -04:00
|
|
|
<footer class="tw-c-text-alt tw-border-t tw-pd-1">
|
|
|
|
<div>
|
|
|
|
{{ t('main-menu.version', 'Version %{version}', {version: version.toString()}) }}
|
|
|
|
</div>
|
|
|
|
<div class="tw-c-text-alt-2">
|
|
|
|
{{ version.build }}
|
|
|
|
</div>
|
|
|
|
</footer>
|
|
|
|
</nav>
|
2018-04-28 17:56:03 -04:00
|
|
|
<simplebar classes="tw-flex-grow-1">
|
|
|
|
<menu-page
|
|
|
|
v-if="currentItem"
|
|
|
|
ref="page"
|
|
|
|
:context="context"
|
|
|
|
:item="currentItem"
|
2018-07-05 20:27:17 -04:00
|
|
|
:filter="filter"
|
2018-04-28 17:56:03 -04:00
|
|
|
@change-item="changeItem"
|
|
|
|
@navigate="navigate"
|
|
|
|
/>
|
|
|
|
</simplebar>
|
2018-03-30 17:58:56 -04:00
|
|
|
</section>
|
|
|
|
</div>
|
2017-11-13 01:23:39 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import displace from 'displacejs';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return this.$vnode.data;
|
|
|
|
},
|
|
|
|
|
2018-07-05 20:27:17 -04:00
|
|
|
computed: {
|
|
|
|
filter() {
|
|
|
|
return this.query.toLowerCase()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-03-30 17:58:56 -04:00
|
|
|
watch: {
|
|
|
|
maximized() {
|
|
|
|
this.updateDrag();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-11-13 01:23:39 -05:00
|
|
|
created() {
|
|
|
|
this.context.context._add_user();
|
|
|
|
},
|
|
|
|
|
|
|
|
destroyed() {
|
|
|
|
this.context.context._remove_user();
|
|
|
|
},
|
|
|
|
|
2018-03-30 17:58:56 -04:00
|
|
|
mounted() {
|
|
|
|
this.updateDrag();
|
|
|
|
|
|
|
|
this._on_resize = this.handleResize.bind(this);
|
|
|
|
window.addEventListener('resize', this._on_resize);
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
this.destroyDrag();
|
|
|
|
|
|
|
|
if ( this._on_resize ) {
|
|
|
|
window.removeEventListener('resize', this._on_resize);
|
|
|
|
this._on_resize = null;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-11-13 01:23:39 -05:00
|
|
|
methods: {
|
|
|
|
changeProfile() {
|
|
|
|
const new_id = this.$refs.profiles.value,
|
|
|
|
new_profile = this.context.profiles[new_id];
|
|
|
|
|
|
|
|
if ( new_profile )
|
|
|
|
this.context.currentProfile = new_profile;
|
|
|
|
},
|
|
|
|
|
|
|
|
changeItem(item) {
|
|
|
|
if ( this.$refs.page && this.$refs.page.onBeforeChange ) {
|
|
|
|
if ( this.$refs.page.onBeforeChange(this.currentItem, item) === false )
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.currentItem = item;
|
|
|
|
let current = item;
|
2018-04-02 03:30:22 -04:00
|
|
|
while(current = current.parent) // eslint-disable-line no-cond-assign
|
2017-11-13 01:23:39 -05:00
|
|
|
current.expanded = true;
|
|
|
|
},
|
|
|
|
|
|
|
|
updateDrag() {
|
|
|
|
if ( this.maximized )
|
|
|
|
this.destroyDrag();
|
|
|
|
else
|
|
|
|
this.createDrag();
|
|
|
|
},
|
|
|
|
|
|
|
|
destroyDrag() {
|
|
|
|
if ( this.displace ) {
|
|
|
|
this.displace.destroy();
|
|
|
|
this.displace = null;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
createDrag() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
if ( ! this.maximized )
|
|
|
|
this.displace = displace(this.$el, {
|
|
|
|
handle: this.$el.querySelector('header'),
|
|
|
|
highlightInputs: true,
|
|
|
|
constrain: true
|
|
|
|
});
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
handleResize() {
|
|
|
|
if ( this.displace )
|
|
|
|
this.displace.reinit();
|
|
|
|
},
|
|
|
|
|
|
|
|
navigate(key) {
|
|
|
|
let item = this.nav_keys[key];
|
|
|
|
while(item && item.page)
|
|
|
|
item = item.parent;
|
|
|
|
|
|
|
|
if ( ! item )
|
|
|
|
return;
|
|
|
|
|
|
|
|
this.changeItem(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|