check for online/offline users, added custom redis sismembers method, fix for category view not showing up if it has no topics

This commit is contained in:
psychobunny
2013-05-21 17:02:04 -04:00
parent 03fcbcb051
commit ab492f147f
8 changed files with 95 additions and 6 deletions

View File

@@ -278,6 +278,35 @@ var socket,
app.current_room = room;
};
app.process_page = function() {
function populate_online_users() {
var uids = [];
jQuery('.post-row').each(function() {
uids.push(this.getAttribute('data-uid'));
});
socket.emit('api:user.get_online_users', uids);
}
populate_online_users();
}
socket.on('api:user.get_online_users', function(users) {
jQuery('.username-field').each(function() {
var uid = jQuery(this).parents('li').attr('data-uid');
if (uid && jQuery.inArray(uid, users) !== -1) {
jQuery(this).prepend('<i class="icon-circle"></i>');
} else {
jQuery(this).prepend('<i class="icon-circle-blank"></i>');
}
});
});
jQuery('document').ready(function() {
app.enter_room('global');