mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
added loading spinner to topic.tpl
This commit is contained in:
@@ -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);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -142,6 +142,9 @@
|
|||||||
</li>
|
</li>
|
||||||
<!-- END posts -->
|
<!-- END posts -->
|
||||||
</ul>
|
</ul>
|
||||||
|
<div id="loading-indicator" style="text-align:center;" class="hide" done="0">
|
||||||
|
<i class="icon-spinner icon-spin icon-large"></i>
|
||||||
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="topic-main-buttons">
|
<div class="topic-main-buttons">
|
||||||
<button id="post_reply" class="btn btn-primary btn-lg post_reply" type="button">Reply</button>
|
<button id="post_reply" class="btn btn-primary btn-lg post_reply" type="button">Reply</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user