aboutsummaryrefslogtreecommitdiff
path: root/src/components/timeline
diff options
context:
space:
mode:
authorShpuld Shpuldson <shpuld@gmail.com>2017-06-19 11:32:40 +0300
committerShpuld Shpuldson <shpuld@gmail.com>2017-06-19 11:32:40 +0300
commit3785a863cb27af18fe91403189eff16f662dc2d0 (patch)
treeff1ee977f74e9516fec4ca0691b017ce6f7867ff /src/components/timeline
parent143aa3b990c0e0fac98c4a097d68e9f7518f1940 (diff)
parent8e5d17a659b157f095ad3850ac3cdd2e537ac38b (diff)
Update branch and fix conflicts.
Diffstat (limited to 'src/components/timeline')
-rw-r--r--src/components/timeline/timeline.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
index d5a9adcc..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 }
@@ -20,11 +21,14 @@ const Timeline = {
const credentials = store.state.users.currentUser.credentials
const showImmediately = this.timeline.visibleStatuses.length === 0
+ window.onscroll = this.scrollLoad
+
timelineFetcher.fetchAndUpdate({
store,
credentials,
timeline: this.timelineName,
- showImmediately
+ showImmediately,
+ userId: this.userId
})
},
methods: {
@@ -40,8 +44,15 @@ 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) {
+ 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()
+ }
}
}
}