mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
Fix karma config
This commit is contained in:
parent
b11add5663
commit
2b6edfc633
@ -700,7 +700,7 @@ var datetimepickerFactory = function ($) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
// for locale settings
|
// for locale settings
|
||||||
$.datetimepicker = {
|
$.datetimepicker = {
|
||||||
@ -735,12 +735,11 @@ var datetimepickerFactory = function ($) {
|
|||||||
RFC_1123: 'D, d M Y H:i:s O',
|
RFC_1123: 'D, d M Y H:i:s O',
|
||||||
RSS: 'D, d M Y H:i:s O',
|
RSS: 'D, d M Y H:i:s O',
|
||||||
W3C: 'Y-m-d\TH:i:sP'
|
W3C: 'Y-m-d\TH:i:sP'
|
||||||
};
|
}
|
||||||
|
|
||||||
var isFormatStandard = function(format){
|
var isFormatStandard = function(format){
|
||||||
return $.map(standardFormats, function (val) { return val })
|
return Object.values(standardFormats).indexOf(format) === -1 ? false : true;
|
||||||
.indexOf(format) === -1 ? false : true;
|
}
|
||||||
};
|
|
||||||
|
|
||||||
$.extend($.datetimepicker, standardFormats);
|
$.extend($.datetimepicker, standardFormats);
|
||||||
|
|
||||||
@ -906,7 +905,7 @@ var datetimepickerFactory = function ($) {
|
|||||||
timeboxparent.on('mousewheel', function (event) {
|
timeboxparent.on('mousewheel', function (event) {
|
||||||
var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
|
var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
|
||||||
|
|
||||||
top = top + (event.originalEvent.deltaY * 20);
|
top = top - (event.deltaY * 20);
|
||||||
if (top < 0) {
|
if (top < 0) {
|
||||||
top = 0;
|
top = 0;
|
||||||
}
|
}
|
||||||
@ -945,6 +944,7 @@ var datetimepickerFactory = function ($) {
|
|||||||
_KEY0 = 96,
|
_KEY0 = 96,
|
||||||
_KEY9 = 105,
|
_KEY9 = 105,
|
||||||
CTRLKEY = 17,
|
CTRLKEY = 17,
|
||||||
|
CMDKEY = 91,
|
||||||
DEL = 46,
|
DEL = 46,
|
||||||
ENTER = 13,
|
ENTER = 13,
|
||||||
ESC = 27,
|
ESC = 27,
|
||||||
@ -961,7 +961,7 @@ var datetimepickerFactory = function ($) {
|
|||||||
ZKEY = 90,
|
ZKEY = 90,
|
||||||
YKEY = 89,
|
YKEY = 89,
|
||||||
ctrlDown = false,
|
ctrlDown = false,
|
||||||
isClosed = false,
|
cmdDown = false,
|
||||||
options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
|
options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
|
||||||
|
|
||||||
lazyInitTimer = 0,
|
lazyInitTimer = 0,
|
||||||
@ -1078,7 +1078,7 @@ var datetimepickerFactory = function ($) {
|
|||||||
if(distance > options.touchMovedThreshold) {
|
if(distance > options.touchMovedThreshold) {
|
||||||
this.touchMoved = true;
|
this.touchMoved = true;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
month_picker
|
month_picker
|
||||||
.find('.xdsoft_select')
|
.find('.xdsoft_select')
|
||||||
@ -2243,7 +2243,6 @@ var datetimepickerFactory = function ($) {
|
|||||||
datetimepicker
|
datetimepicker
|
||||||
.on('open.xdsoft', function (event) {
|
.on('open.xdsoft', function (event) {
|
||||||
var onShow = true;
|
var onShow = true;
|
||||||
isClosed = false;
|
|
||||||
if (options.onShow && $.isFunction(options.onShow)) {
|
if (options.onShow && $.isFunction(options.onShow)) {
|
||||||
onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
|
onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
|
||||||
}
|
}
|
||||||
@ -2264,12 +2263,6 @@ var datetimepickerFactory = function ($) {
|
|||||||
})
|
})
|
||||||
.on('close.xdsoft', function (event) {
|
.on('close.xdsoft', function (event) {
|
||||||
var onClose = true;
|
var onClose = true;
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
if (isClosed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
month_picker
|
month_picker
|
||||||
.find('.xdsoft_month,.xdsoft_year')
|
.find('.xdsoft_month,.xdsoft_year')
|
||||||
.find('.xdsoft_select')
|
.find('.xdsoft_select')
|
||||||
@ -2280,7 +2273,7 @@ var datetimepickerFactory = function ($) {
|
|||||||
if (onClose !== false && !options.opened && !options.inline) {
|
if (onClose !== false && !options.opened && !options.inline) {
|
||||||
datetimepicker.hide();
|
datetimepicker.hide();
|
||||||
}
|
}
|
||||||
isClosed = true;
|
event.stopPropagation();
|
||||||
})
|
})
|
||||||
.on('toggle.xdsoft', function () {
|
.on('toggle.xdsoft', function () {
|
||||||
if (datetimepicker.is(':visible')) {
|
if (datetimepicker.is(':visible')) {
|
||||||
@ -2396,7 +2389,7 @@ var datetimepickerFactory = function ($) {
|
|||||||
setCaretPos(input[0], 0);
|
setCaretPos(input[0], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
input.off('paste.xdsoft').on('paste.xdsoft', function (event) {
|
input.on('paste.xdsoft', function (event) {
|
||||||
// couple options here
|
// couple options here
|
||||||
// 1. return false - tell them they can't paste
|
// 1. return false - tell them they can't paste
|
||||||
// 2. insert over current characters - minimal validation
|
// 2. insert over current characters - minimal validation
|
||||||
@ -2409,13 +2402,12 @@ var datetimepickerFactory = function ($) {
|
|||||||
var clipboardData = event.clipboardData || event.originalEvent.clipboardData || window.clipboardData,
|
var clipboardData = event.clipboardData || event.originalEvent.clipboardData || window.clipboardData,
|
||||||
pastedData = clipboardData.getData('text'),
|
pastedData = clipboardData.getData('text'),
|
||||||
val = this.value,
|
val = this.value,
|
||||||
pos = this.selectionStart;
|
pos = this.selectionStart
|
||||||
|
|
||||||
var valueBeforeCursor = val.substr(0, pos);
|
var valueBeforeCursor = val.substr(0, pos);
|
||||||
var valueAfterPaste = val.substr(pos + pastedData.length);
|
var valueAfterPaste = val.substr(pos + pastedData.length);
|
||||||
|
|
||||||
val = valueBeforeCursor + pastedData + valueAfterPaste;
|
val = valueBeforeCursor + pastedData + valueAfterPaste;
|
||||||
val = val.substring(0, options.mask.length);
|
|
||||||
pos += pastedData.length;
|
pos += pastedData.length;
|
||||||
|
|
||||||
if (isValidValue(options.mask, val)) {
|
if (isValidValue(options.mask, val)) {
|
||||||
@ -2473,6 +2465,10 @@ var datetimepickerFactory = function ($) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.metaKey) { // cmd has been pressed
|
||||||
|
pos = 0;
|
||||||
|
hasSel = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasSel) {
|
if (hasSel) {
|
||||||
// pos might have moved so re-calc length
|
// pos might have moved so re-calc length
|
||||||
@ -2595,6 +2591,7 @@ var datetimepickerFactory = function ($) {
|
|||||||
};
|
};
|
||||||
$(options.ownerDocument)
|
$(options.ownerDocument)
|
||||||
.off('keydown.xdsoftctrl keyup.xdsoftctrl')
|
.off('keydown.xdsoftctrl keyup.xdsoftctrl')
|
||||||
|
.off('keydown.xdsoftcmd keyup.xdsoftcmd')
|
||||||
.on('keydown.xdsoftctrl', function (e) {
|
.on('keydown.xdsoftctrl', function (e) {
|
||||||
if (e.keyCode === CTRLKEY) {
|
if (e.keyCode === CTRLKEY) {
|
||||||
ctrlDown = true;
|
ctrlDown = true;
|
||||||
@ -2603,6 +2600,16 @@ var datetimepickerFactory = function ($) {
|
|||||||
.on('keyup.xdsoftctrl', function (e) {
|
.on('keyup.xdsoftctrl', function (e) {
|
||||||
if (e.keyCode === CTRLKEY) {
|
if (e.keyCode === CTRLKEY) {
|
||||||
ctrlDown = false;
|
ctrlDown = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.on('keydown.xdsoftcmd', function (e) {
|
||||||
|
if (e.keyCode === CMDKEY) {
|
||||||
|
cmdDown = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.on('keyup.xdsoftcmd', function (e) {
|
||||||
|
if (e.keyCode === CMDKEY) {
|
||||||
|
cmdDown = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2673,7 +2680,7 @@ var datetimepickerFactory = function ($) {
|
|||||||
define(['jquery', 'jquery-mousewheel'], factory);
|
define(['jquery', 'jquery-mousewheel'], factory);
|
||||||
} else if (typeof exports === 'object') {
|
} else if (typeof exports === 'object') {
|
||||||
// Node/CommonJS style for Browserify
|
// Node/CommonJS style for Browserify
|
||||||
module.exports = factory(require('jquery'));
|
module.exports = factory(require('jquery'));;
|
||||||
} else {
|
} else {
|
||||||
// Browser globals
|
// Browser globals
|
||||||
factory(jQuery);
|
factory(jQuery);
|
||||||
|
@ -11,7 +11,8 @@ module.exports = function(config) {
|
|||||||
'tests/tests/*.js'
|
'tests/tests/*.js'
|
||||||
],
|
],
|
||||||
reporters: ['progress'],
|
reporters: ['progress'],
|
||||||
port: 9876,
|
port: 2002,
|
||||||
|
hostname: '127.0.0.1',
|
||||||
colors: true,
|
colors: true,
|
||||||
logLevel: config.LOG_INFO,
|
logLevel: config.LOG_INFO,
|
||||||
browsers: ['Firefox'],
|
browsers: ['Firefox'],
|
||||||
|
Loading…
Reference in New Issue
Block a user