mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-11-01 23:55:58 +09:00
make sounds great again
This commit is contained in:
parent
bad780ce96
commit
9cff3868de
@ -94,6 +94,13 @@ export default class MiOS extends EventEmitter {
|
|||||||
return localStorage.getItem('debug') == 'true';
|
return localStorage.getItem('debug') == 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether enable sounds
|
||||||
|
*/
|
||||||
|
public get isEnableSounds() {
|
||||||
|
return localStorage.getItem('enableSounds') == 'true';
|
||||||
|
}
|
||||||
|
|
||||||
public apis: API;
|
public apis: API;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +29,7 @@ import Vue from 'vue';
|
|||||||
import MessagingStreamConnection from '../../scripts/streaming/messaging-stream';
|
import MessagingStreamConnection from '../../scripts/streaming/messaging-stream';
|
||||||
import XMessage from './messaging-room.message.vue';
|
import XMessage from './messaging-room.message.vue';
|
||||||
import XForm from './messaging-room.form.vue';
|
import XForm from './messaging-room.form.vue';
|
||||||
|
import { url } from '../../../config';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
@ -147,6 +148,11 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onMessage(message) {
|
onMessage(message) {
|
||||||
|
// サウンドを再生する
|
||||||
|
if ((this as any).os.isEnableSounds) {
|
||||||
|
new Audio(`${url}/assets/message.mp3`).play();
|
||||||
|
}
|
||||||
|
|
||||||
const isBottom = this.isBottom();
|
const isBottom = this.isBottom();
|
||||||
|
|
||||||
this.messages.push(message);
|
this.messages.push(message);
|
||||||
|
@ -26,6 +26,13 @@
|
|||||||
<mk-switch v-model="os.i.client_settings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/>
|
<mk-switch v-model="os.i.client_settings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="web" v-show="page == 'web'">
|
||||||
|
<h1>サウンド</h1>
|
||||||
|
<mk-switch v-model="enableSounds" text="サウンドを有効にする">
|
||||||
|
<span>投稿やメッセージを送受信したときなどにサウンドを再生します。この設定はブラウザに記憶されます。</span>
|
||||||
|
</mk-switch>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="web" v-show="page == 'web'">
|
<section class="web" v-show="page == 'web'">
|
||||||
<h1>モバイル</h1>
|
<h1>モバイル</h1>
|
||||||
<mk-switch v-model="os.i.client_settings.disableViaMobile" @change="onChangeDisableViaMobile" text="「モバイルからの投稿」フラグを付けない"/>
|
<mk-switch v-model="os.i.client_settings.disableViaMobile" @change="onChangeDisableViaMobile" text="「モバイルからの投稿」フラグを付けない"/>
|
||||||
@ -166,6 +173,7 @@ export default Vue.extend({
|
|||||||
version,
|
version,
|
||||||
latestVersion: undefined,
|
latestVersion: undefined,
|
||||||
checkingForUpdate: false,
|
checkingForUpdate: false,
|
||||||
|
enableSounds: localStorage.getItem('enableSounds') == 'true',
|
||||||
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',
|
||||||
@ -173,6 +181,9 @@ export default Vue.extend({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
enableSounds() {
|
||||||
|
localStorage.setItem('enableSounds', this.enableSounds ? 'true' : 'false');
|
||||||
|
},
|
||||||
lang() {
|
lang() {
|
||||||
localStorage.setItem('lang', this.lang);
|
localStorage.setItem('lang', this.lang);
|
||||||
},
|
},
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import { url } from '../../../config';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
data() {
|
data() {
|
||||||
@ -93,6 +94,11 @@ export default Vue.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onPost(post) {
|
onPost(post) {
|
||||||
|
// サウンドを再生する
|
||||||
|
if ((this as any).os.isEnableSounds) {
|
||||||
|
new Audio(`${url}/assets/post.mp3`).play();
|
||||||
|
}
|
||||||
|
|
||||||
this.posts.unshift(post);
|
this.posts.unshift(post);
|
||||||
},
|
},
|
||||||
onChangeFollowing() {
|
onChangeFollowing() {
|
||||||
|
BIN
src/web/assets/message.mp3
Normal file
BIN
src/web/assets/message.mp3
Normal file
Binary file not shown.
BIN
src/web/assets/post.mp3
Normal file
BIN
src/web/assets/post.mp3
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user