added flag to empty container

v1.18.x
Baris Usakli 11 years ago
parent b3f73eace1
commit 95ee7fb49f

@ -83,18 +83,20 @@ define(function() {
socket.on('api:user.isOnline', function(data) {
if(getActiveSection() == 'online' && !loadingMoreUsers) {
loadingMoreUsers = true;
$('#users-inner-container').empty();
startLoading('users:online', 0);
startLoading('users:online', 0, true);
socket.emit('api:user.getOnlineAnonCount', {} , function(anonCount) {
$('#online_anon_count').html(anonCount);
});
}
});
function onUsersLoaded(users) {
function onUsersLoaded(users, emptyContainer) {
var html = templates.prepare(templates['users'].blocks['users']).parse({
users: users
});
if(emptyContainer)
$('#users-inner-container').empty();
$('#users-inner-container').append(html);
}
@ -115,14 +117,14 @@ define(function() {
}
}
function startLoading(set, after) {
function startLoading(set, after, emptyContainer) {
loadingMoreUsers = true;
socket.emit('api:users.loadMore', {
set: set,
after: after
}, function(data) {
if (data.users.length) {
onUsersLoaded(data.users);
onUsersLoaded(data.users, emptyContainer);
$('#load-more-users-btn').removeClass('disabled');
} else {
$('#load-more-users-btn').addClass('disabled');

Loading…
Cancel
Save