2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-01-30 11:10:42 +09:00
|
|
|
<section class="_card">
|
2020-01-30 04:37:25 +09:00
|
|
|
<div class="_title"><fa :icon="faCog"/> {{ $t('general') }}</div>
|
|
|
|
<div class="_content">
|
2020-02-14 01:24:05 +09:00
|
|
|
<mk-input type="file" @change="onWallpaperChange">
|
2020-01-30 04:37:25 +09:00
|
|
|
<span>{{ $t('wallpaper') }}</span>
|
|
|
|
<template #icon><fa :icon="faImage"/></template>
|
|
|
|
<template #desc v-if="wallpaperUploading">{{ $t('uploading') }}<mk-ellipsis/></template>
|
|
|
|
</mk-input>
|
|
|
|
<mk-button primary :disabled="$store.state.settings.wallpaper == null" @click="delWallpaper()">{{ $t('removeWallpaper') }}</mk-button>
|
|
|
|
</div>
|
|
|
|
<div class="_content">
|
2020-02-06 17:21:28 +09:00
|
|
|
<mk-switch v-model="autoReload">
|
|
|
|
{{ $t('autoReloadWhenDisconnected') }}
|
|
|
|
</mk-switch>
|
2020-01-30 04:37:25 +09:00
|
|
|
<mk-switch v-model="$store.state.i.autoWatch" @change="onChangeAutoWatch">
|
2020-02-08 20:02:15 +09:00
|
|
|
{{ $t('autoNoteWatch') }}<template #desc>{{ $t('autoNoteWatchDescription') }}</template>
|
2020-01-30 04:37:25 +09:00
|
|
|
</mk-switch>
|
|
|
|
</div>
|
|
|
|
<div class="_content">
|
2020-02-08 13:06:09 +09:00
|
|
|
<mk-button @click="readAllNotifications">{{ $t('markAsReadAllNotifications') }}</mk-button>
|
|
|
|
<mk-button @click="readAllUnreadNotes">{{ $t('markAsReadAllUnreadNotes') }}</mk-button>
|
|
|
|
<mk-button @click="readAllMessagingMessages">{{ $t('markAsReadAllTalkMessages') }}</mk-button>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-02-06 19:11:14 +09:00
|
|
|
<div class="_content">
|
2020-02-13 23:20:12 +09:00
|
|
|
<mk-switch v-model="disableAnimatedMfm">{{ $t('disableAnimatedMfm') }}</mk-switch>
|
2020-02-13 03:11:37 +09:00
|
|
|
<mk-switch v-model="reduceAnimation">{{ $t('reduceUiAnimation') }}</mk-switch>
|
|
|
|
<mk-switch v-model="useOsNativeEmojis">
|
|
|
|
{{ $t('useOsNativeEmojis') }}
|
|
|
|
<template #desc><mfm text="🍮🍦🍭🍩🍰🍫🍬🥞🍪"/></template>
|
2020-02-06 19:11:14 +09:00
|
|
|
</mk-switch>
|
|
|
|
</div>
|
2020-02-12 07:12:58 +09:00
|
|
|
<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>
|
2020-01-30 04:37:25 +09:00
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
import { faImage, faCog } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import MkInput from '../../components/ui/input.vue';
|
|
|
|
import MkButton from '../../components/ui/button.vue';
|
|
|
|
import MkSwitch from '../../components/ui/switch.vue';
|
2020-02-12 07:12:58 +09:00
|
|
|
import MkSelect from '../../components/ui/select.vue';
|
2020-01-30 04:37:25 +09:00
|
|
|
import i18n from '../../i18n';
|
2020-02-12 07:12:58 +09:00
|
|
|
import { apiUrl, langs } from '../../config';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
i18n,
|
|
|
|
|
|
|
|
components: {
|
|
|
|
MkInput,
|
|
|
|
MkButton,
|
|
|
|
MkSwitch,
|
2020-02-12 07:12:58 +09:00
|
|
|
MkSelect,
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2020-02-12 07:12:58 +09:00
|
|
|
langs,
|
|
|
|
lang: localStorage.getItem('lang'),
|
2020-01-30 04:37:25 +09:00
|
|
|
wallpaperUploading: false,
|
|
|
|
faImage, faCog
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
wallpaper: {
|
|
|
|
get() { return this.$store.state.settings.wallpaper; },
|
|
|
|
set(value) { this.$store.dispatch('settings/set', { key: 'wallpaper', value }); }
|
|
|
|
},
|
2020-02-06 17:21:28 +09:00
|
|
|
|
|
|
|
autoReload: {
|
|
|
|
get() { return this.$store.state.device.autoReload; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'autoReload', value }); }
|
|
|
|
},
|
2020-02-06 19:11:14 +09:00
|
|
|
|
|
|
|
reduceAnimation: {
|
|
|
|
get() { return !this.$store.state.device.animation; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'animation', value: !value }); }
|
|
|
|
},
|
2020-02-13 03:11:37 +09:00
|
|
|
|
2020-02-13 23:20:12 +09:00
|
|
|
disableAnimatedMfm: {
|
|
|
|
get() { return !this.$store.state.device.animatedMfm; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'animatedMfm', value: !value }); }
|
|
|
|
},
|
|
|
|
|
2020-02-13 03:11:37 +09:00
|
|
|
useOsNativeEmojis: {
|
|
|
|
get() { return this.$store.state.device.useOsNativeEmojis; },
|
|
|
|
set(value) { this.$store.commit('device/set', { key: 'useOsNativeEmojis', value }); }
|
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
2020-02-12 07:12:58 +09:00
|
|
|
watch: {
|
|
|
|
lang() {
|
|
|
|
localStorage.setItem('lang', this.lang);
|
|
|
|
localStorage.removeItem('locale');
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
methods: {
|
|
|
|
onWallpaperChange([file]) {
|
|
|
|
this.wallpaperUploading = true;
|
|
|
|
|
|
|
|
const data = new FormData();
|
|
|
|
data.append('file', file);
|
|
|
|
data.append('i', this.$store.state.i.token);
|
|
|
|
|
|
|
|
fetch(apiUrl + '/drive/files/create', {
|
|
|
|
method: 'POST',
|
|
|
|
body: data
|
|
|
|
})
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(f => {
|
|
|
|
this.wallpaper = f.url;
|
|
|
|
this.wallpaperUploading = false;
|
|
|
|
document.documentElement.style.backgroundImage = `url(${this.$store.state.settings.wallpaper})`;
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
this.wallpaperUploading = false;
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'error',
|
|
|
|
text: e
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
delWallpaper() {
|
|
|
|
this.wallpaper = null;
|
|
|
|
document.documentElement.style.backgroundImage = 'none';
|
|
|
|
},
|
|
|
|
|
|
|
|
onChangeAutoWatch(v) {
|
|
|
|
this.$root.api('i/update', {
|
|
|
|
autoWatch: v
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
readAllUnreadNotes() {
|
|
|
|
this.$root.api('i/read_all_unread_notes');
|
|
|
|
},
|
|
|
|
|
|
|
|
readAllMessagingMessages() {
|
|
|
|
this.$root.api('i/read_all_messaging_messages');
|
|
|
|
},
|
|
|
|
|
|
|
|
readAllNotifications() {
|
|
|
|
this.$root.api('notifications/mark_all_as_read');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|