get-min.js revision ea0c5e771ec96e571483d760ab2e4b4a3053cf89
YUI.add("get",function(F){var B=F.UA,A=F.Lang,D="text/javascript",E="text/css",C="stylesheet";F.Get=function(){var M,N,J,L={},K=0,U,W=function(a,X,b){var Y=b||F.config.win,c=Y.document,e=c.createElement(a),Z;for(Z in X){if(X[Z]&&X.hasOwnProperty(Z)){e.setAttribute(Z,X[Z]);}}return e;},T=function(Y,Z,X){var a={id:F.guid(),type:E,rel:C,href:Y};if(X){F.mix(a,X);}return W("link",a,Z);},S=function(Y,Z,X){var a={id:F.guid(),type:D};if(X){F.mix(a,X);}a.src=Y;return W("script",a,Z);},P=function(Y,Z,X){return{tId:Y.tId,win:Y.win,data:Y.data,nodes:Y.nodes,msg:Z,statusText:X,purge:function(){N(this.tId);}};},O=function(b,a,X){var Y=L[b],Z;if(Y&&Y.onEnd){Z=Y.context||Y;Y.onEnd.call(Z,P(Y,a,X));}},V=function(a,Z){var X=L[a],Y;if(X.timer){clearTimeout(X.timer);}if(X.onFailure){Y=X.context||X;X.onFailure.call(Y,P(X,Z));}O(a,Z,"failure");},I=function(a){var X=L[a],Z,Y;if(X.timer){clearTimeout(X.timer);}X.finished=true;if(X.aborted){Z="transaction "+a+" was aborted";V(a,Z);return;}if(X.onSuccess){Y=X.context||X;X.onSuccess.call(Y,P(X));}O(a,Z,"OK");},Q=function(Z){var X=L[Z],Y;if(X.onTimeout){Y=X.context||X;X.onTimeout.call(Y,P(X));}O(Z,"timeout","timeout");},H=function(Z,c){var Y=L[Z],b,i,g,e,a,X,j,f;if(Y.timer){clearTimeout(Y.timer);}if(Y.aborted){b="transaction "+Z+" was aborted";V(Z,b);return;}if(c){Y.url.shift();if(Y.varName){Y.varName.shift();}}else{Y.url=(A.isString(Y.url))?[Y.url]:Y.url;if(Y.varName){Y.varName=(A.isString(Y.varName))?[Y.varName]:Y.varName;}}i=Y.win;g=i.document;e=g.getElementsByTagName("head")[0];if(Y.url.length===0){I(Z);return;}X=Y.url[0];if(!X){Y.url.shift();return H(Z);}if(Y.timeout){Y.timer=setTimeout(function(){Q(Z);},Y.timeout);}if(Y.type==="script"){a=S(X,i,Y.attributes);}else{a=T(X,i,Y.attributes);}J(Y.type,a,Z,X,i,Y.url.length);Y.nodes.push(a);f=Y.insertBefore||g.getElementsByTagName("base")[0];if(f){j=M(f,Z);if(j){j.parentNode.insertBefore(a,j);}}else{e.appendChild(a);}if((B.webkit||B.gecko)&&Y.type==="css"){H(Z,X);}},G=function(){if(U){return;}U=true;var X,Y;for(X in L){if(L.hasOwnProperty(X)){Y=L[X];if(Y.autopurge&&Y.finished){N(Y.tId);delete L[X];}}}U=false;},R=function(Y,X,Z){Z=Z||{};var c="q"+(K++),a,b=Z.purgethreshold||F.Get.PURGE_THRESH;if(K%b===0){G();}L[c]=F.merge(Z,{tId:c,type:Y,url:X,finished:false,nodes:[]});a=L[c];a.win=a.win||F.config.win;a.context=a.context||a;a.autopurge=("autopurge" in a)?a.autopurge:(Y==="script")?true:false;a.attributes=a.attributes||{};a.attributes.charset=Z.charset||a.attributes.charset||"utf-8";H(c);return{tId:c};};J=function(Z,e,d,Y,c,b,X){var a=X||H;if(B.ie){e.onreadystatechange=function(){var f=this.readyState;if("loaded"===f||"complete"===f){e.onreadystatechange=null;a(d,Y);}};}else{if(B.webkit){if(Z==="script"){e.addEventListener("load",function(){a(d,Y);});}}else{e.onload=function(){a(d,Y);};e.onerror=function(f){V(d,f+": "+Y);};}}};M=function(X,a){var Y=L[a],Z=(A.isString(X))?Y.win.document.getElementById(X):X;if(!Z){V(a,"target node not found: "+X);}return Z;};N=function(c){var Y,a,j,e,k,b,Z,g,f,X=L[c];if(X){Y=X.nodes;a=Y.length;j=X.win.document;e=j.getElementsByTagName("head")[0];f=X.insertBefore||j.getElementsByTagName("base")[0];if(f){k=M(f,c);if(k){e=k.parentNode;}}for(b=0;b<a;b=b+1){Z=Y[b];if(Z.clearAttributes){Z.clearAttributes();}else{for(g in Z){if(Z.hasOwnProperty(g)){delete Z[g];}}}e.removeChild(Z);}}X.nodes=[];};return{PURGE_THRESH:20,_finalize:function(X){setTimeout(function(){I(X);},0);},abort:function(Y){var Z=(A.isString(Y))?Y:Y.tId,X=L[Z];if(X){X.aborted=true;}},script:function(X,Y){return R("script",X,Y);},css:function(X,Y){return R("css",X,Y);}};}();},"@VERSION@",{requires:["yui-base"]});