From 3e2b30ec614bb0e063ccef1f8649e83abfb577d2 Mon Sep 17 00:00:00 2001 From: Ilya Zhitomirskiy Date: Wed, 5 Oct 2011 15:12:16 -0700 Subject: [PATCH] passing the server time to help intiate the infinite scrolling --- app/views/aspects/_aspect_stream.haml | 2 +- public/javascripts/widgets/infinite-scroll.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/aspects/_aspect_stream.haml b/app/views/aspects/_aspect_stream.haml index 08954106b..c86ae06dc 100644 --- a/app/views/aspects/_aspect_stream.haml +++ b/app/views/aspects/_aspect_stream.haml @@ -19,7 +19,7 @@ - if current_user.contacts.size < 2 = render 'aspects/no_contacts_message' -#main_stream.stream{:data => {:guids => stream.aspect_ids.join(',')}} +#main_stream.stream{:data => {:guids => stream.aspect_ids.join(','), :time_for_scroll => time_for_scroll(stream.ajax_stream?, stream)}} - if !stream.ajax_stream? && stream.posts.length > 0 = render 'shared/stream', :posts => stream.posts #pagination diff --git a/public/javascripts/widgets/infinite-scroll.js b/public/javascripts/widgets/infinite-scroll.js index 36ca113c5..6c3511642 100644 --- a/public/javascripts/widgets/infinite-scroll.js +++ b/public/javascripts/widgets/infinite-scroll.js @@ -20,9 +20,7 @@ lastTime = $('#main_stream .stream_element').last().find(".time").attr("integer"); if(lastTime === undefined){ - var currentTime = new Date, - unixtimeMs = currentTime.getTime(), - lastTime = parseInt(unixtimeMs / 1000); + lastTime = $('#main_stream').data('time_for_scroll'); } return newPath.replace(/max_time=\d+/, "max_time=" + lastTime);