This commit is contained in:
barisusakli
2014-06-27 15:35:53 -04:00
parent 181613e946
commit a9e5e82431
6 changed files with 60 additions and 23 deletions

View File

@@ -62,7 +62,7 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
handleBookmark(tid);
navigator.init('.posts > .post-row', postCount, Topic.navigatorCallback);
navigator.init('.posts > .post-row', postCount, Topic.navigatorCallback, Topic.toTop, Topic.toBottom);
socket.on('event:new_post', onNewPost);
@@ -74,6 +74,16 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
socket.emit('topics.increaseViewCount', tid);
};
Topic.toTop = function() {
navigator.scrollTop(1);
};
Topic.toBottom = function() {
socket.emit('topics.lastPostIndex', ajaxify.variables.get('topic_id'), function(err, index) {
navigator.scrollBottom(index);
});
};
function handleBookmark(tid) {
var bookmark = localStorage.getItem('topic:' + tid + ':bookmark');
var postIndex = getPostIndex();