mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 09:25:45 +01:00
fixed #649 - Once you hit the end, infinite loader will stop for good. If infinite loader is active when the browser hits the bottom, updateHeader will not assume 100%.
This commit is contained in:
@@ -957,7 +957,8 @@ define(['composer'], function(composer) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (scrollTop + windowHeight == jQuery(document).height()) {
|
console.log(infiniteLoaderActive);
|
||||||
|
if (scrollTop + windowHeight == jQuery(document).height() && !infiniteLoaderActive) {
|
||||||
pagination.innerHTML = Topic.postCount + ' out of ' + Topic.postCount;
|
pagination.innerHTML = Topic.postCount + ' out of ' + Topic.postCount;
|
||||||
progressBar.width('100%');
|
progressBar.width('100%');
|
||||||
}
|
}
|
||||||
@@ -1099,11 +1100,10 @@ define(['composer'], function(composer) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
infiniteLoaderActive = true;
|
|
||||||
|
|
||||||
if (indicatorEl.attr('done') === '0') {
|
if (indicatorEl.attr('done') === '0') {
|
||||||
|
infiniteLoaderActive = true;
|
||||||
indicatorEl.fadeIn();
|
indicatorEl.fadeIn();
|
||||||
}
|
|
||||||
|
|
||||||
socket.emit('topics.loadMore', {
|
socket.emit('topics.loadMore', {
|
||||||
tid: tid,
|
tid: tid,
|
||||||
@@ -1119,13 +1119,17 @@ define(['composer'], function(composer) {
|
|||||||
createNewPosts(data, true);
|
createNewPosts(data, true);
|
||||||
} else {
|
} else {
|
||||||
indicatorEl.attr('done', '1');
|
indicatorEl.attr('done', '1');
|
||||||
|
updateHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
indicatorEl.fadeOut();
|
indicatorEl.fadeOut();
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(data.posts);
|
callback(data.posts);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Topic;
|
return Topic;
|
||||||
});
|
});
|
||||||
@@ -204,7 +204,9 @@ SocketTopics.loadMore = function(socket, data, callback) {
|
|||||||
end = start + 9;
|
end = start + 9;
|
||||||
|
|
||||||
topics.getTopicPosts(data.tid, start, end, socket.uid, function(err, posts) {
|
topics.getTopicPosts(data.tid, start, end, socket.uid, function(err, posts) {
|
||||||
|
setTimeout(function() {
|
||||||
callback(err, {posts: posts});
|
callback(err, {posts: posts});
|
||||||
|
}, 2500);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user