PageSourceSearch

https://snowdesignhk.com/wp-content/plugins/aio-time-clock-lite/js/jquery.datetimepicker.js?ver=5.6.13

js snowdesignhk.com collected 2026-09-24 14:53:02 UTC 37,961 bytes, 696 lines download raw bytes

1/** 
2 * @preserve jQuery DateTimePicker plugin v1.1.0
3 * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4 * (c) 2013, Chupurnov Valeriy.
5 */
6(function( $ ){
7	$.fn.datetimepicker = function( opt ){
8		var 
9			CTRLKEY = 17,
10			DEL = 46,
11			ENTER = 13,
12			ESC = 27,
13			BACKSPACE = 8,
14			ARROWLEFT = 37,
15			ARROWUP = 38,
16			ARROWRIGHT = 39,
17			ARROWDOWN = 40,
18			TAB = 9,
19			F5 = 116,
20			AKEY = 65,
21			CKEY = 67,
22			VKEY = 86,
23			ZKEY = 90,
24			YKEY = 89;
25		var default_options  = {
26			i18n:{
27				ru:{
28					months:[
29						'Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'
30					],
31					dayOfWeek:[
32						"Вск", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
33					]
34				},
35				en:{
36					months: [
37						"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
37November", "December"
38					],
39					dayOfWeek: [
40						"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
41					]
42				},
43				de:{
44					months:[
45						'Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'
46					],
47					dayOfWeek:[
48						"So.", "Mo", "Di", "Mi", "Do", "Fr", "Sa."
49					]
50				},
51				nl:{
52					months:[
53						"januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
54					],
55					dayOfWeek:[
56						"zo", "ma", "di", "wo", "do", "vr", "za"
57					]
58				}
59			},
60			value:'',
61			lang:'en',
62			format:'Y/m/d H:i',
63			formatTime:'H:i',
64			formatDate:'Y/m/d',
65			step:60,
66			closeOnDateSelect:0,
67			closeOnWithoutClick:true,
68			timepicker:true,
69			datepicker:true,
70			minDate:false,
71			maxDate:false,
72			minTime:false,
73			maxTime:false,
74			allowTimes:[],
75			opened:false,
76			inline:false,
77			onSelectDate:function(){},
78			onSelectTime:function(){},
79			onChangeMonth:function(){},
80			onChangeDateTime:function(){},
81			onShow:function(){},
82			onClose:function(){},
83			withoutCopyright:true,
84			inverseButton:false,
85			hours12:false,
86			next:	'xdsoft_next',
87			prev : 'xdsoft_prev',
88			dayOfWeekStart:0,
89			timeHeightInTimePicker:25,
90			timepickerScrollbar:true,
91			scrollMonth:true,
92			scrollTime:true,
93			scrollInput:true,
94			mask:false
95		};
96		var options = ($.isPlainObject(opt)||!opt)?$.extend({},default_options,opt):$.extend({},default_options);
97		var createDateTimePicker = function( input ){
98			var datetimepicker = $('<div class="xdsoft_datetimepicker"></div>'),
99				xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
100				datepicker = $('<div class="xdsoft_datepicker active"></div>'),
101				mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_label xdsoft_month"></div><div class="xdsoft_label xdsoft_year"></div><button type="button" class="xdsoft_next"></button></div>'),
102				calendar = $('<div class="xdsoft_calendar"></div>'),
103				timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),
104				timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
105				timebox = $('<div class="xdsoft_time_variant"></div>'),
106				scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
107				scroller = $('<div class="xdsoft_scroller"></div>');
108			
109			datetimepicker.setOptions = function( _options ){
110				options = $.extend({},options,_options);
111				if( options.inline ){
112					datetimepicker.addClass('xdsoft_inline');
113					input.after(datetimepicker).hide();
114				}
115				if( options.open||options.opened||options.inline ){
116					input.trigger('open.xdsoft');
117				}
118				if( options.inverseButton ){
119					options.next = 'xdsoft_prev';
120					options.prev = 'xdsoft_next';
121				}
122				if( !options.datepicker && options.timepicker )
123					datepicker.removeClass('active');
124				if( options.datepicker && !options.timepicker )
125					timepicker.removeClass('active');
126				if( options.value )
127					input&&input.val&&input.val(options.value);
128				if( isNaN(options.dayOfWeekStart)||parseInt(options.dayOfWeekStart)<0||parseInt(options.dayOfWeekStart)>6 )
129					options.dayOfWeekStart = 0;
130				else 
131					options.dayOfWeekStart = parseInt(options.dayOfWeekStart);
132				if( !options.timepickerScrollbar )
133					scrollbar.hide();
134				var tmpDate = [];
135				if( options.minDate && ( tmpDate = /^-(.*)$/.exec(options.minDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ){
136					options.minDate = new Date((new Date).getTime()-tmpDate.getTime()).dateFormat( options.formatDate );
137				}
138				if( options.maxDate && ( tmpDate = /^\+(.*)$/.exec(options.maxDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ){
139					options.maxDate = new Date((new Date).getTime()+tmpDate.getTime()).dateFormat( options.formatDate );
140				}
141				if( options.mask ){
142					var ctrlDown=false,e,
143						getCaretPos = function( input ) {
144							try{
145								if ( document.selection && document.selection.createRange ) {
146									var range = document.selection.createRange();
147									return range.getBookmark().charCodeAt(2) - 2;
148								}else
149									if ( input.setSelectionRange )
150										return input.selectionStart;
151							}catch(e){
152								return 0;
153							}
154						},
155						setCaretPos = function (node,pos){
156							var node = (typeof node == "string" || node instanceof String) ? document.getElementById(node) : node;
157							if(!node){
158								return false;
159							}else if(node.createTextRange){
160								var textRange = node.createTextRange();
161								textRange.collapse(true);
162								textRange.moveEnd(pos);
163								textRange.moveStart(pos);
164								textRange.select();
165								return true;
166							}else if(node.setSelectionRange){
167								node.setSelectionRange(pos,pos);
168								return true;
169							}
170							return false;
171						},
172						isValidValue = function( mask,value ){
173							var reg = mask
174								.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,'\\$1')
175								.replace(/_/g,'{digit+}')
176								.replace(/([0-9]{1})/g,'{digit$1}')
177								.replace(/\{digit([0-9]{1})\}/g,'[0-$1_]{1}')
178								.replace(/\{digit[\+]\}/g,'[0-9_]{1}');
179							return RegExp(reg).test(value);
180						};
181					$(document).on('keydown.xdsoft',function(e){
182						if ( e.keyCode == CTRLKEY ) 
183							ctrlDown = true;
184					}).on('keyup.xdsoft',function(e){
185						if ( e.keyCode == CTRLKEY )
186							ctrlDown = false;
187					});
188					input.off('keydown.xdsoft');
189					switch(true){
190						case (options.mask===true):
191							options.mask = (new Date()).dateFormat( options.format );
192							options.mask = options.mask.replace(/[0-9]/g,'_');
193						case ($.type(options.mask) == 'string'):
194							if( !isValidValue( options.mask,input.val() ) )
195								input.val(options.mask.replace(/[0-9]/g,'_'))
196							input.on('keydown.xdsoft',function( event ){
197									var val = this.value , key = event.which;
198									switch(true){
199										case ((key>=48&&key<=57)||(key>=96&&key<=105))||(key==BACKSPACE||key==DEL):
200											var pos = getCaretPos(this),
201												digit = ( key!=BACKSPACE&&key!=DEL )?String.fromCharCode(key):'_';
202											if( (key==BACKSPACE||key==DEL)&&pos ){
203												pos--;
204												digit='_';
205											}
206											while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
207												pos+=( key==BACKSPACE||key==DEL )?-1:1;
208												
209											val = val.substr(0,pos)+digit+val.substr(pos+1);
210											if( $.trim(val)=='' )
211												val = options.mask.replace(/[0-9]/g,'_');
212											else 
213												if( pos==options.mask.length )
214													break;
215											pos+=(key==BACKSPACE||key==DEL)?0:1;
216											while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
217												pos+=(key==BACKSPACE||key==DEL)?-1:1;
218											if( isValidValue( options.mask,val ) ){
219												this.value = val;
220												setCaretPos(this,pos);
221											}else if( $.trim(val)=='' )
222												this.value = options.mask.replace(/[0-9]/g,'_');
223											else{
224												input.trigger('error_input.xdsoft');
225											}
226										break;
227										case (([AKEY,CKEY,VKEY,ZKEY,YKEY].indexOf(key)!==-1)&&(ctrlDown)):
228										 case [ESC,ARROWUP,ARROWDOWN,ARROWLEFT,ARROWRIGHT,F5,CTRLKEY].indexOf(key)!==-1:
229											return true;
230										case [ENTER,TAB].indexOf(options.mask,key)!==-1:
231											var elementSelector = "input:visible,textarea:visible";
232											$(elementSelector ).eq($(elementSelector ).index(this) + 1).focus();
233										return false;
234									}
235									event.preventDefault();
236									return false;
237								});
238						break;
239					}
240				}
241				options.dayOfWeekStartPrev = (options.dayOfWeekStart==0)?6:options.dayOfWeekStart-1;
242			};
243			datetimepicker.data('options',options);
244			datetimepicker.on('mousedown.xdsoft',function( event ){
245				event.stopPropagation();
246				event.preventDefault();
247				return false;
248			});
249			// scrollbar for timepicker
250			scrollbar.append(scroller);
251			timepicker.find('.xdsoft_time_box').append(scrollbar);
252			(function(){
253				var move = 0;
254				scroller.on('mousedown.xdsoft',function( event ){
255					var pageY = event.pageY,
256						top = parseInt(scroller.css('margin-top')),
257						h1 = scrollbar[0].offsetHeight;
258					$('body').addClass('xdsoft_noselect');
259					$([document.body,window]).on('mouseup.xdsoft',function(){
260						$([document.body,window]).off('mouseup.xdsoft',arguments.callee)
261							.off('mousemove.xdsoft',move)
262							.removeClass('xdsoft_noselect');
263					});
264					$('body').on('mousemove.xdsoft',move = function(event){
265						var offset = event.pageY-pageY+top;
266						if( offset<0 )
267							offset = 0;
268						if( offset+scroller[0].offsetHeight>h1 )
269							offset = h1-scroller[0].offsetHeight;
270						
271						scroller.css('margin-top',offset);
272						datetimepicker.trigger('scroll.scrollbar',[offset]);
273					});
274				});
275				datetimepicker.on('scroll.timebox',function( event,offset ){
276					if( !options.timepickerScrollbar )
277						return;
278					var sbh 	= scrollbar.height()-scroller[0].offsetHeight,
279						pheight = timeboxparent[0].offsetHeight-2,
280						height 	= timebox[0].offsetHeight,
281						percent = offset/(height-pheight);
282					scroller.css('margin-top',sbh*percent);
283				})
284				.on('open.xdsoft',function( event ){
285					if( !options.timepickerScrollbar )
286						return;
287					var pheight = timeboxparent[0].offsetHeight-2;
288						height 	= timebox[0].offsetHeight,
289						percent = pheight/height,
290						sh = percent*scrollbar[0].offsetHeight;
291					if( percent>1 )
292						scroller.hide();
293					else{
294						scroller.show();
295						scroller.css('height',parseInt(sh>10?sh:10));
296					}
297				});
298				
299			})();
300			
301			datetimepicker.on('scroll.scrollbar',function(event,offset){
302				var sbh = scrollbar[0].offsetHeight-scroller[0].offsetHeight,
303					percent = offset/sbh;
304					pheight = timeboxparent[0].offsetHeight-2,
305					height = timebox[0].offsetHeight;
306				timebox.css('marginTop',-parseInt((height-pheight)*percent))
307			});
308			timepicker.find('.xdsoft_time_box').append(timebox);
309			datetimepicker.append(datepicker).append(timepicker);
310			if( options.withoutCopyright!==true )
311				datetimepicker.append(xdsoft_copyright);
312			datepicker.append(mounth_picker).append(calendar);
313			$('body').append(datetimepicker);
314			var xdsoft_datetime = function(){
315				var self = this;
316				self.now = function(){
317					return new Date();
318				};
319				self.currentTime = this.now();
320				self.isValidDate = function (d) {
321					if ( Object.prototype.toString.call(d) !== "[object Date]" )
322						return false;
323					return !isNaN(d.getTime());
324				};
325				self.setCurrentTime = function( dTime){
326					self.currentTime = (typeof dTime == 'string')? self.strtodatetime(dTime) : self.isValidDate(dTime) ? dTime: self.now();
327					datetimepicker.trigger('change.xdsoft');
328				};
329				self.getCurrentTime = function( dTime){
330					return self.currentTime;
331				};
332				self.nextMonth = function(){
333					var month = self.currentTime.getMonth()+1;
334					if( month==12 ){
335						self.currentTime.setFullYear(self.currentTime.getFullYear()+1);
336						month = 0;
337					}
338					self.currentTime.setMonth(month);
339					options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
340					datetimepicker.trigger('change.xdsoft');
341					return month;
342				};
343				self.prevMonth = function(){
344					var month = self.currentTime.getMonth()-1;
345					if( month==-1 ){
346						self.currentTime.setFullYear(self.currentTime.getFullYear()-1);
347						month = 11;
348					}
349					self.currentTime.setMonth(month);
350					options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
351					datetimepicker.trigger('change.xdsoft');
352					return month;
353				};
354				
355				this.strtodatetime = function( sDateTime ){
356					var currentTime = sDateTime?Date.parseDate(sDateTime, options.format):new Date;
357					if( ! self.isValidDate(currentTime) )
358						currentTime = new Date;
359					return currentTime;
360				};
361				this.strtodate = function( sDate ){
362					var currentTime = sDate?Date.parseDate(sDate, options.formatDate):new Date;
363					if( !self.isValidDate(currentTime) )
364						currentTime = new Date;
365					return currentTime;
366				};
367				this.strtotime = function( sTime ){
368					var currentTime = sTime?Date.parseDate(sTime, options.formatTime):new Date;
369					if( ! self.isValidDate(currentTime) )
370						currentTime = new Date;
371					return currentTime;
372				};
373				this.str = function(){
374					return this.currentTime.dateFormat(options.format);
375				};	
376			};
377			mounth_picker.find('.xdsoft_prev,.xdsoft_next').on('mousedown.xdsoft',function(){
378				var $this = $(this), timer = 0, stop = false;
379				(function(v){
380					var month =  datetimepicker.data('xdsoft_datetime').currentTime.getMonth();
381					if( $this.hasClass( options.next ) ){
382						datetimepicker.data('xdsoft_datetime').nextMonth();
383					}else if( $this.hasClass( options.prev ) ){
384						datetimepicker.data('xdsoft_datetime').prevMonth();
385					}
386					!stop&&(timer = setTimeout(arguments.callee,v?v:100));
387				})(500);
388				$([document.body,window]).on('mouseup.xdsoft',function(){
389					clearTimeout(timer);
390					stop = true;
391					$([document.body,window]).off('mouseup.xdsoft',arguments.callee);
392				});
393			});
394			timepicker.find('.xdsoft_prev,.xdsoft_next').on('mousedown.xdsoft',function(){
395				var $this = $(this), timer = 0, stop = false, period = 110;
396				(function(v){
397					var pheight = timeboxparent[0].offsetHeight-2,
398						height = timebox[0].offsetHeight,
399						top = Math.abs(parseInt(timebox.css('marginTop')));
400					if( $this.hasClass(options.next) && (height-pheight)- options.timeHeightInTimePicker>=top ){
401						timebox.css('marginTop','-'+(top+options.timeHeightInTimePicker)+'px')
402					}else if( $this.hasClass(options.prev) && top-options.timeHeightInTimePicker>=0  ){
403						timebox.css('marginTop','-'+(top-options.timeHeightInTimePicker)+'px')
404					}
405					datetimepicker.trigger('scroll.timebox',[Math.abs(parseInt(timebox.css('marginTop')))]);
406					period= ( period>10 )?10:period-10;
407					!stop&&(timer = setTimeout(arguments.callee,v?v:period));
408				})(500);
409				$([document.body,window]).on('mouseup.xdsoft',function(){
410					clearTimeout(timer);
411					stop = true;
412					$([document.body,window]).off('mouseup.xdsoft',arguments.callee);
413				});
414			});	
415			datetimepicker.on('change.xdsoft',function(){
416				var xd 		=	$(this).data('xdsoft_datetime'),
417					table 	=	'';
418				var start = new Date(xd.currentTime.getFullYear(),xd.currentTime.getMonth(),1);
419				while( start.getDay()!=options.dayOfWeekStart )
420					start.setDate(start.getDate()-1);
421				var i = 0, today = new Date;
422				table+='<table><thead><tr>';
423				for(var j = 0; j<7; j++)
424					table+='<th>'+options.i18n[options.lang].dayOfWeek[(j+options.dayOfWeekStart)>6?0:j+options.dayOfWeekStart]+'</th>';
425				table+='</tr></thead>';
426				table+='<tbody><tr>';
427				while( i<xd.currentTime.getDaysInMonth()||start.getDay()!=options.dayOfWeekStart||xd.currentTime.getMonth()==start.getMonth() ){
428					i++;
429					table+='<td data-date="'+start.getDate()+'" data-month="'+start.getMonth()+'" data-year="'+start.getFullYear()+'"'+
430						' class="'+
431							(
432								(options.maxDate!==false&&Math.round(xd.strtodate(options.maxDate).getTime()/86400000)<Math.round(start.getTime()/86400000))||
433								(options.minDate!==false&&Math.round(xd.strtodate(options.minDate).getTime()/86400000)>Math.round(start.getTime()/86400000))
434							?'xdsoft_disabled ':' ')+
435							(xd.currentTime.getMonth()!=start.getMonth()?' xdsoft_other_month ':' ')+
436							(xd.currentTime.dateFormat('d.m.Y')==start.dateFormat('d.m.Y')?' xdsoft_current ':' ')+
437							(today.dateFormat('d.m.Y')==start.dateFormat('d.m.Y')?' xdsoft_today ':' ')
438						+'"><div>'+start.getDate()+'</div></td>';
439					if( start.getDay()==options.dayOfWeekStartPrev )
440						table+='</tr>';
441					start.setDate(start.getDate()+1);
442				}
443				table+='</tbody></table>';
444				calendar.html(table);
445				mounth_picker.find('.xdsoft_label').eq(0).text(options.i18n[options.lang].months[xd.currentTime.getMonth()]);
446				mounth_picker.find('.xdsoft_label').eq(1).text(xd.currentTime.getFullYear());
447				var time = '',h = '',m ='';
448				var line_time = function (h,m){
449					var now = new Date();
450					now.setHours(h);
451					h = parseInt(now.getHours());
452					now.setMinutes(m);
453					m = parseInt(now.getMinutes());
454					time+= '<div class="'+
455								(
456									(options.maxTime!==false&&xd.strtotime(options.maxTime).getTime()<now.getTime())||
457									(options.minTime!==false&&xd.strtotime(options.minTime).getTime()>now.getTime())
458								?'xdsoft_disabled ':' ')+
459								(
460									(parseInt(xd.currentTime.getHours())==parseInt(h)
461								&&
462									parseInt(xd.currentTime.getMinutes()/options.step)*options.step==parseInt(m)
463								)?' xdsoft_current ':'')+
464								((parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))?' xdsoft_today ':'')+
465								'" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>';
466				};
467				if( !options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length ){
468					for(var i=0;i<(options.hours12?12:24);i++){
469						for(var j=0;j<60;j+=options.step){
470							h = (i<10?'0':'')+i;
471							m = (j<10?'0':'')+j;
472							line_time(h,m);
473						}
474					}
475				}else{
476					for(var i=0;i<options.allowTimes.length;i++){
477						h = xd.strtotime(options.allowTimes[i]).getHours();
478						m = xd.strtotime(options.allowTimes[i]).getMinutes();
479						line_time(h,m);
480					}
481				}
482				timebox.html(time);
483				//timebox.find('.xdsoft_current').length&&timebox.css('marginTop','-'+parseInt(timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker)+'px');
484			});
485			datetimepicker.on('open.xdsoft',function(){
486				if( timebox.find('.xdsoft_current').length ){
487					var pheight = timeboxparent[0].offsetHeight-2,
488						height = timebox[0].offsetHeight,
489						top = timebox.find('.xdsoft_current').index()*options.timeHeightInTimePicker+1;
490					if( (height-pheight)<top )
491						top = height-pheight;
492					timebox.css('marginTop','-'+parseInt(top)+'px');
493				}
494			});
495			calendar.on('mousedown.xdsoft','td',function(){
496				if($(this).hasClass('xdsoft_disabled'))
497					return false;
498				var ct = datetimepicker.data('xdsoft_datetime').currentTime;
499				ct.setFullYear($(this).data('year'));
500				ct.setMonth($(this).data('month'));
501				ct.setDate($(this).data('date'));
502				datetimepicker.trigger('select.xdsoft',[ct]);
503				input.val( datetimepicker.data('xdsoft_datetime').str() );
504				if( (options.closeOnDateSelect===true||( options.closeOnDateSelect===0&&!options.timepicker ))&&!options.inline )
505					datetimepicker.trigger('close.xdsoft');
506				options.onSelectDate&&options.onSelectDate.call&&options.onSelectDate.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
507				datetimepicker.trigger('change.xdsoft');
508				datetimepicker.trigger('changedatetime.xdsoft');
509			});		
510			timebox.on('mousedown.xdsoft','div',function(){
511				if($(this).hasClass('xdsoft_disabled'))
512					return false;
513				var ct = datetimepicker.data('xdsoft_datetime').currentTime;
514				ct.setHours($(this).data('hour'));
515				ct.setMinutes($(this).data('minute'));
516				datetimepicker.trigger('select.xdsoft',[ct]);
517				datetimepicker.data('input').val( datetimepicker.data('xdsoft_datetime').str() );
518				!options.inline&&datetimepicker.trigger('close.xdsoft');
519				options.onSelectTime&&options.onSelectTime.call&&options.onSelectTime.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
520				datetimepicker.trigger('change.xdsoft');
521				datetimepicker.trigger('changedatetime.xdsoft');
522			});
523			datetimepicker.mousewheel&&datepicker.mousewheel(function(event, delta, deltaX, deltaY) {
524				if( !options.scrollMonth )
525					return true;
526				if( delta<0 )
527					datetimepicker.data('xdsoft_datetime').nextMonth();
528				else
529					datetimepicker.data('xdsoft_datetime').prevMonth();
530				return false;
531			});		
532			datetimepicker.mousewheel&&timepicker.mousewheel(function(event, delta, deltaX, deltaY) {
533				if( !options.scrollTime )
534					return true;
535				var pheight = timeboxparent[0].offsetHeight-2,
536					height = timebox[0].offsetHeight,
537					top = Math.abs(parseInt(timebox.css('marginTop'))),
538					fl = true;
539				if( delta<0 && (height-pheight)-options.timeHeightInTimePicker>=top ){
540					timebox.css('marginTop','-'+(top+options.timeHeightInTimePicker)+'px');
541					fl = false;
542				}else if( delta>0&&top-options.timeHeightInTimePicker>=0 ){
543					timebox.css('marginTop','-'+(top-options.timeHeightInTimePicker)+'px');
544					fl = false;
545				}
546				datetimepicker.trigger('scroll.timebox',[Math.abs(parseInt(timebox.css('marginTop')))]);
547				return fl;
548			});
549			datetimepicker.on('changedatetime.xdsoft',function(){
550				options.onChangeDateTime&&options.onChangeDateTime.call&&options.onChangeDateTime.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input'));
551			});
552			var current_time_index = 0;
553			input.mousewheel&&input.mousewheel(function( event, delta, deltaX, deltaY ){
554				if( !options.scrollInput )
555					return true;
556				if( !options.datepicker && options.timepicker ){
557					current_time_index = timebox.find('.xdsoft_current').length?timebox.find('.xdsoft_current').eq(0).index():0;
558					if( current_time_index+delta>=0&&current_time_index+delta<timebox.children().length )
559						current_time_index+=delta;
560					timebox.children().eq(current_time_index).length&&timebox.children().eq(current_time_index).trigger('mousedown');
561					return false;
562				}else if( options.datepicker && !options.timepicker ){
563					datepicker.trigger( event, [delta, deltaX, deltaY]);
564					input.val&&input.val( datetimepicker.data('xdsoft_datetime').str() );
565					datetimepicker.trigger('changedatetime.xdsoft');
566					return false;
567				}
568			});
569			datetimepicker.on('open.xdsoft',function(){
570				var onShow = true;
571				options.onShow&&options.onShow.call&&(onShow=options.onShow.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input')));
572				if( onShow!==false ){
573					var setPos = function(){
574						var offset = datetimepicker.data('input').offset(), top = offset.top+datetimepicker.data('input')[0].offsetHeight-1;
575						if( top+datetimepicker[0].offsetHeight>$('body').height() )
576							top = offset.top-datetimepicker[0].offsetHeight+1;
577						datetimepicker.css({
578							left:offset.left,
579							top:top	
580						});
581					};
582					datetimepicker.show();
583					setPos();
584					$(window).on('resize.xdsoft',setPos);
585					
586					if( options.closeOnWithoutClick ){
587						$([document.body,window]).on('mousedown.xdsoft',function(){
588							datetimepicker.trigger('close.xdsoft');
589							$([document.body,window]).off('mousedown.xdsoft',arguments.callee);
590						});
591					}
592				}
593			}); 
594			datetimepicker.on( 'close.xdsoft',function(){
595				var onClose = true;
596				options.onClose&&options.onClose.call&&(onClose=options.onClose.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input')));
597				if( onClose!==false&&!options.opened&&!options.inline ){
598					datetimepicker.hide();
599				}
600			} );
601			datetimepicker.data('input',input);
602			
603			var _xdsoft_datetime = new xdsoft_datetime,timer = 0,timer1 = 0;
604			datetimepicker.data('xdsoft_datetime',_xdsoft_datetime);
605			datetimepicker.setOptions(options);
606			_xdsoft_datetime.setCurrentTime( options.value?options.value:(input&&input.val&&input.val())?input.val():new Date );
607			input.data( 'xdsoft_datetimepicker',datetimepicker )
608			 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function(event){
609				if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible') )
610					return;
611				clearTimeout(timer);
612				timer = setTimeout(function(){
613					if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible') )
614						return;
615					_xdsoft_datetime.setCurrentTime((input&&input.val&&input.val())?input.val():new Date);
616					datetimepicker.trigger( 'open.xdsoft' );
617				},100);
618			 })
619			 .on('focusout.xdsoft',function(event){
620				clearTimeout(timer1);
621				timer1 = setTimeout(function(){
622					datetimepicker.trigger('close.xdsoft');
623				},100);
624			 });
625		};
626		var destroyDateTimePicker = function(input){
627			var datetimepicker = input.data('xdsoft_datetimepicker');
628			if( datetimepicker ){
629				var _xdsoft_datetime = datetimepicker.data('xdsoft_datetime');
630				delete _xdsoft_datetime;
631				datetimepicker.remove();
632				delete datetimepicker;
633				input.data( 'xdsoft_datetimepicker',null );
634				input.off( 'open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft' );
635				$(window).off('resize.xdsoft');
636				$([window,document.body]).off('mousedown.xdsoft');
637				input.unmousewheel&&input.unmousewheel();
638				delete options;
639			}
640		};
641		return this.each(function(){
642			var datetimepicker;
643			if( datetimepicker = $(this).data('xdsoft_datetimepicker') ){
644				if( $.type(opt) === 'string' ){
645					switch(opt){
646						case 'show':
647							$(this).select().focus();
648							datetimepicker.trigger( 'open.xdsoft' );
649						break;
650						case 'hide':
651							datetimepicker.trigger('close.xdsoft');
652						break;
653						case 'destroy':
654							destroyDateTimePicker($(this));
655						break;
656					}
657				}else{
658					$(this).data('xdsoft_datetimepicker').setOptions(options);
659				}
660				return 0;
661			}else
662				($.type(opt) !== 'string')&&createDateTimePicker($(this));
663		});
664	};
665})( jQuery );
666
667//http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/
668/*
669 * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
670 *
671 * This program is free software; you can redistribute it and/or modify it
672 * under the terms of the GNU Lesser General Public License as published by the
673 * Free Software Foundation, version 2.1.
674 *
675 * This program is distributed in the hope that it will be useful, but WITHOUT
676 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
677 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
678 * details.
679 */
680Date.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(ch
680aracter){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})"};
680case"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"};
681
682//https://github.com/brandonaaron/jquery-mousewheel/blob/master/jquery.mousewheel.js
683/*
684 * Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
685 *
686 * Licensed under the MIT License (LICENSE.txt).
687 *
688 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
689 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
690 * Thanks to: Seamus Leahy for adding deltaX and deltaY
691 *
692 * Version: 3.1.3
693 *
694 * Requires: 1.2.2+
695 */
696(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
696),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)}}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.