From 9b67e114ad9da2b5e0456709affd20d9c760e4ae Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 13 Jun 2013 19:21:45 -0700 Subject: possibly fix skipped pages on endless scroll --- js/main.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index 01aea6b22..f1a50e28a 100644 --- a/js/main.js +++ b/js/main.js @@ -118,6 +118,7 @@ var scroll_next = false; var next_page = 1; var page_load = true; + var loadingPage = false; $(function() { $.ajaxSetup({cache: false}); @@ -395,6 +396,10 @@ function updateConvItems(mode,data) { // $("div.wall-item-body").divgrow({ initialHeight: 400 }); } }); + + if(loadingPage) { + loadingPage = false; + } } if(mode === 'replace') { // clear existing content @@ -916,6 +921,7 @@ $(".autotime").timeago(); } + $(window).scroll(function () { if(typeof buildCmd == 'function') { $('#more').hide(); @@ -927,12 +933,15 @@ $(window).scroll(function () { } if($(window).scrollTop() + $(window).height() == $(document).height()) { - $('#more').hide(); - $('#no-more').hide(); - // alert('scroll'); - next_page++; - scroll_next = true; - liveUpdate(); + if(! loadingPage) { + $('#more').hide(); + $('#no-more').hide(); + // alert('scroll'); + next_page++; + scroll_next = true; + loadingPage = true; + liveUpdate(); + } } } -- cgit v1.2.3