mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
new version 2.2.3
Added options lazyInit to accelerate the plugin
This commit is contained in:
parent
9001bdb708
commit
50d9e9b42f
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name":"datetimepicker",
|
||||
"version":"2.2.2",
|
||||
"version":"2.2.3",
|
||||
"main": [
|
||||
"jquery.datetimepicker.js",
|
||||
"jquery.datetimepicker.css"
|
||||
|
@ -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",
|
||||
|
2
doc.tpl
2
doc.tpl
@ -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> Also there is a special type of <i>«unixtime»</i></td>
|
||||
<td>Format datetime. <a href="http://php.net/manual/ru/function.date.php" target="_blank">More</a> Also there is a special type of <a href="#unixtime"><i>«unixtime»</i></a></td>
|
||||
<td>
|
||||
<pre><code data-language="javascript">{format:'H'}
|
||||
{format:'Y'}{format:'unixtime'}</code></pre>
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user