text: (function(a){if(!$("#twitter")[0])return;$("#page-body").addClass("app-loading");var b=a.App;_.extend(b,{baseUrl:window.BASE_URL,UnAuthorized:401,hasLoaded:!1,start:function(){Backbone.history.start({pushState:!0}),this.handleClicks()},handleClicks:function(){$(document.body).click(function(a){console.log("handleClicks",a);var c=$(a.srcElement).data("cmd");if(!c)return;var d=c.split(":"),e=d[0],f=d.length>1?d[1].split(","):[];b.sendCmd(e,f)})},finishedLoading:function(){this.hasLoaded||(this.hasLoaded=!0,$(".app-loading").removeClass("app-loading"),console.log("app finishedLoading..."))},navigate:function(a){this.routes.navigate(a)},route:function(a){var b=_.rest(arguments);console.log("route: "+a,b),this.sendCmd(a,b),this.finishedLoading()},sendCmd:function(a,b){_.isFunction(this.routes[a])&&this.routes[a].apply(this.routes,b),_.each(this.models,function(c){_.isFunction(c[a])&&c[a].apply(c,b)}),_.each(this.views,function(c){_.isFunction(c[a])&&c[a].apply(c,b)})},error:function(a,b,c){console.log("App Error: ",arguments),this.trigger("error",b||a),a.status==this.UnAuthorized&&$.getJSON("api/userinfo",function(a){},function(a){a.status==this.UnAuthorized&&(location.href=location.href)})}}),_.extend(b,Backbone.Events),_.bindAll(b,"error","navigate","sendCmd");var c=new b.Login,d=new b.UserProfile({login:c}),e=new b.Twitter;b.isAuth=function(){return c.get("isAuthenticated")},b.twitterScreenName=function(){return d.get("twitterScreenName")},console.log(c.attributes,d.attributes,e.attributes),b.models={login:c,userProfile:d,twitter:e},_.each(b.models,function(a){a.sendCmd=b.sendCmd,a.navigate=b.navigate}),b.views={login:new b.LoginView({el:"#login",model:c}),register:new b.RegisterView({el:"#register",model:c}),userProfile:new b.UserProfileView({el:"#user-profile",model:d}),twitter:new b.TwitterView({el:"#twitter",model:e})},$(".tabs a:first").tab("show"),$(".dropdown-toggle").dropdown()})(window)