only update anon count if on online page

v1.18.x
Baris Soner Usakli 11 years ago
parent fdfe796fe3
commit 6ab5f42ef0

@ -92,15 +92,18 @@ define(function() {
socket.on('user.anonConnect', updateAnonCount) socket.on('user.anonConnect', updateAnonCount)
function updateAnonCount() { function updateAnonCount() {
socket.emit('user.getOnlineAnonCount', {} , function(err, anonCount) { var section = getActiveSection();
if((section.indexOf('online') === 0 || section.indexOf('users') === 0) && !loadingMoreUsers) {
if(parseInt(anonCount, 10) > 0) { socket.emit('user.getOnlineAnonCount', {} , function(err, anonCount) {
$('#users-container .anon-user').removeClass('hide');
$('#online_anon_count').html(anonCount); if(parseInt(anonCount, 10) > 0) {
} else { $('#users-container .anon-user').removeClass('hide');
$('#users-container .anon-user').addClass('hide'); $('#online_anon_count').html(anonCount);
} } else {
}); $('#users-container .anon-user').addClass('hide');
}
});
}
} }
function onUsersLoaded(users, emptyContainer) { function onUsersLoaded(users, emptyContainer) {

Loading…
Cancel
Save