move removeExtra to IS

This commit is contained in:
barisusakli
2015-09-27 15:20:10 -04:00
parent 8c17de4221
commit 6457cd02ab
3 changed files with 39 additions and 63 deletions

View File

@@ -152,7 +152,7 @@ define('forum/topic/posts', [
components.get('topic').append(html);
}
removeExtraPosts(direction);
infinitescroll.removeExtra(components.get('posts'), direction, 40);
html.hide().fadeIn('slow');
@@ -167,23 +167,6 @@ define('forum/topic/posts', [
});
}
function removeExtraPosts(direction) {
var posts = components.get('post');
if (posts.length > 40) {
var removeCount = posts.length - 40;
if (direction > 0) {
var height = $(document).height(),
scrollTop = $(window).scrollTop();
posts.slice(0, removeCount).remove();
$(window).scrollTop(scrollTop + ($(document).height() - height));
} else {
posts.slice(posts.length - removeCount).remove();
}
}
}
function onNewPostsLoaded(html, pids) {
if (app.user.uid) {
socket.emit('posts.getPrivileges', pids, function(err, privileges) {