@ -1,47 +1,28 @@
( function ( ) {
var num_users = document . getElementById ( 'number_of _users') ,
post_stat s = document . getElementById ( ' post_ stats') ,
latest_user = document . getElementById ( 'latest_user ') ,
active_users = document . getElementById ( ' ac tive_u sers ') ,
var stats_users = document . getElementById ( 'stats _users') ,
stats_topic s = document . getElementById ( ' stats_topic s') ,
stats_posts = document . getElementById ( 'stats_posts ') ,
stats_online = document . getElementById ( ' st ats_onlin e') ,
user _label = document . getElementById ( 'user_label' ) ,
active _record = document . getElementById ( 'active_record' ) ,
right _menu = document . getElementById ( 'right-menu' ) ;
socket . emit ( 'user.count' , { } ) ;
socket . on ( 'user.count' , function ( data ) {
num _users . innerHTML = "We currently have <b>" + data . count + "</b> registered users." ;
stats _users . innerHTML = data . count ;
} ) ;
socket . emit ( 'post.stats' ) ;
socket . on ( 'post.stats' , function ( data ) {
post _stats . innerHTML = "Our users have created <b>" + data . topics + "</b> topics and made <b>" + data . posts + "</b> posts." ;
} ) ;
socket . emit ( 'user.latest' , { } ) ;
socket . on ( 'user.latest' , function ( data ) {
if ( data . username == '' ) {
latest _user . innerHTML = '' ;
} else {
latest _user . innerHTML = "The most recent user to register is <b><a href='/users/" + data . userslug + "'>" + data . username + "</a></b>." ;
}
stats _topics . innerHTML = data . topics ;
stats _posts . innerHTML = data . posts ;
} ) ;
socket . emit ( 'api:user.active.get' ) ;
socket . on ( 'api:user.active.get' , function ( data ) {
var plural _users = parseInt ( data . users ) !== 1 ,
plural _anon = parseInt ( data . anon ) !== 1 ;
active _users . innerHTML = 'There ' + ( plural _users ? 'are' : 'is' ) + ' <strong>' + data . users + '</strong> user' + ( plural _users ? 's' : '' ) + ' and <strong>' + data . anon + '</strong> guest' + ( plural _anon ? 's' : '' ) + ' online' ;
} ) ;
socket . emit ( 'api:user.active.get_record' ) ;
socket . on ( 'api:user.active.get_record' , function ( data ) {
active _record . innerHTML = "most users ever online was <strong>" + data . record + "</strong> on <strong>" + ( new Date ( parseInt ( data . timestamp , 10 ) ) ) . toUTCString ( ) + "</strong>" ;
stats _online . innerHTML = data . users + data . anon ;
} ) ;
socket . emit ( 'api:updateHeader' , { fields : [ 'username' , 'picture' , 'userslug' ] } ) ;
socket . on ( 'api:updateHeader' , function ( data ) {
jQuery ( '#search-button' ) . on ( 'click' , function ( ) {