jquery-datetimepicker-rails 2.1.1.0 → 2.1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/jquery.datetimepicker.js +126 -100
- data/lib/jquery/datetimepicker/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67b1529e35f5f8fa856e64ee11084e0d2bee9172
|
4
|
+
data.tar.gz: 7d45d59478395663291581d1fab35f6c7f6dce49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e116ec937017061c8aef59538b5782dda71863114ec04691b836021a45dbb4dad5769f026740e5d1c4136ba32ae8e25f50e2705e0a856bfbd8dd3e4e80485fa6
|
7
|
+
data.tar.gz: 540a304c0200d8531ef4275cfdb39dbe29b431026bc0d528236c3fdb9571c6f164b0252afe5f5a6488cefe70f8bbffa94c5793a2ceb2c04e9fe9e781d08abe86
|
@@ -1,5 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* @preserve jQuery DateTimePicker plugin v2.1.
|
1
|
+
/**
|
2
|
+
* @preserve jQuery DateTimePicker plugin v2.1.2
|
3
3
|
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
4
4
|
* (c) 2013, Chupurnov Valeriy.
|
5
5
|
*/
|
@@ -38,6 +38,22 @@
|
|
38
38
|
dayOfWeek:[
|
39
39
|
"zo", "ma", "di", "wo", "do", "vr", "za"
|
40
40
|
]
|
41
|
+
},
|
42
|
+
tr:{
|
43
|
+
months:[
|
44
|
+
"Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
|
45
|
+
],
|
46
|
+
dayOfWeek:[
|
47
|
+
"Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
|
48
|
+
]
|
49
|
+
},
|
50
|
+
fr:{
|
51
|
+
months:[
|
52
|
+
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
|
53
|
+
],
|
54
|
+
dayOfWeek:[
|
55
|
+
"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
|
56
|
+
]
|
41
57
|
}
|
42
58
|
},
|
43
59
|
value:'',
|
@@ -89,7 +105,7 @@
|
|
89
105
|
weekends : []
|
90
106
|
};
|
91
107
|
// fix for ie8
|
92
|
-
if (!Array.prototype.indexOf) {
|
108
|
+
if (!Array.prototype.indexOf) {
|
93
109
|
Array.prototype.indexOf = function(obj, start) {
|
94
110
|
for (var i = (start || 0), j = this.length; i < j; i++) {
|
95
111
|
if (this[i] === obj) { return i; }
|
@@ -121,9 +137,9 @@
|
|
121
137
|
scroller = $('<div class="xdsoft_scroller"></div>'),
|
122
138
|
maximumOffset = 100,
|
123
139
|
start = false;
|
124
|
-
|
140
|
+
|
125
141
|
scrollbar.append(scroller);
|
126
|
-
|
142
|
+
|
127
143
|
timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
|
128
144
|
scroller.on('mousedown.xdsoft_scroller',function ( event ) {
|
129
145
|
var pageY = event.pageY,
|
@@ -144,7 +160,7 @@
|
|
144
160
|
timeboxparent.trigger('scroll_element.xdsoft_scroller',[maximumOffset?offset/maximumOffset:0]);
|
145
161
|
});
|
146
162
|
});
|
147
|
-
|
163
|
+
|
148
164
|
timeboxparent
|
149
165
|
.on('scroll_element.xdsoft_scroller',function( event,percent ) {
|
150
166
|
percent = percent>1?1:(percent<0||isNaN(percent))?0:percent;
|
@@ -225,7 +241,7 @@
|
|
225
241
|
scroller = $('<div class="xdsoft_scroller"></div>'),
|
226
242
|
monthselect =$('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
|
227
243
|
yearselect =$('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>');
|
228
|
-
|
244
|
+
|
229
245
|
//constructor lego
|
230
246
|
mounth_picker
|
231
247
|
.find('.xdsoft_month span')
|
@@ -233,7 +249,7 @@
|
|
233
249
|
mounth_picker
|
234
250
|
.find('.xdsoft_year span')
|
235
251
|
.after(yearselect);
|
236
|
-
|
252
|
+
|
237
253
|
mounth_picker
|
238
254
|
.find('.xdsoft_month,.xdsoft_year')
|
239
255
|
.on('mousedown.xdsoft',function(event) {
|
@@ -243,22 +259,22 @@
|
|
243
259
|
var select = $(this).find('.xdsoft_select').eq(0),
|
244
260
|
val = 0,
|
245
261
|
top = 0;
|
246
|
-
|
262
|
+
|
247
263
|
if( _xdsoft_datetime.currentTime )
|
248
264
|
val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month')?'getMonth':'getFullYear']();
|
249
|
-
|
265
|
+
|
250
266
|
select.show();
|
251
267
|
for(var items = select.find('div.xdsoft_option'),i = 0;i<items.length;i++) {
|
252
268
|
if( items.eq(i).data('value')==val ) {
|
253
269
|
break;
|
254
270
|
}else top+=items[0].offsetHeight;
|
255
271
|
}
|
256
|
-
|
272
|
+
|
257
273
|
select.xdsoftScroller(top/(select.children()[0].offsetHeight-(select[0].offsetHeight-2)));
|
258
274
|
event.stopPropagation();
|
259
275
|
return false;
|
260
276
|
});
|
261
|
-
|
277
|
+
|
262
278
|
mounth_picker
|
263
279
|
.find('.xdsoft_select')
|
264
280
|
.xdsoftScroller()
|
@@ -271,44 +287,45 @@
|
|
271
287
|
_xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect')?'setMonth':'setFullYear']($(this).data('value'));
|
272
288
|
$(this).parent().parent().hide();
|
273
289
|
datetimepicker.trigger('xchange.xdsoft');
|
290
|
+
options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
|
274
291
|
});
|
275
|
-
|
276
|
-
|
292
|
+
|
293
|
+
|
277
294
|
// set options
|
278
295
|
datetimepicker.setOptions = function( _options ) {
|
279
296
|
options = $.extend({},options,_options);
|
280
297
|
if( (options.open||options.opened)&&(!options.inline) ) {
|
281
298
|
input.trigger('open.xdsoft');
|
282
299
|
}
|
283
|
-
|
300
|
+
|
284
301
|
if( options.inline ) {
|
285
302
|
datetimepicker.addClass('xdsoft_inline');
|
286
303
|
input.after(datetimepicker).hide();
|
287
304
|
datetimepicker.trigger('afterOpen.xdsoft');
|
288
305
|
}
|
289
|
-
|
306
|
+
|
290
307
|
if( options.inverseButton ) {
|
291
308
|
options.next = 'xdsoft_prev';
|
292
309
|
options.prev = 'xdsoft_next';
|
293
310
|
}
|
294
|
-
|
311
|
+
|
295
312
|
if( !options.datepicker && options.timepicker )
|
296
313
|
datepicker.removeClass('active');
|
297
|
-
|
314
|
+
|
298
315
|
if( options.datepicker && !options.timepicker )
|
299
316
|
timepicker.removeClass('active');
|
300
|
-
|
317
|
+
|
301
318
|
if( options.value )
|
302
319
|
input&&input.val&&input.val(options.value);
|
303
|
-
|
320
|
+
|
304
321
|
if( isNaN(options.dayOfWeekStart)||parseInt(options.dayOfWeekStart)<0||parseInt(options.dayOfWeekStart)>6 )
|
305
322
|
options.dayOfWeekStart = 0;
|
306
|
-
else
|
323
|
+
else
|
307
324
|
options.dayOfWeekStart = parseInt(options.dayOfWeekStart);
|
308
|
-
|
325
|
+
|
309
326
|
if( !options.timepickerScrollbar )
|
310
327
|
scrollbar.hide();
|
311
|
-
|
328
|
+
|
312
329
|
var tmpDate = [],timeOffset;
|
313
330
|
if( options.minDate && ( tmpDate = /^-(.*)$/.exec(options.minDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ) {
|
314
331
|
timeOffset = tmpDate.getTime()+-1*(tmpDate.getTimezoneOffset())*60000;
|
@@ -322,7 +339,7 @@
|
|
322
339
|
mounth_picker
|
323
340
|
.find('.xdsoft_today_button')
|
324
341
|
.css('visibility',!options.todayButton?'hidden':'visible');
|
325
|
-
|
342
|
+
|
326
343
|
if( options.mask ) {
|
327
344
|
var e,
|
328
345
|
getCaretPos = function ( input ) {
|
@@ -379,9 +396,9 @@
|
|
379
396
|
case ( $.type(options.mask) == 'string' ):
|
380
397
|
if( !isValidValue( options.mask,input.val() ) )
|
381
398
|
input.val(options.mask.replace(/[0-9]/g,'_'));
|
382
|
-
|
399
|
+
|
383
400
|
input.on('keydown.xdsoft',function( event ) {
|
384
|
-
var val = this.value,
|
401
|
+
var val = this.value,
|
385
402
|
key = event.which;
|
386
403
|
switch(true) {
|
387
404
|
case (( key>=KEY0&&key<=KEY9 )||( key>=_KEY0&&key<=_KEY9 ))||(key==BACKSPACE||key==DEL):
|
@@ -393,14 +410,14 @@
|
|
393
410
|
}
|
394
411
|
while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
|
395
412
|
pos+=( key==BACKSPACE||key==DEL )?-1:1;
|
396
|
-
|
413
|
+
|
397
414
|
val = val.substr(0,pos)+digit+val.substr(pos+1);
|
398
415
|
if( $.trim(val)=='' )
|
399
416
|
val = options.mask.replace(/[0-9]/g,'_');
|
400
|
-
else
|
417
|
+
else
|
401
418
|
if( pos==options.mask.length )
|
402
419
|
break;
|
403
|
-
|
420
|
+
|
404
421
|
pos+=(key==BACKSPACE||key==DEL)?0:1;
|
405
422
|
while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
|
406
423
|
pos+=(key==BACKSPACE||key==DEL)?-1:1;
|
@@ -428,18 +445,23 @@
|
|
428
445
|
.off('blur.xdsoft')
|
429
446
|
.on('blur.xdsoft', function() {
|
430
447
|
if( options.allowBlank && !$.trim($(this).val()).length ) {
|
431
|
-
|
432
|
-
|
433
|
-
else if( !Date.parseDate( $(this).val(), options.format ) ) {
|
448
|
+
$(this).val(null);
|
449
|
+
datetimepicker.data('xdsoft_datetime').empty();
|
450
|
+
}else if( !Date.parseDate( $(this).val(), options.format ) ) {
|
434
451
|
$(this).val((new Date()).dateFormat( options.format ));
|
452
|
+
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
|
435
453
|
}
|
454
|
+
else{
|
455
|
+
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
|
456
|
+
}
|
457
|
+
datetimepicker.trigger('changedatetime.xdsoft');
|
436
458
|
});
|
437
459
|
}
|
438
460
|
options.dayOfWeekStartPrev = (options.dayOfWeekStart==0)?6:options.dayOfWeekStart-1;
|
439
461
|
datetimepicker
|
440
462
|
.trigger('xchange.xdsoft');
|
441
463
|
};
|
442
|
-
|
464
|
+
|
443
465
|
datetimepicker
|
444
466
|
.data('options',options)
|
445
467
|
.on('mousedown.xdsoft',function( event ) {
|
@@ -449,50 +471,54 @@
|
|
449
471
|
monthselect.hide();
|
450
472
|
return false;
|
451
473
|
});
|
452
|
-
|
474
|
+
|
453
475
|
var scroll_element = timepicker.find('.xdsoft_time_box');
|
454
476
|
scroll_element.append(timebox);
|
455
477
|
scroll_element.xdsoftScroller();
|
456
478
|
datetimepicker.on('afterOpen.xdsoft',function() {
|
457
479
|
scroll_element.xdsoftScroller();
|
458
480
|
});
|
459
|
-
|
481
|
+
|
460
482
|
datetimepicker
|
461
483
|
.append(datepicker)
|
462
484
|
.append(timepicker);
|
463
|
-
|
485
|
+
|
464
486
|
if( options.withoutCopyright!==true )
|
465
487
|
datetimepicker
|
466
488
|
.append(xdsoft_copyright);
|
467
|
-
|
489
|
+
|
468
490
|
datepicker
|
469
491
|
.append(mounth_picker)
|
470
492
|
.append(calendar);
|
471
|
-
|
493
|
+
|
472
494
|
$('body').append(datetimepicker);
|
473
|
-
|
495
|
+
|
474
496
|
var XDSoftDateTime = function() {
|
475
497
|
var _this = this;
|
476
498
|
_this.now = function() {
|
477
499
|
return new Date();
|
478
500
|
};
|
479
|
-
|
501
|
+
|
480
502
|
_this.currentTime = this.now();
|
481
503
|
_this.isValidDate = function (d) {
|
482
504
|
if ( Object.prototype.toString.call(d) !== "[object Date]" )
|
483
505
|
return false;
|
484
506
|
return !isNaN(d.getTime());
|
485
507
|
};
|
486
|
-
|
508
|
+
|
487
509
|
_this.setCurrentTime = function( dTime) {
|
488
510
|
_this.currentTime = (typeof dTime == 'string')? _this.strtodatetime(dTime) : _this.isValidDate(dTime) ? dTime: _this.now();
|
489
511
|
datetimepicker.trigger('xchange.xdsoft');
|
490
512
|
};
|
491
|
-
|
513
|
+
|
514
|
+
_this.empty = function() {
|
515
|
+
_this.currentTime = null;
|
516
|
+
};
|
517
|
+
|
492
518
|
_this.getCurrentTime = function( dTime) {
|
493
519
|
return _this.currentTime;
|
494
520
|
};
|
495
|
-
|
521
|
+
|
496
522
|
_this.nextMonth = function() {
|
497
523
|
var month = _this.currentTime.getMonth()+1;
|
498
524
|
if( month==12 ) {
|
@@ -504,7 +530,7 @@
|
|
504
530
|
datetimepicker.trigger('xchange.xdsoft');
|
505
531
|
return month;
|
506
532
|
};
|
507
|
-
|
533
|
+
|
508
534
|
_this.prevMonth = function() {
|
509
535
|
var month = _this.currentTime.getMonth()-1;
|
510
536
|
if( month==-1 ) {
|
@@ -516,31 +542,31 @@
|
|
516
542
|
datetimepicker.trigger('xchange.xdsoft');
|
517
543
|
return month;
|
518
544
|
};
|
519
|
-
|
545
|
+
|
520
546
|
_this.strtodatetime = function( sDateTime ) {
|
521
547
|
var currentTime = sDateTime?Date.parseDate(sDateTime, options.format):new Date;
|
522
548
|
if( !_this.isValidDate(currentTime) )
|
523
549
|
currentTime = new Date;
|
524
550
|
return currentTime;
|
525
551
|
};
|
526
|
-
|
552
|
+
|
527
553
|
_this.strtodate = function( sDate ) {
|
528
554
|
var currentTime = sDate?Date.parseDate(sDate, options.formatDate):new Date;
|
529
555
|
if( !_this.isValidDate(currentTime) )
|
530
556
|
currentTime = new Date;
|
531
557
|
return currentTime;
|
532
558
|
};
|
533
|
-
|
559
|
+
|
534
560
|
_this.strtotime = function( sTime ) {
|
535
561
|
var currentTime = sTime?Date.parseDate(sTime, options.formatTime):new Date;
|
536
562
|
if( !_this.isValidDate(currentTime) )
|
537
563
|
currentTime = new Date;
|
538
564
|
return currentTime;
|
539
565
|
};
|
540
|
-
|
566
|
+
|
541
567
|
_this.str = function() {
|
542
568
|
return _this.currentTime.dateFormat(options.format);
|
543
|
-
};
|
569
|
+
};
|
544
570
|
},
|
545
571
|
_xdsoft_datetime = new XDSoftDateTime;
|
546
572
|
mounth_picker
|
@@ -569,7 +595,7 @@
|
|
569
595
|
}
|
570
596
|
!stop&&(timer = setTimeout(arguments_callee1,v?v:100));
|
571
597
|
})(500);
|
572
|
-
|
598
|
+
|
573
599
|
$([document.body,window]).on('mouseup.xdsoft',function arguments_callee2() {
|
574
600
|
clearTimeout(timer);
|
575
601
|
stop = true;
|
@@ -604,25 +630,25 @@
|
|
604
630
|
.off('mouseup.xdsoft',arguments_callee5);
|
605
631
|
});
|
606
632
|
});
|
607
|
-
|
633
|
+
|
608
634
|
// base handler - generating a calendar and timepicker
|
609
635
|
datetimepicker
|
610
636
|
.on('xchange.xdsoft',function( event ) {
|
611
637
|
var table = '',
|
612
638
|
start = new Date(_xdsoft_datetime.currentTime.getFullYear(),_xdsoft_datetime.currentTime.getMonth(),1),
|
613
|
-
i = 0,
|
639
|
+
i = 0,
|
614
640
|
today = new Date;
|
615
641
|
while( start.getDay()!=options.dayOfWeekStart )
|
616
|
-
start.setDate(start.getDate()-1);
|
617
|
-
|
642
|
+
start.setDate(start.getDate()-1);
|
643
|
+
|
618
644
|
//generate calendar
|
619
645
|
table+='<table><thead><tr>';
|
620
|
-
|
646
|
+
|
621
647
|
// days
|
622
648
|
for(var j = 0; j<7; j++) {
|
623
649
|
table+='<th>'+options.i18n[options.lang].dayOfWeek[(j+options.dayOfWeekStart)>6?0:j+options.dayOfWeekStart]+'</th>';
|
624
650
|
}
|
625
|
-
|
651
|
+
|
626
652
|
table+='</tr></thead>';
|
627
653
|
table+='<tbody><tr>';
|
628
654
|
var maxDate = false, minDate = false;
|
@@ -638,46 +664,46 @@
|
|
638
664
|
while( i<_xdsoft_datetime.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) {
|
639
665
|
classes = [];
|
640
666
|
i++;
|
641
|
-
|
667
|
+
|
642
668
|
d = start.getDate(); y = start.getFullYear(); m = start.getMonth();
|
643
|
-
|
669
|
+
|
644
670
|
classes.push('xdsoft_date');
|
645
|
-
|
671
|
+
|
646
672
|
if( ( maxDate!==false && start > maxDate )||( minDate!==false && start < minDate ) ){
|
647
673
|
classes.push('xdsoft_disabled');
|
648
674
|
}
|
649
|
-
|
675
|
+
|
650
676
|
if( _xdsoft_datetime.currentTime.getMonth()!=m ) classes.push('xdsoft_other_month');
|
651
|
-
|
677
|
+
|
652
678
|
if( (options.defaultSelect||datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat('d.m.Y')==start.dateFormat('d.m.Y') ) {
|
653
679
|
classes.push('xdsoft_current');
|
654
680
|
}
|
655
|
-
|
681
|
+
|
656
682
|
if( today.dateFormat('d.m.Y')==start.dateFormat('d.m.Y') ) {
|
657
683
|
classes.push('xdsoft_today');
|
658
684
|
}
|
659
|
-
|
685
|
+
|
660
686
|
if( start.getDay()==0||start.getDay()==6||~options.weekends.indexOf(start.dateFormat('d.m.Y')) ) {
|
661
687
|
classes.push('xdsoft_weekend');
|
662
688
|
}
|
663
|
-
|
689
|
+
|
664
690
|
table+='<td data-date="'+d+'" data-month="'+m+'" data-year="'+y+'"'+' class="xdsoft_date '+ classes.join(' ')+'">'+
|
665
691
|
'<div>'+d+'</div>'+
|
666
692
|
'</td>';
|
667
|
-
|
693
|
+
|
668
694
|
if( start.getDay()==options.dayOfWeekStartPrev ) {
|
669
695
|
table+='</tr>';
|
670
696
|
}
|
671
|
-
|
697
|
+
|
672
698
|
start.setDate(d+1);
|
673
699
|
}
|
674
700
|
table+='</tbody></table>';
|
675
|
-
|
701
|
+
|
676
702
|
calendar.html(table);
|
677
|
-
|
703
|
+
|
678
704
|
mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]);
|
679
705
|
mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
|
680
|
-
|
706
|
+
|
681
707
|
// generate timebox
|
682
708
|
var time = '',
|
683
709
|
h = '',
|
@@ -688,7 +714,7 @@
|
|
688
714
|
h = parseInt(now.getHours());
|
689
715
|
now.setMinutes(m);
|
690
716
|
m = parseInt(now.getMinutes());
|
691
|
-
|
717
|
+
|
692
718
|
classes = [];
|
693
719
|
if( (options.maxTime!==false&&_xdsoft_datetime.strtotime(options.maxTime).getTime()<now.getTime())||(options.minTime!==false&&_xdsoft_datetime.strtotime(options.minTime).getTime()>now.getTime()))
|
694
720
|
classes.push('xdsoft_disabled');
|
@@ -698,7 +724,7 @@
|
|
698
724
|
classes.push('xdsoft_today');
|
699
725
|
time+= '<div class="xdsoft_time '+classes.join(' ')+'" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>';
|
700
726
|
};
|
701
|
-
|
727
|
+
|
702
728
|
if( !options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length ) {
|
703
729
|
for( var i=0,j=0;i<(options.hours12?12:24);i++ ) {
|
704
730
|
for( j=0;j<60;j+=options.step ) {
|
@@ -714,18 +740,18 @@
|
|
714
740
|
line_time( h,m );
|
715
741
|
}
|
716
742
|
}
|
717
|
-
|
743
|
+
|
718
744
|
timebox.html(time);
|
719
|
-
|
745
|
+
|
720
746
|
var opt = '',
|
721
747
|
i = 0;
|
722
|
-
|
748
|
+
|
723
749
|
for( i = parseInt(options.yearStart,10);i<= parseInt(options.yearEnd,10);i++ ) {
|
724
750
|
opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getFullYear()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+i+'</div>';
|
725
751
|
}
|
726
752
|
yearselect.children().eq(0)
|
727
753
|
.html(opt);
|
728
|
-
|
754
|
+
|
729
755
|
for( i = 0,opt = '';i<= 11;i++ ) {
|
730
756
|
opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getMonth()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+options.i18n[options.lang].months[i]+'</div>';
|
731
757
|
}
|
@@ -752,29 +778,29 @@
|
|
752
778
|
currentTime = _xdsoft_datetime.currentTime;
|
753
779
|
if( $this.hasClass('xdsoft_disabled') )
|
754
780
|
return false;
|
755
|
-
|
781
|
+
|
756
782
|
currentTime.setFullYear( $this.data('year') );
|
757
783
|
currentTime.setMonth( $this.data('month') );
|
758
784
|
currentTime.setDate( $this.data('date') );
|
759
785
|
datetimepicker.trigger('select.xdsoft',[currentTime]);
|
760
|
-
|
786
|
+
|
761
787
|
input.val( _xdsoft_datetime.str() );
|
762
788
|
if( (timerclick>1||(options.closeOnDateSelect===true||( options.closeOnDateSelect===0&&!options.timepicker )))&&!options.inline ) {
|
763
789
|
datetimepicker.trigger('close.xdsoft');
|
764
790
|
}
|
765
|
-
|
791
|
+
|
766
792
|
if( options.onSelectDate && options.onSelectDate.call ) {
|
767
793
|
options.onSelectDate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
|
768
794
|
}
|
769
|
-
|
795
|
+
|
770
796
|
datetimepicker.data('changed',true);
|
771
797
|
datetimepicker.trigger('xchange.xdsoft');
|
772
798
|
datetimepicker.trigger('changedatetime.xdsoft');
|
773
799
|
setTimeout(function(){
|
774
800
|
timerclick = 0;
|
775
801
|
},200);
|
776
|
-
});
|
777
|
-
|
802
|
+
});
|
803
|
+
|
778
804
|
timebox
|
779
805
|
.on('click.xdsoft','div',function() {
|
780
806
|
var $this = $(this),
|
@@ -784,11 +810,11 @@
|
|
784
810
|
currentTime.setHours($this.data('hour'));
|
785
811
|
currentTime.setMinutes($this.data('minute'));
|
786
812
|
datetimepicker.trigger('select.xdsoft',[currentTime]);
|
787
|
-
|
813
|
+
|
788
814
|
datetimepicker.data('input').val( _xdsoft_datetime.str() );
|
789
|
-
|
815
|
+
|
790
816
|
!options.inline&&datetimepicker.trigger('close.xdsoft');
|
791
|
-
|
817
|
+
|
792
818
|
if( options.onSelectTime&&options.onSelectTime.call ) {
|
793
819
|
options.onSelectTime.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
|
794
820
|
}
|
@@ -796,7 +822,7 @@
|
|
796
822
|
datetimepicker.trigger('xchange.xdsoft');
|
797
823
|
datetimepicker.trigger('changedatetime.xdsoft');
|
798
824
|
});
|
799
|
-
|
825
|
+
|
800
826
|
datetimepicker.mousewheel&&datepicker.mousewheel(function(event, delta, deltaX, deltaY) {
|
801
827
|
if( !options.scrollMonth )
|
802
828
|
return true;
|
@@ -806,7 +832,7 @@
|
|
806
832
|
_xdsoft_datetime.prevMonth();
|
807
833
|
return false;
|
808
834
|
});
|
809
|
-
|
835
|
+
|
810
836
|
datetimepicker.mousewheel&&timeboxparent.unmousewheel().mousewheel(function(event, delta, deltaX, deltaY) {
|
811
837
|
if( !options.scrollTime )
|
812
838
|
return true;
|
@@ -825,7 +851,7 @@
|
|
825
851
|
event.stopPropagation();
|
826
852
|
return fl;
|
827
853
|
});
|
828
|
-
|
854
|
+
|
829
855
|
datetimepicker
|
830
856
|
.on('changedatetime.xdsoft',function() {
|
831
857
|
if( options.onChangeDateTime&&options.onChangeDateTime.call )
|
@@ -835,7 +861,7 @@
|
|
835
861
|
if( options.onGenerate&&options.onGenerate.call )
|
836
862
|
options.onGenerate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
|
837
863
|
});
|
838
|
-
|
864
|
+
|
839
865
|
var current_time_index = 0;
|
840
866
|
input.mousewheel&&input.mousewheel(function( event, delta, deltaX, deltaY ) {
|
841
867
|
if( !options.scrollInput )
|
@@ -861,7 +887,7 @@
|
|
861
887
|
left = offset.left-datetimepicker[0].offsetWidth+datetimepicker.data('input')[0].offsetWidth;
|
862
888
|
datetimepicker.css({
|
863
889
|
left:left,
|
864
|
-
top:top
|
890
|
+
top:top
|
865
891
|
});
|
866
892
|
};
|
867
893
|
datetimepicker
|
@@ -877,7 +903,7 @@
|
|
877
903
|
$(window)
|
878
904
|
.off('resize.xdsoft',setPos)
|
879
905
|
.on('resize.xdsoft',setPos);
|
880
|
-
|
906
|
+
|
881
907
|
if( options.closeOnWithoutClick ) {
|
882
908
|
$([document.body,window]).on('mousedown.xdsoft',function arguments_callee6() {
|
883
909
|
datetimepicker.trigger('close.xdsoft');
|
@@ -897,23 +923,23 @@
|
|
897
923
|
event.stopPropagation();
|
898
924
|
})
|
899
925
|
.data('input',input);
|
900
|
-
|
926
|
+
|
901
927
|
var timer = 0,
|
902
928
|
timer1 = 0;
|
903
|
-
|
929
|
+
|
904
930
|
datetimepicker.data('xdsoft_datetime',_xdsoft_datetime);
|
905
931
|
datetimepicker.setOptions(options);
|
906
|
-
|
932
|
+
|
907
933
|
var ct = options.value?options.value:(input&&input.val&&input.val())?input.val():'';
|
908
934
|
if( ct && _xdsoft_datetime.isValidDate(ct = Date.parseDate(ct, options.format)) ) {
|
909
935
|
datetimepicker.data('changed',true);
|
910
|
-
}else
|
936
|
+
}else
|
911
937
|
ct = '';
|
912
|
-
|
938
|
+
|
913
939
|
_xdsoft_datetime.setCurrentTime( ct?ct:new Date );
|
914
|
-
|
940
|
+
|
915
941
|
datetimepicker.trigger('afterOpen.xdsoft');
|
916
|
-
|
942
|
+
|
917
943
|
input
|
918
944
|
.data( 'xdsoft_datetimepicker',datetimepicker )
|
919
945
|
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function(event) {
|
@@ -928,7 +954,7 @@
|
|
928
954
|
},100);
|
929
955
|
})
|
930
956
|
.on('keydown.xdsoft',function( event ) {
|
931
|
-
var val = this.value,
|
957
|
+
var val = this.value,
|
932
958
|
key = event.which;
|
933
959
|
switch(true) {
|
934
960
|
case !!~([ENTER].indexOf(key)):
|
@@ -964,7 +990,7 @@
|
|
964
990
|
$(document)
|
965
991
|
.off('keydown.xdsoftctrl keyup.xdsoftctrl')
|
966
992
|
.on('keydown.xdsoftctrl',function(e) {
|
967
|
-
if ( e.keyCode == CTRLKEY )
|
993
|
+
if ( e.keyCode == CTRLKEY )
|
968
994
|
ctrlDown = true;
|
969
995
|
})
|
970
996
|
.on('keyup.xdsoftctrl',function(e) {
|
@@ -990,7 +1016,7 @@
|
|
990
1016
|
this.value = this.defaultValue;
|
991
1017
|
if(!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(Date.parseDate(this.value, options.format)))
|
992
1018
|
datetimepicker.data('changed',false);
|
993
|
-
datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
|
1019
|
+
datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
|
994
1020
|
break;
|
995
1021
|
}
|
996
1022
|
}else{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jquery-datetimepicker-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|