Fix mobile infinite scroll

This commit is contained in:
Raphael Sofaer 2011-04-07 15:00:45 -07:00
parent 883ff63ec9
commit d12ec38736
5 changed files with 15 additions and 11 deletions

View file

@ -12,6 +12,7 @@
= link_to t('.post_a_message'), '#publisher_page', :id => 'publisher_button'
#main_stream.stream
= render 'shared/stream', :posts => @posts
#pagination
%a.more-link.paginate{:href => aspects_path(:a_ids => params[:a_ids], :page => params[:page] + 1)}
%h2= t("more")
- content_for :subpages do

View file

@ -14,4 +14,4 @@
.info
%span.time
= t('ago', :time => time_ago_in_words(post.created_at))
= link_to "#{t('comments', :count => post.comments.length)} →", status_message_path(post), :class => 'comment_link right'
= link_to "#{t('comments', :count => post.comments.length)} →", status_message_path(post), :class => 'comment_link right ui-link'

View file

@ -10,15 +10,14 @@ var InfiniteScroll = {
var newPath = pathStr.replace("?", "?only_posts=true&");
return newPath.replace( "page=2", "page=" + nextPage);
},
bufferPx: 300,
bufferPx: 500,
debug: false,
donetext: "no more.",
loadingText: "",
loadingImg: '/images/ajax-loader.gif'
},
postScrollCallback: function(){},
initialize: function(){
$('#main_stream').infinitescroll(InfiniteScroll.options, function() {
Diaspora.widgets.timeago.updateTimeAgo();
});
$('#main_stream').infinitescroll(InfiniteScroll.options, InfiniteScroll.postScrollCallback);
}
}

View file

@ -38,3 +38,7 @@ Diaspora.widgets.add("timeago", function() {
$(selector || this.selector).timeago();
};
});
InfiniteScroll.postScrollCallback = function(){
Diaspora.widgets.timeago.updateTimeAgo();
}

View file

@ -67,7 +67,7 @@ module ActionController
# the user has opted to use either the 'Standard' view or 'Mobile' view.
def set_mobile_format
if is_mobile_device? && !request.xhr?
if is_mobile_device? && ['/','text/html'].include?(request.format)
request.format = session[:mobile_view] == false ? :html : :mobile
session[:mobile_view] = true if session[:mobile_view].nil?
end