diff --git a/public/src/app.js b/public/src/app.js index 43a00581f8..b7f714f0f0 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -423,14 +423,16 @@ var socket, app.infiniteLoaderActive = false; app.loadMorePosts = function (tid, callback) { + var indicatorEl = $('.loading-indicator'); + if (app.infiniteLoaderActive) { return; } app.infiniteLoaderActive = true; - if ($('#loading-indicator').attr('done') === '0') { - $('#loading-indicator').removeClass('hide'); + if (indicatorEl.attr('done') === '0') { + indicatorEl.fadeIn(); } socket.emit('api:topic.loadMore', { @@ -439,14 +441,15 @@ var socket, }, function (data) { app.infiniteLoaderActive = false; if (data.posts.length) { - $('#loading-indicator').attr('done', '0'); + indicatorEl.attr('done', '0'); app.createNewPosts(data, true); } else { - $('#loading-indicator').attr('done', '1'); + indicatorEl.attr('done', '1'); } - $('#loading-indicator').addClass('hide'); - if (callback) + indicatorEl.fadeOut(); + if (callback) { callback(data.posts); + } }); } diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 343c4a4013..8f8ff6a8c5 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -193,13 +193,11 @@ -