From 55989c498fd62a47b47cb033a764fd4dd23ed5a6 Mon Sep 17 00:00:00 2001 From: Ev Bogue Date: Tue, 10 Dec 2019 12:45:48 -0600 Subject: only load more posts on profile and main feed pages (it was calling bottom of page everywhere and only displaying once you returned) --- views.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/views.js b/views.js index 9ec0af6..1f9aee3 100644 --- a/views.js +++ b/views.js @@ -92,13 +92,11 @@ function profilePage (src, keys) { addPosts(posts, keys).then(done => { index = index + 25 window.onscroll = function(ev) { - if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight) { + if (((window.innerHeight + window.scrollY) >= document.body.scrollHeight) && (window.location.hash.substring(1) === src)) { posts = log.slice(index, index + 25) index = index + 25 - if (src === window.location.hash.substring(1)) { - addPosts(posts, keys) - } - //console.log("Bottom of page"); + addPosts(posts, keys) + console.log("Bottom of page") } } }) @@ -157,13 +155,11 @@ function publicPage (keys) { addPosts(posts, keys).then(done => { index = index + 25 window.onscroll = function(ev) { - if ((window.innerHeight + window.scrollY) >= document.body.scrollHeight) { + if (((window.innerHeight + window.scrollY) >= document.body.scrollHeight) && window.location.hash.substring(1) === '') { posts = log.slice(index, index + 25) index = index + 25 - if ('' === window.location.hash.substring(1)) { - addPosts(posts, keys) - } - //console.log("Bottom of page"); + addPosts(posts, keys) + console.log("Bottom of page") } } }) -- cgit v1.2.3-70-g09d2