New version 2.1.6

Fixed bug with scroller hidden inline mode
This commit is contained in:
Valeriy Chupurnov 2014-01-13 00:02:26 +06:00
parent edeae329a5
commit 72e400dca1
5 changed files with 31 additions and 22 deletions

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "datetimepicker",
"version": "2.1.5",
"version": "2.1.6",
"title": "jQuery Date and Time picker",
"description": "jQuery plugin for date, time, or datetime manipulation in form",
"keywords": [

View File

@ -1,9 +1,11 @@
<div class="page-header">
<h1>DateTimePicker <small>jQuery plugin select date and time</small></h1>
</div>
<?php echo $this->parse('right250x250',array('link'=>"https://github.com/xdan/datetimepicker/archive/master.zip"))?>
<p>
Use this plugin to unobtrusively add a datetimepicker, datepicker or timepicker dropdown to your forms. It's easy to customize options. <a href="https://github.com/xdan/datetimepicker">Source code on GitHub</a> or <a href="https://github.com/xdan/datetimepicker/archive/master.zip">download (zip)</a>.
</p>
<h3>DateTimepicker</h3>
<input type="text" value="2014/03/15 05:06" id="datetimepicker"/><br/>
<h3>Use mask DateTimepicker</h3>
@ -36,9 +38,6 @@ $('#datetimepicker3').datetimepicker({
});
</script>
</p>
<p>
<a class="btn btn-large btn-primary" href="https://github.com/xdan/datetimepicker/archive/master.zip">Download (zip)</a>
</p>
<h2>How do I use it?</h2>
<p>
First include to page css and js files
@ -63,6 +62,7 @@ $(function(){$('#_datetimepicker').datetimepicker();});
<hr id="i18n"/>
<h4>i18n DatePicker Example <a href="#i18n">#</a></h4>
<p>All supported languages <a href="#lang">here</a></p>
<p><strong>javaScript</strong></p>
<pre><code data-language="javascript">$(&#39;#datetimepicker1&#39;).datetimepicker({
lang:&#39;de&#39;,
@ -420,6 +420,7 @@ $('#_datetimepicker_weekends_disable').datetimepicker({
<strong>fr</strong> - French<br>
<strong>es</strong> - Spanish<br>
<strong>th</strong> - Thai</td>
<strong>pl</strong> - Polish</td>
<td>
<pre><code data-language="javascript">{lang:&#39;ru&#39;}</code></pre>
</td>

View File

@ -29,11 +29,20 @@
<input type="text" id="datetimepicker8"/>
<h3>disable all weekend</h3>
<input type="text" id="datetimepicker9"/>
<h3>Show inline</h3>
<a href="javascript:var si = document.getElementById('show_inline').style; si.display = (si.display=='none')?'block':'none';return false; ">Show/Hide</a>
<div id="show_inline" style="display:none">
<input type="text" id="datetimepicker10"/>
</div>
</body>
<script src="./jquery.js"></script>
<script src="./jquery.datetimepicker.js"></script>
<script>
$('#datetimepicker_mask').datetimepicker({
$('#datetimepicker10').datetimepicker({
step:5,
inline:true
});/*$('#datetimepicker_mask').datetimepicker({
mask:'9999/19/39 29:59',
});
$('#datetimepicker').datetimepicker();
@ -109,6 +118,6 @@ $('#datetimepicker9').datetimepicker({
},
weekends:['01.01.2014','02.01.2014','03.01.2014','04.01.2014','05.01.2014','06.01.2014'],
timepicker:false
});
});*/
</script>
</html>

View File

@ -1,5 +1,5 @@
/**
* @preserve jQuery DateTimePicker plugin v2.1.5
* @preserve jQuery DateTimePicker plugin v2.1.6
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
* (c) 2014, Chupurnov Valeriy.
*/
@ -156,7 +156,7 @@
},
move = 0,
timebox = timeboxparent.children().eq(0),
parentHeight = timeboxparent[0].offsetHeight-2,
parentHeight = timeboxparent[0].clientHeight,
height = timebox[0].offsetHeight,
scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
scroller = $('<div class="xdsoft_scroller"></div>'),
@ -167,6 +167,8 @@
timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
scroller.on('mousedown.xdsoft_scroller',function ( event ) {
if( !parentHeight )
timeboxparent.trigger('resize_scroll.xdsoft_scroller',[_percent]);
var pageY = event.pageY,
top = parseInt(scroller.css('margin-top')),
h1 = scrollbar[0].offsetHeight;
@ -188,12 +190,14 @@
timeboxparent
.on('scroll_element.xdsoft_scroller',function( event,percent ) {
if( !parentHeight )
timeboxparent.trigger('resize_scroll.xdsoft_scroller',[percent,true]);
percent = percent>1?1:(percent<0||isNaN(percent))?0:percent;
scroller.css('margin-top',maximumOffset*percent);
timebox.css('marginTop',-parseInt((height-parentHeight)*percent))
})
.on('resize_scroll.xdsoft_scroller',function( event,_percent ) {
parentHeight = timeboxparent[0].offsetHeight-2;
.on('resize_scroll.xdsoft_scroller',function( event,_percent,noTriggerScroll ) {
parentHeight = timeboxparent[0].clientHeight;
height = timebox[0].offsetHeight;
var percent = parentHeight/height,
sh = percent*scrollbar[0].offsetHeight;
@ -203,6 +207,7 @@
scroller.show();
scroller.css('height',parseInt(sh>10?sh:10));
maximumOffset = scrollbar[0].offsetHeight-scroller[0].offsetHeight;
if( noTriggerScroll!==true )
timeboxparent.trigger('scroll_element.xdsoft_scroller',[_percent?_percent:Math.abs(parseInt(timebox.css('marginTop')))/(height-parentHeight)]);
}
});
@ -295,7 +300,7 @@
}else top+=items[0].offsetHeight;
}
select.xdsoftScroller(top/(select.children()[0].offsetHeight-(select[0].offsetHeight-2)));
select.xdsoftScroller(top/(select.children()[0].offsetHeight-(select[0].clientHeight)));
event.stopPropagation();
return false;
});
@ -640,7 +645,7 @@
stop = false,
period = 110;
(function arguments_callee4(v) {
var pheight = timeboxparent[0].offsetHeight-2,
var pheight = timeboxparent[0].clientHeight,
height = timebox[0].offsetHeight,
top = Math.abs(parseInt(timebox.css('marginTop')));
if( $this.hasClass(options.next) && (height-pheight)- options.timeHeightInTimePicker>=top ) {
@ -790,7 +795,7 @@
})
.on('afterOpen.xdsoft',function() {
if( options.timepicker && timebox.find('.xdsoft_current').length ) {
var pheight = timeboxparent[0].offsetHeight-2,
var pheight = timeboxparent[0].clientHeight,
height = timebox[0].offsetHeight,
top = timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker+1;
if( (height-pheight)<top )
@ -865,7 +870,7 @@
datetimepicker.mousewheel&&timeboxparent.unmousewheel().mousewheel(function(event, delta, deltaX, deltaY) {
if( !options.scrollTime )
return true;
var pheight = timeboxparent[0].offsetHeight-2,
var pheight = timeboxparent[0].clientHeight,
height = timebox[0].offsetHeight,
top = Math.abs(parseInt(timebox.css('marginTop'))),
fl = true;
@ -996,12 +1001,6 @@
return true;
}
});
/*.on('focusout.xdsoft',function(event) {
clearTimeout(timer1);
timer1 = setTimeout(function() {
//datetimepicker.trigger('close.xdsoft');
},100);
});*/
},
destroyDateTimePicker = function( input ) {
var datetimepicker = input.data('xdsoft_datetimepicker');