-
Notifications
You must be signed in to change notification settings - Fork 0
/
req.js
2 lines (2 loc) · 1.97 KB
/
req.js
1
2
/* Req.js v1.0 - MIT/GPL Licensed - More info: http://mar.anomynet/entries/2009/10/20/23.39.22/ @preserve */
(!window.Req||!window.Req.assets)&&!function(e,t){var n,r,s,a,i,l,f=[],o="onreadystatechange",c="onload",u=function(e){for(var t,n=g.assets,r=g.fixUrl,s=[],a=0,i=e.length;i>a;a++){var l=e[a];if("function"==typeof l)s.push(l);else if(l&&l!==!0&&(l.charAt?(t=l,l=n[t]||(n[t]=n[r(t)]||{src:t})):(t=l.id||l.src,n[t]=n[t]||l),!l._seen&&!l._loaded)){var f=l.req;l._seen=1,l._normalized||(l._normalized=1,l.src&&(l.src=r(l.src),n[l.src]=l),f&&f.charAt&&(l.req=[f])),f&&s.push.apply(s,u(l.req)),s.push(l)}}return s},d=[],h=function(){var e,t=d.length;if(t>=g.joinLim){for(var n=[];t--;)d[t].src&&n.unshift(g.getJoinStub(d[t]));e={src:i.replace(l,n.join(g.joint||"")),_loads:d},d=[]}else e=d.shift(),e._buffered=1;return e},p=function(){if(n=!(!f.length&&!d.length)){var a=f.shift()||h();if("function"==typeof a&&(d.length?(f.unshift(a),a=h()):(a(),a=e)),a&&!a._loaded)if(a.check&&a.check())d.length&&a[c]?f.unshift(h(),a):(a._loaded=1,a[c]&&(a[c](),a[c]=e));else if(a.join!==!0&&a.src||a._buffered){if(d.length&&!a._buffered&&(f.unshift(a),a=h()),a.src){var i=t.createElement("script"),l=a.charset||g.charset;return l&&(i.charset=l),i.src=a.src,i[c]=i[o]=function(){if(!i.readyState||/^(loaded|complete)$/.test(i.readyState)){i[o]=i[c]=e;for(var t,n=a._loads||[a],r=0;t=n[r];r++)t._loaded=1,t[c]&&t[c](),t[c]=e;p()}},void(s?r.insertBefore(i,s):r.appendChild(i))}a._loaded=1}else d.push(a);p()}},g=Req=function(e){l||(l=g.urlToken||"%{s}",a=g.baseUrl||l,a+=a.indexOf(l)>-1?"":l,i=g.joinUrl||l,i+=i.indexOf(l)>-1?"":l,r=r||t.getElementsByTagName("head")[0],s=s||r.getElementsByTagName("base")[0]);for(var o=u([].slice.call(arguments,0)),c=o.length;c--;)delete o[c]._seen;f[e===!0?"push":"unshift"].apply(f,o),setTimeout(function(){n||p()},0)};g.joinLim=1,g.fixUrl=function(e){return/^(\.?\/|https?:)/.test(e)?e:a.replace(l,e)},g.getJoinStub=function(e){return e.src.replace(a.split(l)[0],"")},g.assets={}}(null,document);