pjax-base-min.js revision 4106577eb9389768607e9d9a51f614faa6bdb8bc
YUI.add("pjax-base",function(f){var d=f.config.win,b=f.Lang,e=f.ClassNameManager.getClassName("pjax"),a="navigate";function c(){}c.prototype={_regexURL:/^((?:[^\/#?:]+:\/\/|\/\/)[^\/]*)?([^?#]*)(.*)$/,initializer:function(){this.publish(a,{defaultFn:this._defNavigateFn});if(this.get("html5")){this._pjaxBindUI();}},destructor:function(){this._pjaxEvents&&this._pjaxEvents.detach();},navigate:function(h,g){h=this._resolveURL(h);if(this._navigate(h,g)){return true;}if(!this._hasSameOrigin(h)){f.error("Security error: The new URL must be of the same origin as the current URL.");}return false;},_getRoot:function(){var h="/",i=f.getLocation().pathname,g;if(i.charAt(i.length-1)===h){return i;}g=i.split(h);g.pop();return g.join(h)+h;},_navigate:function(h,g){if(!this.hasRoute(h)){return false;}g||(g={});g.url=h;b.isValue(g.replace)||(g.replace=h===this._getURL());if(this.get("html5")||g.force){this.fire(a,g);}else{if(g.replace){d&&d.location.replace(h);}else{d&&(d.location=h);}}return true;},_normalizePath:function(p){var m="..",g="/",h,l,o,j,k,n;if(!p){return g;}j=p.split(g);n=[];for(h=0,l=j.length;h<l;++h){k=j[h];if(k===m){n.pop();}else{if(k){n.push(k);}}}o=g+n.join(g);if(o!==g&&p.charAt(p.length-1)===g){o+=g;}return o;},_pjaxBindUI:function(){if(!this._pjaxEvents){this._pjaxEvents=f.one("body").delegate("click",this._onLinkClick,this.get("linkSelector"),this);}},_resolvePath:function(g){if(!g){return this._getPath();}if(g.charAt(0)==="/"){return g;}return this._normalizePath(this._getRoot()+g);},_resolveURL:function(h){var k=h&&h.match(this._regexURL),g,j,i;if(!k){return this._getURL();}g=k[1];j=k[2];i=k[3];if(g){if(g.indexOf("//")===0){g=f.getLocation().protocol+g;}return g+(j||"/")+(i+"");}return this._getOrigin()+this._resolvePath(j)+(i||"");},_defNavigateFn:function(g){this[g.replace?"replace":"save"](g.url);if(d&&this.get("scrollToTop")){setTimeout(function(){d.scroll(0,0);},1);}},_onLinkClick:function(h){var g;if(h.button!==1||h.ctrlKey||h.metaKey){return;}g=h.currentTarget.get("href");g&&this._navigate(g,{originEvent:h})&&h.preventDefault();}};c.ATTRS={linkSelector:{value:"a."+e,writeOnce:"initOnly"},scrollToTop:{value:true}};f.PjaxBase=c;},"@VERSION@",{requires:["classnamemanager","node-event-delegate","router"]});