aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEv Bogue <ev@evbogue.com>2019-12-10 12:45:48 -0600
committerEv Bogue <ev@evbogue.com>2019-12-10 12:45:48 -0600
commit55989c498fd62a47b47cb033a764fd4dd23ed5a6 (patch)
treec42e6747a4e2c4e72a2e441b5b15067df751178c
parent8bce6804c197299f473776da758273b92c0fef70 (diff)
only load more posts on profile and main feed pages (it was calling bottom of page everywhere and only displaying once you returned)
-rw-r--r--views.js16
1 files 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")
}
}
})