Browse Source

Merge pull request #315 in ~GUY/fineui from ~WINDY/fineui:master to master

* commit '879cff57fe04fe560ad64817cab0048a6e6e365b':
  IE8兼容
es6
windy 7 years ago
parent
commit
29bbd5903b
  1. 82
      dist/bundle.js
  2. 82
      dist/core.js
  3. 112
      dist/fineui.js
  4. 30
      dist/polyfill.js
  5. 82
      src/core/proto/date.js
  6. 29
      src/polyfill/function.js

82
dist/bundle.js vendored

@ -21315,7 +21315,46 @@ Date.parseDateTime = function (str, fmt) {
};
Date.getDate = function () {
var dt = new (Function.prototype.bind.apply(Date, BI.concat([null], [].slice.apply(arguments))))();
var length = arguments.length;
var args = arguments;
var dt;
switch (length) {
// new Date()
case 0:
dt = new Date();
break;
// new Date(long)
case 1:
dt = new Date(args[0]);
break;
// new Date(year, month)
case 2:
dt = new Date(args[0], args[1]);
break;
// new Date(year, month, day)
case 3:
dt = new Date(args[0], args[1], args[2]);
break;
// new Date(year, month, day, hour)
case 4:
dt = new Date(args[0], args[1], args[2], args[3]);
break;
// new Date(year, month, day, hour, minute)
case 5:
dt = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
// new Date(year, month, day, hour, minute, second)
case 6:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
// new Date(year, month, day, hour, minute, second, millisecond)
case 7:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
break;
default:
dt = new Date();
break;
}
if(BI.isNotNull(Date.timeZone) && (arguments.length === 0 || (arguments.length === 1 && BI.isNumber(arguments[0])))) {
var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; // 获得当地时间偏移的毫秒数
@ -21327,7 +21366,46 @@ Date.getDate = function () {
};
Date.getTime = function () {
var dt = Function.prototype.bind.apply(Date.getDate, BI.concat([null], [].slice.apply(arguments)))();
var length = arguments.length;
var args = arguments;
var dt;
switch (length) {
// new Date()
case 0:
dt = new Date();
break;
// new Date(long)
case 1:
dt = new Date(args[0]);
break;
// new Date(year, month)
case 2:
dt = new Date(args[0], args[1]);
break;
// new Date(year, month, day)
case 3:
dt = new Date(args[0], args[1], args[2]);
break;
// new Date(year, month, day, hour)
case 4:
dt = new Date(args[0], args[1], args[2], args[3]);
break;
// new Date(year, month, day, hour, minute)
case 5:
dt = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
// new Date(year, month, day, hour, minute, second)
case 6:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
// new Date(year, month, day, hour, minute, second, millisecond)
case 7:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
break;
default:
dt = new Date();
break;
}
if(BI.isNotNull(Date.timeZone)) {
return dt.getTime() - Date.timeZone - dt.getTimezoneOffset() * 60000;
}

82
dist/core.js vendored

@ -21315,7 +21315,46 @@ Date.parseDateTime = function (str, fmt) {
};
Date.getDate = function () {
var dt = new (Function.prototype.bind.apply(Date, BI.concat([null], [].slice.apply(arguments))))();
var length = arguments.length;
var args = arguments;
var dt;
switch (length) {
// new Date()
case 0:
dt = new Date();
break;
// new Date(long)
case 1:
dt = new Date(args[0]);
break;
// new Date(year, month)
case 2:
dt = new Date(args[0], args[1]);
break;
// new Date(year, month, day)
case 3:
dt = new Date(args[0], args[1], args[2]);
break;
// new Date(year, month, day, hour)
case 4:
dt = new Date(args[0], args[1], args[2], args[3]);
break;
// new Date(year, month, day, hour, minute)
case 5:
dt = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
// new Date(year, month, day, hour, minute, second)
case 6:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
// new Date(year, month, day, hour, minute, second, millisecond)
case 7:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
break;
default:
dt = new Date();
break;
}
if(BI.isNotNull(Date.timeZone) && (arguments.length === 0 || (arguments.length === 1 && BI.isNumber(arguments[0])))) {
var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; // 获得当地时间偏移的毫秒数
@ -21327,7 +21366,46 @@ Date.getDate = function () {
};
Date.getTime = function () {
var dt = Function.prototype.bind.apply(Date.getDate, BI.concat([null], [].slice.apply(arguments)))();
var length = arguments.length;
var args = arguments;
var dt;
switch (length) {
// new Date()
case 0:
dt = new Date();
break;
// new Date(long)
case 1:
dt = new Date(args[0]);
break;
// new Date(year, month)
case 2:
dt = new Date(args[0], args[1]);
break;
// new Date(year, month, day)
case 3:
dt = new Date(args[0], args[1], args[2]);
break;
// new Date(year, month, day, hour)
case 4:
dt = new Date(args[0], args[1], args[2], args[3]);
break;
// new Date(year, month, day, hour, minute)
case 5:
dt = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
// new Date(year, month, day, hour, minute, second)
case 6:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
// new Date(year, month, day, hour, minute, second, millisecond)
case 7:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
break;
default:
dt = new Date();
break;
}
if(BI.isNotNull(Date.timeZone)) {
return dt.getTime() - Date.timeZone - dt.getTimezoneOffset() * 60000;
}

112
dist/fineui.js vendored

@ -106,7 +106,35 @@ window.console = window.console || (function () {
};
return c;
})();
/*
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5
// internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function() {},
fBound = function() {
return fToBind.apply(this instanceof fNOP
? this
: oThis,
// 获取调用时(fBound)的传参.bind 返回的函数入参往往是这么传递的
aArgs.concat(Array.prototype.slice.call(arguments)));
};
// 维护原型关系
if (this.prototype) {
// Function.prototype doesn't have a prototype property
fNOP.prototype = this.prototype;
}
fBound.prototype = new fNOP();
return fBound;
};
}/*
* 前端缓存
*/
window.localStorage || (window.localStorage = {
@ -21488,7 +21516,46 @@ Date.parseDateTime = function (str, fmt) {
};
Date.getDate = function () {
var dt = new (Function.prototype.bind.apply(Date, BI.concat([null], [].slice.apply(arguments))))();
var length = arguments.length;
var args = arguments;
var dt;
switch (length) {
// new Date()
case 0:
dt = new Date();
break;
// new Date(long)
case 1:
dt = new Date(args[0]);
break;
// new Date(year, month)
case 2:
dt = new Date(args[0], args[1]);
break;
// new Date(year, month, day)
case 3:
dt = new Date(args[0], args[1], args[2]);
break;
// new Date(year, month, day, hour)
case 4:
dt = new Date(args[0], args[1], args[2], args[3]);
break;
// new Date(year, month, day, hour, minute)
case 5:
dt = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
// new Date(year, month, day, hour, minute, second)
case 6:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
// new Date(year, month, day, hour, minute, second, millisecond)
case 7:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
break;
default:
dt = new Date();
break;
}
if(BI.isNotNull(Date.timeZone) && (arguments.length === 0 || (arguments.length === 1 && BI.isNumber(arguments[0])))) {
var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; // 获得当地时间偏移的毫秒数
@ -21500,7 +21567,46 @@ Date.getDate = function () {
};
Date.getTime = function () {
var dt = Function.prototype.bind.apply(Date.getDate, BI.concat([null], [].slice.apply(arguments)))();
var length = arguments.length;
var args = arguments;
var dt;
switch (length) {
// new Date()
case 0:
dt = new Date();
break;
// new Date(long)
case 1:
dt = new Date(args[0]);
break;
// new Date(year, month)
case 2:
dt = new Date(args[0], args[1]);
break;
// new Date(year, month, day)
case 3:
dt = new Date(args[0], args[1], args[2]);
break;
// new Date(year, month, day, hour)
case 4:
dt = new Date(args[0], args[1], args[2], args[3]);
break;
// new Date(year, month, day, hour, minute)
case 5:
dt = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
// new Date(year, month, day, hour, minute, second)
case 6:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
// new Date(year, month, day, hour, minute, second, millisecond)
case 7:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
break;
default:
dt = new Date();
break;
}
if(BI.isNotNull(Date.timeZone)) {
return dt.getTime() - Date.timeZone - dt.getTimezoneOffset() * 60000;
}

30
dist/polyfill.js vendored

@ -106,7 +106,35 @@ window.console = window.console || (function () {
};
return c;
})();
/*
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5
// internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function() {},
fBound = function() {
return fToBind.apply(this instanceof fNOP
? this
: oThis,
// 获取调用时(fBound)的传参.bind 返回的函数入参往往是这么传递的
aArgs.concat(Array.prototype.slice.call(arguments)));
};
// 维护原型关系
if (this.prototype) {
// Function.prototype doesn't have a prototype property
fNOP.prototype = this.prototype;
}
fBound.prototype = new fNOP();
return fBound;
};
}/*
* 前端缓存
*/
window.localStorage || (window.localStorage = {

82
src/core/proto/date.js

@ -499,7 +499,46 @@ Date.parseDateTime = function (str, fmt) {
};
Date.getDate = function () {
var dt = new (Function.prototype.bind.apply(Date, BI.concat([null], [].slice.apply(arguments))))();
var length = arguments.length;
var args = arguments;
var dt;
switch (length) {
// new Date()
case 0:
dt = new Date();
break;
// new Date(long)
case 1:
dt = new Date(args[0]);
break;
// new Date(year, month)
case 2:
dt = new Date(args[0], args[1]);
break;
// new Date(year, month, day)
case 3:
dt = new Date(args[0], args[1], args[2]);
break;
// new Date(year, month, day, hour)
case 4:
dt = new Date(args[0], args[1], args[2], args[3]);
break;
// new Date(year, month, day, hour, minute)
case 5:
dt = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
// new Date(year, month, day, hour, minute, second)
case 6:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
// new Date(year, month, day, hour, minute, second, millisecond)
case 7:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
break;
default:
dt = new Date();
break;
}
if(BI.isNotNull(Date.timeZone) && (arguments.length === 0 || (arguments.length === 1 && BI.isNumber(arguments[0])))) {
var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; // 获得当地时间偏移的毫秒数
@ -511,7 +550,46 @@ Date.getDate = function () {
};
Date.getTime = function () {
var dt = Function.prototype.bind.apply(Date.getDate, BI.concat([null], [].slice.apply(arguments)))();
var length = arguments.length;
var args = arguments;
var dt;
switch (length) {
// new Date()
case 0:
dt = new Date();
break;
// new Date(long)
case 1:
dt = new Date(args[0]);
break;
// new Date(year, month)
case 2:
dt = new Date(args[0], args[1]);
break;
// new Date(year, month, day)
case 3:
dt = new Date(args[0], args[1], args[2]);
break;
// new Date(year, month, day, hour)
case 4:
dt = new Date(args[0], args[1], args[2], args[3]);
break;
// new Date(year, month, day, hour, minute)
case 5:
dt = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
// new Date(year, month, day, hour, minute, second)
case 6:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
// new Date(year, month, day, hour, minute, second, millisecond)
case 7:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
break;
default:
dt = new Date();
break;
}
if(BI.isNotNull(Date.timeZone)) {
return dt.getTime() - Date.timeZone - dt.getTimezoneOffset() * 60000;
}

29
src/polyfill/function.js

@ -0,0 +1,29 @@
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5
// internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function() {},
fBound = function() {
return fToBind.apply(this instanceof fNOP
? this
: oThis,
// 获取调用时(fBound)的传参.bind 返回的函数入参往往是这么传递的
aArgs.concat(Array.prototype.slice.call(arguments)));
};
// 维护原型关系
if (this.prototype) {
// Function.prototype doesn't have a prototype property
fNOP.prototype = this.prototype;
}
fBound.prototype = new fNOP();
return fBound;
};
}
Loading…
Cancel
Save