diff --git a/bower.json b/bower.json index 8300440..88f5164 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name":"datetimepicker", - "version":"2.2.2", + "version":"2.2.3", "main": [ "jquery.datetimepicker.js", "jquery.datetimepicker.css" diff --git a/datetimepicker.jquery.json b/datetimepicker.jquery.json index 4b9802f..c45257e 100644 --- a/datetimepicker.jquery.json +++ b/datetimepicker.jquery.json @@ -1,7 +1,7 @@ { "name": "datetimepicker", - "version": "2.2.2", - "title": "jQuery Date and Time picker", + "version": "2.2.3", + "title": "jQuery Date and Time picker", "description": "jQuery plugin for date, time, or datetime manipulation in form", "keywords": [ "calendar", diff --git a/doc.tpl b/doc.tpl index 398e2b2..5f2ec55 100644 --- a/doc.tpl +++ b/doc.tpl @@ -455,7 +455,7 @@ $('#_datetimepicker_weekends_disable').datetimepicker({
{format:'H'}
{format:'Y'}{format:'unixtime'}
diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js
index dd02ee3..4e20029 100644
--- a/jquery.datetimepicker.js
+++ b/jquery.datetimepicker.js
@@ -1,5 +1,5 @@
/**
- * @preserve jQuery DateTimePicker plugin v2.2.2
+ * @preserve jQuery DateTimePicker plugin v2.2.3
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
* (c) 2014, Chupurnov Valeriy.
*/
@@ -183,6 +183,8 @@
scrollTime:true,
scrollInput:true,
+ lazyInit:true,
+
mask:false,
validateOnBlur:true,
allowBlank:true,
@@ -330,8 +332,32 @@
YKEY = 89,
ctrlDown = false,
options = ($.isPlainObject(opt)||!opt)?$.extend(true,{},default_options,opt):$.extend({},default_options),
+
+ lazyInitTimer = 0,
+
+ lazyInit = function( input ){
+ input
+ .on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function initOnActionCallback(event) {
+ if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible')||input.data( 'xdsoft_datetimepicker') )
+ return;
+
+ clearTimeout(lazyInitTimer);
+
+ lazyInitTimer = setTimeout(function() {
+
+ if( !input.data( 'xdsoft_datetimepicker') )
+ createDateTimePicker(input);
+
+ input
+ .off('open.xdsoft focusin.xdsoft mousedown.xdsoft',initOnActionCallback)
+ .trigger('open.xdsoft');
+ },100);
+
+ });
+ },
createDateTimePicker = function( input ) {
+
var datetimepicker = $(''),
xdsoft_copyright = $(''),
datepicker = $(''),
@@ -1194,7 +1220,12 @@
}
return 0;
}else
- ($.type(opt) !== 'string')&&createDateTimePicker($(this));
+ if( ($.type(opt) !== 'string') ){
+ if( !options.lazyInit||options.open||options.inline ){
+ createDateTimePicker($(this));
+ }else
+ lazyInit($(this));
+ }
});
};
})( jQuery );