From 65646c5a125126bca97b0f5bf5f43c9544fd2cb2 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Sat, 3 Jun 2017 18:51:55 +0300 Subject: Add an option to initiate fetching older statuses automatically when scrolled 750 pixels or less from the bottom. --- src/components/timeline/timeline.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/components/timeline/timeline.js') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index d5a9adcc..6070e442 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -20,6 +20,8 @@ const Timeline = { const credentials = store.state.users.currentUser.credentials const showImmediately = this.timeline.visibleStatuses.length === 0 + window.onscroll = this.scrollLoad + timelineFetcher.fetchAndUpdate({ store, credentials, @@ -42,6 +44,11 @@ const Timeline = { older: true, showImmediately: true }).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false })) + }, + scrollLoad (e) { + if (this.timeline.loading === false && this.$store.state.config.autoLoad && (window.innerHeight + window.pageYOffset) >= (document.body.scrollHeight - 750)) { + this.fetchOlderStatuses() + } } } } -- cgit v1.2.3-70-g09d2 From 67452923a5446108ee042f489f906199ebfb531e Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Sat, 3 Jun 2017 19:53:23 +0300 Subject: Hotfix for firefox to prevent loading on every scroll event. --- src/components/timeline/timeline.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/components/timeline/timeline.js') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 6070e442..7aaa81c8 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -46,7 +46,8 @@ const Timeline = { }).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false })) }, scrollLoad (e) { - if (this.timeline.loading === false && this.$store.state.config.autoLoad && (window.innerHeight + window.pageYOffset) >= (document.body.scrollHeight - 750)) { + let height = Math.max(document.body.offsetHeight, document.body.scrollHeight) + if (this.timeline.loading === false && this.$store.state.config.autoLoad && (window.innerHeight + window.pageYOffset) >= (height - 750)) { this.fetchOlderStatuses() } } -- cgit v1.2.3-70-g09d2 From 5328aca1efcdd09089bda9068efca9b940c2f6fa Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Mon, 12 Jun 2017 16:34:41 +0200 Subject: Use userId in timeline. --- src/components/timeline/timeline.js | 9 ++++++--- src/components/user_profile/user_profile.vue | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/components/timeline/timeline.js') diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 7aaa81c8..3dc07f9e 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -6,7 +6,8 @@ const Timeline = { props: [ 'timeline', 'timelineName', - 'title' + 'title', + 'userId' ], computed: { timelineError () { return this.$store.state.statuses.error } @@ -26,7 +27,8 @@ const Timeline = { store, credentials, timeline: this.timelineName, - showImmediately + showImmediately, + userId: this.userId }) }, methods: { @@ -42,7 +44,8 @@ const Timeline = { credentials, timeline: this.timelineName, older: true, - showImmediately: true + showImmediately: true, + userId: this.userId }).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false })) }, scrollLoad (e) { diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 0765b01c..9241c469 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -3,7 +3,7 @@ - + -- cgit v1.2.3-70-g09d2