2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-02-17 03:10:51 +09:00
|
|
|
<div>
|
2020-01-30 04:37:25 +09:00
|
|
|
<portal to="icon"><fa :icon="faCog"/></portal>
|
2020-07-25 01:56:52 +09:00
|
|
|
<portal to="title">{{ $t('clinetSettings') }}</portal>
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-07-25 01:56:52 +09:00
|
|
|
<router-link v-if="$store.getters.isSignedIn" class="_panel _buttonPrimary" to="/my/settings" style="margin-bottom: var(--margin);">{{ $t('accountSettings') }}</router-link>
|
2020-03-22 15:11:16 +09:00
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
<x-theme/>
|
2020-02-17 03:10:51 +09:00
|
|
|
|
2020-05-06 11:41:44 +09:00
|
|
|
<x-sidebar/>
|
|
|
|
|
2020-07-12 00:38:55 +09:00
|
|
|
<x-plugins/>
|
|
|
|
|
2020-02-20 02:40:53 +09:00
|
|
|
<section class="_card">
|
|
|
|
<div class="_title"><fa :icon="faMusic"/> {{ $t('sounds') }}</div>
|
|
|
|
<div class="_content">
|
2020-03-22 10:53:47 +09:00
|
|
|
<mk-range v-model="sfxVolume" :min="0" :max="1" :step="0.1">
|
2020-03-20 14:30:37 +09:00
|
|
|
<fa slot="icon" :icon="volumeIcon"/>
|
2020-07-25 01:56:52 +09:00
|
|
|
<span slot="title">{{ $t('volume') }}</span>
|
2020-03-20 14:30:37 +09:00
|
|
|
</mk-range>
|
2020-02-20 02:40:53 +09:00
|
|
|
</div>
|
|
|
|
<div class="_content">
|
|
|
|
<mk-select v-model="sfxNote">
|
|
|
|
<template #label>{{ $t('_sfx.note') }}</template>
|
|
|
|
<option v-for="sound in sounds" :value="sound" :key="sound">{{ sound || $t('none') }}</option>
|
|
|
|
<template #text><button class="_textButton" @click="listen(sfxNote)" v-if="sfxNote"><fa :icon="faPlay"/> {{ $t('listen') }}</button></template>
|
|
|
|
</mk-select>
|
2020-02-20 03:14:17 +09:00
|
|
|
<mk-select v-model="sfxNoteMy">
|
|
|
|
<template #label>{{ $t('_sfx.noteMy') }}</template>
|
|
|
|
<option v-for="sound in sounds" :value="sound" :key="sound">{{ sound || $t('none') }}</option>
|
|
|
|
<template #text><button class="_textButton" @click="listen(sfxNoteMy)" v-if="sfxNoteMy"><fa :icon="faPlay"/> {{ $t('listen') }}</button></template>
|
|
|
|
</mk-select>
|
2020-02-20 02:40:53 +09:00
|
|
|
<mk-select v-model="sfxNotification">
|
|
|
|
<template #label>{{ $t('_sfx.notification') }}</template>
|
|
|
|
<option v-for="sound in sounds" :value="sound" :key="sound">{{ sound || $t('none') }}</option>
|
|
|
|
<template #text><button class="_textButton" @click="listen(sfxNotification)" v-if="sfxNotification"><fa :icon="faPlay"/> {{ $t('listen') }}</button></template>
|
|
|
|
</mk-select>
|
|
|
|
<mk-select v-model="sfxChat">
|
|
|
|
<template #label>{{ $t('_sfx.chat') }}</template>
|
|
|
|
<option v-for="sound in sounds" :value="sound" :key="sound">{{ sound || $t('none') }}</option>
|
|
|
|
<template #text><button class="_textButton" @click="listen(sfxChat)" v-if="sfxChat"><fa :icon="faPlay"/> {{ $t('listen') }}</button></template>
|
|
|
|
</mk-select>
|
|
|
|
<mk-select v-model="sfxChatBg">
|
|
|
|
<template #label>{{ $t('_sfx.chatBg') }}</template>
|
|
|
|
<option v-for="sound in sounds" :value="sound" :key="sound">{{ sound || $t('none') }}</option>
|
|
|
|
<template #text><button class="_textButton" @click="listen(sfxChatBg)" v-if="sfxChatBg"><fa :icon="faPlay"/> {{ $t('listen') }}</button></template>
|
|
|
|
</mk-select>
|
2020-02-20 06:08:49 +09:00
|
|
|
<mk-select v-model="sfxAntenna">
|
|
|
|
<template #label>{{ $t('_sfx.antenna') }}</template>
|
|
|
|
<option v-for="sound in sounds" :value="sound" :key="sound">{{ sound || $t('none') }}</option>
|
|
|
|
<template #text><button class="_textButton" @click="listen(sfxAntenna)" v-if="sfxAntenna"><fa :icon="faPlay"/> {{ $t('listen') }}</button></template>
|
|
|
|
</mk-select>
|
2020-02-20 02:40:53 +09:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
2020-07-11 10:13:11 +09:00
|
|
|
<section class="_card">
|
|
|
|
<div class="_title"><fa :icon="faColumns"/> {{ $t('deck') }}</div>
|
|
|
|
<div class="_content">
|
|
|
|
<mk-switch v-model="deckAlwaysShowMainColumn">
|
|
|
|
{{ $t('_deck.alwaysShowMainColumn') }}
|
|
|
|
</mk-switch>
|
|
|
|
</div>
|
|
|
|
<div class="_content">
|
2020-07-25 01:56:52 +09:00
|
|
|
<div>{{ $t('_deck.columnAlign') }}</div>
|
|
|
|
<mk-radio v-model="deckColumnAlign" value="left">{{ $t('left') }}</mk-radio>
|
|
|
|
<mk-radio v-model="deckColumnAlign" value="center">{{ $t('center') }}</mk-radio>
|
2020-07-11 10:13:11 +09:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
2020-02-17 03:10:51 +09:00
|
|
|
<section class="_card">
|
2020-07-17 22:30:41 +09:00
|
|
|
<div class="_title"><fa :icon="faCog"/> {{ $t('appearance') }}</div>
|
2020-02-17 03:10:51 +09:00
|
|
|
<div class="_content">
|
2020-07-25 01:56:52 +09:00
|
|
|
<mk-switch v-model="disableAnimatedMfm">{{ $t('disableAnimatedMfm') }}</mk-switch>
|
|
|
|
<mk-switch v-model="reduceAnimation">{{ $t('reduceUiAnimation') }}</mk-switch>
|
|
|
|
<mk-switch v-model="useBlurEffectForModal">{{ $t('useBlurEffectForModal') }}</mk-switch>
|
2020-02-17 03:10:51 +09:00
|
|
|
<mk-switch v-model="useOsNativeEmojis">
|
|
|
|
{{ $t('useOsNativeEmojis') }}
|
|
|
|
<template #desc><mfm text="🍮🍦🍭🍩🍰🍫🍬🥞🍪"/></template>
|
|
|
|
</mk-switch>
|
2020-07-17 22:30:41 +09:00
|
|
|
</div>
|
|
|
|
<div class="_content">
|
2020-07-25 01:56:52 +09:00
|
|
|
<div>{{ $t('fontSize') }}</div>
|
2020-07-17 22:30:41 +09:00
|
|
|
<mk-radio v-model="fontSize" value="small"><span style="font-size: 14px;">Aa</span></mk-radio>
|
|
|
|
<mk-radio v-model="fontSize" :value="null"><span style="font-size: 16px;">Aa</span></mk-radio>
|
|
|
|
<mk-radio v-model="fontSize" value="large"><span style="font-size: 18px;">Aa</span></mk-radio>
|
|
|
|
<mk-radio v-model="fontSize" value="veryLarge"><span style="font-size: 20px;">Aa</span></mk-radio>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section class="_card">
|
|
|
|
<div class="_title"><fa :icon="faCog"/> {{ $t('general') }}</div>
|
|
|
|
<div class="_content">
|
|
|
|
<mk-switch v-model="autoReload">
|
|
|
|
{{ $t('autoReloadWhenDisconnected') }}
|
|
|
|
</mk-switch>
|
|
|
|
</div>
|
|
|
|
<div class="_content">
|
2020-07-25 01:56:52 +09:00
|
|
|
<mk-switch v-model="imageNewTab">{{ $t('openImageInNewTab') }}</mk-switch>
|
|
|
|
<mk-switch v-model="showFixedPostForm">{{ $t('showFixedPostForm') }}</mk-switch>
|
|
|
|
<mk-switch v-model="enableInfiniteScroll">{{ $t('enableInfiniteScroll') }}</mk-switch>
|
|
|
|
<mk-switch v-model="fixedWidgetsPosition">{{ $t('fixedWidgetsPosition') }}</mk-switch>
|
|
|
|
<mk-switch v-model="disablePagesScript">{{ $t('disablePagesScript') }}</mk-switch>
|
2020-02-17 03:10:51 +09:00
|
|
|
</div>
|
|
|
|
<div class="_content">
|
|
|
|
<mk-select v-model="lang">
|
|
|
|
<template #label>{{ $t('uiLanguage') }}</template>
|
|
|
|
|
|
|
|
<option v-for="x in langs" :value="x[0]" :key="x[0]">{{ x[1] }}</option>
|
|
|
|
</mk-select>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
2020-07-25 01:56:52 +09:00
|
|
|
<mk-button @click="cacheClear()" primary style="margin: var(--margin) auto;">{{ $t('cacheClear') }}</mk-button>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2020-07-11 10:13:11 +09:00
|
|
|
import { faImage, faCog, faMusic, faPlay, faVolumeUp, faVolumeMute, faColumns } from '@fortawesome/free-solid-svg-icons';
|
2020-01-30 04:37:25 +09:00
|
|
|
import MkButton from '../../components/ui/button.vue';
|
2020-02-17 03:10:51 +09:00
|
|
|
import MkSwitch from '../../components/ui/switch.vue';
|
|
|
|
import MkSelect from '../../components/ui/select.vue';
|
|
|
|
import MkRadio from '../../components/ui/radio.vue';
|
2020-03-20 14:30:37 +09:00
|
|
|
import MkRange from '../../components/ui/range.vue';
|
2020-02-17 03:10:51 +09:00
|
|
|
import XTheme from './theme.vue';
|
2020-05-06 11:41:44 +09:00
|
|
|
import XSidebar from './sidebar.vue';
|
2020-07-12 00:38:55 +09:00
|
|
|
import XPlugins from './plugins.vue';
|
2020-02-17 03:10:51 +09:00
|
|
|
import { langs } from '../../config';
|
2020-05-23 13:19:31 +09:00
|
|
|
import { clientDb, set } from '../../db';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-02-20 02:40:53 +09:00
|
|
|
const sounds = [
|
|
|
|
null,
|
2020-02-20 03:14:17 +09:00
|
|
|
'syuilo/up',
|
|
|
|
'syuilo/down',
|
2020-02-20 02:40:53 +09:00
|
|
|
'syuilo/pope1',
|
|
|
|
'syuilo/pope2',
|
|
|
|
'syuilo/waon',
|
2020-02-20 06:08:49 +09:00
|
|
|
'syuilo/popo',
|
|
|
|
'syuilo/triple',
|
2020-02-20 07:29:34 +09:00
|
|
|
'syuilo/poi1',
|
|
|
|
'syuilo/poi2',
|
2020-07-08 23:29:35 +09:00
|
|
|
'syuilo/pirori',
|
2020-07-12 22:17:13 +09:00
|
|
|
'syuilo/pirori-wet',
|
|
|
|
'syuilo/pirori-square-wet',
|
2020-02-20 02:40:53 +09:00
|
|
|
'aisha/1',
|
|
|
|
'aisha/2',
|
|
|
|
'aisha/3',
|
|
|
|
'noizenecio/kick_gaba',
|
|
|
|
];
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
export default Vue.extend({
|
|
|
|
metaInfo() {
|
|
|
|
return {
|
|
|
|
title: this.$t('settings') as string
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
components: {
|
|
|
|
XTheme,
|
2020-05-06 11:41:44 +09:00
|
|
|
XSidebar,
|
2020-07-12 00:38:55 +09:00
|
|
|
XPlugins,
|
2020-01-30 04:37:25 +09:00
|
|
|
MkButton,
|
2020-02-17 03:10:51 +09:00
|
|
|
MkSwitch,
|
|
|
|
MkSelect,
|
|
|
|
MkRadio,
|
2020-07-12 00:38:55 +09:00
|
|
|
MkRange,
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2020-02-17 03:10:51 +09:00
|
|
|
langs,
|
|
|
|
lang: localStorage.getItem('lang'),
|
|
|
|
fontSize: localStorage.getItem('fontSize'),
|
2020-02-20 02:40:53 +09:00
|
|
|
sounds,
|
2020-07-11 10:13:11 +09:00
|
|
|
faImage, faCog, faMusic, faPlay, faVolumeUp, faVolumeMute, faColumns
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-02-17 03:10:51 +09:00
|
|
|
computed: {
|
|
|
|
autoReload: {
|
|
|
|
get() { return this.$store.state.device.autoReload; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'autoReload', value }); }
|
|
|
|
},
|
|
|
|
|
|
|
|
reduceAnimation: {
|
|
|
|
get() { return !this.$store.state.device.animation; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'animation', value: !value }); }
|
|
|
|
},
|
|
|
|
|
2020-07-12 18:14:59 +09:00
|
|
|
useBlurEffectForModal: {
|
|
|
|
get() { return this.$store.state.device.useBlurEffectForModal; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'useBlurEffectForModal', value: value }); }
|
|
|
|
},
|
|
|
|
|
2020-02-17 03:10:51 +09:00
|
|
|
disableAnimatedMfm: {
|
|
|
|
get() { return !this.$store.state.device.animatedMfm; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'animatedMfm', value: !value }); }
|
|
|
|
},
|
|
|
|
|
|
|
|
useOsNativeEmojis: {
|
|
|
|
get() { return this.$store.state.device.useOsNativeEmojis; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'useOsNativeEmojis', value }); }
|
|
|
|
},
|
|
|
|
|
|
|
|
imageNewTab: {
|
|
|
|
get() { return this.$store.state.device.imageNewTab; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'imageNewTab', value }); }
|
|
|
|
},
|
2020-02-19 03:11:09 +09:00
|
|
|
|
2020-04-13 23:46:53 +09:00
|
|
|
disablePagesScript: {
|
|
|
|
get() { return this.$store.state.device.disablePagesScript; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'disablePagesScript', value }); }
|
|
|
|
},
|
|
|
|
|
2020-02-19 03:11:09 +09:00
|
|
|
showFixedPostForm: {
|
|
|
|
get() { return this.$store.state.device.showFixedPostForm; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'showFixedPostForm', value }); }
|
|
|
|
},
|
2020-02-19 06:16:49 +09:00
|
|
|
|
2020-05-31 12:53:06 +09:00
|
|
|
enableInfiniteScroll: {
|
|
|
|
get() { return this.$store.state.device.enableInfiniteScroll; },
|
2020-07-12 00:12:30 +09:00
|
|
|
set(value) { this.$store.commit('device/set', { key: 'enableInfiniteScroll', value }); }
|
2020-05-31 12:53:06 +09:00
|
|
|
},
|
|
|
|
|
2020-07-06 00:03:08 +09:00
|
|
|
fixedWidgetsPosition: {
|
|
|
|
get() { return this.$store.state.device.fixedWidgetsPosition; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'fixedWidgetsPosition', value }); }
|
|
|
|
},
|
|
|
|
|
2020-07-11 10:13:11 +09:00
|
|
|
deckAlwaysShowMainColumn: {
|
|
|
|
get() { return this.$store.state.device.deckAlwaysShowMainColumn; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'deckAlwaysShowMainColumn', value }); }
|
|
|
|
},
|
|
|
|
|
|
|
|
deckColumnAlign: {
|
|
|
|
get() { return this.$store.state.device.deckColumnAlign; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'deckColumnAlign', value }); }
|
|
|
|
},
|
|
|
|
|
2020-02-20 02:40:53 +09:00
|
|
|
sfxVolume: {
|
|
|
|
get() { return this.$store.state.device.sfxVolume; },
|
2020-02-27 16:32:10 +09:00
|
|
|
set(value) { this.$store.commit('device/set', { key: 'sfxVolume', value: parseFloat(value, 10) }); }
|
2020-02-20 02:40:53 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
sfxNote: {
|
|
|
|
get() { return this.$store.state.device.sfxNote; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'sfxNote', value }); }
|
|
|
|
},
|
|
|
|
|
2020-02-20 03:14:17 +09:00
|
|
|
sfxNoteMy: {
|
|
|
|
get() { return this.$store.state.device.sfxNoteMy; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'sfxNoteMy', value }); }
|
|
|
|
},
|
|
|
|
|
2020-02-20 02:40:53 +09:00
|
|
|
sfxNotification: {
|
|
|
|
get() { return this.$store.state.device.sfxNotification; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'sfxNotification', value }); }
|
|
|
|
},
|
|
|
|
|
|
|
|
sfxChat: {
|
|
|
|
get() { return this.$store.state.device.sfxChat; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'sfxChat', value }); }
|
|
|
|
},
|
|
|
|
|
|
|
|
sfxChatBg: {
|
|
|
|
get() { return this.$store.state.device.sfxChatBg; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'sfxChatBg', value }); }
|
|
|
|
},
|
2020-02-20 06:08:49 +09:00
|
|
|
|
|
|
|
sfxAntenna: {
|
|
|
|
get() { return this.$store.state.device.sfxAntenna; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'sfxAntenna', value }); }
|
|
|
|
},
|
2020-03-20 14:30:37 +09:00
|
|
|
|
|
|
|
volumeIcon: {
|
|
|
|
get() {
|
|
|
|
return this.sfxVolume === 0 ? faVolumeMute : faVolumeUp;
|
|
|
|
}
|
|
|
|
}
|
2020-02-17 03:10:51 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
lang() {
|
2020-05-23 13:19:31 +09:00
|
|
|
const dialog = this.$root.dialog({
|
|
|
|
type: 'waiting',
|
|
|
|
iconOnly: true
|
|
|
|
});
|
|
|
|
|
2020-02-17 03:10:51 +09:00
|
|
|
localStorage.setItem('lang', this.lang);
|
2020-05-23 13:19:31 +09:00
|
|
|
|
|
|
|
return set('_version_', `changeLang-${(new Date()).toJSON()}`, clientDb.i18n)
|
|
|
|
.then(() => location.reload())
|
|
|
|
.catch(() => {
|
|
|
|
dialog.close();
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'error',
|
|
|
|
iconOnly: true,
|
|
|
|
autoClose: true
|
|
|
|
});
|
|
|
|
});
|
2020-02-17 03:10:51 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
fontSize() {
|
|
|
|
if (this.fontSize == null) {
|
|
|
|
localStorage.removeItem('fontSize');
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('fontSize', this.fontSize);
|
|
|
|
}
|
|
|
|
location.reload();
|
|
|
|
},
|
2020-07-06 16:08:30 +09:00
|
|
|
|
|
|
|
fixedWidgetsPosition() {
|
|
|
|
location.reload()
|
|
|
|
},
|
2020-07-12 00:12:30 +09:00
|
|
|
|
|
|
|
enableInfiniteScroll() {
|
|
|
|
location.reload()
|
|
|
|
},
|
2020-02-17 03:10:51 +09:00
|
|
|
},
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
methods: {
|
2020-02-20 02:40:53 +09:00
|
|
|
listen(sound) {
|
|
|
|
const audio = new Audio(`/assets/sounds/${sound}.mp3`);
|
|
|
|
audio.volume = this.$store.state.device.sfxVolume;
|
|
|
|
audio.play();
|
|
|
|
},
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
cacheClear() {
|
|
|
|
// Clear cache (service worker)
|
|
|
|
try {
|
|
|
|
navigator.serviceWorker.controller.postMessage('clear');
|
|
|
|
|
|
|
|
navigator.serviceWorker.getRegistrations().then(registrations => {
|
|
|
|
for (const registration of registrations) registration.unregister();
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Force reload
|
|
|
|
location.reload(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|