@ -26,30 +26,28 @@ var ajaxify = {};
ajaxify . go = function ( url , callback ) {
// leave room and join global
if ( current _room != 'global' ) {
socket . emit ( 'event:enter_room' , 'global' ) ;
current _room = 'global' ;
}
app . enter _room ( 'global' ) ;
var url = url . replace ( /\/$/ , "" ) ;
var tpl _url = ( url === '' || url === '/' ) ? 'home' : url . split ( '/' ) [ 0 ] ;
if ( templates [ tpl _url ] ) {
window . history . pushState ( { } , url , "/" + url ) ;
jQuery ( '#content, #footer' ) . fadeOut ( 100 ) ;
load _template ( function ( ) {
exec _body _scripts ( content ) ;
ajaxify . enable ( ) ;
if ( callback ) {
callback ( ) ;
}
jQuery ( '#content, #footer' ) . fadeIn ( 200 ) ;
jQuery ( '#content, #footer' ) . fadeOut ( 100 , function ( ) {
load _template ( function ( ) {
exec _body _scripts ( content ) ;
ajaxify . enable ( ) ;
if ( callback ) {
callback ( ) ;
}
jQuery ( '#content, #footer' ) . fadeIn ( 250 ) ;
} ) ;
} ) ;
return true ;
}
@ -62,7 +60,6 @@ var ajaxify = {};
ajaxify . onclick = function ( ev ) {
if ( this . href == window . location . href + "#" ) return ;
console . log ( this . href ) ;
var url = this . href . replace ( rootUrl + '/' , '' ) ;
if ( ajaxify . go ( url ) ) {