pjax-base-min.js revision 18b15b90c6c4350ea262aa08b9fc735459722866
YUI.add("pjax-base",function(e){var c=e.config.win,d=e.ClassNameManager.getClassName("pjax"),a="navigate";function b(){}b.prototype={_resolved:{},_regexUrl:/^((?:([^:]+):(?:\/\/)?|\/\/)[^\/]*)?([^?#]*)(.*)$/i,initializer:function(){this.publish(a,{defaultFn:this._defNavigateFn});this._pjaxBindUI();},destructor:function(){this._pjaxEvents&&this._pjaxEvents.detach();},navigate:function(g,f){f||(f={});f.url=g;this.fire(a,f);},_getRoot:function(){var f=(c&&c.location.pathname.split("/"))||[];f.pop();return f.join("/");},_normalizePath:function(o){var l="..",h="/",j,k,n,g,f,m;if(!o){return o;}g=o.split(h);m=[];for(j=0,k=g.length;j<k;++j){f=g[j];if(f===l){m.pop();}else{if(f){m.push(f);}}}n=m.join(h);if(o.charAt(o.length-1)===h){n+=h;}return n;},_pjaxBindUI:function(){if(this.get("html5")){this._pjaxEvents=e.one("body").delegate("click",this._onLinkClick,this.get("linkSelector"),this);}},_resolvePath:function(g,f){f||(f=this._getRoot());if(!g){return f;}if(g.charAt(0)==="/"){return g;}return this._normalizePath(f+"/"+g);},_resolveUrl:function(i){var h=this,g=h._getRoot(),f,k;f=h._resolved[g]||(h._resolved[g]={});k=f[i];if(k){return k;}function j(m,n,l,p,o){if(l&&l.toLowerCase().indexOf("http")!==0){return m;}return(n||"")+h._resolvePath(p,g)+(o||"");}k=f[i]=i.replace(h._regexUrl,j);return k;},_defNavigateFn:function(f){this.save(this._resolveUrl(f.url));if(this.get("scrollToTop")&&e.config.win){setTimeout(function(){e.config.win.scroll(0,0);},1);}},_onLinkClick:function(g){var f=this._resolveUrl(g.currentTarget.get("href"));if(g.button!==1||g.ctrlKey||g.metaKey){return;}if(!this.hasRoute(f)){return;}g.preventDefault();this.navigate(f,{originEvent:g});}};b.ATTRS={linkSelector:{value:"a."+d,writeOnce:"initOnly"},scrollToTop:{value:true}};e.PjaxBase=b;},"@VERSION@",{requires:["classnamemanager","node-event-delegate","router"]});