This commit is contained in:
syuilo 2018-03-05 20:09:26 +09:00
parent 4294310b2f
commit ff0c76be97
4 changed files with 48 additions and 11 deletions

View File

@ -56,6 +56,7 @@ export default Vue.extend({
}, },
watch: { watch: {
value() { value() {
(this.$el).style.transition = 'all 0.3s';
(this.$refs.input as any).checked = this.checked; (this.$refs.input as any).checked = this.checked;
} }
}, },

View File

@ -69,11 +69,21 @@ export default Vue.extend({
margin-right 8px margin-right 8px
> footer > footer
> *
display block
margin 0
padding 16px padding 16px
width 100%
text-align center text-align center
color #ccc color #ccc
border-top solid 1px #eaeaea border-top solid 1px #eaeaea
border-bottom-left-radius 4px border-bottom-left-radius 4px
border-bottom-right-radius 4px border-bottom-right-radius 4px
> button
&:hover
background #f5f5f5
&:active
background #eee
</style> </style>

View File

@ -18,6 +18,13 @@
<x-profile/> <x-profile/>
</section> </section>
<section class="web" v-show="page == 'web'">
<h1>動作</h1>
<mk-switch v-model="fetchOnScroll" @change="onChangeFetchOnScroll" text="スクロールで自動読み込み">
<span>ページを下までスクロールしたときに自動で追加のコンテンツを読み込みます</span>
</mk-switch>
</section>
<section class="web" v-show="page == 'web'"> <section class="web" v-show="page == 'web'">
<h1>デザイン</h1> <h1>デザイン</h1>
<div class="div"> <div class="div">
@ -186,6 +193,7 @@ export default Vue.extend({
version, version,
latestVersion: undefined, latestVersion: undefined,
checkingForUpdate: false, checkingForUpdate: false,
fetchOnScroll: true,
autoWatch: true, autoWatch: true,
enableSounds: localStorage.getItem('enableSounds') == 'true', enableSounds: localStorage.getItem('enableSounds') == 'true',
lang: localStorage.getItem('lang') || '', lang: localStorage.getItem('lang') || '',
@ -223,6 +231,16 @@ export default Vue.extend({
if ((this as any).os.i.settings.auto_watch != null) { if ((this as any).os.i.settings.auto_watch != null) {
this.autoWatch = (this as any).os.i.settings.auto_watch; this.autoWatch = (this as any).os.i.settings.auto_watch;
this.$watch('os.i.settings.auto_watch', v => {
this.autoWatch = v;
});
}
if ((this as any).os.i.client_settings.fetchOnScroll != null) {
this.fetchOnScroll = (this as any).os.i.client_settings.fetchOnScroll;
this.$watch('os.i.client_settings.fetchOnScroll', v => {
this.fetchOnScroll = v;
});
} }
}, },
methods: { methods: {
@ -230,6 +248,12 @@ export default Vue.extend({
this.$router.push('/i/customize-home'); this.$router.push('/i/customize-home');
this.$emit('done'); this.$emit('done');
}, },
onChangeFetchOnScroll(v) {
(this as any).api('i/update_client_setting', {
name: 'fetchOnScroll',
value: v
});
},
onChangeAutoWatch(v) { onChangeAutoWatch(v) {
(this as any).api('i/update', { (this as any).api('i/update', {
auto_watch: v auto_watch: v

View File

@ -8,10 +8,10 @@
%fa:R comments%自分の投稿や自分がフォローしているユーザーの投稿が表示されます %fa:R comments%自分の投稿や自分がフォローしているユーザーの投稿が表示されます
</p> </p>
<mk-posts :posts="posts" ref="timeline"> <mk-posts :posts="posts" ref="timeline">
<div slot="footer"> <button slot="footer" @click="more" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
<template v-if="!moreFetching">%fa:comments%</template> <template v-if="!moreFetching">もっと見る</template>
<template v-if="moreFetching">%fa:spinner .pulse .fw%</template> <template v-if="moreFetching">%fa:spinner .pulse .fw%</template>
</div> </button>
</mk-posts> </mk-posts>
</div> </div>
</template> </template>
@ -105,8 +105,10 @@ export default Vue.extend({
this.fetch(); this.fetch();
}, },
onScroll() { onScroll() {
if ((this as any).os.i.client_settings.fetchOnScroll !== false) {
const current = window.scrollY + window.innerHeight; const current = window.scrollY + window.innerHeight;
if (current > document.body.offsetHeight - 8) this.more(); if (current > document.body.offsetHeight - 8) this.more();
}
}, },
onKeydown(e) { onKeydown(e) {
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') { if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {