mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 22:17:30 -07:00
This commit is contained in:
parent
d02f084c05
commit
3e642a3b68
3 changed files with 24 additions and 3 deletions
|
@ -150,7 +150,9 @@ export default Vue.extend({
|
||||||
onMessage(message) {
|
onMessage(message) {
|
||||||
// サウンドを再生する
|
// サウンドを再生する
|
||||||
if ((this as any).os.isEnableSounds) {
|
if ((this as any).os.isEnableSounds) {
|
||||||
new Audio(`${url}/assets/message.mp3`).play();
|
const sound = new Audio(`${url}/assets/message.mp3`);
|
||||||
|
sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 1;
|
||||||
|
sound.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
const isBottom = this.isBottom();
|
const isBottom = this.isBottom();
|
||||||
|
|
|
@ -42,6 +42,14 @@
|
||||||
<mk-switch v-model="enableSounds" text="サウンドを有効にする">
|
<mk-switch v-model="enableSounds" text="サウンドを有効にする">
|
||||||
<span>投稿やメッセージを送受信したときなどにサウンドを再生します。この設定はブラウザに記憶されます。</span>
|
<span>投稿やメッセージを送受信したときなどにサウンドを再生します。この設定はブラウザに記憶されます。</span>
|
||||||
</mk-switch>
|
</mk-switch>
|
||||||
|
<label>ボリューム</label>
|
||||||
|
<el-slider
|
||||||
|
v-model="soundVolume"
|
||||||
|
:show-input="true"
|
||||||
|
:format-tooltip="v => `${v}%`"
|
||||||
|
:disabled="!enableSounds"
|
||||||
|
/>
|
||||||
|
<button class="ui button" @click="soundTest">%fa:volume-up% テスト</button>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="web" v-show="page == 'web'">
|
<section class="web" v-show="page == 'web'">
|
||||||
|
@ -175,7 +183,7 @@ import XApi from './settings.api.vue';
|
||||||
import XApps from './settings.apps.vue';
|
import XApps from './settings.apps.vue';
|
||||||
import XSignins from './settings.signins.vue';
|
import XSignins from './settings.signins.vue';
|
||||||
import XDrive from './settings.drive.vue';
|
import XDrive from './settings.drive.vue';
|
||||||
import { docsUrl, license, lang, version } from '../../../config';
|
import { url, docsUrl, license, lang, version } from '../../../config';
|
||||||
import checkForUpdate from '../../../common/scripts/check-for-update';
|
import checkForUpdate from '../../../common/scripts/check-for-update';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
|
@ -198,6 +206,7 @@ export default Vue.extend({
|
||||||
latestVersion: undefined,
|
latestVersion: undefined,
|
||||||
checkingForUpdate: false,
|
checkingForUpdate: false,
|
||||||
enableSounds: localStorage.getItem('enableSounds') == 'true',
|
enableSounds: localStorage.getItem('enableSounds') == 'true',
|
||||||
|
soundVolume: localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) : 100,
|
||||||
lang: localStorage.getItem('lang') || '',
|
lang: localStorage.getItem('lang') || '',
|
||||||
preventUpdate: localStorage.getItem('preventUpdate') == 'true',
|
preventUpdate: localStorage.getItem('preventUpdate') == 'true',
|
||||||
debug: localStorage.getItem('debug') == 'true',
|
debug: localStorage.getItem('debug') == 'true',
|
||||||
|
@ -208,6 +217,9 @@ export default Vue.extend({
|
||||||
enableSounds() {
|
enableSounds() {
|
||||||
localStorage.setItem('enableSounds', this.enableSounds ? 'true' : 'false');
|
localStorage.setItem('enableSounds', this.enableSounds ? 'true' : 'false');
|
||||||
},
|
},
|
||||||
|
soundVolume() {
|
||||||
|
localStorage.setItem('soundVolume', this.soundVolume.toString());
|
||||||
|
},
|
||||||
lang() {
|
lang() {
|
||||||
localStorage.setItem('lang', this.lang);
|
localStorage.setItem('lang', this.lang);
|
||||||
},
|
},
|
||||||
|
@ -295,6 +307,11 @@ export default Vue.extend({
|
||||||
title: 'キャッシュを削除しました',
|
title: 'キャッシュを削除しました',
|
||||||
text: 'ページを再度読み込みしてください。'
|
text: 'ページを再度読み込みしてください。'
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
soundTest() {
|
||||||
|
const sound = new Audio(`${url}/assets/message.mp3`);
|
||||||
|
sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 1;
|
||||||
|
sound.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -96,7 +96,9 @@ export default Vue.extend({
|
||||||
onPost(post) {
|
onPost(post) {
|
||||||
// サウンドを再生する
|
// サウンドを再生する
|
||||||
if ((this as any).os.isEnableSounds) {
|
if ((this as any).os.isEnableSounds) {
|
||||||
new Audio(`${url}/assets/post.mp3`).play();
|
const sound = new Audio(`${url}/assets/post.mp3`);
|
||||||
|
sound.volume = localStorage.getItem('soundVolume') ? parseInt(localStorage.getItem('soundVolume'), 10) / 100 : 1;
|
||||||
|
sound.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.posts.unshift(post);
|
this.posts.unshift(post);
|
||||||
|
|
Loading…
Reference in a new issue