HACK: hold back on loading more topics for a bit while we are repositioning the page for Safari

This commit is contained in:
Sam 2013-08-20 11:25:01 +10:00
parent 341a28402d
commit d43bd55e5b

View file

@ -228,6 +228,11 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
var info = Discourse.Eyeline.analyze(rows);
if(!info) { return; }
// We disable scrolling of the topic while performing initial positioning
// This code needs to be refactored, the pipline for positioning posts is wack
// Be sure to test on safari as well when playing with this
if(!Discourse.TopicView.disableScroll) {
// are we scrolling upwards?
if(info.top === 0 || info.onScreen[0] === 0 || info.bottom === 0) {
var $body = $('body');
@ -239,6 +244,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
});
});
}
}
// are we scrolling down?
var currentPost;
@ -247,6 +253,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
this.get('postStream').appendMore();
}
// update dock
this.updateDock(Ember.View.views[rows[info.bottom].id]);
@ -352,6 +359,7 @@ Discourse.TopicView.reopenClass({
// Scroll to a given post, if in the DOM. Returns whether it was in the DOM or not.
jumpToPost: function(topicId, postNumber, avoidScrollIfPossible) {
this.disableScroll = true;
Em.run.scheduleOnce('afterRender', function() {
var rows = $('.topic-post.ready');
@ -428,6 +436,8 @@ Discourse.TopicView.reopenClass({
$contents.removeClass('highlighted');
});
}
setTimeout(function(){Discourse.TopicView.disableScroll = false;}, 500);
}
});
}