summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2018-04-15 21:01:35 +0900
committerGitHub <noreply@github.com>2018-04-15 21:01:35 +0900
commit322742c3bab3b4e48fed36654a210e59cd7198e1 (patch)
treee561f6edb1f5499cc045bdc8dc646f253b13b227 /src
parentUpdate timeline.vue (diff)
parentMerge branch 'master' into pop (diff)
downloadmisskey-322742c3bab3b4e48fed36654a210e59cd7198e1.tar.gz
misskey-322742c3bab3b4e48fed36654a210e59cd7198e1.tar.bz2
misskey-322742c3bab3b4e48fed36654a210e59cd7198e1.zip
Merge pull request #7 from tamaina/pop
Pop
Diffstat (limited to 'src')
-rw-r--r--src/client/app/desktop/views/components/timeline.vue11
-rw-r--r--src/client/app/mobile/views/components/timeline.vue14
2 files changed, 20 insertions, 5 deletions
diff --git a/src/client/app/desktop/views/components/timeline.vue b/src/client/app/desktop/views/components/timeline.vue
index cdedbac19f..829e73106b 100644
--- a/src/client/app/desktop/views/components/timeline.vue
+++ b/src/client/app/desktop/views/components/timeline.vue
@@ -5,11 +5,11 @@
<mk-ellipsis-icon/>
</div>
<p class="empty" v-if="notes.length == 0 && !fetching">
- %fa:R comments%自分の投稿や、自分がフォローしているユーザーの投稿が表示されます。
+ %fa:R comments%%i18n:@empty%
</p>
<mk-notes :notes="notes" ref="timeline">
<button slot="footer" @click="more" :disabled="moreFetching" :style="{ cursor: moreFetching ? 'wait' : 'pointer' }">
- <template v-if="!moreFetching">もっと見る</template>
+ <template v-if="!moreFetching">%i18n:@load-more%</template>
<template v-if="moreFetching">%fa:spinner .pulse .fw%</template>
</button>
</mk-notes>
@@ -29,7 +29,8 @@ export default Vue.extend({
notes: [],
connection: null,
connectionId: null,
- date: null
+ date: null,
+ isTop: true
};
},
computed: {
@@ -101,7 +102,7 @@ export default Vue.extend({
sound.play();
}
- this.notes.pop();
+ if (this.isTop) this.notes.pop();
this.notes.unshift(note);
},
onChangeFollowing() {
@@ -112,6 +113,8 @@ export default Vue.extend({
const current = window.scrollY + window.innerHeight;
if (current > document.body.offsetHeight - 8) this.more();
}
+ if (window.scrollY > 100) this.isTop = false;
+ else this.isTop = true;
},
onKeydown(e) {
if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') {
diff --git a/src/client/app/mobile/views/components/timeline.vue b/src/client/app/mobile/views/components/timeline.vue
index 12cc7fcf19..7bb71cb07a 100644
--- a/src/client/app/mobile/views/components/timeline.vue
+++ b/src/client/app/mobile/views/components/timeline.vue
@@ -37,7 +37,8 @@ export default Vue.extend({
notes: [],
existMore: false,
connection: null,
- connectionId: null
+ connectionId: null,
+ isTop: true
};
},
computed: {
@@ -53,6 +54,8 @@ export default Vue.extend({
this.connection.on('follow', this.onChangeFollowing);
this.connection.on('unfollow', this.onChangeFollowing);
+ window.addEventListener('scroll', this.onScroll);
+
this.fetch();
},
beforeDestroy() {
@@ -95,10 +98,19 @@ export default Vue.extend({
});
},
onNote(note) {
+ if (this.isTop) this.notes.pop();
this.notes.unshift(note);
},
onChangeFollowing() {
this.fetch();
+ },
+ onScroll() {
+ if ((this as any).os.i.clientSettings.fetchOnScroll !== false) {
+ const current = window.scrollY + window.innerHeight;
+ if (current > document.body.offsetHeight - 8) this.more();
+ }
+ if (window.scrollY > 100) this.isTop = false;
+ else this.isTop = true;
}
}
});