1
0

es5-shim.min.js 8.0 KB

12345678910111213141516
  1. (function(q){"function"==typeof define?define(q):"function"==typeof YUI?YUI.add("es5",q):q()})(function(){function q(a){a=+a;a!==a?a=0:0!==a&&(a!==1/0&&a!==-(1/0))&&(a=(0<a||-1)*Math.floor(Math.abs(a)));return a}function t(a){var b=typeof a;return null===a||"undefined"===b||"boolean"===b||"number"===b||"string"===b}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError("Function.prototype.bind called on incompatible "+b);var d=r.call(arguments,
  2. 1),c=function(){if(this instanceof c){var e=b.apply(this,d.concat(r.call(arguments)));return Object(e)===e?e:this}return b.apply(a,d.concat(r.call(arguments)))};b.prototype&&(c.prototype=Object.create(b.prototype));return c});var m=Function.prototype.call,p=Object.prototype,r=Array.prototype.slice,h=m.bind(p.toString),u=m.bind(p.hasOwnProperty);u(p,"__defineGetter__")&&(m.bind(p.__defineGetter__),m.bind(p.__defineSetter__),m.bind(p.__lookupGetter__),m.bind(p.__lookupSetter__));if(2!=[1,2].splice(0).length){var y=
  3. Array.prototype.splice;Array.prototype.splice=function(a,b){return arguments.length?y.apply(this,[void 0===a?0:a,void 0===b?this.length-a:b].concat(r.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(a){return"[object Array]"==h(a)});var m=Object("a"),k="a"!=m[0]||!(0 in m);Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var d=l(this),c=k&&"[object String]"==h(this)?this.split(""):d,e=-1,f=c.length>>>0;if("[object Function]"!=h(a))throw new TypeError;for(;++e<f;)e in c&&
  4. a.call(b,c[e],e,d)});Array.prototype.map||(Array.prototype.map=function(a,b){var d=l(this),c=k&&"[object String]"==h(this)?this.split(""):d,e=c.length>>>0,f=Array(e);if("[object Function]"!=h(a))throw new TypeError(a+" is not a function");for(var g=0;g<e;g++)g in c&&(f[g]=a.call(b,c[g],g,d));return f});Array.prototype.filter||(Array.prototype.filter=function(a,b){var d=l(this),c=k&&"[object String]"==h(this)?this.split(""):d,e=c.length>>>0,f=[],g;if("[object Function]"!=h(a))throw new TypeError(a+
  5. " is not a function");for(var i=0;i<e;i++)i in c&&(g=c[i],a.call(b,g,i,d)&&f.push(g));return f});Array.prototype.every||(Array.prototype.every=function(a,b){var d=l(this),c=k&&"[object String]"==h(this)?this.split(""):d,e=c.length>>>0;if("[object Function]"!=h(a))throw new TypeError(a+" is not a function");for(var f=0;f<e;f++)if(f in c&&!a.call(b,c[f],f,d))return!1;return!0});Array.prototype.some||(Array.prototype.some=function(a,b){var d=l(this),c=k&&"[object String]"==h(this)?this.split(""):d,e=
  6. c.length>>>0;if("[object Function]"!=h(a))throw new TypeError(a+" is not a function");for(var f=0;f<e;f++)if(f in c&&a.call(b,c[f],f,d))return!0;return!1});Array.prototype.reduce||(Array.prototype.reduce=function(a){var b=l(this),d=k&&"[object String]"==h(this)?this.split(""):b,c=d.length>>>0;if("[object Function]"!=h(a))throw new TypeError(a+" is not a function");if(!c&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var e=0,f;if(2<=arguments.length)f=arguments[1];
  7. else{do{if(e in d){f=d[e++];break}if(++e>=c)throw new TypeError("reduce of empty array with no initial value");}while(1)}for(;e<c;e++)e in d&&(f=a.call(void 0,f,d[e],e,b));return f});Array.prototype.reduceRight||(Array.prototype.reduceRight=function(a){var b=l(this),d=k&&"[object String]"==h(this)?this.split(""):b,c=d.length>>>0;if("[object Function]"!=h(a))throw new TypeError(a+" is not a function");if(!c&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");
  8. var e,c=c-1;if(2<=arguments.length)e=arguments[1];else{do{if(c in d){e=d[c--];break}if(0>--c)throw new TypeError("reduceRight of empty array with no initial value");}while(1)}do c in this&&(e=a.call(void 0,e,d[c],c,b));while(c--);return e});if(!Array.prototype.indexOf||-1!=[0,1].indexOf(1,2))Array.prototype.indexOf=function(a){var b=k&&"[object String]"==h(this)?this.split(""):l(this),d=b.length>>>0;if(!d)return-1;var c=0;1<arguments.length&&(c=q(arguments[1]));for(c=0<=c?c:Math.max(0,d+c);c<d;c++)if(c in
  9. b&&b[c]===a)return c;return-1};if(!Array.prototype.lastIndexOf||-1!=[0,1].lastIndexOf(0,-3))Array.prototype.lastIndexOf=function(a){var b=k&&"[object String]"==h(this)?this.split(""):l(this),d=b.length>>>0;if(!d)return-1;var c=d-1;1<arguments.length&&(c=Math.min(c,q(arguments[1])));for(c=0<=c?c:d-Math.abs(c);0<=c;c--)if(c in b&&a===b[c])return c;return-1};if(!Object.keys){var w=!0,x="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),z=x.length,
  10. s;for(s in{toString:null})w=!1;Object.keys=function(a){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.keys called on a non-object");var b=[],d;for(d in a)u(a,d)&&b.push(d);if(w)for(d=0;d<z;d++){var c=x[d];u(a,c)&&b.push(c)}return b}}if(!Date.prototype.toISOString||-1===(new Date(-621987552E5)).toISOString().indexOf("-000001"))Date.prototype.toISOString=function(){var a,b,d,c;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");
  11. c=this.getUTCFullYear();a=this.getUTCMonth();c+=Math.floor(a/12);a=[(a%12+12)%12+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];c=(0>c?"-":9999<c?"+":"")+("00000"+Math.abs(c)).slice(0<=c&&9999>=c?-4:-6);for(b=a.length;b--;)d=a[b],10>d&&(a[b]="0"+d);return c+"-"+a.slice(0,2).join("-")+"T"+a.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"};s=!1;try{s=Date.prototype.toJSON&&null===(new Date(NaN)).toJSON()&&-1!==(new Date(-621987552E5)).toJSON().indexOf("-000001")&&
  12. Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(G){}s||(Date.prototype.toJSON=function(){var a=Object(this),b;a:if(t(a))b=a;else{b=a.valueOf;if("function"===typeof b&&(b=b.call(a),t(b)))break a;b=a.toString;if("function"===typeof b&&(b=b.call(a),t(b)))break a;throw new TypeError;}if("number"===typeof b&&!isFinite(b))return null;b=a.toISOString;if("function"!=typeof b)throw new TypeError("toISOString property is not callable");return b.call(a)});var g=Date,v=function(a,b){var d=
  13. 1<b?1:0;return A[b]+Math.floor((a-1969+d)/4)-Math.floor((a-1901+d)/100)+Math.floor((a-1601+d)/400)+365*(a-1970)},n=function(a,b,d,c,e,f,h){var i=arguments.length;return this instanceof g?(i=1==i&&String(a)===a?new g(n.parse(a)):7<=i?new g(a,b,d,c,e,f,h):6<=i?new g(a,b,d,c,e,f):5<=i?new g(a,b,d,c,e):4<=i?new g(a,b,d,c):3<=i?new g(a,b,d):2<=i?new g(a,b):1<=i?new g(a):new g,i.constructor=n,i):g.apply(this,arguments)},B=RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{3}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),
  14. A=[0,31,59,90,120,151,181,212,243,273,304,334,365],j;for(j in g)n[j]=g[j];n.now=g.now;n.UTC=g.UTC;n.prototype=g.prototype;n.prototype.constructor=Date;n.parse=function(a){var b=B.exec(a);if(b){var d=Number(b[1]),c=Number(b[2]||1)-1,e=Number(b[3]||1)-1,f=Number(b[4]||0),h=Number(b[5]||0),i=Number(b[6]||0),j=Number(b[7]||0),m=!b[4]||b[8]?0:Number(new Date(1970,0)),k="-"===b[9]?1:-1,l=Number(b[10]||0),b=Number(b[11]||0);if(f<(0<h||0<i||0<j?24:25)&&60>h&&60>i&&1E3>j&&-1<c&&12>c&&24>l&&60>b&&-1<e&&e<v(d,
  15. c+1)-v(d,c))if(d=60*(24*(v(d,c)+e)+f+l*k),d=1E3*(60*(d+h+b*k)+i)+j+m,-864E13<=d&&864E13>=d)return d;return NaN}return g.parse.apply(this,arguments)};Date=n;Date.now||(Date.now=function(){return(new Date).getTime()});if("0".split(void 0,0).length){var C=String.prototype.split;String.prototype.split=function(a,b){return void 0===a&&0===b?[]:C.apply(this,arguments)}}if("".substr&&"b"!=="0b".substr(-1)){var D=String.prototype.substr;String.prototype.substr=function(a,b){return D.call(this,0>a?0>(a=this.length+
  16. a)?0:a:a,b)}}j="\t\n\x0B\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";if(!String.prototype.trim||j.trim()){j="["+j+"]";var E=RegExp("^"+j+j+"*"),F=RegExp(j+j+"*$");String.prototype.trim=function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(E,"").replace(F,"")}}var l=function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)}});