took out userSockets, using io.sockets.clients() now'

This commit is contained in:
Baris Soner Usakli
2014-02-06 16:32:11 -05:00
parent dc592853fc
commit 56cdc86a37
6 changed files with 92 additions and 89 deletions

View File

@@ -81,19 +81,28 @@ define(function() {
});
socket.on('user.isOnline', function(err, data) {
if(getActiveSection().indexOf('online') === 0 && !loadingMoreUsers) {
var section = getActiveSection();
if((section.indexOf('online') === 0 || section.indexOf('users') === 0) && !loadingMoreUsers) {
startLoading('users:online', 0, true);
socket.emit('user.getOnlineAnonCount', {} , function(err, anonCount) {
if(parseInt(anonCount, 10) > 0) {
$('#users-container .anon-user').removeClass('hide');
$('#online_anon_count').html(anonCount);
} else {
$('#users-container .anon-user').addClass('hide');
}
});
updateAnonCount();
}
});
socket.on('user.anonDisconnect', updateAnonCount);
socket.on('user.anonConnect', updateAnonCount)
function updateAnonCount() {
socket.emit('user.getOnlineAnonCount', {} , function(err, anonCount) {
if(parseInt(anonCount, 10) > 0) {
$('#users-container .anon-user').removeClass('hide');
$('#online_anon_count').html(anonCount);
} else {
$('#users-container .anon-user').addClass('hide');
}
});
}
function onUsersLoaded(users, emptyContainer) {
var html = templates.prepare(templates['users'].blocks['users']).parse({
users: users