new version 2.2.3

Added options lazyInit to accelerate the plugin
This commit is contained in:
Valeriy 2014-03-25 11:58:52 +06:00
parent 9001bdb708
commit 50d9e9b42f
4 changed files with 37 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name":"datetimepicker",
"version":"2.2.2",
"version":"2.2.3",
"main": [
"jquery.datetimepicker.js",
"jquery.datetimepicker.css"

View File

@ -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",

View File

@ -455,7 +455,7 @@ $('#_datetimepicker_weekends_disable').datetimepicker({
<tr id="format">
<td><a href="#format">format</a></td>
<td>Y/m/d H:i</td>
<td>Format datetime. <a href="http://php.net/manual/ru/function.date.php" target="_blank">More</a>&nbsp; Also there is a special type of <i>&laquo;unixtime&raquo;</i></td>
<td>Format datetime. <a href="http://php.net/manual/ru/function.date.php" target="_blank">More</a>&nbsp; Also there is a special type of <a href="#unixtime"><i>&laquo;unixtime&raquo;</i></a></td>
<td>
<pre><code data-language="javascript">{format:&#39;H&#39;}
{format:&#39;Y&#39;}{format:&#39;unixtime&#39;}</code></pre>

View File

@ -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 = $('<div '+(options.id?'id="'+options.id+'"':'')+' '+(options.style?'style="'+options.style+'"':'')+' class="xdsoft_datetimepicker xdsoft_noselect '+options.className+'"></div>'),
xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
datepicker = $('<div class="xdsoft_datepicker active"></div>'),
@ -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 );