/* do version 2.0 pre * creator: kejun (listenpro@gmail.com) * 最新更新:2011-7-12 */(function(a,b){var c={},d={},e={},f={autoload:!0,timeout:6e3,corelib:["http://t.douban.com/js/jquery.min.js"],mods:{}},g=function(){var a=b.getelementsbytagname("script");return a[a.length-1]}(),h=[],i,j=[],k=!1,l={},m={},n=function(a){return a.constructor===array},o=function(a){var b=f.mods,c;typeof a=="string"?c=b[a]?b[a]:{path:a}:c=a;return c},p=function(d,h,i,j){var k,l,m,n,o=function(){c[d]=1,j&&j(d),j=null,a.cleartimeout(k)};if(!!d){if(c[d]){e[d]=!1,j&&j(d);return}if(e[d]){settimeout(function(){p(d,h,i,j)},10);return}e[d]=!0,k=a.settimeout(function(){if(f.timeoutcallback)try{f.timeoutcallback(d)}catch(a){}},f.timeout),m=h||d.tolowercase().substring(d.lastindexof(".")+1),m==="js"?(l=b.createelement("script"),l.setattribute("type","text/javascript"),l.setattribute("src",d),l.setattribute("async",!0)):m==="css"&&(l=b.createelement("link"),l.setattribute("type","text/css"),l.setattribute("rel","stylesheet"),l.setattribute("href",d)),i&&(l.charset=i),m==="css"?(n=new image,n.onerror=function(){o(),n.onerror=null,n=null},n.src=d):(l.onerror=function(){o(),l.onerror=null},l.onload=l.onreadystatechange=function(){var a;if(!this.readystate||this.readystate==="loaded"||this.readystate==="complete")o(),l.onload=l.onreadystatechange=null}),g.parentnode.insertbefore(l,g)}},q=function(a,b){function k(){--j||(d[e]=1,b())}var c=f.mods,e,g,h,i=0,j;e=a.join(""),j=a.length;if(d[e])b();else for(;g=a[i++];)h=o(g),h.requires?q(h.requires,function(a){return function(){p(a.path,a.type,a.charset,k)}}(h)):p(h.path,h.type,h.charset,k)},r=function(b){var c=!1,d=!0,e=a.document,f=e.documentelement,g=e.addeventlistener?"addeventlistener":"attachevent",h=e.addeventlistener?"removeeventlistener":"detachevent",i=e.addeventlistener?"":"on",j=function(d){if(d.type!="readystatechange"||e.readystate=="complete")(d.type=="load"?a:e)[h](i+d.type,j,!1),!c&&(c=!0)&&b.call(a,d.type||d)},k=function(){try{f.doscroll("left")}catch(a){settimeout(k,50);return}j("poll")};if(e.readystate=="complete")b.call(a,"lazy");else{if(e.createeventobject&&f.doscroll){try{d=!a.frameelement}catch(l){}d&&k()}e[g](i+"domcontentloaded",j,!1),e[g](i+"readystatechange",j,!1),a[g](i+"load",j,!1)}},s=function(){var a=0,b;if(j.length)for(;b=j[a++];)t.apply(this,b)},t=function(){var a=[].slice.call(arguments),b,c;if(f.autoload&&!d[f.corelib.join("")])q(f.corelib,function(){t.apply(null,a)});else{if(h.length>0&&!d[h.join("")]){q(h,function(){t.apply(null,a)});return}typeof a[a.length-1]=="function"&&(b=a.pop()),c=a.join("");if((a.length===0||d[c])&&b){b();return}q(a,function(){d[c]=1,b&&b()})}};t.add=function(a,b){!a||!b||!b.path||(f.mods[a]=b)},t.delay=function(){var b=[].slice.call(arguments),c=b.shift();a.settimeout(function(){t.apply(this,b)},c)},t.global=function(){var a=n(arguments[0])?arguments[0]:[].slice.call(arguments);h=h.concat(a)},t.ready=function(){var a=[].slice.call(arguments);if(k)return t.apply(this,a);j.push(a)},t.css=function(a){var c=b.getelementbyid("do-inline-css");c||(c=b.createelement("style"),c.type="text/css",c.id="do-inline-css",g.parentnode.insertbefore(c,g)),c.stylesheet?c.stylesheet.csstext=c.stylesheet.csstext+a:c.appendchild(b.createtextnode(a))},t.setdata=t.setpublicdata=function(a,b){var c=m[a];l[a]=b;if(!!c)while(c.length>0)c.pop().call(this,b)},t.getdata=t.getpublicdata=function(a,b){l[a]?b(l[a]):(m[a]||(m[a]=[]),m[a].push(function(a){b(a)}))},t.setconfig=function(a,b){f[a]=b;return t},t.getconfig=function(a){return f[a]},a.do=t,r(function(){k=!0,s()}),i=g.getattribute("data-cfg-autoload"),i&&(f.autoload=i.tolowercase()==="true"?!0:!1),i=g.getattribute("data-cfg-corelib"),i&&(f.corelib=i.split(","))})(window,document)