mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
only triggering topic infinite loader once a second, fixes #4477
This commit is contained in:
@@ -181,10 +181,13 @@ define('forum/topic/posts', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
Posts.loadMorePosts = function(direction) {
|
Posts.loadMorePosts = function(direction) {
|
||||||
if (!components.get('topic').length || navigator.scrollActive) {
|
if (!components.get('topic').length || navigator.scrollActive || Posts._infiniteScrollTimeout) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Posts._infiniteScrollTimeout = setTimeout(function() {
|
||||||
|
delete Posts._infiniteScrollTimeout;
|
||||||
|
}, 1000);
|
||||||
var replies = components.get('post').not('[data-index=0]').not('.new');
|
var replies = components.get('post').not('[data-index=0]').not('.new');
|
||||||
var afterEl = direction > 0 ? replies.last() : replies.first();
|
var afterEl = direction > 0 ? replies.last() : replies.first();
|
||||||
var after = parseInt(afterEl.attr('data-index'), 10) || 0;
|
var after = parseInt(afterEl.attr('data-index'), 10) || 0;
|
||||||
@@ -204,7 +207,6 @@ define('forum/topic/posts', [
|
|||||||
after: after,
|
after: after,
|
||||||
direction: direction
|
direction: direction
|
||||||
}, function (data, done) {
|
}, function (data, done) {
|
||||||
|
|
||||||
indicatorEl.fadeOut();
|
indicatorEl.fadeOut();
|
||||||
|
|
||||||
if (data && data.posts && data.posts.length) {
|
if (data && data.posts && data.posts.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user