jquery-datetimepicker-rails 2.0.2.1 → 2.0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f96c8a27c4800bcf56a8b3139faa42563b35ed17
4
- data.tar.gz: 1e6e251b2f84de9cfb3d308daa609784391d8d04
3
+ metadata.gz: 9ac41172dc640d4e97f52ddac82213eb57749b7d
4
+ data.tar.gz: 1589b9309b615ff58d3837f53efd20712352f723
5
5
  SHA512:
6
- metadata.gz: 30db25962785b36787d77bad065d195f84bbaa1b1235dee51388cc7addbf75728ff509b7f4a19b611feaadd1874abdf82073c65f4616389c247ffe71b187f9b4
7
- data.tar.gz: 3d15e097f9705315b05090c6b0aecd98c0f27273ae01bf8e91c43461c6e8143c0ced38fb83f7202a7a314e31a339c591fb8a706a1bf46d21e4deace6528ed528
6
+ metadata.gz: 0ff426bc01263987470b36111c5e0b5361e8acd4d9c601988a82119dbe72281547a529859205358a54f8982218efd942ae96bf7845a16a3eaab2bad71504827a
7
+ data.tar.gz: 1b810f89702077a66e1b157324483d644e146ef4440643a52b5d843da8210c0d960bb840d7402dce204c3cba7f807886c930635581635c33154cca6f5abf645b
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @preserve jQuery DateTimePicker plugin v2.0.2
2
+ * @preserve jQuery DateTimePicker plugin v2.0.5
3
3
  * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4
4
  * (c) 2013, Chupurnov Valeriy.
5
5
  */
@@ -97,7 +97,11 @@
97
97
  });
98
98
  };
99
99
  $.fn.datetimepicker = function( opt ){
100
- var CTRLKEY = 17,
100
+ var KEY0 = 48,
101
+ KEY9 = 57,
102
+ _KEY0 = 96,
103
+ _KEY9 = 105,
104
+ CTRLKEY = 17,
101
105
  DEL = 46,
102
106
  ENTER = 13,
103
107
  ESC = 27,
@@ -172,6 +176,7 @@
172
176
  onChangeDateTime:function(){},
173
177
  onShow:function(){},
174
178
  onClose:function(){},
179
+ onGenerate:function(){},
175
180
  withoutCopyright:true,
176
181
  inverseButton:false,
177
182
  hours12:false,
@@ -183,7 +188,7 @@
183
188
  scrollMonth:true,
184
189
  scrollTime:true,
185
190
  scrollInput:true,
186
- mask:false,
191
+ mask:true,
187
192
  validateOnBlur:true,
188
193
  yearStart:1950,
189
194
  yearEnd:2050,
@@ -193,7 +198,7 @@
193
198
  },
194
199
  options = ($.isPlainObject(opt)||!opt)?$.extend({},default_options,opt):$.extend({},default_options),
195
200
  createDateTimePicker = function( input ){
196
- var datetimepicker = $('<div '+(options.id?'id="'+options.id+'"':'')+' '+(options.style?'style="'+options.style+'"':'')+' class="xdsoft_datetimepicker '+options.className+'"></div>'),
201
+ var datetimepicker = $('<div '+(options.id?'id="'+options.id+'"':'')+' '+(options.style?'style="'+options.style+'"':'')+' class="xdsoft_datetimepicker xdsoft_noselect '+options.className+'"></div>'),
197
202
  xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
198
203
  datepicker = $('<div class="xdsoft_datepicker active"></div>'),
199
204
  mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_label xdsoft_month"><span></span></div><div class="xdsoft_label xdsoft_year"><span></span></div><button type="button" class="xdsoft_next"></button></div>'),
@@ -221,12 +226,11 @@
221
226
  .find('.xdsoft_select')
222
227
  .hide();
223
228
  var select = $(this).find('.xdsoft_select').eq(0),
224
- xd = datetimepicker.data('xdsoft_datetime'),
225
229
  val = 0,
226
230
  top = 0;
227
231
 
228
- if( xd&&xd.currentTime )
229
- val = xd.currentTime[$(this).hasClass('xdsoft_month')?'getMonth':'getFullYear']();
232
+ if( _xdsoft_datetime.currentTime )
233
+ val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month')?'getMonth':'getFullYear']();
230
234
 
231
235
  select.show();
232
236
  for(var items = select.find('div.xdsoft_option'),i = 0;i<items.length;i++){
@@ -248,9 +252,8 @@
248
252
  event.preventDefault();
249
253
  })
250
254
  .on('mousedown.xdsoft','.xdsoft_option',function( event ){
251
- var xd = datetimepicker.data('xdsoft_datetime');
252
- if( xd&&xd.currentTime )
253
- xd.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect')?'setMonth':'setFullYear']($(this).data('value'));
255
+ if( _xdsoft_datetime&&_xdsoft_datetime.currentTime )
256
+ _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect')?'setMonth':'setFullYear']($(this).data('value'));
254
257
  $(this).parent().parent().hide();
255
258
  datetimepicker.trigger('xchange.xdsoft');
256
259
  });
@@ -291,12 +294,14 @@
291
294
  if( !options.timepickerScrollbar )
292
295
  scrollbar.hide();
293
296
 
294
- var tmpDate = [];
297
+ var tmpDate = [],timeOffset;
295
298
  if( options.minDate && ( tmpDate = /^-(.*)$/.exec(options.minDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ){
296
- options.minDate = new Date((new Date).getTime()-tmpDate.getTime()).dateFormat( options.formatDate );
299
+ timeOffset = tmpDate.getTime()+-1*(tmpDate.getTimezoneOffset())*60000;
300
+ options.minDate = new Date((new Date).getTime()-timeOffset).dateFormat( options.formatDate );
297
301
  }
298
302
  if( options.maxDate && ( tmpDate = /^\+(.*)$/.exec(options.maxDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ){
299
- options.maxDate = new Date((new Date).getTime()+tmpDate.getTime()).dateFormat( options.formatDate );
303
+ timeOffset = tmpDate.getTime()+-1*(tmpDate.getTimezoneOffset())*60000;
304
+ options.maxDate = new Date((new Date).getTime()+timeOffset).dateFormat( options.formatDate );
300
305
  }
301
306
  if( options.mask ){
302
307
  var e,
@@ -341,8 +346,16 @@
341
346
  input.off('keydown.xdsoft');
342
347
  switch(true){
343
348
  case ( options.mask===true ):
344
- options.mask = (new Date()).dateFormat( options.format );
345
- options.mask = options.mask.replace(/[0-9]/g,'_');
349
+ //options.mask = (new Date()).dateFormat( options.format );
350
+ //options.mask = options.mask.replace(/[0-9]/g,'_');
351
+ options.mask = options.format
352
+ .replace(/Y/g,'9999')
353
+ .replace(/F/g,'9999')
354
+ .replace(/m/g,'19')
355
+ .replace(/d/g,'39')
356
+ .replace(/H/g,'29')
357
+ .replace(/i/g,'59')
358
+ .replace(/s/g,'59');
346
359
  case ( $.type(options.mask) == 'string' ):
347
360
  if( !isValidValue( options.mask,input.val() ) )
348
361
  input.val(options.mask.replace(/[0-9]/g,'_'));
@@ -351,7 +364,7 @@
351
364
  var val = this.value,
352
365
  key = event.which;
353
366
  switch(true){
354
- case ((key>=48&&key<=57)||(key>=96&&key<=105))||(key==BACKSPACE||key==DEL):
367
+ case (( key>=KEY0&&key<=KEY9 )||( key>=_KEY0&&key<=_KEY ))||(key==BACKSPACE||key==DEL):
355
368
  var pos = getCaretPos(this),
356
369
  digit = ( key!=BACKSPACE&&key!=DEL )?String.fromCharCode(key):'_';
357
370
  if( (key==BACKSPACE||key==DEL)&&pos ){
@@ -468,7 +481,7 @@
468
481
  month = 0;
469
482
  }
470
483
  _this.currentTime.setMonth(month);
471
- options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
484
+ options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
472
485
  datetimepicker.trigger('xchange.xdsoft');
473
486
  return month;
474
487
  };
@@ -480,7 +493,7 @@
480
493
  month = 11;
481
494
  }
482
495
  _this.currentTime.setMonth(month);
483
- options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
496
+ options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
484
497
  datetimepicker.trigger('xchange.xdsoft');
485
498
  return month;
486
499
  };
@@ -509,7 +522,8 @@
509
522
  _this.str = function(){
510
523
  return _this.currentTime.dateFormat(options.format);
511
524
  };
512
- };
525
+ },
526
+ _xdsoft_datetime = new XDSoftDateTime;
513
527
 
514
528
  mounth_picker
515
529
  .find('.xdsoft_prev,.xdsoft_next')
@@ -519,12 +533,11 @@
519
533
  stop = false;
520
534
 
521
535
  (function(v){
522
- var month = datetimepicker.data('xdsoft_datetime')
523
- .currentTime.getMonth();
536
+ var month = _xdsoft_datetime.currentTime.getMonth();
524
537
  if( $this.hasClass( options.next ) ){
525
- datetimepicker.data('xdsoft_datetime').nextMonth();
538
+ _xdsoft_datetime.nextMonth();
526
539
  }else if( $this.hasClass( options.prev ) ){
527
- datetimepicker.data('xdsoft_datetime').prevMonth();
540
+ _xdsoft_datetime.prevMonth();
528
541
  }
529
542
  !stop&&(timer = setTimeout(arguments.callee,v?v:100));
530
543
  })(500);
@@ -566,10 +579,9 @@
566
579
 
567
580
  // base handler - generating a calendar and timepicker
568
581
  datetimepicker
569
- .on('xchange.xdsoft',function(event){
570
- var xd = $(this).data('xdsoft_datetime'),
571
- table = '',
572
- start = new Date(xd.currentTime.getFullYear(),xd.currentTime.getMonth(),1),
582
+ .on('xchange.xdsoft',function( event ){
583
+ var table = '',
584
+ start = new Date(_xdsoft_datetime.currentTime.getFullYear(),_xdsoft_datetime.currentTime.getMonth(),1),
573
585
  i = 0,
574
586
  today = new Date;
575
587
 
@@ -586,28 +598,39 @@
586
598
 
587
599
  table+='</tr></thead>';
588
600
  table+='<tbody><tr>';
589
- while( i<xd.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||xd.currentTime.getMonth()==start.getMonth() ){
601
+ var maxDate = false, minDate = false;
602
+ if( options.maxDate!==false ){
603
+ maxDate = _xdsoft_datetime.strtodate(options.maxDate);
604
+ maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate(),23,59,59,999);
605
+ }
606
+ if( options.minDate!==false ){
607
+ minDate = _xdsoft_datetime.strtodate(options.minDate);
608
+ minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
609
+ }
610
+ var d,y,m;
611
+ while( i<_xdsoft_datetime.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ){
590
612
  i++;
591
- table+='<td data-date="'+start.getDate()+'" data-month="'+start.getMonth()+'" data-year="'+start.getFullYear()+'"'+
592
- ' class="'+
613
+ d = start.getDate(); y = start.getFullYear(); m = start.getMonth();
614
+ table+='<td data-date="'+d+'" data-month="'+m+'" data-year="'+y+'"'+
615
+ ' class="xdsoft_date '+
593
616
  (
594
- (options.maxDate!==false&&Math.round(xd.strtodate(options.maxDate).getTime()/86400000)<Math.round(start.getTime()/86400000))||
595
- (options.minDate!==false&&Math.round(xd.strtodate(options.minDate).getTime()/86400000)>Math.round(start.getTime()/86400000))
617
+ (( maxDate!==false && start > maxDate )||
618
+ ( minDate!==false && start < minDate ))
596
619
  ?'xdsoft_disabled ':' ')+
597
- (xd.currentTime.getMonth()!=start.getMonth()?' xdsoft_other_month ':' ')+
598
- (xd.currentTime.dateFormat('d.m.Y')==start.dateFormat('d.m.Y')?' xdsoft_current ':' ')+
599
- (today.dateFormat('d.m.Y')==start.dateFormat('d.m.Y')?' xdsoft_today ':' ')
600
- +'"><div>'+start.getDate()+'</div></td>';
620
+ (_xdsoft_datetime.currentTime.getMonth()!=m?' xdsoft_other_month ':'')+
621
+ (_xdsoft_datetime.currentTime.dateFormat('d.m.Y')==start.dateFormat('d.m.Y')?' xdsoft_current ':'')+
622
+ (today.dateFormat('d.m.Y')==start.dateFormat('d.m.Y')?' xdsoft_today ':'')
623
+ +'"><div>'+d+'</div></td>';
601
624
  if( start.getDay()==options.dayOfWeekStartPrev )
602
625
  table+='</tr>';
603
- start.setDate(start.getDate()+1);
626
+ start.setDate(d+1);
604
627
  }
605
628
  table+='</tbody></table>';
606
629
 
607
630
  calendar.html(table);
608
631
 
609
- mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[xd.currentTime.getMonth()]);
610
- mounth_picker.find('.xdsoft_label span').eq(1).text(xd.currentTime.getFullYear());
632
+ mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]);
633
+ mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
611
634
 
612
635
  // generate timebox
613
636
  var time = '',
@@ -619,15 +642,14 @@
619
642
  h = parseInt(now.getHours());
620
643
  now.setMinutes(m);
621
644
  m = parseInt(now.getMinutes());
622
- time+= '<div class="'+
623
- (
624
- (options.maxTime!==false&&xd.strtotime(options.maxTime).getTime()<now.getTime())||
625
- (options.minTime!==false&&xd.strtotime(options.minTime).getTime()>now.getTime())
645
+ time+= '<div class="xdsoft_time '+
646
+ ( (options.maxTime!==false&&_xdsoft_datetime.strtotime(options.maxTime).getTime()<now.getTime())||
647
+ (options.minTime!==false&&_xdsoft_datetime.strtotime(options.minTime).getTime()>now.getTime())
626
648
  ?'xdsoft_disabled ':' ')+
627
649
  (
628
- (parseInt(xd.currentTime.getHours())==parseInt(h)
650
+ (parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h)
629
651
  &&
630
- parseInt(xd.currentTime.getMinutes()/options.step)*options.step==parseInt(m)
652
+ parseInt(_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m)
631
653
  )?' xdsoft_current ':'')+
632
654
  ((parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))?' xdsoft_today ':'')+
633
655
  '" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>';
@@ -642,8 +664,8 @@
642
664
  }
643
665
  }else{
644
666
  for(var i=0;i<options.allowTimes.length;i++){
645
- h = xd.strtotime(options.allowTimes[i]).getHours();
646
- m = xd.strtotime(options.allowTimes[i]).getMinutes();
667
+ h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
668
+ m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
647
669
  line_time( h,m );
648
670
  }
649
671
  }
@@ -653,15 +675,16 @@
653
675
  i = 0;
654
676
 
655
677
  for( i = parseInt(options.yearStart,10);i<= parseInt(options.yearEnd,10);i++ ){
656
- opt+='<div class="xdsoft_option '+(xd.currentTime.getFullYear()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+i+'</div>';
678
+ opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getFullYear()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+i+'</div>';
657
679
  }
658
680
  yearselect.children().eq(0)
659
681
  .html(opt);
660
682
 
661
683
  for( i = 0,opt = '';i<= 11;i++ ){
662
- opt+='<div class="xdsoft_option '+(xd.currentTime.getMonth()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+options.i18n[options.lang].months[i]+'</div>';
684
+ opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getMonth()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+options.i18n[options.lang].months[i]+'</div>';
663
685
  }
664
686
  monthselect.children().eq(0).html(opt);
687
+ $(this).trigger('generate.xdsoft');
665
688
  event.stopPropagation();
666
689
  })
667
690
  .on('afterOpen.xdsoft',function(){
@@ -678,7 +701,7 @@
678
701
  calendar
679
702
  .on('mousedown.xdsoft','td',function(){
680
703
  var $this = $(this),
681
- currentTime = datetimepicker.data('xdsoft_datetime').currentTime;
704
+ currentTime = _xdsoft_datetime.currentTime;
682
705
  if( $this.hasClass('xdsoft_disabled') )
683
706
  return false;
684
707
  currentTime.setFullYear( $this.data('year') );
@@ -686,13 +709,13 @@
686
709
  currentTime.setDate( $this.data('date') );
687
710
  datetimepicker.trigger('select.xdsoft',[currentTime]);
688
711
 
689
- input.val( datetimepicker.data('xdsoft_datetime').str() );
712
+ input.val( _xdsoft_datetime.str() );
690
713
  if( (options.closeOnDateSelect===true||( options.closeOnDateSelect===0&&!options.timepicker ))&&!options.inline ){
691
714
  datetimepicker.trigger('close.xdsoft');
692
715
  }
693
716
 
694
717
  if( options.onSelectDate && options.onSelectDate.call ){
695
- options.onSelectDate.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
718
+ options.onSelectDate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
696
719
  }
697
720
 
698
721
  datetimepicker.trigger('xchange.xdsoft');
@@ -702,19 +725,19 @@
702
725
  timebox
703
726
  .on('mousedown.xdsoft','div',function(){
704
727
  var $this = $(this),
705
- currentTime = datetimepicker.data('xdsoft_datetime').currentTime;
728
+ currentTime = _xdsoft_datetime.currentTime;
706
729
  if( $this.hasClass('xdsoft_disabled') )
707
730
  return false;
708
731
  currentTime.setHours($this.data('hour'));
709
732
  currentTime.setMinutes($this.data('minute'));
710
733
  datetimepicker.trigger('select.xdsoft',[currentTime]);
711
734
 
712
- datetimepicker.data('input').val( datetimepicker.data('xdsoft_datetime').str() );
735
+ datetimepicker.data('input').val( _xdsoft_datetime.str() );
713
736
 
714
737
  !options.inline&&datetimepicker.trigger('close.xdsoft');
715
738
 
716
739
  if( options.onSelectTime&&options.onSelectTime.call ){
717
- options.onSelectTime.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
740
+ options.onSelectTime.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
718
741
  }
719
742
 
720
743
  datetimepicker.trigger('xchange.xdsoft');
@@ -725,9 +748,9 @@
725
748
  if( !options.scrollMonth )
726
749
  return true;
727
750
  if( delta<0 )
728
- datetimepicker.data('xdsoft_datetime').nextMonth();
751
+ _xdsoft_datetime.nextMonth();
729
752
  else
730
- datetimepicker.data('xdsoft_datetime').prevMonth();
753
+ _xdsoft_datetime.prevMonth();
731
754
  return false;
732
755
  });
733
756
 
@@ -753,9 +776,13 @@
753
776
  datetimepicker
754
777
  .on('changedatetime.xdsoft',function(){
755
778
  if( options.onChangeDateTime&&options.onChangeDateTime.call )
756
- options.onChangeDateTime.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
779
+ options.onChangeDateTime.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
780
+ })
781
+ .on('generate.xdsoft',function(){
782
+ if( options.onGenerate&&options.onGenerate.call )
783
+ options.onGenerate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
757
784
  });
758
-
785
+
759
786
  var current_time_index = 0;
760
787
  input.mousewheel&&input.mousewheel(function( event, delta, deltaX, deltaY ){
761
788
  if( !options.scrollInput )
@@ -768,7 +795,7 @@
768
795
  return false;
769
796
  }else if( options.datepicker && !options.timepicker ){
770
797
  datepicker.trigger( event, [delta, deltaX, deltaY]);
771
- input.val&&input.val( datetimepicker.data('xdsoft_datetime').str() );
798
+ input.val&&input.val( _xdsoft_datetime.str() );
772
799
  datetimepicker.trigger('changedatetime.xdsoft');
773
800
  return false;
774
801
  }
@@ -788,7 +815,7 @@
788
815
  .on('open.xdsoft', function(){
789
816
  var onShow = true;
790
817
  if( options.onShow&&options.onShow.call){
791
- onShow = options.onShow.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
818
+ onShow = options.onShow.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
792
819
  }
793
820
  if( onShow!==false ){
794
821
  datetimepicker.show();
@@ -809,7 +836,7 @@
809
836
  .on('close.xdsoft', function( event ){
810
837
  var onClose = true;
811
838
  if( options.onClose&&options.onClose.call ){
812
- onClose=options.onClose.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
839
+ onClose=options.onClose.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
813
840
  }
814
841
  if( onClose!==false&&!options.opened&&!options.inline ){
815
842
  datetimepicker.hide();
@@ -818,8 +845,7 @@
818
845
  })
819
846
  .data('input',input);
820
847
 
821
- var _xdsoft_datetime = new XDSoftDateTime,
822
- timer = 0,
848
+ var timer = 0,
823
849
  timer1 = 0;
824
850
 
825
851
  datetimepicker.data('xdsoft_datetime',_xdsoft_datetime);
@@ -851,13 +877,13 @@
851
877
  destroyDateTimePicker = function( input ){
852
878
  var datetimepicker = input.data('xdsoft_datetimepicker');
853
879
  if( datetimepicker ){
854
- var _xdsoft_datetime = datetimepicker.data('xdsoft_datetime');
880
+ var _xdsoft_datetime = _xdsoft_datetime;
855
881
  delete _xdsoft_datetime;
856
882
  datetimepicker.remove();
857
883
  delete datetimepicker;
858
884
  input
859
885
  .data( 'xdsoft_datetimepicker',null )
860
- .off( 'open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft blur.xdsoft' );
886
+ .off( 'open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft blur.xdsoft keydown.xdsoft' );
861
887
  $(window).off('resize.xdsoft');
862
888
  $([window,document.body]).off('mousedown.xdsoft');
863
889
  input.unmousewheel&&input.unmousewheel();
@@ -914,7 +940,7 @@
914
940
  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
915
941
  * details.
916
942
  */
917
- Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(format){if(Date.formatFunctions[format]==null){Date.createNewFormat(format)}var func=Date.formatFunctions[format];return this[func]()};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function(){return ";var special=false;var ch='';for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true}else if(special){special=false;code+="'"+String.escape(ch)+"' + "}else{code+=Date.getFormatCode(ch)}}eval(code.substring(0,code.length-3)+";}")};Date.getFormatCode=function(character){switch(character){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(character)+"' + "}};Date.parseDate=function(input,format){if(Date.parseFunctions[format]==null){Date.createParser(format)}var func=Date.parseFunctions[format];return Date[func](input)};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input){\n"+"var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n"+"var d = new Date();\n"+"y = d.getFullYear();\n"+"m = d.getMonth();\n"+"d = d.getDate();\n"+"var results = input.match(Date.parseRegexes["+regexNum+"]);\n"+"if (results && results.length > 0) {";var regex="";var special=false;var ch='';for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true}else if(special){special=false;regex+=String.escape(ch)}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c}}}code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"+"{return new Date(y, m, d, h, i, s);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"+"{return new Date(y, m, d, h, i);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n"+"{return new Date(y, m, d, h);}\n"+"else if (y > 0 && m >= 0 && d > 0)\n"+"{return new Date(y, m, d);}\n"+"else if (y > 0 && m >= 0)\n"+"{return new Date(y, m);}\n"+"else if (y > 0)\n"+"{return new Date(y);}\n"+"}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code)};Date.formatCodeToRegex=function(character,currentGroup){switch(character){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:0,c:null,s:"(?:\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+currentGroup+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+currentGroup+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+currentGroup+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+currentGroup+"], 10);\n"+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+currentGroup+"] == 'am') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+currentGroup+"] == 'AM') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(character)}}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(this.getTimezoneOffset()/60),2,"0")+String.leftPad(this.getTimezoneOffset()%60,2,"0")};Date.prototype.getDayOfYear=function(){var num=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var i=0;i<this.getMonth();++i){num+=Date.daysInMonth[i]}return num+this.getDate()-1};Date.prototype.getWeekOfYear=function(){var now=this.getDayOfYear()+(4-this.getDay());var jan1=new Date(this.getFullYear(),0,1);var then=(7-jan1.getDay()+4);document.write(then);return String.leftPad(((now-then)/7)+1,2,"0")};Date.prototype.isLeapYear=function(){var year=this.getFullYear();return((year&3)==0&&(year%100||(year%400==0&&year)))};Date.prototype.getFirstDayOfMonth=function(){var day=(this.getDay()-(this.getDate()-1))%7;return(day<0)?(day+7):day};Date.prototype.getLastDayOfMonth=function(){var day=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(day<0)?(day+7):day};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()]};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};String.escape=function(string){return string.replace(/('|\\)/g,"\\$1")};String.leftPad=function(val,size,ch){var result=new String(val);if(ch==null){ch=" "}while(result.length<size){result=ch+result}return result};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};
943
+ Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(format){if(Date.formatFunctions[format]==null){Date.createNewFormat(format)}var func=Date.formatFunctions[format];return this[func]()};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function(){return ";var special=false;var ch='';for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true}else if(special){special=false;code+="'"+String.escape(ch)+"' + "}else{code+=Date.getFormatCode(ch)}}eval(code.substring(0,code.length-3)+";}")};Date.getFormatCode=function(character){switch(character){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(character)+"' + "}};Date.parseDate=function(input,format){if(Date.parseFunctions[format]==null){Date.createParser(format)}var func=Date.parseFunctions[format];return Date[func](input)};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input){\n"+"var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n"+"var d = new Date();\n"+"y = d.getFullYear();\n"+"m = d.getMonth();\n"+"d = d.getDate();\n"+"var results = input.match(Date.parseRegexes["+regexNum+"]);\n"+"if (results && results.length > 0) {";var regex="";var special=false;var ch='';for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true}else if(special){special=false;regex+=String.escape(ch)}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c}}}code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"+"{return new Date(y, m, d, h, i, s);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"+"{return new Date(y, m, d, h, i);}\n"+"else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n"+"{return new Date(y, m, d, h);}\n"+"else if (y > 0 && m >= 0 && d > 0)\n"+"{return new Date(y, m, d);}\n"+"else if (y > 0 && m >= 0)\n"+"{return new Date(y, m);}\n"+"else if (y > 0)\n"+"{return new Date(y);}\n"+"}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code)};Date.formatCodeToRegex=function(character,currentGroup){switch(character){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:0,c:null,s:"(?:\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+currentGroup+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+currentGroup+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+currentGroup+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+currentGroup+"], 10);\n"+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+currentGroup+"] == 'am') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+currentGroup+"] == 'AM') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(character)}}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0")};Date.prototype.getDayOfYear=function(){var num=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var i=0;i<this.getMonth();++i){num+=Date.daysInMonth[i]}return num+this.getDate()-1};Date.prototype.getWeekOfYear=function(){var now=this.getDayOfYear()+(4-this.getDay());var jan1=new Date(this.getFullYear(),0,1);var then=(7-jan1.getDay()+4);document.write(then);return String.leftPad(((now-then)/7)+1,2,"0")};Date.prototype.isLeapYear=function(){var year=this.getFullYear();return((year&3)==0&&(year%100||(year%400==0&&year)))};Date.prototype.getFirstDayOfMonth=function(){var day=(this.getDay()-(this.getDate()-1))%7;return(day<0)?(day+7):day};Date.prototype.getLastDayOfMonth=function(){var day=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(day<0)?(day+7):day};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()]};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};String.escape=function(string){return string.replace(/('|\\)/g,"\\$1")};String.leftPad=function(val,size,ch){var result=new String(val);if(ch==null){ch=" "}while(result.length<size){result=ch+result}return result};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};
918
944
 
919
945
  //https://github.com/brandonaaron/jquery-mousewheel/blob/master/jquery.mousewheel.js
920
946
  /*
@@ -15,12 +15,6 @@
15
15
  z-index: 9999;
16
16
  box-sizing: border-box;
17
17
  display:none;
18
- -webkit-touch-callout: none;
19
- -webkit-user-select: none;
20
- -khtml-user-select: none;
21
- -moz-user-select: none;
22
- -ms-user-select: none;
23
- user-select: none;
24
18
  }
25
19
 
26
20
  .xdsoft_noselect{
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Datetimepicker
3
3
  module Rails
4
- VERSION = '2.0.2.1'
4
+ VERSION = '2.0.5.0'
5
5
  end
6
6
  end
7
7
  end
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.0.2.1
4
+ version: 2.0.5.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: 2013-12-10 00:00:00.000000000 Z
11
+ date: 2013-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler