From caaede7e847f5a1933c957d7dc7ecb3b61e60994 Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Tue, 3 Sep 2013 12:18:26 -0400 Subject: [PATCH] added loading spinner to topic.tpl --- public/src/app.js | 9 ++++++++- public/templates/topic.tpl | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/public/src/app.js b/public/src/app.js index a462e53b6f..2604f78608 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -353,15 +353,22 @@ var socket, if(app.infiniteLoaderActive) return; app.infiniteLoaderActive = true; + + if($('#loading-indicator').attr('done') === '0') + $('#loading-indicator').removeClass('hide'); + socket.emit('api:topic.loadMore', { tid: tid, after: document.querySelectorAll('#post-container li[data-pid]').length }, function(data) { app.infiniteLoaderActive = false; if(data.posts.length) { + $('#loading-indicator').attr('done', '0'); app.createNewPosts(data); + } else { + $('#loading-indicator').attr('done', '1'); } - + $('#loading-indicator').addClass('hide'); if(callback) callback(data.posts); }); diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 7a3aa20b8e..f7f829b6bb 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -142,6 +142,9 @@ +
+ +