jsonp-base-min.js revision e7eae9b3ca0194e8c08f10b485269a2cdb28b450
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav GlassYUI.add("jsonp-base",function(D){var A=D.Lang,C=A.isFunction;function B(){this._init.apply(this,arguments);}B._pattern=/\bcallback=(.*?)(?=&|$)/i;B._template="callback={callback}";B.prototype={_init:function(E,G){this.url=E;G=(C(G))?{on:{success:G}}:G||{};var F=G.on||{};if(!F.success){F.success=this._defaultCallback(E,G);}this._config=D.merge({context:this,args:[],format:this._format},G,{on:F});},_defaultCallback:function(G){var F=G.match(B._pattern)||[],E=F[1],H;if(E){E=E.replace(/^Y\./,"");if(/^\w+$/.test(E)){H=D.config.win[E]||D[E];}}return(C(H))?H:function(){};},send:function(I){if(!this._config.on.success){return this;}var G=D.guid().replace(/-/g,"_"),F=this._config,E=F.format.call(this,this.url,"YUI.Env.JSONP."+G);function H(J){return(C(J))?function(K){delete YUI.Env.JSONP[G];J.apply(F.context,[K].concat(F.args));}:null;}YUI.Env.JSONP[G]=H(F.on.success);D.Get.script(E,{onFailure:H(F.on.failure),onTimeout:H(F.on.timeout||F.on.failure),timeout:F.timeout});return this;},_format:function(E,G){var H=B._template.replace(/\{callback\}/,G),F;if(B._pattern.test(E)){return E.replace(B._pattern,H);}else{F=E.slice(-1);if(F!=="&"&&F!=="?"){E+=(E.indexOf("?")>-1)?"&":"?";}return E+H;}}};D.JSONPRequest=B;D.jsonp=function(E,F){return new D.JSONPRequest(E,F).send();};YUI.Env.JSONP={};},"@VERSION@",{requires:["get","oop"]});