mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
Fix getComputedStyle for ie8
This commit is contained in:
parent
89668464a1
commit
72ff0b43e5
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "datetimepicker",
|
"name": "datetimepicker",
|
||||||
"version": "2.4.4",
|
"version": "2.4.5",
|
||||||
"main": [
|
"main": [
|
||||||
"jquery.datetimepicker.js",
|
"jquery.datetimepicker.js",
|
||||||
"jquery.datetimepicker.css"
|
"jquery.datetimepicker.css"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "datetimepicker",
|
"name": "datetimepicker",
|
||||||
"version": "2.4.4",
|
"version": "2.4.5",
|
||||||
"title": "jQuery Date and Time picker",
|
"title": "jQuery Date and Time picker",
|
||||||
"description": "jQuery plugin for date, time, or datetime manipulation in form",
|
"description": "jQuery plugin for date, time, or datetime manipulation in form",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @preserve jQuery DateTimePicker plugin v2.4.4
|
* @preserve jQuery DateTimePicker plugin v2.4.5
|
||||||
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
||||||
* (c) 2014, Chupurnov Valeriy.
|
* (c) 2014, Chupurnov Valeriy.
|
||||||
*/
|
*/
|
||||||
@ -529,6 +529,24 @@
|
|||||||
showApplyButton: false
|
showApplyButton: false
|
||||||
};
|
};
|
||||||
// fix for ie8
|
// fix for ie8
|
||||||
|
if (!window.getComputedStyle) {
|
||||||
|
window.getComputedStyle = function (el, pseudo) {
|
||||||
|
this.el = el;
|
||||||
|
this.getPropertyValue = function (prop) {
|
||||||
|
var re = /(\-([a-z]){1})/g;
|
||||||
|
if (prop === 'float') {
|
||||||
|
prop = 'styleFloat';
|
||||||
|
}
|
||||||
|
if (re.test(prop)) {
|
||||||
|
prop = prop.replace(re, function (a, b, c) {
|
||||||
|
return c.toUpperCase();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return el.currentStyle[prop] || null;
|
||||||
|
};
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
}
|
||||||
if (!Array.prototype.indexOf) {
|
if (!Array.prototype.indexOf) {
|
||||||
Array.prototype.indexOf = function (obj, start) {
|
Array.prototype.indexOf = function (obj, start) {
|
||||||
var i, j;
|
var i, j;
|
||||||
@ -773,9 +791,15 @@
|
|||||||
timer1 = 0,
|
timer1 = 0,
|
||||||
_xdsoft_datetime;
|
_xdsoft_datetime;
|
||||||
|
|
||||||
if (options.id) datetimepicker.attr('id', options.id);
|
if (options.id) {
|
||||||
if (options.style) datetimepicker.attr('style', options.style);
|
datetimepicker.attr('id', options.id);
|
||||||
if (options.weeks) datetimepicker.addClass('xdsoft_showweeks');
|
}
|
||||||
|
if (options.style) {
|
||||||
|
datetimepicker.attr('style', options.style);
|
||||||
|
}
|
||||||
|
if (options.weeks) {
|
||||||
|
datetimepicker.addClass('xdsoft_showweeks');
|
||||||
|
}
|
||||||
|
|
||||||
datetimepicker.addClass('xdsoft_' + options.theme);
|
datetimepicker.addClass('xdsoft_' + options.theme);
|
||||||
datetimepicker.addClass(options.className);
|
datetimepicker.addClass(options.className);
|
||||||
@ -1347,16 +1371,16 @@
|
|||||||
_xdsoft_datetime.setCurrentTime(0);
|
_xdsoft_datetime.setCurrentTime(0);
|
||||||
datetimepicker.trigger('afterOpen.xdsoft');
|
datetimepicker.trigger('afterOpen.xdsoft');
|
||||||
}).on('dblclick.xdsoft', function () {
|
}).on('dblclick.xdsoft', function () {
|
||||||
var currentDate = _xdsoft_datetime.getCurrentTime();
|
var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
|
||||||
currentDate = new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate());
|
currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
|
||||||
var minDate = _xdsoft_datetime.strToDate(options.minDate);
|
minDate = _xdsoft_datetime.strToDate(options.minDate);
|
||||||
minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
|
minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
|
||||||
if(currentDate < minDate) {
|
if (currentDate < minDate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var maxDate = _xdsoft_datetime.strToDate(options.maxDate);
|
maxDate = _xdsoft_datetime.strToDate(options.maxDate);
|
||||||
maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate());
|
maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
|
||||||
if(currentDate > maxDate) {
|
if (currentDate > maxDate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
input.val(_xdsoft_datetime.str());
|
input.val(_xdsoft_datetime.str());
|
||||||
@ -1579,8 +1603,8 @@
|
|||||||
classes.push('xdsoft_disabled');
|
classes.push('xdsoft_disabled');
|
||||||
}
|
}
|
||||||
if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) {
|
if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) {
|
||||||
classes.push('xdsoft_disabled');
|
classes.push('xdsoft_disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
current_time = new Date(_xdsoft_datetime.currentTime);
|
current_time = new Date(_xdsoft_datetime.currentTime);
|
||||||
current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
|
current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
|
||||||
@ -1794,7 +1818,7 @@
|
|||||||
current_time_index = 0;
|
current_time_index = 0;
|
||||||
|
|
||||||
setPos = function () {
|
setPos = function () {
|
||||||
var offset = datetimepicker.data('input').offset(), top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, position = "absolute";
|
var offset = datetimepicker.data('input').offset(), top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, position = "absolute", node;
|
||||||
if (options.fixed) {
|
if (options.fixed) {
|
||||||
top -= $(window).scrollTop();
|
top -= $(window).scrollTop();
|
||||||
left -= $(window).scrollLeft();
|
left -= $(window).scrollLeft();
|
||||||
@ -1810,14 +1834,15 @@
|
|||||||
left = $(window).width() - datetimepicker[0].offsetWidth;
|
left = $(window).width() - datetimepicker[0].offsetWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var node = datetimepicker[0]
|
|
||||||
|
node = datetimepicker[0];
|
||||||
do {
|
do {
|
||||||
node = node.parentNode;
|
node = node.parentNode;
|
||||||
if(window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) {
|
if (window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) {
|
||||||
left = left - (($(window).width() - node.offsetWidth)/2)
|
left = left - (($(window).width() - node.offsetWidth) / 2);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
} while(node.nodeName != 'HTML')
|
} while (node.nodeName !== 'HTML');
|
||||||
datetimepicker.css({
|
datetimepicker.css({
|
||||||
left: left,
|
left: left,
|
||||||
top: top,
|
top: top,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jquery-datetimepicker",
|
"name": "jquery-datetimepicker",
|
||||||
"version": "2.4.4",
|
"version": "2.4.5",
|
||||||
"description": "jQuery Plugin DateTimePicker it is DatePicker and TimePicker in one",
|
"description": "jQuery Plugin DateTimePicker it is DatePicker and TimePicker in one",
|
||||||
"main": "jquery.datetimepicker.js",
|
"main": "jquery.datetimepicker.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user