jsonp-min.js revision 9b7a02e2742bfa28250fb9c71fb520e1ddc150eb
YUI.add("jsonp",function(c){var b=c.Lang.isFunction;function a(){this._init.apply(this,arguments);}a.prototype={_requests:0,_init:function(d,f){this.url=d;f=(b(f))?{on:{success:f}}:f||{};var e=f.on||{};if(!e.success){e.success=this._defaultCallback(d,f);}this._config=c.merge({context:this,args:[],format:this._format,allowCache:false},f,{on:e});},_defaultCallback:function(){},send:function(){var d=this,g=c.Array(arguments,0,true),f=d._config,h=d._proxy||c.guid(),e;if(f.allowCache){d._proxy=h;d._requests++;if(!("_timeouts" in d)){d._timeouts=0;}}g.unshift(d.url,"YUI.Env.JSONP."+h);e=f.format.apply(d,g);if(!f.on.success){return d;}function i(k,j){return(b(k))?function(n){var m=true,l="_requests";if(f.allowCache){if(j){++d._timeouts;--d._requests;}else{if(!d._requests){m=false;l="_timeouts";}--d[l];}}if(!f.allowCache||!d[l]){delete YUI.Env.JSONP[h];}if(m){k.apply(f.context,[n].concat(f.args));}}:null;}YUI.Env.JSONP[h]=i(f.on.success);c.Get.script(e,{onFailure:i(f.on.failure),onTimeout:i(f.on.timeout,true),timeout:f.timeout});return d;},_format:function(d,e){return d.replace(/\{callback\}/,e);}};c.JSONPRequest=a;c.jsonp=function(d,f){var e=new c.JSONPRequest(d,f);return e.send.apply(e,c.Array(arguments,2,true));};if(!YUI.Env.JSONP){YUI.Env.JSONP={};}},"@VERSION@",{requires:["get","oop"]});