PageSourceSearch

https://cvillevet.com/js/jquery/datetimepicker-master/jquery.datetimepicker.js

js cvillevet.com collected 2026-09-29 22:37:03 UTC 64,140 bytes, 1,633 lines download raw bytes

1/**
2 * @preserve jQuery DateTimePicker plugin v2.3.7
3 * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4 * (c) 2014, Chupurnov Valeriy.
5 */
6
7(function ($) {
8	'use strict';
9	var default_options  = {
10		i18n: {
11			ar: { // Arabic
12				months: [
13					"كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"
14				],
15				dayOfWeek: [
16					"ن", "ث", "ع", "خ", "ج", "س", "ح"
17				]
18			},
19			ro: { // Romanian
20				months: [
21					"ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie"
22				],
23				dayOfWeek: [
24					"l", "ma", "mi", "j", "v", "s", "d"
25				]
26			},
27			id: { // Indonesian
28				months: [
29					"Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
30				],
31				dayOfWeek: [
32					"Sen", "Sel", "Rab", "Kam", "Jum", "Sab", "Min"
33				]
34			},
35			bg: { // Bulgarian
36				months: [
37					"Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
38				],
39				dayOfWeek: [
40					"Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
41				]
42			},
43			fa: { // Persian/Farsi
44				months: [
45					'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'
46				],
47				dayOfWeek: [
48					'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'
49				]
50			},
51			ru: { // Russian
52				months: [
53					'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
54				],
55				dayOfWeek: [
56					"Вск", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
57				]
58			},
59			uk: { // Ukrainian
60				months: [
61					'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
62				],
63				dayOfWeek: [
64					"Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
65				]
66			},
67			en: { // English
68				months: [
69					"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
69November", "December"
70				],
71				dayOfWeek: [
72					"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
73				]
74			},
75			el: { // Ελληνικά
76				months: [
77					"Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
78				],
79				dayOfWeek: [
80					"Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"
81				]
82			},
83			de: { // German
84				months: [
85					'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
86				],
87				dayOfWeek: [
88					"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
89				]
90			},
91			nl: { // Dutch
92				months: [
93					"januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
94				],
95				dayOfWeek: [
96					"zo", "ma", "di", "wo", "do", "vr", "za"
97				]
98			},
99			tr: { // Turkish
100				months: [
101					"Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
102				],
103				dayOfWeek: [
104					"Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
105				]
106			},
107			fr: { //French
108				months: [
109					"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
110				],
111				dayOfWeek: [
112					"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
113				]
114			},
115			es: { // Spanish
116				months: [
117					"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
118				],
119				dayOfWeek: [
120					"Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
121				]
122			},
123			th: { // Thai
124				months: [
125					'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'
126				],
127				dayOfWeek: [
128					'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'
129				]
130			},
131			pl: { // Polish
132				months: [
133					"styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"
134				],
135				dayOfWeek: [
136					"nd", "pn", "wt", "śr", "cz", "pt", "sb"
137				]
138			},
139			pt: { // Portuguese
140				months: [
141					"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
142				],
143				dayOfWeek: [
144					"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
145				]
146			},
147			ch: { // Simplified Chinese
148				months: [
149					"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
150				],
151				dayOfWeek: [
152					"日", "一", "二", "三", "四", "五", "六"
153				]
154			},
155			se: { // Swedish
156				months: [
157					"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September",  "Oktober", "November", "December"
158				],
159				dayOfWeek: [
160					"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
161				]
162			},
163			kr: { // Korean
164				months: [
165					"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
166				],
167				dayOfWeek: [
168					"일", "월", "화", "수", "목", "금", "토"
169				]
170			},
171			it: { // Italian
172				months: [
173					"Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
174				],
175				dayOfWeek: [
176					"Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
177				]
178			},
179			da: { // Dansk
180				months: [
181					"January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December"
182				],
183				dayOfWeek: [
184					"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
185				]
186			},
187			no: { // Norwegian
188				months: [
189					"Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
190				],
191				dayOfWeek: [
192					"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
193				]
194			},
195			ja: { // Japanese
196				months: [
197					"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
198				],
199				dayOfWeek: [
200					"日", "月", "火", "水", "木", "金", "土"
201				]
202			},
203			vi: { // Vietnamese
204				months: [
205					"Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"
206				],
207				dayOfWeek: [
208					"CN", "T2", "T3", "T4", "T5", "T6", "T7"
209				]
210			},
211			sl: { // Slovenščina
212				months: [
213					"Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "
213November", "December"
214				],
215				dayOfWeek: [
216					"Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"
217				]
218			},
219			cs: { // Čeština
220				months: [
221					"Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
222				],
223				dayOfWeek: [
224					"Ne", "Po", "Út", "St", "Čt", "Pá", "So"
225				]
226			},
227			hu: { // Hungarian
228				months: [
229					"Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
230				],
231				dayOfWeek: [
232					"Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
233				]
234			}
235		},
236		value: '',
237		lang: 'en',
238
239		format:	'Y/m/d H:i',
240		formatTime:	'H:i',
241		formatDate:	'Y/m/d',
242
243		startDate:	false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
244		step: 60,
245		monthChangeSpinner: true,
246
247		closeOnDateSelect: false,
248		closeOnWithoutClick: true,
249		closeOnInputClick: true,
250
251		timepicker: true,
252		datepicker: true,
253		weeks: false,
254
255		defaultTime: false,	// use formatTime format (ex. '10:00' for formatTime:	'H:i')
256		defaultDate: false,	// use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
257
258		minDate: false,
259		maxDate: false,
260		minTime: false,
261		maxTime: false,
262
263		allowTimes: [],
264		opened: false,
265		initTime: true,
266		inline: false,
267		theme: '',
268
269		onSelectDate: function () {},
270		onSelectTime: function () {},
271		onChangeMonth: function () {},
272		onChangeYear: function () {},
273		onChangeDateTime: function () {},
274		onShow: function () {},
275		onClose: function () {},
276		onGenerate: function () {},
277
278		withoutCopyright: true,
279		inverseButton: false,
280		hours12: false,
281		next:	'xdsoft_next',
282		prev : 'xdsoft_prev',
283		dayOfWeekStart: 0,
284		parentID: 'body',
285		timeHeightInTimePicker: 25,
286		timepickerScrollbar: true,
287		todayButton: true,
288		defaultSelect: true,
289
290		scrollMonth: true,
291		scrollTime: true,
292		scrollInput: true,
293
294		lazyInit: false,
295		mask: false,
296		validateOnBlur: true,
297		allowBlank: true,
298		yearStart: 1950,
299		yearEnd: 2050,
300		style: '',
301		id: '',
302		fixed: false,
303		roundTime: 'round', // ceil, floor
304		className: '',
305		weekends: [],
306		yearOffset: 0,
307		beforeShowDay: null
308	};
309	// fix for ie8
310	if (!Array.prototype.indexOf) {
311		Array.prototype.indexOf = function (obj, start) {
312			var i, j;
313			for (i = (start || 0), j = this.length; i < j; i += 1) {
314				if (this[i] === obj) { return i; }
315			}
316			return -1;
317		};
318	}
319	Date.prototype.countDaysInMonth = function () {
320		return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
321	};
322	$.fn.xdsoftScroller = function (percent) {
323		return this.each(function () {
324			var timeboxparent = $(this),
325				pointerEventToXY = function (e) {
326					var out = {x: 0, y: 0},
327						touch;
328					if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
329						touch  = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
330						out.x = touch.pageX;
331						out.y = touch.pageY;
332					} else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
333						out.x = e.pageX;
334						out.y = e.pageY;
335					}
336					return out;
337				},
338				move = 0,
339				timebox,
340				parentHeight,
341				height,
342				scrollbar,
343				scroller,
344				maximumOffset = 100,
345				start = false;
346			if (!$(this).hasClass('xdsoft_scroller_box')) {
347				timebox = timeboxparent.children().eq(0);
348				parentHeight = timeboxparent[0].clientHeight;
349				height = timebox[0].offsetHeight;
350				scrollbar = $('<div class="xdsoft_scrollbar"></div>');
351				scroller = $('<div class="xdsoft_scroller"></div>');
352				scrollbar.append(scroller);
353
354				timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
355				scroller.on('mousedown.xdsoft_scroller', function (event) {
356					if (!parentHeight) {
357						timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
358					}
359					var pageY = event.pageY,
360						top = parseInt(scroller.css('margin-top'), 10),
361						h1 = scrollbar[0].offsetHeight;
362
363					if (document) {
364						$(document.body).addClass('xdsoft_noselect');
365					}
366					$([document.body, window]).on('mouseup.xdsoft_scroller', function arguments_callee() {
367						$([document.body, window]).off('mouseup.xdsoft_scroller', arguments_callee)
368							.off('mousemove.xdsoft_scroller', move)
369							.removeClass('xdsoft_noselect');
370					});
371					$(document.body).on('mousemove.xdsoft_scroller', move = function (event) {
372						var offset = event.pageY - pageY + top;
373						if (offset < 0) {
374							offset = 0;
375						}
376						if (offset + scroller[0].offsetHeight > h1) {
377							offset = h1 - scroller[0].offsetHeight;
378						}
379						timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
380					});
381				});
382
383				timeboxparent
384					.on('scroll_element.xdsoft_scroller', function (event, percentage) {
385						if (!parentHeight) {
386							timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
387						}
388						percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
389						scroller.css('margin-top', maximumOffset * percentage);
390						setTimeout(function () {
391							timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10));
392						}, 10);
393					})
394					.on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
395						var percent, sh;
396						parentHeight = timeboxparent[0].clientHeight;
397						height = timebox[0].offsetHeight;
398						percent = parentHeight / height;
399						sh = percent * scrollbar[0].offsetHeight;
400						if (percent > 1) {
401							scroller.hide();
402						} else {
403							scroller.show();
404							scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
405							maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
406							if (noTriggerScroll !== true) {
407								timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]);
408							}
409						}
410					});
411				if (timeboxparent.mousewheel) {
412					timeboxparent.mousewheel(function (event, delta, deltaX, deltaY) {
413						var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
414						timeboxparent.trigger('scroll_element.xdsoft_scroller', [(top - delta * 20) / (height - parentHeight)]);
415						event.stopPropagation();
416						return false;
417					});
418				}
419				timeboxparent.on('touchstart', function (event) {
420					start = pointerEventToXY(event);
421				});
422				timeboxparent.on('touchmove', function (event) {
423					if (start) {
424						var coord = pointerEventToXY(event), top = Math.abs(parseInt(timebox.css('marginTop'), 10));
425						timeboxparent.trigger('scroll_element.xdsoft_scroller', [(top - (coord.y - start.y)) / (height - parentHeight)]);
426						event.stopPropagation();
427						event.preventDefault();
428						start = pointerEventToXY(event);
429					}
430				});
431				timeboxparent.on('touchend touchcancel', function (event) {
432					start = false;
433				});
434			}
435			timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
436		});
437	};
438
439	$.fn.datetimepicker = function (opt) {
440		var KEY0 = 48,
441			KEY9 = 57,
442			_KEY0 = 96,
443			_KEY9 = 105,
444			CTRLKEY = 17,
445			DEL = 46,
446			ENTER = 13,
447			ESC = 27,
448			BACKSPACE = 8,
449			ARROWLEFT = 37,
450			ARROWUP = 38,
451			ARROWRIGHT = 39,
452			ARROWDOWN = 40,
453			TAB = 9,
454			F5 = 116,
455			AKEY = 65,
456			CKEY = 67,
457			VKEY = 86,
458			ZKEY = 90,
459			YKEY = 89,
460			ctrlDown	=	false,
461			options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
462
463			lazyInitTimer = 0,
464			createDateTimePicker,
465			destroyDateTimePicker,
466			_xdsoft_datetime,
467
468			lazyInit = function (input) {
469				input
470					.on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function initOnActionCallback(event) {
471						if (input.is(':disabled') || input.is(':hidden') || !input.is(':visible') || input.data('xdsoft_datetimepicker')) {
472							return;
473						}
474						clearTimeout(lazyInitTimer);
475						lazyInitTimer = setTimeout(function () {
476
477							if (!input.data('xdsoft_datetimepicker')) {
478								createDateTimePicker(input);
479							}
480							input
481								.off('open.xdsoft focusin.xdsoft mousedown.xdsoft', initOnActionCallback)
482								.trigger('open.xdsoft');
483						}, 100);
484					});
485			};
486
487		createDateTimePicker = function (input) {
488			var datetimepicker = $('<div ' + (options.id ? 'id="' + options.id + '"' : '') + ' ' + (options.style ? 'style="' + options.style + '"' : '') + ' class="xdsoft_datetimepicker xdsoft_' + options.theme + ' xdsoft_noselect ' + (options.weeks ? ' xdsoft_showweeks' : '') + options.className + '"></div>'),
489				xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
490				datepicker = $('<div class="xdsoft_datepicker active"></div>'),
491				mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
492					'<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' +
493					'<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' +
494					'<button type="button" class="xdsoft_next"></button></div>'),
495				calendar = $('<div class="xdsoft_calendar"></div>'),
496				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>'),
497				timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
498				timebox = $('<div class="xdsoft_time_variant"></div>'),
499				scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
500				scroller = $('<div class="xdsoft_scroller"></div>'),
501				monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
502				yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
503				triggerAfterOpen = false,
504				XDSoft_datetime,
505				scroll_element,
506				xchangeTimer,
507				timerclick,
508				current_time_index,
509				setPos,
510				timer = 0,
511				timer1 = 0;
512
513			mounth_picker
514				.find('.xdsoft_month span')
515					.after(monthselect);
516			mounth_picker
517				.find('.xdsoft_year span')
518					.after(yearselect);
519
520			mounth_picker
521				.find('.xdsoft_month,.xdsoft_year')
522					.on('mousedown.xdsoft', function (event) {
523					var select = $(this).find('.xdsoft_select').eq(0),
524						val = 0,
525						top = 0,
526						visible = select.is(':visible'),
527						items,
528						i;
529
530					mounth_picker
531						.find('.xdsoft_select')
532							.hide();
533					if (_xdsoft_datetime.currentTime) {
534						val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
535					}
536
537					select[visible ? 'hide' : 'show']();
538					for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
539						if (items.eq(i).data('value') === val) {
540							break;
541						} else {
542							top += items[0].offsetHeight;
543						}
544					}
545
vendor: 23,863 bytes, lines 546-1262
546					select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
547					event.stopPropagation();
548					return false;
549				});
550
551			mounth_picker
552				.find('.xdsoft_select')
553					.xdsoftScroller()
554				.on('mousedown.xdsoft', function (event) {
555					event.stopPropagation();
556					event.preventDefault();
557				})
558				.on('mousedown.xdsoft', '.xdsoft_option', function (event) {
559					var year = _xdsoft_datetime.currentTime.getFullYear();
560					if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
561						_xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
562					}
563
564					$(this).parent().parent().hide();
565
566					datetimepicker.trigger('xchange.xdsoft');
567					if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
568						options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
569					}
570
571					if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
572						options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
573					}
574				});
575
576			datetimepicker.setOptions = function (_options) {
577				options = $.extend(true, {}, options, _options);
578
579				if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
580					options.allowTimes = $.extend(true, [], _options.allowTimes);
581				}
582
583				if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) {
584					options.weekends = $.extend(true, [], _options.weekends);
585				}
586
587				if ((options.open || options.opened) && (!options.inline)) {
588					input.trigger('open.xdsoft');
589				}
590
591				if (options.inline) {
592					triggerAfterOpen = true;
593					datetimepicker.addClass('xdsoft_inline');
594					input.after(datetimepicker).hide();
595				}
596
597				if (options.inverseButton) {
598					options.next = 'xdsoft_prev';
599					options.prev = 'xdsoft_next';
600				}
601
602				if (options.datepicker) {
603					datepicker.addClass('active');
604				} else {
605					datepicker.removeClass('active');
606				}
607
608				if (options.timepicker) {
609					timepicker.addClass('active');
610				} else {
611					timepicker.removeClass('active');
612				}
613
614				if (options.value) {
615					if (input && input.val) {
616						input.val(options.value);
617					}
618					_xdsoft_datetime.setCurrentTime(options.value);
619				}
620
621				if (isNaN(options.dayOfWeekStart)) {
622					options.dayOfWeekStart = 0;
623				} else {
624					options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
625				}
626
627				if (!options.timepickerScrollbar) {
628					scrollbar.hide();
629				}
630
631				if (options.minDate && /^-(.*)$/.test(options.minDate)) {
632					options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat(options.formatDate);
633				}
634
635				if (options.maxDate &&  /^\+(.*)$/.test(options.maxDate)) {
636					options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat(options.formatDate);
637				}
638
639				mounth_picker
640					.find('.xdsoft_today_button')
641						.css('visibility', !options.todayButton ? 'hidden' : 'visible');
642
643				if (options.mask) {
644					var e,
645						getCaretPos = function (input) {
646							try {
647								if (document.selection && document.selection.createRange) {
648									var range = document.selection.createRange();
649									return range.getBookmark().charCodeAt(2) - 2;
650								}
651								if (input.setSelectionRange) {
652									return input.selectionStart;
653								}
654							} catch (e) {
655								return 0;
656							}
657						},
658						setCaretPos = function (node, pos) {
659							node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node;
660							if (!node) {
661								return false;
662							}
663							if (node.createTextRange) {
664								var textRange = node.createTextRange();
665								textRange.collapse(true);
666								textRange.moveEnd('character',pos);
667								textRange.moveStart('character',pos);
668								textRange.select();
669								return true;
670							}
671							if (node.setSelectionRange) {
672								node.setSelectionRange(pos, pos);
673								return true;
674							}
675							return false;
676						},
677						isValidValue = function (mask, value) {
678							var reg = mask
679								.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
680								.replace(/_/g, '{digit+}')
681								.replace(/([0-9]{1})/g, '{digit$1}')
682								.replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
683								.replace(/\{digit[\+]\}/g, '[0-9_]{1}');
684							return (new RegExp(reg)).test(value);
685						};
686					input.off('keydown.xdsoft');
687
688					if (options.mask === true) {
689						options.mask = options.format
690							.replace(/Y/g, '9999')
691							.replace(/F/g, '9999')
692							.replace(/m/g, '19')
693							.replace(/d/g, '39')
694							.replace(/H/g, '29')
695							.replace(/i/g, '59')
696							.replace(/s/g, '59');
697					}
698
699					if ($.type(options.mask) === 'string') {
700						if (!isValidValue(options.mask, input.val())) {
701							input.val(options.mask.replace(/[0-9]/g, '_'));
702						}
703
704						input.on('keydown.xdsoft', function (event) {
705							var val = this.value,
706								key = event.which,
707								pos,
708								digit;
709
710							if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) {
711								pos = getCaretPos(this);
712								digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_';
713
714								if ((key === BACKSPACE || key === DEL) && pos) {
715									pos -= 1;
716									digit = '_';
717								}
718
719								while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
720									pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
721								}
722
723								val = val.substr(0, pos) + digit + val.substr(pos + 1);
724								if ($.trim(val) === '') {
725									val = options.mask.replace(/[0-9]/g, '_');
726								} else {
727									if (pos === options.mask.length) {
728										event.preventDefault();
729										return false;
730									}
731								}
732
733								pos += (key === BACKSPACE || key === DEL) ? 0 : 1;
734								while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
735									pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
736								}
737
738								if (isValidValue(options.mask, val)) {
739									this.value = val;
740									setCaretPos(this, pos);
741								} else if ($.trim(val) === '') {
742									this.value = options.mask.replace(/[0-9]/g, '_');
743								} else {
744									input.trigger('error_input.xdsoft');
745								}
746							} else {
747								if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key)!==-1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
748									return true;
749								}
750							}
751
752							event.preventDefault();
753							return false;
754						});
755					}
756				}
757				if (options.validateOnBlur) {
758					input
759						.off('blur.xdsoft')
760						.on('blur.xdsoft', function () {
761							if (options.allowBlank && !$.trim($(this).val()).length) {
762								$(this).val(null);
763								datetimepicker.data('xdsoft_datetime').empty();
764							} else if (!Date.parseDate($(this).val(), options.format)) {
765								$(this).val((_xdsoft_datetime.now()).dateFormat(options.format));
766								datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
767							} else {
768								datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
769							}
770							datetimepicker.trigger('changedatetime.xdsoft');
771						});
772				}
773				options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
774
775				datetimepicker
776					.trigger('xchange.xdsoft')
777					.trigger('afterOpen.xdsoft');
778			};
779
780			datetimepicker
781				.data('options', options)
782				.on('mousedown.xdsoft', function (event) {
783					event.stopPropagation();
784					event.preventDefault();
785					yearselect.hide();
786					monthselect.hide();
787					return false;
788				});
789
790			scroll_element = timepicker.find('.xdsoft_time_box');
791			scroll_element.append(timebox);
792			scroll_element.xdsoftScroller();
793
794			datetimepicker.on('afterOpen.xdsoft', function () {
795				scroll_element.xdsoftScroller();
796			});
797
798			datetimepicker
799				.append(datepicker)
800				.append(timepicker);
801
802			if (options.withoutCopyright !== true) {
803				datetimepicker
804					.append(xdsoft_copyright);
805			}
806
807			datepicker
808				.append(mounth_picker)
809				.append(calendar);
810
811			$(options.parentID)
812				.append(datetimepicker);
813
814			XDSoft_datetime = function () {
815				var _this = this;
816				_this.now = function (norecursion) {
817					var d = new Date(),
818						date,
819						time;
820
821					if (!norecursion && options.defaultDate) {
822						date = _this.strToDate(options.defaultDate);
823						d.setFullYear(date.getFullYear());
824						d.setMonth(date.getMonth());
825						d.setDate(date.getDate());
826					}
827
828					if (options.yearOffset) {
829						d.setFullYear(d.getFullYear() + options.yearOffset);
830					}
831
832					if (!norecursion && options.defaultTime) {
833						time = _this.strtotime(options.defaultTime);
834						d.setHours(time.getHours());
835						d.setMinutes(time.getMinutes());
836					}
837
838					return d;
839				};
840
841				_this.isValidDate = function (d) {
842					if (Object.prototype.toString.call(d) !== "[object Date]") {
843						return false;
844					}
845					return !isNaN(d.getTime());
846				};
847
848				_this.setCurrentTime = function (dTime) {
849					_this.currentTime = (typeof dTime === 'string') ? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime : _this.now();
850					datetimepicker.trigger('xchange.xdsoft');
851				};
852
853				_this.empty = function () {
854					_this.currentTime = null;
855				};
856
857				_this.getCurrentTime = function (dTime) {
858					return _this.currentTime;
859				};
860
861				_this.nextMonth = function () {
862					var month = _this.currentTime.getMonth() + 1,
863						year;
864					if (month === 12) {
865						_this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
866						month = 0;
867					}
868
869					year = _this.currentTime.getFullYear();
870
871					_this.currentTime.setDate(
872						Math.min(
873							new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
874							_this.currentTime.getDate()
875						)
876					);
877					_this.currentTime.setMonth(month);
878
879					if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
880						options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
881					}
882
883					if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
884						options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
885					}
886
887					datetimepicker.trigger('xchange.xdsoft');
888					return month;
889				};
890
891				_this.prevMonth = function () {
892					var month = _this.currentTime.getMonth() - 1;
893					if (month === -1) {
894						_this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
895						month = 11;
896					}
897					_this.currentTime.setDate(
898						Math.min(
899							new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
900							_this.currentTime.getDate()
901						)
902					);
903					_this.currentTime.setMonth(month);
904					if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
905						options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
906					}
907					datetimepicker.trigger('xchange.xdsoft');
908					return month;
909				};
910
911				_this.getWeekOfYear = function (datetime) {
912					var onejan = new Date(datetime.getFullYear(), 0, 1);
913					return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
914				};
915
916				_this.strToDateTime = function (sDateTime) {
917					var tmpDate = [], timeOffset, currentTime;
918
919					if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
920						return sDateTime;
921					}
922
923					tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime);
924					if (tmpDate) {
925						tmpDate[2] = Date.parseDate(tmpDate[2], options.formatDate);
926					}
927					if (tmpDate  && tmpDate[2]) {
928						timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
929						currentTime = new Date((_xdsoft_datetime.now()).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
930					} else {
931						currentTime = sDateTime ? Date.parseDate(sDateTime, options.format) : _this.now();
932					}
933
934					if (!_this.isValidDate(currentTime)) {
935						currentTime = _this.now();
936					}
937
938					return currentTime;
939				};
940
941				_this.strToDate = function (sDate) {
942					if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
943						return sDate;
944					}
945
946					var currentTime = sDate ? Date.parseDate(sDate, options.formatDate) : _this.now(true);
947					if (!_this.isValidDate(currentTime)) {
948						currentTime = _this.now(true);
949					}
950					return currentTime;
951				};
952
953				_this.strtotime = function (sTime) {
954					if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
955						return sTime;
956					}
957					var currentTime = sTime ? Date.parseDate(sTime, options.formatTime) : _this.now(true);
958					if (!_this.isValidDate(currentTime)) {
959						currentTime = _this.now(true);
960					}
961					return currentTime;
962				};
963
964				_this.str = function () {
965					return _this.currentTime.dateFormat(options.format);
966				};
967				_this.currentTime = this.now();
968			};
969
970			_xdsoft_datetime = new XDSoft_datetime();
971
972			mounth_picker
973				.find('.xdsoft_today_button')
974				.on('mousedown.xdsoft', function () {
975					datetimepicker.data('changed', true);
976					_xdsoft_datetime.setCurrentTime(0);
977					datetimepicker.trigger('afterOpen.xdsoft');
978				}).on('dblclick.xdsoft', function () {
979					input.val(_xdsoft_datetime.str());
980					datetimepicker.trigger('close.xdsoft');
981				});
982			mounth_picker
983				.find('.xdsoft_prev,.xdsoft_next')
984				.on('mousedown.xdsoft', function () {
985					var $this = $(this),
986						timer = 0,
987						stop = false;
988
989					(function arguments_callee1(v) {
990						var month =  _xdsoft_datetime.currentTime.getMonth();
991						if ($this.hasClass(options.next)) {
992							_xdsoft_datetime.nextMonth();
993						} else if ($this.hasClass(options.prev)) {
994							_xdsoft_datetime.prevMonth();
995						}
996						if (options.monthChangeSpinner) {
997							if (!stop) {
998								timer = setTimeout(arguments_callee1, v || 100);
999							}
1000						}
1001					}(500));
1002
1003					$([document.body, window]).on('mouseup.xdsoft', function arguments_callee2() {
1004						clearTimeout(timer);
1005						stop = true;
1006						$([document.body, window]).off('mouseup.xdsoft', arguments_callee2);
1007					});
1008				});
1009
1010			timepicker
1011				.find('.xdsoft_prev,.xdsoft_next')
1012				.on('mousedown.xdsoft', function () {
1013					var $this = $(this),
1014						timer = 0,
1015						stop = false,
1016						period = 110;
1017					(function arguments_callee4(v) {
1018						var pheight = timeboxparent[0].clientHeight,
1019							height = timebox[0].offsetHeight,
1020							top = Math.abs(parseInt(timebox.css('marginTop'), 10));
1021						if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
1022							timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
1023						} else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
1024							timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
1025						}
1026						timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox.css('marginTop'), 10) / (height - pheight))]);
1027						period = (period > 10) ? 10 : period - 10;
1028						if (!stop) {
1029							timer = setTimeout(arguments_callee4, v || period);
1030						}
1031					}(500));
1032					$([document.body, window]).on('mouseup.xdsoft', function arguments_callee5() {
1033						clearTimeout(timer);
1034						stop = true;
1035						$([document.body, window])
1036							.off('mouseup.xdsoft', arguments_callee5);
1037					});
1038				});
1039
1040			xchangeTimer = 0;
1041			// base handler - generating a calendar and timepicker
1042			datetimepicker
1043				.on('xchange.xdsoft', function (event) {
1044					clearTimeout(xchangeTimer);
1045					xchangeTimer = setTimeout(function () {
1046						var table =	'',
1047							start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
1048							i = 0,
1049							j,
1050							today = _xdsoft_datetime.now(),
1051							maxDate = false,
1052							minDate = false,
1053							d,
1054							y,
1055							m,
1056							w,
1057							classes = [],
1058							customDateSettings,
1059							newRow = true,
1060							time = '',
1061							h = '',
1062							line_time;
1063
1064						while (start.getDay() !== options.dayOfWeekStart) {
1065							start.setDate(start.getDate() - 1);
1066						}
1067
1068						table += '<table><thead><tr>';
1069
1070						if (options.weeks) {
1071							table += '<th></th>';
1072						}
1073
1074						for (j = 0; j < 7; j += 1) {
1075							table += '<th>' + options.i18n[options.lang].dayOfWeek[(j + options.dayOfWeekStart) % 7] + '</th>';
1076						}
1077
1078						table += '</tr></thead>';
1079						table += '<tbody>';
1080
1081						if (options.maxDate !== false) {
1082							maxDate = _xdsoft_datetime.strToDate(options.maxDate);
1083							maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
1084						}
1085
1086						if (options.minDate !== false) {
1087							minDate = _xdsoft_datetime.strToDate(options.minDate);
1088							minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
1089						}
1090
1091						while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
1092							classes = [];
1093							i += 1;
1094
1095							d = start.getDate();
1096							y = start.getFullYear();
1097							m = start.getMonth();
1098							w = _xdsoft_datetime.getWeekOfYear(start);
1099
1100							classes.push('xdsoft_date');
1101
1102							if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) {
1103								customDateSettings = options.beforeShowDay.call(datetimepicker, start);
1104							} else {
1105								customDateSettings = null;
1106							}
1107
1108							if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) {
1109								classes.push('xdsoft_disabled');
1110							}
1111
1112							if (customDateSettings && customDateSettings[1] !== "") {
1113								classes.push(customDateSettings[1]);
1114							}
1115
1116							if (_xdsoft_datetime.currentTime.getMonth() !== m) {
1117								classes.push('xdsoft_other_month');
1118							}
1119
1120							if ((options.defaultSelect || datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) {
1121								classes.push('xdsoft_current');
1122							}
1123
1124							if (today.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) {
1125								classes.push('xdsoft_today');
1126							}
1127
1128							if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(start.dateFormat(options.formatDate)) === -1) {
1129								classes.push('xdsoft_weekend');
1130							}
1131
1132							if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
1133								classes.push(options.beforeShowDay(start));
1134							}
1135
1136							if (newRow) {
1137								table += '<tr>';
1138								newRow = false;
1139								if (options.weeks) {
1140									table += '<th>' + w + '</th>';
1141								}
1142							}
1143
1144							table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '">' +
1145										'<div>' + d + '</div>' +
1146									'</td>';
1147
1148							if (start.getDay() === options.dayOfWeekStartPrev) {
1149								table += '</tr>';
1150								newRow = true;
1151							}
1152
1153							start.setDate(d + 1);
1154						}
1155						table += '</tbody></table>';
1156
1157						calendar.html(table);
1158
1159						mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]);
1160						mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
1161
1162						// generate timebox
1163						time = '';
1164						h = '';
1165						m = '';
1166						line_time = function line_time(h, m) {
1167							var now = _xdsoft_datetime.now();
1168							now.setHours(h);
1169							h = parseInt(now.getHours(), 10);
1170							now.setMinutes(m);
1171							m = parseInt(now.getMinutes(), 10);
1172
1173							classes = [];
1174							if ((options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) {
1175								classes.push('xdsoft_disabled');
1176							}
1177							if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours(), 10) === parseInt(h, 10) && (options.step > 59 || Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step === parseInt(m, 10))) {
1178								if (options.defaultSelect || datetimepicker.data('changed')) {
1179									classes.push('xdsoft_current');
1180								} else if (options.initTime) {
1181									classes.push('xdsoft_init_time');
1182								}
1183							}
1184							if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
1185								classes.push('xdsoft_today');
1186							}
1187							time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + now.dateFormat(options.formatTime) + '</div>';
1188						};
1189
1190						if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
1191							for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) {
1192								for (j = 0; j < 60; j += options.step) {
1193									h = (i < 10 ? '0' : '') + i;
1194									m = (j < 10 ? '0' : '') + j;
1195									line_time(h, m);
1196								}
1197							}
1198						} else {
1199							for (i = 0; i < options.allowTimes.length; i += 1) {
1200								h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
1201								m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
1202								line_time(h, m);
1203							}
1204						}
1205
1206						timebox.html(time);
1207
1208						opt = '';
1209						i = 0;
1210
1211						for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) {
1212							opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>';
1213						}
1214						yearselect.children().eq(0)
1215												.html(opt);
1216
1217						for (i = 0, opt = ''; i <= 11; i += 1) {
1218							opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[options.lang].months[i] + '</div>';
1219						}
1220						monthselect.children().eq(0).html(opt);
1221						$(datetimepicker)
1222							.trigger('generate.xdsoft');
1223					}, 10);
1224					event.stopPropagation();
1225				})
1226				.on('afterOpen.xdsoft', function () {
1227					if (options.timepicker) {
1228						var classType, pheight, height, top;
1229						if (timebox.find('.xdsoft_current').length) {
1230							classType = '.xdsoft_current';
1231						} else if (timebox.find('.xdsoft_init_time').length) {
1232							classType = '.xdsoft_init_time';
1233						}
1234						if (classType) {
1235							pheight = timeboxparent[0].clientHeight;
1236							height = timebox[0].offsetHeight;
1237							top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
1238							if ((height - pheight) < top) {
1239								top = height - pheight;
1240							}
1241							timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
1242						} else {
1243							timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
1244						}
1245					}
1246				});
1247
1248			timerclick = 0;
1249			calendar
1250				.on('click.xdsoft', 'td', function (xdevent) {
1251					xdevent.stopPropagation();  // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
1252					timerclick += 1;
1253					var $this = $(this),
1254						currentTime = _xdsoft_datetime.currentTime;
1255
1256					if (currentTime === undefined || currentTime === null) {
1257						_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1258						currentTime = _xdsoft_datetime.currentTime;
1259					}
1260
1261					if ($this.hasClass('xdsoft_disabled')) {
1262						return false;
1263					}
1264
1265					currentTime.setDate(1);
1266					currentTime.setFullYear($this.data('year'));
1267					currentTime.setMonth($this.data('month'));
1268					currentTime.setDate($this.data('date'));
1269
1270					datetimepicker.trigger('select.xdsoft', [currentTime]);
1271
1272					input.val(_xdsoft_datetime.str());
1273					if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === 0 && !options.timepicker))) && !options.inline) {
1274						datetimepicker.trigger('close.xdsoft');
1275					}
1276
1277					if (options.onSelectDate &&	$.isFunction(options.onSelectDate)) {
1278						options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
1279					}
1280
1281					datetimepicker.data('changed', true);
1282					datetimepicker.trigger('xchange.xdsoft');
1283					datetimepicker.trigger('changedatetime.xdsoft');
1284					setTimeout(function () {
1285						timerclick = 0;
1286					}, 200);
1287				});
1288
1289			timebox
1290				.on('click.xdsoft', 'div', function (xdevent) {
1291					xdevent.stopPropagation();
1292					var $this = $(this),
1293						currentTime = _xdsoft_datetime.currentTime;
1294
1295					if (currentTime === undefined || currentTime === null) {
1296						_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1297						currentTime = _xdsoft_datetime.currentTime;
1298					}
1299
1300					if ($this.hasClass('xdsoft_disabled')) {
1301						return false;
1302					}
1303					currentTime.setHours($this.data('hour'));
1304					currentTime.setMinutes($this.data('minute'));
1305					datetimepicker.trigger('select.xdsoft', [currentTime]);
1306
1307					datetimepicker.data('input').val(_xdsoft_datetime.str());
1308					if (!options.inline) {
1309						datetimepicker.trigger('close.xdsoft');
1310					}
1311
1312					if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
1313						options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
1314					}
1315					datetimepicker.data('changed', true);
1316					datetimepicker.trigger('xchange.xdsoft');
1317					datetimepicker.trigger('changedatetime.xdsoft');
1318				});
1319
1320			if (datetimepicker.mousewheel) {
1321				datepicker.mousewheel(function (event, delta, deltaX, deltaY) {
1322					if (!options.scrollMonth) {
1323						return true;
1324					}
1325					if (delta < 0) {
1326						_xdsoft_datetime.nextMonth();
1327					} else {
1328						_xdsoft_datetime.prevMonth();
1329					}
1330					return false;
1331				});
1332
1333				timeboxparent.unmousewheel().mousewheel(function (event, delta, deltaX, deltaY) {
1334					if (!options.scrollTime) {
1335						return true;
1336					}
1337					var pheight = timeboxparent[0].clientHeight,
1338						height = timebox[0].offsetHeight,
1339						top = Math.abs(parseInt(timebox.css('marginTop'), 10)),
1340						fl = true;
1341					if (delta < 0 && (height - pheight) - options.timeHeightInTimePicker >= top) {
1342						timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
1343						fl = false;
1344					} else if (delta > 0 && top - options.timeHeightInTimePicker >= 0) {
1345						timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
1346						fl = false;
1347					}
1348					timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox.css('marginTop'), 10) / (height - pheight))]);
1349					event.stopPropagation();
1350					return fl;
1351				});
1352
1353				input.mousewheel(function (event, delta, deltaX, deltaY) {
1354					if (!options.scrollInput) {
1355						return true;
1356					}
1357					if (!options.datepicker && options.timepicker) {
1358						current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
1359						if (current_time_index + delta >= 0 && current_time_index + delta < timebox.children().length) {
1360							current_time_index += delta;
1361						}
1362						if (timebox.children().eq(current_time_index).length) {
1363							timebox.children().eq(current_time_index).trigger('mousedown');
1364						}
1365						return false;
1366					}
1367					if (options.datepicker && !options.timepicker) {
1368						datepicker.trigger(event, [delta, deltaX, deltaY]);
1369						if (input.val) {
1370							input.val(_xdsoft_datetime.str());
1371						}
1372						datetimepicker.trigger('changedatetime.xdsoft');
1373						return false;
1374					}
1375				});
1376			}
1377
1378			datetimepicker
1379				.on('changedatetime.xdsoft', function (event) {
1380					if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) {
1381						var $input = datetimepicker.data('input');
1382						options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
1383						delete options.value;
1384						$input.trigger('change');
1385					}
1386				})
1387				.on('generate.xdsoft', function () {
1388					if (options.onGenerate && $.isFunction(options.onGenerate)) {
1389						options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1390					}
1391					if (triggerAfterOpen) {
1392						datetimepicker.trigger('afterOpen.xdsoft');
1393						triggerAfterOpen = false;
1394					}
1395				})
1396				.on('click.xdsoft', function (xdevent) {
1397					xdevent.stopPropagation();
1398				});
1399
1400			current_time_index = 0;
1401
1402			setPos = function () {
1403				var offset = datetimepicker.data('input').offset(), top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, position = "absolute";
1404				if (options.fixed) {
1405					top -= $(window).scrollTop();
1406					left -= $(window).scrollLeft();
1407					position = "fixed";
1408				} else {
1409					if (top + datetimepicker[0].offsetHeight > $(window).height() + $(window).scrollTop()) {
1410						top = offset.top - datetimepicker[0].offsetHeight + 1;
1411					}
1412					if (top < 0) {
1413						top = 0;
1414					}
1415					if (left + datetimepicker[0].offsetWidth > $(window).width()) {
1416						left = $(window).width() - datetimepicker[0].offsetWidth;
1417					}
1418				}
1419				datetimepicker.css({
1420					left: left,
1421					top: top,
1422					position: position
1423				});
1424			};
1425			datetimepicker
1426				.on('open.xdsoft', function (event) {
1427					var onShow = true;
1428					if (options.onShow && $.isFunction(options.onShow)) {
1429						onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
1430					}
1431					if (onShow !== false) {
1432						datetimepicker.show();
1433						setPos();
1434						$(window)
1435							.off('resize.xdsoft', setPos)
1436							.on('resize.xdsoft', setPos);
1437
1438						if (options.closeOnWithoutClick) {
1439							$([document.body, window]).on('mousedown.xdsoft', function arguments_callee6() {
1440								datetimepicker.trigger('close.xdsoft');
1441								$([document.body, window]).off('mousedown.xdsoft', arguments_callee6);
1442							});
1443						}
1444					}
1445				})
1446				.on('close.xdsoft', function (event) {
1447					var onClose = true;
1448					mounth_picker
1449						.find('.xdsoft_month,.xdsoft_year')
1450							.find('.xdsoft_select')
1451								.hide();
1452					if (options.onClose && $.isFunction(options.onClose)) {
1453						onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
1454					}
1455					if (onClose !== false && !options.opened && !options.inline) {
1456						datetimepicker.hide();
1457					}
1458					event.stopPropagation();
1459				})
1460				.data('input', input);
1461
1462			timer = 0;
1463			timer1 = 0;
1464
1465			datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
1466			datetimepicker.setOptions(options);
1467
1468			function getCurrentValue() {
1469
1470				var ct = false, time;
1471
1472				if (options.startDate) {
1473					ct = _xdsoft_datetime.strToDate(options.startDate);
1474				} else {
1475					ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
1476					if (ct) {
1477						ct = _xdsoft_datetime.strToDateTime(ct);
1478					} else if (options.defaultDate) {
1479						ct = _xdsoft_datetime.strToDate(options.defaultDate);
1480						if (options.defaultTime) {
1481							time = _xdsoft_datetime.strtotime(options.defaultTime);
1482							ct.setHours(time.getHours());
1483							ct.setMinutes(time.getMinutes());
1484						}
1485					}
1486				}
1487
1488				if (ct && _xdsoft_datetime.isValidDate(ct)) {
1489					datetimepicker.data('changed', true);
1490				} else {
1491					ct = '';
1492				}
1493
1494				return ct || 0;
1495			}
1496
1497			_xdsoft_datetime.setCurrentTime(getCurrentValue());
1498
1499			input
1500				.data('xdsoft_datetimepicker', datetimepicker)
1501				.on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function (event) {
1502					if (input.is(':disabled') || input.is(':hidden') || !input.is(':visible') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
1503						return;
1504					}
1505					clearTimeout(timer);
1506					timer = setTimeout(function () {
1507						if (input.is(':disabled') || input.is(':hidden') || !input.is(':visible')) {
1508							return;
1509						}
1510
1511						triggerAfterOpen = true;
1512						_xdsoft_datetime.setCurrentTime(getCurrentValue());
1513
1514						datetimepicker.trigger('open.xdsoft');
1515					}, 100);
1516				})
1517				.on('keydown.xdsoft', function (event) {
1518					var val = this.value, elementSelector,
1519						key = event.which;
1520					if ([ENTER].indexOf(key) !== -1) {
1521						elementSelector = $("input:visible,textarea:visible");
1522						datetimepicker.trigger('close.xdsoft');
1523						elementSelector.eq(elementSelector.index(this) + 1).focus();
1524						return false;
1525					}
1526					if ([TAB].indexOf(key) !== -1) {
1527						datetimepicker.trigger('close.xdsoft');
1528						return true;
1529					}
1530				});
1531		};
1532		destroyDateTimePicker = function (input) {
1533			var datetimepicker = input.data('xdsoft_datetimepicker');
1534			if (datetimepicker) {
1535				datetimepicker.data('xdsoft_datetime', null);
1536				datetimepicker.remove();
1537				input
1538					.data('xdsoft_datetimepicker', null)
1539					.off('.xdsoft');
1540				$(window).off('resize.xdsoft');
1541				$([window, document.body]).off('mousedown.xdsoft');
1542				if (input.unmousewheel) {
1543					input.unmousewheel();
1544				}
1545			}
1546		};
1547		$(document)
1548			.off('keydown.xdsoftctrl keyup.xdsoftctrl')
1549			.on('keydown.xdsoftctrl', function (e) {
1550				if (e.keyCode === CTRLKEY) {
1551					ctrlDown = true;
1552				}
1553			})
1554			.on('keyup.xdsoftctrl', function (e) {
1555				if (e.keyCode === CTRLKEY) {
1556					ctrlDown = false;
1557				}
1558			});
1559		return this.each(function () {
1560			var datetimepicker = $(this).data('xdsoft_datetimepicker');
1561			if (datetimepicker) {
1562				if ($.type(opt) === 'string') {
1563					switch (opt) {
1564					case 'show':
1565						$(this).select().focus();
1566						datetimepicker.trigger('open.xdsoft');
1567						break;
1568					case 'hide':
1569						datetimepicker.trigger('close.xdsoft');
1570						break;
1571					case 'destroy':
1572						destroyDateTimePicker($(this));
1573						break;
1574					case 'reset':
1575						this.value = this.defaultValue;
1576						if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(Date.parseDate(this.value, options.format))) {
1577							datetimepicker.data('changed', false);
1578						}
1579						datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
1580						break;
1581					}
1582				} else {
1583					datetimepicker
1584						.setOptions(opt);
1585				}
1586				return 0;
1587			}
1588			if ($.type(opt) !== 'string') {
1589				if (!options.lazyInit || options.open || options.inline) {
1590					createDateTimePicker($(this));
1591				} else {
1592					lazyInit($(this));
1593				}
1594			}
1595		});
1596	};
1597	$.fn.datetimepicker.defaults = default_options;
1598}(jQuery));
1599(function () {
1600/* jshint ignore:start */
1601/*
1602 * Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
1603 *
1604 * Licensed under the MIT License (LICENSE.txt).
1605 *
1606 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
1607 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
1608 * Thanks to: Seamus Leahy for adding deltaX and deltaY
1609 *
1610 * Version: 3.1.3
1611 *
1612 * Requires: 1.2.2+
1613 */
1614(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
1614(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)}}));
1615
1616
1617// Parse and Format Library
1618//http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/
1619/*
1620 * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
1621 *
1622 * This program is free software; you can redistribute it and/or modify it
1623 * under the terms of the GNU Lesser General Public License as published by the
1624 * Free Software Foundation, version 2.1.
1625 *
1626 * This program is distributed in the hope that it will be useful, but WITHOUT
1627 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1628 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
1629 * details.
1630 */
1631Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};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(a){switch(a){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(a)+"' + ";}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};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) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (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 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){case"D":return{g:0,c:null,
1631s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+a+"], 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:1,c:"z = parseInt(results["+a+"], 10);\n",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["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 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["+a+"], 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["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (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["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 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(b)};}};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 a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)));};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a;};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a;};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(a){return a.replace(/('|\\)/g,"\\$1");};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};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"};
1632/* jshint ignore:end */
1633}())

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.