|
|
@ -353,15 +353,22 @@ var socket,
|
|
|
|
if(app.infiniteLoaderActive)
|
|
|
|
if(app.infiniteLoaderActive)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
app.infiniteLoaderActive = true;
|
|
|
|
app.infiniteLoaderActive = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($('#loading-indicator').attr('done') === '0')
|
|
|
|
|
|
|
|
$('#loading-indicator').removeClass('hide');
|
|
|
|
|
|
|
|
|
|
|
|
socket.emit('api:topic.loadMore', {
|
|
|
|
socket.emit('api:topic.loadMore', {
|
|
|
|
tid: tid,
|
|
|
|
tid: tid,
|
|
|
|
after: document.querySelectorAll('#post-container li[data-pid]').length
|
|
|
|
after: document.querySelectorAll('#post-container li[data-pid]').length
|
|
|
|
}, function(data) {
|
|
|
|
}, function(data) {
|
|
|
|
app.infiniteLoaderActive = false;
|
|
|
|
app.infiniteLoaderActive = false;
|
|
|
|
if(data.posts.length) {
|
|
|
|
if(data.posts.length) {
|
|
|
|
|
|
|
|
$('#loading-indicator').attr('done', '0');
|
|
|
|
app.createNewPosts(data);
|
|
|
|
app.createNewPosts(data);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$('#loading-indicator').attr('done', '1');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#loading-indicator').addClass('hide');
|
|
|
|
if(callback)
|
|
|
|
if(callback)
|
|
|
|
callback(data.posts);
|
|
|
|
callback(data.posts);
|
|
|
|
});
|
|
|
|
});
|
|
|
|