jquery-datetimepicker-rails 2.0.7.0 → 2.0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfc315c9ea8b1e81bf74685f2ea320d930160d1b
4
- data.tar.gz: dd4af6e66e33a3c26340cc6e2a1b2a07ca5c3dd3
3
+ metadata.gz: 752b9a9af29d44523d1ee1273e26006ceaa3229f
4
+ data.tar.gz: c5dff8147817478608e4a07431a716f4367f4d5c
5
5
  SHA512:
6
- metadata.gz: a4bd0659d6667e73c3d69abbd96d880997febbe3b3eefccba09595a3699cccafd30d6fca550ba77246d353f72322d605c7974114bbfe855b93b310081d08d424
7
- data.tar.gz: e729d486064a4e5e0c2556d4dfff0df2c1e4d084261835be2192dff06fc8b3f597f8ccda3fe8473db28b6eb61fddf0609f8fc948672f75213363b059502055db
6
+ metadata.gz: 2593f3d80cb8f1dee2c1b84bbf47e8280d1711fd19a18c9eab9e86050ef5b727d644906d06949df865d4da1cd0eb6c73c37e5b4a997a62c93fd0f86e6634494f
7
+ data.tar.gz: eab7609bc3feef7b1190e5996df18e55d00888bff02f7f9de065ded44b9a5000c72386ae2ade2bedf1db9b098d7f82d112c6451bcee59dc1d8dd9be8ac74219d
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @preserve jQuery DateTimePicker plugin v2.0.7
2
+ * @preserve jQuery DateTimePicker plugin v2.0.8
3
3
  * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4
4
  * (c) 2013, Chupurnov Valeriy.
5
5
  */
6
- (function( $ ){
6
+ (function( $ ) {
7
7
  // fix for ie8
8
8
  if (!Array.prototype.indexOf) {
9
9
  Array.prototype.indexOf = function(obj, start) {
@@ -13,13 +13,13 @@
13
13
  return -1;
14
14
  }
15
15
  }
16
- $.fn.xdsoftScroller = function( _percent ){
17
- return this.each(function(){
16
+ $.fn.xdsoftScroller = function( _percent ) {
17
+ return this.each(function() {
18
18
  var timeboxparent = $(this);
19
- if( !$(this).hasClass('xdsoft_scroller_box') ){
20
- var pointerEventToXY = function( e ){
19
+ if( !$(this).hasClass('xdsoft_scroller_box') ) {
20
+ var pointerEventToXY = function( e ) {
21
21
  var out = {x:0, y:0};
22
- if(e.type == 'touchstart' || e.type == 'touchmove' || e.type == 'touchend' || e.type == 'touchcancel'){
22
+ if( e.type == 'touchstart' || e.type == 'touchmove' || e.type == 'touchend' || e.type == 'touchcancel' ) {
23
23
  var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
24
24
  out.x = touch.pageX;
25
25
  out.y = touch.pageY;
@@ -41,17 +41,17 @@
41
41
  scrollbar.append(scroller);
42
42
 
43
43
  timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
44
- scroller.on('mousedown.xdsoft_scroller',function( event ){
44
+ scroller.on('mousedown.xdsoft_scroller',function( event ) {
45
45
  var pageY = event.pageY,
46
46
  top = parseInt(scroller.css('margin-top')),
47
47
  h1 = scrollbar[0].offsetHeight;
48
48
  $(document.body).addClass('xdsoft_noselect');
49
- $([document.body,window]).on('mouseup.xdsoft_scroller',function(){
49
+ $([document.body,window]).on('mouseup.xdsoft_scroller',function() {
50
50
  $([document.body,window]).off('mouseup.xdsoft_scroller',arguments.callee)
51
51
  .off('mousemove.xdsoft_scroller',move)
52
52
  .removeClass('xdsoft_noselect');
53
53
  });
54
- $(document.body).on('mousemove.xdsoft_scroller',move = function(event){
54
+ $(document.body).on('mousemove.xdsoft_scroller',move = function(event) {
55
55
  var offset = event.pageY-pageY+top;
56
56
  if( offset<0 )
57
57
  offset = 0;
@@ -62,12 +62,12 @@
62
62
  });
63
63
 
64
64
  timeboxparent
65
- .on('scroll_element.xdsoft_scroller',function( event,percent ){
65
+ .on('scroll_element.xdsoft_scroller',function( event,percent ) {
66
66
  percent = percent>1?1:(percent<0||isNaN(percent))?0:percent;
67
67
  scroller.css('margin-top',maximumOffset*percent);
68
68
  timebox.css('marginTop',-parseInt((height-parentHeight)*percent))
69
69
  })
70
- .on('resize_scroll.xdsoft_scroller',function( event,_percent ){
70
+ .on('resize_scroll.xdsoft_scroller',function( event,_percent ) {
71
71
  parentHeight = timeboxparent[0].offsetHeight-2;
72
72
  height = timebox[0].offsetHeight;
73
73
  var percent = parentHeight/height,
@@ -87,25 +87,25 @@
87
87
  event.stopPropagation();
88
88
  return false;
89
89
  });
90
- timeboxparent.on('touchstart',function( event ){
90
+ timeboxparent.on('touchstart',function( event ) {
91
91
  start = pointerEventToXY(event);
92
92
  });
93
- timeboxparent.on('touchmove',function( event ){
94
- if( start ){
93
+ timeboxparent.on('touchmove',function( event ) {
94
+ if( start ) {
95
95
  var coord = pointerEventToXY(event), top = Math.abs(parseInt(timebox.css('marginTop')));
96
96
  timeboxparent.trigger('scroll_element.xdsoft_scroller',[(top-(coord.y-start.y))/(height-parentHeight)]);
97
97
  event.stopPropagation();
98
98
  event.preventDefault();
99
99
  };
100
100
  });
101
- timeboxparent.on('touchend touchcancel',function( event ){
101
+ timeboxparent.on('touchend touchcancel',function( event ) {
102
102
  start = false;
103
103
  });
104
104
  }
105
105
  timeboxparent.trigger('resize_scroll.xdsoft_scroller',[_percent]);
106
106
  });
107
107
  };
108
- $.fn.datetimepicker = function( opt ){
108
+ $.fn.datetimepicker = function( opt ) {
109
109
  var KEY0 = 48,
110
110
  KEY9 = 57,
111
111
  _KEY0 = 96,
@@ -179,13 +179,13 @@
179
179
  allowTimes:[],
180
180
  opened:false,
181
181
  inline:false,
182
- onSelectDate:function(){},
183
- onSelectTime:function(){},
184
- onChangeMonth:function(){},
185
- onChangeDateTime:function(){},
186
- onShow:function(){},
187
- onClose:function(){},
188
- onGenerate:function(){},
182
+ onSelectDate:function() {},
183
+ onSelectTime:function() {},
184
+ onChangeMonth:function() {},
185
+ onChangeDateTime:function() {},
186
+ onShow:function() {},
187
+ onClose:function() {},
188
+ onGenerate:function() {},
189
189
  withoutCopyright:true,
190
190
  inverseButton:false,
191
191
  hours12:false,
@@ -199,14 +199,17 @@
199
199
  scrollInput:true,
200
200
  mask:false,
201
201
  validateOnBlur:true,
202
+ allowBlank:false,
202
203
  yearStart:1950,
203
204
  yearEnd:2050,
204
205
  style:'',
205
206
  id:'',
206
- className:''
207
+ roundTime:'round', // ceil, floor
208
+ className:'',
209
+ weekends : []
207
210
  },
208
211
  options = ($.isPlainObject(opt)||!opt)?$.extend({},default_options,opt):$.extend({},default_options),
209
- createDateTimePicker = function( input ){
212
+ createDateTimePicker = function( input ) {
210
213
  var datetimepicker = $('<div '+(options.id?'id="'+options.id+'"':'')+' '+(options.style?'style="'+options.style+'"':'')+' class="xdsoft_datetimepicker xdsoft_noselect '+options.className+'"></div>'),
211
214
  xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
212
215
  datepicker = $('<div class="xdsoft_datepicker active"></div>'),
@@ -242,8 +245,8 @@
242
245
  val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month')?'getMonth':'getFullYear']();
243
246
 
244
247
  select.show();
245
- for(var items = select.find('div.xdsoft_option'),i = 0;i<items.length;i++){
246
- if( items.eq(i).data('value')==val ){
248
+ for(var items = select.find('div.xdsoft_option'),i = 0;i<items.length;i++) {
249
+ if( items.eq(i).data('value')==val ) {
247
250
  break;
248
251
  }else top+=items[0].offsetHeight;
249
252
  }
@@ -260,7 +263,7 @@
260
263
  event.stopPropagation();
261
264
  event.preventDefault();
262
265
  })
263
- .on('mousedown.xdsoft','.xdsoft_option',function( event ){
266
+ .on('mousedown.xdsoft','.xdsoft_option',function( event ) {
264
267
  if( _xdsoft_datetime&&_xdsoft_datetime.currentTime )
265
268
  _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect')?'setMonth':'setFullYear']($(this).data('value'));
266
269
  $(this).parent().parent().hide();
@@ -269,19 +272,19 @@
269
272
 
270
273
 
271
274
  // set options
272
- datetimepicker.setOptions = function( _options ){
275
+ datetimepicker.setOptions = function( _options ) {
273
276
  options = $.extend({},options,_options);
274
- if( (options.open||options.opened)&&(!options.inline) ){
277
+ if( (options.open||options.opened)&&(!options.inline) ) {
275
278
  input.trigger('open.xdsoft');
276
279
  }
277
280
 
278
- if( options.inline ){
281
+ if( options.inline ) {
279
282
  datetimepicker.addClass('xdsoft_inline');
280
283
  input.after(datetimepicker).hide();
281
284
  datetimepicker.trigger('afterOpen.xdsoft');
282
285
  }
283
286
 
284
- if( options.inverseButton ){
287
+ if( options.inverseButton ) {
285
288
  options.next = 'xdsoft_prev';
286
289
  options.prev = 'xdsoft_next';
287
290
  }
@@ -304,17 +307,17 @@
304
307
  scrollbar.hide();
305
308
 
306
309
  var tmpDate = [],timeOffset;
307
- if( options.minDate && ( tmpDate = /^-(.*)$/.exec(options.minDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ){
310
+ if( options.minDate && ( tmpDate = /^-(.*)$/.exec(options.minDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ) {
308
311
  timeOffset = tmpDate.getTime()+-1*(tmpDate.getTimezoneOffset())*60000;
309
312
  options.minDate = new Date((new Date).getTime()-timeOffset).dateFormat( options.formatDate );
310
313
  }
311
- if( options.maxDate && ( tmpDate = /^\+(.*)$/.exec(options.maxDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ){
314
+ if( options.maxDate && ( tmpDate = /^\+(.*)$/.exec(options.maxDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ) {
312
315
  timeOffset = tmpDate.getTime()+-1*(tmpDate.getTimezoneOffset())*60000;
313
316
  options.maxDate = new Date((new Date).getTime()+timeOffset).dateFormat( options.formatDate );
314
317
  }
315
- if( options.mask ){
318
+ if( options.mask ) {
316
319
  var e,
317
- getCaretPos = function( input ) {
320
+ getCaretPos = function ( input ) {
318
321
  try{
319
322
  if ( document.selection && document.selection.createRange ) {
320
323
  var range = document.selection.createRange();
@@ -322,28 +325,28 @@
322
325
  }else
323
326
  if ( input.setSelectionRange )
324
327
  return input.selectionStart;
325
- }catch(e){
328
+ }catch(e) {
326
329
  return 0;
327
330
  }
328
331
  },
329
- setCaretPos = function (node,pos){
332
+ setCaretPos = function ( node,pos ) {
330
333
  var node = (typeof node == "string" || node instanceof String) ? document.getElementById(node) : node;
331
- if(!node){
334
+ if(!node) {
332
335
  return false;
333
- }else if(node.createTextRange){
336
+ }else if(node.createTextRange) {
334
337
  var textRange = node.createTextRange();
335
338
  textRange.collapse(true);
336
339
  textRange.moveEnd(pos);
337
340
  textRange.moveStart(pos);
338
341
  textRange.select();
339
342
  return true;
340
- }else if(node.setSelectionRange){
343
+ }else if(node.setSelectionRange) {
341
344
  node.setSelectionRange(pos,pos);
342
345
  return true;
343
346
  }
344
347
  return false;
345
348
  },
346
- isValidValue = function( mask,value ){
349
+ isValidValue = function ( mask,value ) {
347
350
  var reg = mask
348
351
  .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,'\\$1')
349
352
  .replace(/_/g,'{digit+}')
@@ -353,7 +356,7 @@
353
356
  return RegExp(reg).test(value);
354
357
  };
355
358
  input.off('keydown.xdsoft');
356
- switch(true){
359
+ switch(true) {
357
360
  case ( options.mask===true ):
358
361
  //options.mask = (new Date()).dateFormat( options.format );
359
362
  //options.mask = options.mask.replace(/[0-9]/g,'_');
@@ -369,14 +372,14 @@
369
372
  if( !isValidValue( options.mask,input.val() ) )
370
373
  input.val(options.mask.replace(/[0-9]/g,'_'));
371
374
 
372
- input.on('keydown.xdsoft',function( event ){
375
+ input.on('keydown.xdsoft',function( event ) {
373
376
  var val = this.value,
374
377
  key = event.which;
375
- switch(true){
378
+ switch(true) {
376
379
  case (( key>=KEY0&&key<=KEY9 )||( key>=_KEY0&&key<=_KEY9 ))||(key==BACKSPACE||key==DEL):
377
380
  var pos = getCaretPos(this),
378
381
  digit = ( key!=BACKSPACE&&key!=DEL )?String.fromCharCode((_KEY0 <= key && key <= _KEY9)? key-KEY0 : key):'_';
379
- if( (key==BACKSPACE||key==DEL)&&pos ){
382
+ if( (key==BACKSPACE||key==DEL)&&pos ) {
380
383
  pos--;
381
384
  digit='_';
382
385
  }
@@ -393,7 +396,7 @@
393
396
  pos+=(key==BACKSPACE||key==DEL)?0:1;
394
397
  while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
395
398
  pos+=(key==BACKSPACE||key==DEL)?-1:1;
396
- if( isValidValue( options.mask,val ) ){
399
+ if( isValidValue( options.mask,val ) ) {
397
400
  this.value = val;
398
401
  setCaretPos(this,pos);
399
402
  }else if( $.trim(val)=='' )
@@ -412,12 +415,16 @@
412
415
  break;
413
416
  }
414
417
  }
415
- if( options.validateOnBlur ){
418
+ if( options.validateOnBlur ) {
416
419
  input
417
420
  .off('blur.xdsoft')
418
- .on('blur.xdsoft', function(){
419
- if( !Date.parseDate( $(this).val(), options.format ) )
421
+ .on('blur.xdsoft', function() {
422
+ if( options.allowBlank && !$.trim($(this).val()).length ) {
423
+ return true;
424
+ }
425
+ else if( !Date.parseDate( $(this).val(), options.format ) ) {
420
426
  $(this).val((new Date()).dateFormat( options.format ));
427
+ }
421
428
  });
422
429
  }
423
430
  options.dayOfWeekStartPrev = (options.dayOfWeekStart==0)?6:options.dayOfWeekStart-1;
@@ -427,7 +434,7 @@
427
434
 
428
435
  datetimepicker
429
436
  .data('options',options)
430
- .on('mousedown.xdsoft',function( event ){
437
+ .on('mousedown.xdsoft',function( event ) {
431
438
  event.stopPropagation();
432
439
  event.preventDefault();
433
440
  yearselect.hide();
@@ -438,7 +445,7 @@
438
445
  var scroll_element = timepicker.find('.xdsoft_time_box');
439
446
  scroll_element.append(timebox);
440
447
  scroll_element.xdsoftScroller();
441
- datetimepicker.on('afterOpen.xdsoft',function(){
448
+ datetimepicker.on('afterOpen.xdsoft',function() {
442
449
  scroll_element.xdsoftScroller();
443
450
  });
444
451
 
@@ -456,9 +463,9 @@
456
463
 
457
464
  $('body').append(datetimepicker);
458
465
 
459
- var XDSoftDateTime = function(){
466
+ var XDSoftDateTime = function() {
460
467
  var _this = this;
461
- _this.now = function(){
468
+ _this.now = function() {
462
469
  return new Date();
463
470
  };
464
471
 
@@ -469,18 +476,18 @@
469
476
  return !isNaN(d.getTime());
470
477
  };
471
478
 
472
- _this.setCurrentTime = function( dTime){
479
+ _this.setCurrentTime = function( dTime) {
473
480
  _this.currentTime = (typeof dTime == 'string')? _this.strtodatetime(dTime) : _this.isValidDate(dTime) ? dTime: _this.now();
474
481
  datetimepicker.trigger('xchange.xdsoft');
475
482
  };
476
483
 
477
- _this.getCurrentTime = function( dTime){
484
+ _this.getCurrentTime = function( dTime) {
478
485
  return _this.currentTime;
479
486
  };
480
487
 
481
- _this.nextMonth = function(){
488
+ _this.nextMonth = function() {
482
489
  var month = _this.currentTime.getMonth()+1;
483
- if( month==12 ){
490
+ if( month==12 ) {
484
491
  _this.currentTime.setFullYear(_this.currentTime.getFullYear()+1);
485
492
  month = 0;
486
493
  }
@@ -490,9 +497,9 @@
490
497
  return month;
491
498
  };
492
499
 
493
- _this.prevMonth = function(){
500
+ _this.prevMonth = function() {
494
501
  var month = _this.currentTime.getMonth()-1;
495
- if( month==-1 ){
502
+ if( month==-1 ) {
496
503
  _this.currentTime.setFullYear(_this.currentTime.getFullYear()-1);
497
504
  month = 11;
498
505
  }
@@ -502,28 +509,28 @@
502
509
  return month;
503
510
  };
504
511
 
505
- _this.strtodatetime = function( sDateTime ){
512
+ _this.strtodatetime = function( sDateTime ) {
506
513
  var currentTime = sDateTime?Date.parseDate(sDateTime, options.format):new Date;
507
514
  if( !_this.isValidDate(currentTime) )
508
515
  currentTime = new Date;
509
516
  return currentTime;
510
517
  };
511
518
 
512
- _this.strtodate = function( sDate ){
519
+ _this.strtodate = function( sDate ) {
513
520
  var currentTime = sDate?Date.parseDate(sDate, options.formatDate):new Date;
514
521
  if( !_this.isValidDate(currentTime) )
515
522
  currentTime = new Date;
516
523
  return currentTime;
517
524
  };
518
525
 
519
- _this.strtotime = function( sTime ){
526
+ _this.strtotime = function( sTime ) {
520
527
  var currentTime = sTime?Date.parseDate(sTime, options.formatTime):new Date;
521
528
  if( !_this.isValidDate(currentTime) )
522
529
  currentTime = new Date;
523
530
  return currentTime;
524
531
  };
525
532
 
526
- _this.str = function(){
533
+ _this.str = function() {
527
534
  return _this.currentTime.dateFormat(options.format);
528
535
  };
529
536
  },
@@ -531,22 +538,22 @@
531
538
 
532
539
  mounth_picker
533
540
  .find('.xdsoft_prev,.xdsoft_next')
534
- .on('mousedown.xdsoft',function(){
541
+ .on('mousedown.xdsoft',function() {
535
542
  var $this = $(this),
536
543
  timer = 0,
537
544
  stop = false;
538
545
 
539
- (function(v){
546
+ (function(v) {
540
547
  var month = _xdsoft_datetime.currentTime.getMonth();
541
- if( $this.hasClass( options.next ) ){
548
+ if( $this.hasClass( options.next ) ) {
542
549
  _xdsoft_datetime.nextMonth();
543
- }else if( $this.hasClass( options.prev ) ){
550
+ }else if( $this.hasClass( options.prev ) ) {
544
551
  _xdsoft_datetime.prevMonth();
545
552
  }
546
553
  !stop&&(timer = setTimeout(arguments.callee,v?v:100));
547
554
  })(500);
548
555
 
549
- $([document.body,window]).on('mouseup.xdsoft',function(){
556
+ $([document.body,window]).on('mouseup.xdsoft',function() {
550
557
  clearTimeout(timer);
551
558
  stop = true;
552
559
  $([document.body,window]).off('mouseup.xdsoft',arguments.callee);
@@ -555,25 +562,25 @@
555
562
 
556
563
  timepicker
557
564
  .find('.xdsoft_prev,.xdsoft_next')
558
- .on('mousedown.xdsoft',function(){
565
+ .on('mousedown.xdsoft',function() {
559
566
  var $this = $(this),
560
567
  timer = 0,
561
568
  stop = false,
562
569
  period = 110;
563
- (function(v){
570
+ (function(v) {
564
571
  var pheight = timeboxparent[0].offsetHeight-2,
565
572
  height = timebox[0].offsetHeight,
566
573
  top = Math.abs(parseInt(timebox.css('marginTop')));
567
- if( $this.hasClass(options.next) && (height-pheight)- options.timeHeightInTimePicker>=top ){
574
+ if( $this.hasClass(options.next) && (height-pheight)- options.timeHeightInTimePicker>=top ) {
568
575
  timebox.css('marginTop','-'+(top+options.timeHeightInTimePicker)+'px')
569
- }else if( $this.hasClass(options.prev) && top-options.timeHeightInTimePicker>=0 ){
576
+ }else if( $this.hasClass(options.prev) && top-options.timeHeightInTimePicker>=0 ) {
570
577
  timebox.css('marginTop','-'+(top-options.timeHeightInTimePicker)+'px')
571
578
  }
572
579
  timeboxparent.trigger('scroll_element.xdsoft_scroller',[Math.abs(parseInt(timebox.css('marginTop'))/(height-pheight))]);
573
580
  period= ( period>10 )?10:period-10;
574
581
  !stop&&(timer = setTimeout(arguments.callee,v?v:period));
575
582
  })(500);
576
- $([document.body,window]).on('mouseup.xdsoft',function(){
583
+ $([document.body,window]).on('mouseup.xdsoft',function() {
577
584
  clearTimeout(timer);
578
585
  stop = true;
579
586
  $([document.body,window])
@@ -583,7 +590,7 @@
583
590
 
584
591
  // base handler - generating a calendar and timepicker
585
592
  datetimepicker
586
- .on('xchange.xdsoft',function( event ){
593
+ .on('xchange.xdsoft',function( event ) {
587
594
  var table = '',
588
595
  start = new Date(_xdsoft_datetime.currentTime.getFullYear(),_xdsoft_datetime.currentTime.getMonth(),1),
589
596
  i = 0,
@@ -596,37 +603,56 @@
596
603
  table+='<table><thead><tr>';
597
604
 
598
605
  // days
599
- for(var j = 0; j<7; j++){
606
+ for(var j = 0; j<7; j++) {
600
607
  table+='<th>'+options.i18n[options.lang].dayOfWeek[(j+options.dayOfWeekStart)>6?0:j+options.dayOfWeekStart]+'</th>';
601
608
  }
602
609
 
603
610
  table+='</tr></thead>';
604
611
  table+='<tbody><tr>';
605
612
  var maxDate = false, minDate = false;
606
- if( options.maxDate!==false ){
613
+ if( options.maxDate!==false ) {
607
614
  maxDate = _xdsoft_datetime.strtodate(options.maxDate);
608
615
  maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate(),23,59,59,999);
609
616
  }
610
- if( options.minDate!==false ){
617
+ if( options.minDate!==false ) {
611
618
  minDate = _xdsoft_datetime.strtodate(options.minDate);
612
619
  minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
613
620
  }
614
- var d,y,m;
615
- while( i<_xdsoft_datetime.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ){
621
+ var d,y,m,classes = [];
622
+ while( i<_xdsoft_datetime.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) {
623
+ classes = [];
616
624
  i++;
625
+
617
626
  d = start.getDate(); y = start.getFullYear(); m = start.getMonth();
618
- table+='<td data-date="'+d+'" data-month="'+m+'" data-year="'+y+'"'+
619
- ' class="xdsoft_date '+
620
- (
621
- (( maxDate!==false && start > maxDate )||
622
- ( minDate!==false && start < minDate ))
623
- ?'xdsoft_disabled ':' ')+
624
- (_xdsoft_datetime.currentTime.getMonth()!=m?' xdsoft_other_month ':'')+
625
- (_xdsoft_datetime.currentTime.dateFormat('d.m.Y')==start.dateFormat('d.m.Y')?' xdsoft_current ':'')+
626
- (today.dateFormat('d.m.Y')==start.dateFormat('d.m.Y')?' xdsoft_today ':'')
627
- +'"><div>'+d+'</div></td>';
628
- if( start.getDay()==options.dayOfWeekStartPrev )
627
+
628
+ classes.push('xdsoft_date');
629
+
630
+ if( ( maxDate!==false && start > maxDate )||( minDate!==false && start < minDate ) ){
631
+ classes.push('xdsoft_disabled');
632
+ }
633
+
634
+ if( _xdsoft_datetime.currentTime.getMonth()!=m ) classes.push('xdsoft_other_month');
635
+
636
+ if( _xdsoft_datetime.currentTime.dateFormat('d.m.Y')==start.dateFormat('d.m.Y') ) {
637
+ classes.push('xdsoft_current');
638
+ }
639
+
640
+ if( today.dateFormat('d.m.Y')==start.dateFormat('d.m.Y') ) {
641
+ classes.push('xdsoft_today');
642
+ }
643
+
644
+ if( start.getDay()==0||start.getDay()==6||~options.weekends.indexOf(start.dateFormat('d.m.Y')) ) {
645
+ classes.push('xdsoft_weekend');
646
+ }
647
+
648
+ table+='<td data-date="'+d+'" data-month="'+m+'" data-year="'+y+'"'+' class="xdsoft_date '+ classes.join(' ')+'">'+
649
+ '<div>'+d+'</div>'+
650
+ '</td>';
651
+
652
+ if( start.getDay()==options.dayOfWeekStartPrev ) {
629
653
  table+='</tr>';
654
+ }
655
+
630
656
  start.setDate(d+1);
631
657
  }
632
658
  table+='</tbody></table>';
@@ -640,7 +666,7 @@
640
666
  var time = '',
641
667
  h = '',
642
668
  m ='',
643
- line_time = function line_time( h,m ){
669
+ line_time = function line_time( h,m ) {
644
670
  var now = new Date();
645
671
  now.setHours(h);
646
672
  h = parseInt(now.getHours());
@@ -653,46 +679,48 @@
653
679
  (
654
680
  (parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h)
655
681
  &&
656
- Math.round(_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m)
682
+ (options.step>59||Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m))
657
683
  )?' xdsoft_current ':'')+
658
684
  ((parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))?' xdsoft_today ':'')+
659
685
  '" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>';
660
686
  };
661
- if( !options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length ){
662
- for(var i=0,j=0;i<(options.hours12?12:24);i++){
663
- for(j=0;j<60;j+=options.step){
687
+
688
+ if( !options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length ) {
689
+ for( var i=0,j=0;i<(options.hours12?12:24);i++ ) {
690
+ for( j=0;j<60;j+=options.step ) {
664
691
  h = (i<10?'0':'')+i;
665
692
  m = (j<10?'0':'')+j;
666
693
  line_time( h,m );
667
694
  }
668
695
  }
669
696
  }else{
670
- for(var i=0;i<options.allowTimes.length;i++){
697
+ for( var i=0;i<options.allowTimes.length;i++ ) {
671
698
  h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
672
699
  m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
673
700
  line_time( h,m );
674
701
  }
675
702
  }
703
+
676
704
  timebox.html(time);
677
705
 
678
706
  var opt = '',
679
707
  i = 0;
680
708
 
681
- for( i = parseInt(options.yearStart,10);i<= parseInt(options.yearEnd,10);i++ ){
709
+ for( i = parseInt(options.yearStart,10);i<= parseInt(options.yearEnd,10);i++ ) {
682
710
  opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getFullYear()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+i+'</div>';
683
711
  }
684
712
  yearselect.children().eq(0)
685
713
  .html(opt);
686
714
 
687
- for( i = 0,opt = '';i<= 11;i++ ){
715
+ for( i = 0,opt = '';i<= 11;i++ ) {
688
716
  opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getMonth()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+options.i18n[options.lang].months[i]+'</div>';
689
717
  }
690
718
  monthselect.children().eq(0).html(opt);
691
719
  $(this).trigger('generate.xdsoft');
692
720
  event.stopPropagation();
693
721
  })
694
- .on('afterOpen.xdsoft',function(){
695
- if( options.timepicker && timebox.find('.xdsoft_current').length ){
722
+ .on('afterOpen.xdsoft',function() {
723
+ if( options.timepicker && timebox.find('.xdsoft_current').length ) {
696
724
  var pheight = timeboxparent[0].offsetHeight-2,
697
725
  height = timebox[0].offsetHeight,
698
726
  top = timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker+1;
@@ -703,7 +731,7 @@
703
731
  }
704
732
  });
705
733
  calendar
706
- .on('mousedown.xdsoft','td',function(){
734
+ .on('mousedown.xdsoft','td',function() {
707
735
  var $this = $(this),
708
736
  currentTime = _xdsoft_datetime.currentTime;
709
737
  if( $this.hasClass('xdsoft_disabled') )
@@ -714,11 +742,11 @@
714
742
  datetimepicker.trigger('select.xdsoft',[currentTime]);
715
743
 
716
744
  input.val( _xdsoft_datetime.str() );
717
- if( (options.closeOnDateSelect===true||( options.closeOnDateSelect===0&&!options.timepicker ))&&!options.inline ){
745
+ if( (options.closeOnDateSelect===true||( options.closeOnDateSelect===0&&!options.timepicker ))&&!options.inline ) {
718
746
  datetimepicker.trigger('close.xdsoft');
719
747
  }
720
748
 
721
- if( options.onSelectDate && options.onSelectDate.call ){
749
+ if( options.onSelectDate && options.onSelectDate.call ) {
722
750
  options.onSelectDate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
723
751
  }
724
752
 
@@ -727,7 +755,7 @@
727
755
  });
728
756
 
729
757
  timebox
730
- .on('mousedown.xdsoft','div',function(){
758
+ .on('mousedown.xdsoft','div',function() {
731
759
  var $this = $(this),
732
760
  currentTime = _xdsoft_datetime.currentTime;
733
761
  if( $this.hasClass('xdsoft_disabled') )
@@ -740,7 +768,7 @@
740
768
 
741
769
  !options.inline&&datetimepicker.trigger('close.xdsoft');
742
770
 
743
- if( options.onSelectTime&&options.onSelectTime.call ){
771
+ if( options.onSelectTime&&options.onSelectTime.call ) {
744
772
  options.onSelectTime.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
745
773
  }
746
774
 
@@ -765,10 +793,10 @@
765
793
  height = timebox[0].offsetHeight,
766
794
  top = Math.abs(parseInt(timebox.css('marginTop'))),
767
795
  fl = true;
768
- if( delta<0 && (height-pheight)-options.timeHeightInTimePicker>=top ){
796
+ if( delta<0 && (height-pheight)-options.timeHeightInTimePicker>=top ) {
769
797
  timebox.css('marginTop','-'+(top+options.timeHeightInTimePicker)+'px');
770
798
  fl = false;
771
- }else if( delta>0&&top-options.timeHeightInTimePicker>=0 ){
799
+ }else if( delta>0&&top-options.timeHeightInTimePicker>=0 ) {
772
800
  timebox.css('marginTop','-'+(top-options.timeHeightInTimePicker)+'px');
773
801
  fl = false;
774
802
  }
@@ -778,33 +806,33 @@
778
806
  });
779
807
 
780
808
  datetimepicker
781
- .on('changedatetime.xdsoft',function(){
809
+ .on('changedatetime.xdsoft',function() {
782
810
  if( options.onChangeDateTime&&options.onChangeDateTime.call )
783
811
  options.onChangeDateTime.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
784
812
  })
785
- .on('generate.xdsoft',function(){
813
+ .on('generate.xdsoft',function() {
786
814
  if( options.onGenerate&&options.onGenerate.call )
787
815
  options.onGenerate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
788
816
  });
789
817
 
790
818
  var current_time_index = 0;
791
- input.mousewheel&&input.mousewheel(function( event, delta, deltaX, deltaY ){
819
+ input.mousewheel&&input.mousewheel(function( event, delta, deltaX, deltaY ) {
792
820
  if( !options.scrollInput )
793
821
  return true;
794
- if( !options.datepicker && options.timepicker ){
822
+ if( !options.datepicker && options.timepicker ) {
795
823
  current_time_index = timebox.find('.xdsoft_current').length?timebox.find('.xdsoft_current').eq(0).index():0;
796
824
  if( current_time_index+delta>=0&&current_time_index+delta<timebox.children().length )
797
825
  current_time_index+=delta;
798
826
  timebox.children().eq(current_time_index).length&&timebox.children().eq(current_time_index).trigger('mousedown');
799
827
  return false;
800
- }else if( options.datepicker && !options.timepicker ){
828
+ }else if( options.datepicker && !options.timepicker ) {
801
829
  datepicker.trigger( event, [delta, deltaX, deltaY]);
802
830
  input.val&&input.val( _xdsoft_datetime.str() );
803
831
  datetimepicker.trigger('changedatetime.xdsoft');
804
832
  return false;
805
833
  }
806
834
  });
807
- var setPos = function(){
835
+ var setPos = function() {
808
836
  var offset = datetimepicker.data('input').offset(), top = offset.top+datetimepicker.data('input')[0].offsetHeight-1, left = offset.left;
809
837
  if( top+datetimepicker[0].offsetHeight>$('body').height() )
810
838
  top = offset.top-datetimepicker[0].offsetHeight+1;
@@ -816,12 +844,12 @@
816
844
  });
817
845
  };
818
846
  datetimepicker
819
- .on('open.xdsoft', function(){
847
+ .on('open.xdsoft', function() {
820
848
  var onShow = true;
821
- if( options.onShow&&options.onShow.call){
849
+ if( options.onShow&&options.onShow.call) {
822
850
  onShow = options.onShow.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
823
851
  }
824
- if( onShow!==false ){
852
+ if( onShow!==false ) {
825
853
  datetimepicker.show();
826
854
  datetimepicker.trigger('afterOpen.xdsoft');
827
855
  setPos();
@@ -829,20 +857,20 @@
829
857
  .off('resize.xdsoft',setPos)
830
858
  .on('resize.xdsoft',setPos);
831
859
 
832
- if( options.closeOnWithoutClick ){
833
- $([document.body,window]).on('mousedown.xdsoft',function(){
860
+ if( options.closeOnWithoutClick ) {
861
+ $([document.body,window]).on('mousedown.xdsoft',function() {
834
862
  datetimepicker.trigger('close.xdsoft');
835
863
  $([document.body,window]).off('mousedown.xdsoft',arguments.callee);
836
864
  });
837
865
  }
838
866
  }
839
867
  })
840
- .on('close.xdsoft', function( event ){
868
+ .on('close.xdsoft', function( event ) {
841
869
  var onClose = true;
842
- if( options.onClose&&options.onClose.call ){
870
+ if( options.onClose&&options.onClose.call ) {
843
871
  onClose=options.onClose.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
844
872
  }
845
- if( onClose!==false&&!options.opened&&!options.inline ){
873
+ if( onClose!==false&&!options.opened&&!options.inline ) {
846
874
  datetimepicker.hide();
847
875
  }
848
876
  event.stopPropagation();
@@ -860,21 +888,21 @@
860
888
 
861
889
  input
862
890
  .data( 'xdsoft_datetimepicker',datetimepicker )
863
- .on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function(event){
891
+ .on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function(event) {
864
892
  if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible') )
865
893
  return;
866
894
  clearTimeout(timer);
867
- timer = setTimeout(function(){
895
+ timer = setTimeout(function() {
868
896
  if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible') )
869
897
  return;
870
898
  _xdsoft_datetime.setCurrentTime((input&&input.val&&input.val())?input.val():new Date);
871
899
  datetimepicker.trigger('open.xdsoft');
872
900
  },100);
873
901
  })
874
- .on('keydown.xdsoft',function( event ){
902
+ .on('keydown.xdsoft',function( event ) {
875
903
  var val = this.value,
876
904
  key = event.which;
877
- switch(true){
905
+ switch(true) {
878
906
  case !!~([ENTER].indexOf(key)):
879
907
  var elementSelector = $("input:visible,textarea:visible");
880
908
  datetimepicker.trigger('close.xdsoft');
@@ -885,16 +913,16 @@
885
913
  return true;
886
914
  }
887
915
  });
888
- /*.on('focusout.xdsoft',function(event){
916
+ /*.on('focusout.xdsoft',function(event) {
889
917
  clearTimeout(timer1);
890
- timer1 = setTimeout(function(){
918
+ timer1 = setTimeout(function() {
891
919
  //datetimepicker.trigger('close.xdsoft');
892
920
  },100);
893
921
  });*/
894
922
  },
895
- destroyDateTimePicker = function( input ){
923
+ destroyDateTimePicker = function( input ) {
896
924
  var datetimepicker = input.data('xdsoft_datetimepicker');
897
- if( datetimepicker ){
925
+ if( datetimepicker ) {
898
926
  var _xdsoft_datetime = _xdsoft_datetime;
899
927
  delete _xdsoft_datetime;
900
928
  datetimepicker.remove();
@@ -910,19 +938,19 @@
910
938
  };
911
939
  $(document)
912
940
  .off('keydown.xdsoftctrl keyup.xdsoftctrl')
913
- .on('keydown.xdsoftctrl',function(e){
941
+ .on('keydown.xdsoftctrl',function(e) {
914
942
  if ( e.keyCode == CTRLKEY )
915
943
  ctrlDown = true;
916
944
  })
917
- .on('keyup.xdsoftctrl',function(e){
945
+ .on('keyup.xdsoftctrl',function(e) {
918
946
  if ( e.keyCode == CTRLKEY )
919
947
  ctrlDown = false;
920
948
  });
921
- return this.each(function(){
949
+ return this.each(function() {
922
950
  var datetimepicker;
923
- if( datetimepicker = $(this).data('xdsoft_datetimepicker') ){
924
- if( $.type(opt) === 'string' ){
925
- switch(opt){
951
+ if( datetimepicker = $(this).data('xdsoft_datetimepicker') ) {
952
+ if( $.type(opt) === 'string' ) {
953
+ switch(opt) {
926
954
  case 'show':
927
955
  $(this).select().focus();
928
956
  datetimepicker.trigger( 'open.xdsoft' );
@@ -958,7 +986,7 @@
958
986
  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
959
987
  * details.
960
988
  */
961
- 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"};
989
+ 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"};
962
990
 
963
991
  //https://github.com/brandonaaron/jquery-mousewheel/blob/master/jquery.mousewheel.js
964
992
  /*
@@ -974,4 +1002,4 @@ Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0
974
1002
  *
975
1003
  * Requires: 1.2.2+
976
1004
  */
977
- (function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else if(typeof exports==='object'){module.exports=factory}else{factory(jQuery)}}(function($){var toFix=['wheel','mousewheel','DOMMouseScroll','MozMousePixelScroll'];var toBind='onwheel'in document||document.documentMode>=9?['wheel']:['mousewheel','DomMouseScroll','MozMousePixelScroll'];var lowestDelta,lowestDeltaXY;if($.event.fixHooks){for(var i=toFix.length;i;){$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}$.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var i=toBind.length;i;){this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}},teardown:function(){if(this.removeEventListener){for(var i=toBind.length;i;){this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}});function handler(event){var orgEvent=event||window.event,args=[].slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,absDeltaXY=0,fn;event=$.event.fix(orgEvent);event.type="mousewheel";if(orgEvent.wheelDelta){delta=orgEvent.wheelDelta}if(orgEvent.detail){delta=orgEvent.detail*-1}if(orgEvent.deltaY){deltaY=orgEvent.deltaY*-1;delta=deltaY}if(orgEvent.deltaX){deltaX=orgEvent.deltaX;delta=deltaX*-1}if(orgEvent.wheelDeltaY!==undefined){deltaY=orgEvent.wheelDeltaY}if(orgEvent.wheelDeltaX!==undefined){deltaX=orgEvent.wheelDeltaX*-1}absDelta=Math.abs(delta);if(!lowestDelta||absDelta<lowestDelta){lowestDelta=absDelta}absDeltaXY=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDeltaXY||absDeltaXY<lowestDeltaXY){lowestDeltaXY=absDeltaXY}fn=delta>0?'floor':'ceil';delta=Math[fn](delta/lowestDelta);deltaX=Math[fn](deltaX/lowestDeltaXY);deltaY=Math[fn](deltaY/lowestDeltaXY);args.unshift(event,delta,deltaX,deltaY);return($.event.dispatch||$.event.handle).apply(this,args)}}));
1005
+ (function(factory) {if(typeof define==='function'&&define.amd) {define(['jquery'],factory)}else if(typeof exports==='object') {module.exports=factory}else{factory(jQuery)}}(function($) {var toFix=['wheel','mousewheel','DOMMouseScroll','MozMousePixelScroll'];var toBind='onwheel'in document||document.documentMode>=9?['wheel']:['mousewheel','DomMouseScroll','MozMousePixelScroll'];var lowestDelta,lowestDeltaXY;if($.event.fixHooks) {for(var i=toFix.length;i;) {$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}$.event.special.mousewheel={setup:function() {if(this.addEventListener) {for(var i=toBind.length;i;) {this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}},teardown:function() {if(this.removeEventListener) {for(var i=toBind.length;i;) {this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}}};$.fn.extend({mousewheel:function(fn) {return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn) {return this.unbind("mousewheel",fn)}});function handler(event) {var orgEvent=event||window.event,args=[].slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,absDeltaXY=0,fn;event=$.event.fix(orgEvent);event.type="mousewheel";if(orgEvent.wheelDelta) {delta=orgEvent.wheelDelta}if(orgEvent.detail) {delta=orgEvent.detail*-1}if(orgEvent.deltaY) {deltaY=orgEvent.deltaY*-1;delta=deltaY}if(orgEvent.deltaX) {deltaX=orgEvent.deltaX;delta=deltaX*-1}if(orgEvent.wheelDeltaY!==undefined) {deltaY=orgEvent.wheelDeltaY}if(orgEvent.wheelDeltaX!==undefined) {deltaX=orgEvent.wheelDeltaX*-1}absDelta=Math.abs(delta);if(!lowestDelta||absDelta<lowestDelta) {lowestDelta=absDelta}absDeltaXY=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDeltaXY||absDeltaXY<lowestDeltaXY) {lowestDeltaXY=absDeltaXY}fn=delta>0?'floor':'ceil';delta=Math[fn](delta/lowestDelta);deltaX=Math[fn](deltaX/lowestDeltaXY);deltaY=Math[fn](deltaY/lowestDeltaXY);args.unshift(event,delta,deltaX,deltaY);return($.event.dispatch||$.event.handle).apply(this,args)}}));
@@ -1,7 +1,7 @@
1
1
  module Jquery
2
2
  module Datetimepicker
3
3
  module Rails
4
- VERSION = '2.0.7.0'
4
+ VERSION = '2.0.8.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.7.0
4
+ version: 2.0.8.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-13 00:00:00.000000000 Z
11
+ date: 2013-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.1.10
79
+ rubygems_version: 2.1.11
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: This gem packages the datetimepicker jQuery plugin for Rails 3.1+ asset pipeline