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