mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-16 16:27:12 +10:00
8 lines
1.4 KiB
JavaScript
8 lines
1.4 KiB
JavaScript
/*!
|
|
* $script.js v1.3
|
|
* https://github.com/ded/script.js
|
|
* Copyright: @ded & @fat - Dustin Diaz, Jacob Thornton 2011
|
|
* Follow our software http://twitter.com/dedfat
|
|
* License: MIT
|
|
*/
|
|
!function(a,b,c){function u(a,c){var e=b.createElement("script"),f=0;e.onload=e[p]=function(){e[n]&&!!h.test(e[n])||f||(e.onload=e[p]=null,f=1,c())},e.async=1,e.src=a,d.parentNode.insertBefore(e,d)}function r(a,b){q(a,function(a){return!b(a)})}var d=b.getElementsByTagName("script")[0],e={},f={},g={},h=/^i|c/,i={},j="string",k=!1,l="push",m="DOMContentLoaded",n="readyState",o="addEventListener",p="onreadystatechange",q=function(a,b){for(var c=0,d=a.length;c<d;++c)if(!b(a[c]))return 0;return 1};!b[n]&&b[o]&&(b[o](m,function s(){b.removeEventListener(m,s,k),b[n]="complete"},k),b[n]="loading");var t=function(a,b,d){function o(){if(!--m){e[k]=1,j&&j();for(var a in g)q(a.split("|"),n)&&!r(g[a],n)&&(g[a]=[])}}function n(a){return a.call?a():e[a]}a=a[l]?a:[a];var h=b&&b.call,j=h?b:d,k=h?a.join(""):b,m=a.length;c(function(){r(a,function(a){i[a]?(k&&(f[k]=1),o()):(i[a]=1,k&&(f[k]=1),u(t.path?t.path+a+".js":a,o))})},0);return t};t.get=u,t.ready=function(a,b,c){a=a[l]?a:[a];var d=[];!r(a,function(a){e[a]||d[l](a)})&&q(a,function(a){return e[a]})?b():!function(a){g[a]=g[a]||[],g[a][l](b),c&&c(d)}(a.join("|"));return t};var v=a.$script;t.noConflict=function(){a.$script=v;return this},typeof module!="undefined"&&module.exports?module.exports=t:a.$script=t}(this,document,setTimeout) |