2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2020-02-16 18:10:51 +00:00
|
|
|
<div>
|
2020-01-29 19:37:25 +00:00
|
|
|
<portal to="icon"><fa :icon="faCog"/></portal>
|
2020-02-16 18:19:27 +00:00
|
|
|
<portal to="title">{{ $t('clinetSettings') }}</portal>
|
2020-01-29 19:37:25 +00:00
|
|
|
|
|
|
|
<x-theme/>
|
2020-02-16 18:10:51 +00:00
|
|
|
|
|
|
|
<section class="_card">
|
|
|
|
<div class="_title"><fa :icon="faCog"/> {{ $t('accessibility') }}</div>
|
|
|
|
<div class="_content">
|
|
|
|
<mk-switch v-model="autoReload">
|
|
|
|
{{ $t('autoReloadWhenDisconnected') }}
|
|
|
|
</mk-switch>
|
|
|
|
</div>
|
|
|
|
<div class="_content">
|
|
|
|
<mk-switch v-model="imageNewTab">{{ $t('openImageInNewTab') }}</mk-switch>
|
|
|
|
<mk-switch v-model="disableAnimatedMfm">{{ $t('disableAnimatedMfm') }}</mk-switch>
|
|
|
|
<mk-switch v-model="reduceAnimation">{{ $t('reduceUiAnimation') }}</mk-switch>
|
|
|
|
<mk-switch v-model="useOsNativeEmojis">
|
|
|
|
{{ $t('useOsNativeEmojis') }}
|
|
|
|
<template #desc><mfm text="🍮🍦🍭🍩🍰🍫🍬🥞🍪"/></template>
|
|
|
|
</mk-switch>
|
|
|
|
</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>
|
|
|
|
<div class="_content">
|
|
|
|
<div>{{ $t('fontSize') }}</div>
|
|
|
|
<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>
|
|
|
|
|
|
|
|
<mk-button @click="cacheClear()" primary style="margin: var(--margin) auto;">{{ $t('cacheClear') }}</mk-button>
|
2020-01-29 19:37:25 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2020-02-16 18:10:51 +00:00
|
|
|
import { faImage, faCog } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import MkInput from '../../components/ui/input.vue';
|
2020-01-29 19:37:25 +00:00
|
|
|
import MkButton from '../../components/ui/button.vue';
|
2020-02-16 18:10:51 +00:00
|
|
|
import MkSwitch from '../../components/ui/switch.vue';
|
|
|
|
import MkSelect from '../../components/ui/select.vue';
|
|
|
|
import MkRadio from '../../components/ui/radio.vue';
|
|
|
|
import XTheme from './theme.vue';
|
|
|
|
import i18n from '../../i18n';
|
|
|
|
import { langs } from '../../config';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2020-02-16 18:10:51 +00:00
|
|
|
i18n,
|
|
|
|
|
2020-01-29 19:37:25 +00:00
|
|
|
metaInfo() {
|
|
|
|
return {
|
|
|
|
title: this.$t('settings') as string
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
components: {
|
|
|
|
XTheme,
|
2020-02-16 18:10:51 +00:00
|
|
|
MkInput,
|
2020-01-29 19:37:25 +00:00
|
|
|
MkButton,
|
2020-02-16 18:10:51 +00:00
|
|
|
MkSwitch,
|
|
|
|
MkSelect,
|
|
|
|
MkRadio,
|
2020-01-29 19:37:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2020-02-16 18:10:51 +00:00
|
|
|
langs,
|
|
|
|
lang: localStorage.getItem('lang'),
|
|
|
|
fontSize: localStorage.getItem('fontSize'),
|
|
|
|
faImage, faCog
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-02-16 18:10:51 +00: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 }); }
|
|
|
|
},
|
|
|
|
|
|
|
|
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 }); }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
lang() {
|
|
|
|
localStorage.setItem('lang', this.lang);
|
|
|
|
localStorage.removeItem('locale');
|
|
|
|
location.reload();
|
|
|
|
},
|
|
|
|
|
|
|
|
fontSize() {
|
|
|
|
if (this.fontSize == null) {
|
|
|
|
localStorage.removeItem('fontSize');
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('fontSize', this.fontSize);
|
|
|
|
}
|
|
|
|
location.reload();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2020-01-29 19:37:25 +00:00
|
|
|
methods: {
|
|
|
|
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>
|