PageSourceSearch

https://outiror.com/modules/ets_contactform7/views/js/date.js

js outiror.com collected 2026-10-01 14:46:42 UTC 108,845 bytes, 2,889 lines download raw bytes

vendor: 8,527 bytes, lines 1-56
1/**
2 * 2007-2020 ETS-Soft
3 *
4 * NOTICE OF LICENSE
5 *
6 * This file is not open source! Each license that you purchased is only available for 1 wesite only.
7 * If you want to use this file on more websites (or projects), you need to purchase additional licenses.
8 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
9 *
10 * DISCLAIMER
11 *
12 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
13 * versions in the future. If you wish to customize PrestaShop for your
14 * needs please contact us for extra customization service at an affordable price
15 *
16 *  @author ETS-Soft <[email protected]>
17 *  @copyright  2007-2020 ETS-Soft
18 *  @license    Valid for 1 website (or project) for each purchase of license
19 *  International Registered Trademark & Property of ETS-Soft
20 */
21var DateFormatter;!function(){"use strict";var t,e,r,n,a,u,i;u=864e5,i=3600,t=function(t,e){return"string"==typeof t&&"string"==typeof e&&t.toLowerCase()===e.toLowerCase()},e=function(t,r,n){var a=n||"0",u=t.toString();return u.length<r?e(a+u,r):u},r=function(t){var e,n;for(t=t||{},e=1;e<arguments.length;e++)if(n=arguments[e])for(var a in n)n.hasOwnProperty(a)&&("object"==typeof n[a]?r(t[a],n[a]):t[a]=n[a]);return t},n=function(t,e){for(var r=0;r<e.length;r++)if(e[r].toLowerCase()===t.toLowerCase())return r;return-1},a={dateSettings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["AM","PM"],ordinal:function(t){var e=t%10,r={1:"st",2:"nd",3:"rd"};return 1!==Math.floor(t%100/10)&&r[e]?r[e]:"th"}},separators:/[ \-+\/\.T:@]/g,validParts:/[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,intParts:/[djwNzmnyYhHgGis]/g,tzParts:/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,tzClip:/[^-+\dA-Z]/g},DateFormatter=function(t){var e=this,n=r(a,t);e.dateSettings=n.dateSettings,e.separators=n.separators,e.validParts=n.validParts,e.intParts=n.intParts,e.tzParts=n.tzParts,e.tzClip=n.tzClip},DateFormatter.prototype={constructor:DateFormatter,getMonth:function(t){var e,r=this;return e=n(t,r.dateSettings.monthsShort)+1,0===e&&(e=n(t,r.dateSettings.months)+1),e},parseDate:function(e,r){var n,a,u,i,s,o,c,f,l,h,d=this,g=!1,m=!1,p=d.dateSettings,y={date:null,year:null,month:null,day:null,hour:0,min:0,sec:0};if(!e)return null;if(e instanceof Date)return e;if("U"===r)return u=parseInt(e),u?new Date(1e3*u):e;switch(typeof e){case"number":return new Date(e);case"string":break;default:return null}if(n=r.match(d.validParts),!n||0===n.length)throw new Error("Invalid date format definition.");for(a=e.replace(d.separators,"\x00").split("\x00"),u=0;u<a.length;u++)switch(i=a[u],s=parseInt(i),n[u]){case"y":case"Y":if(!s)return null;l=i.length,y.year=2===l?parseInt((70>s?"20":"19")+i):s,g=!0;break;case"m":case"n":case"M":case"F":if(isNaN(s)){if(o=d.getMonth(i),!(o>0))return null;y.month=o}else{if(!(s>=1&&12>=s))return null;y.month=s}g=!0;break;case"d":case"j":if(!(s>=1&&31>=s))return null;y.day=s,g=!0;break;case"g":case"h":if(c=n.indexOf("a")>-1?n.indexOf("a"):n.indexOf("A")>-1?n.indexOf("A"):-1,h=a[c],c>-1)f=t(h,p.meridiem[0])?0:t(h,p.meridiem[1])?12:-1,s>=1&&12>=s&&f>-1?y.hour=s+f-1:s>=0&&23>=s&&(y.hour=s);else{if(!(s>=0&&23>=s))return null;y.hour=s}m=!0;break;case"G":case"H":if(!(s>=0&&23>=s))return null;y.hour=s,m=!0;break;case"i":if(!(s>=0&&59>=s))return null;y.min=s,m=!0;break;case"s":if(!(s>=0&&59>=s))return null;y.sec=s,m=!0}if(g===!0&&y.year&&y.month&&y.day)y.date=new Date(y.year,y.month-1,y.day,y.hour,y.min,y.sec,0);else{if(m!==!0)return null;y.date=new Date(0,0,0,y.hour,y.min,y.sec,0)}return y.date},guessDate:function(t,e){if("string"!=typeof t)return t;var r,n,a,u,i,s,o=this,c=t.replace(o.separators,"\x00").split("\x00"),f=/^[djmn]/g,l=e.match(o.validParts),h=new Date,d=0;if(!f.test(l[0]))return t;for(a=0;a<c.length;a++){if(d=2,i=c[a],s=parseInt(i.substr(0,2)),isNaN(s))return null;switch(a){case 0:"m"===l[0]||"n"===l[0]?h.setMonth(s-1):h.setDate(s);break;case 1:"m"===l[0]||"n"===l[0]?h.setDate(s):h.setMonth(s-1);break;case 2:if(n=h.getFullYear(),r=i.length,d=4>r?r:4,n=parseInt(4>r?n.toString().substr(0,4-r)+i:i.substr(0,4)),!n)return null;h.setFullYear(n);break;case 3:h.setHours(s);break;case 4:h.setMinutes(s);break;case 5:h.setSeconds(s)}u=i.substr(d),u.length>0&&c.splice(a+1,0,u)}return h},parseFormat:function(t,r){var n,a=this,s=a.dateSettings,o=/\\?(.?)/gi,c=function(t,e){return n[t]?n[t]():e};return n={d:function(){return e(n.j(),2)},D:function(){return s.daysShort[n.w()]},j:function(){return r.getDate()},l:function(){return s.days[n.w()]},N:function(){return n.w()||7},w:function(){return r.getDay()},z:function(){var t=new Date(n.Y(),n.n()-1,n.j()),e=new Date(n.Y(),0,1);return Math.round((t-e)/u)},W:function(){var t=new Date(n.Y(),n.n()-1,n.j()-n.N()+3),r=new Date(t.getFullYear(),0,4);return e(1+Math.round((t-r)/u/7),2)},F:function(){return s.months[r.getMonth()]},m:function(){return e(n.n(),2)},M:function(){return s.monthsShort[r.getMonth()]},n:function(){return r.getMonth()+1},t:function(){return new Date(n.Y(),n.n(),0).getDate()},L:function(){var t=n.Y();return t%4===0&&t%100!==0||t%400===0?1:0},o:function(){var t=n.n(),e=n.W(),r=n.Y();return r+(12===t&&9>e?1:1===t&&e>9?-1:0)},Y:function(){return r.getFullYear()},y:function(){return n.Y().toString().slice(-2)},a:function(){return n.A().toLowerCase()},A:function(){var t=n.G()<12?0:1;return s.meridiem[t]},B:function(){var t=r.getUTCHours()*i,n=60*r.getUTCMinutes(),a=r.getUTCSeconds();return e(Math.floor((t+n+a+i)/86.4)%1e3,3)},g:function(){return n.G()%12||12},G:function(){return r.getHours()},h:function(){return e(n.g(),2)},H:function(){return e(n.G(),2)},i:function(){return e(r.getMinutes(),2)},s:function(){return e(r.getSeconds(),2)},u:function(){return e(1e3*r.getMilliseconds(),6)},e:function(){var t=/\((.*)\)/.exec(String(r))[1];return t||"Coordinated Universal Time"},I:function(){var t=new Date(n.Y(),0),e=Date.UTC(n.Y(),0),r=new Date(n.Y(),6),a=Date.UTC(n.Y(),6);return t-e!==r-a?1:0},O:function(){var t=r.getTimezoneOffset(),n=Math.abs(t);return(t>0?"-":"+")+e(100*Math.floor(n/60)+n%60,4)},P:function(){var t=n.O();return t.substr(0,3)+":"+t.substr(3,2)},T:function(){var t=(String(r).match(a.tzParts)||[""]).pop().replace(a.tzClip,"");return t||"UTC"},Z:function(){return 60*-r.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(o,c)},r:function(){return"D, d M Y H:i:s O".replace(o,c)},U:function(){return r.getTime()/1e3||0}},c(t,t)},formatDate:function(t,e){var r,n,a,u,i,s=this,o="",c="\\";if("string"==typeof t&&(t=s.parseDate(t,e),!t))return null;if(t instanceof Date){for(a=e.length,r=0;a>r;r++)i=e.charAt(r),"S"!==i&&i!==c&&(r>0&&e.charAt(r-1)===c?o+=i:(u=s.parseFormat(i,t),r!==a-1&&s.intParts.test(i)&&"S"===e.charAt(r+1)&&(n=parseInt(u)||0,u+=s.dateSettings.ordinal(n)),o+=u));return o}return""}}}();
22var datetimepickerFactory = function ($) {
23	'use strict';
24
25	var default_options  = {
26		i18n: {
27			ar: { // Arabic
28				months: [
29					"????? ??????", "????", "????", "?????", "????", "??????", "????", "??", "?????", "????? ?????", "????? ??????", "????? ?????"
30				],
31				dayOfWeekShort: [
32					"?", "?", "?", "?", "?", "?", "?"
33				],
34				dayOfWeek: ["?????", "???????", "????????", "????????", "??????", "??????", "?????", "?????"]
35			},
36			ro: { // Romanian
37				months: [
38					"Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
39				],
40				dayOfWeekShort: [
41					"Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ"
42				],
43				dayOfWeek: ["Duminica", "Luni", "Marti", "Miercuri", "Joi", "Vineri", "Sâmbata"]
44			},
45			id: { // Indonesian
46				months: [
47					"Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
48				],
49				dayOfWeekShort: [
50					"Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
51				],
52				dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
53			},
54			is: { // Icelandic
55				months: [
56					"Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "
56Nóvember", "Desember"
57				],
58				dayOfWeekShort: [
59					"Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau"
60				],
61				dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"]
62			},
63			bg: { // Bulgarian
64				months: [
65					"??????", "????????", "????", "?????", "???", "???", "???", "??????", "?????????", "????????", "???????", "????????"
66				],
67				dayOfWeekShort: [
68					"??", "??", "??", "??", "??", "??", "??"
69				],
70				dayOfWeek: ["??????", "??????????", "???????", "?????", "?????????", "?????", "??????"]
71			},
72			fa: { // Persian/Farsi
73				months: [
74					'???????', '????????', '?????', '???', '?????', '??????', '???', '????', '???', '??', '????', '?????'
75				],
76				dayOfWeekShort: [
77					'??????', '??????', '?? ????', '????????', '???????', '????', '????'
78				],
79				dayOfWeek: ["???????", "??????", "???????", "????????", "????????", "????", "????", "???????"]
80			},
81			ru: { // Russian
82				months: [
83					'??????', '???????', '????', '??????', '???', '????', '????', '??????', '????????', '???????', '??????', '???????'
84				],
85				dayOfWeekShort: [
86					"??", "??", "??", "??", "??", "??", "??"
87				],
88				dayOfWeek: ["???????????", "???????????", "???????", "?????", "???????", "???????", "???????"]
89			},
90			uk: { // Ukrainian
91				months: [
92					'??????', '?????', '????????', '???????', '???????', '???????', '??????', '???????', '????????', '???????', '????????', '???????'
93				],
94				dayOfWeekShort: [
95					"???", "???", "???", "???", "???", "???", "???"
96				],
97				dayOfWeek: ["??????", "?????????", "????????", "??????", "??????", "?'??????", "??????"]
98			},
99			en: { // English
100				months: [
101					"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
101November", "December"
102				],
103				dayOfWeekShort: [
104					"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
105				],
106				dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
107			},
108			el: { // ????????
109				months: [
110					"?a????????", "Feß????????", "???t???", "?p??????", "?????", "???????", "???????", "?????st??", "Sept?µß????", "??t?ß????", "???µß????", "?e??µß????"
111				],
112				dayOfWeekShort: [
113					"???", "?e?", "???", "?et", "?eµ", "?a?", "Saß"
114				],
115				dayOfWeek: ["????a??", "?e?t??a", "???t?", "?et??t?", "??µpt?", "?a?as?e??", "S?ßßat?"]
116			},
117			de: { // German
118				months: [
119					'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
120				],
121				dayOfWeekShort: [
122					"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
123				],
124				dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
125			},
126			nl: { // Dutch
127				months: [
128					"januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
129				],
130				dayOfWeekShort: [
131					"zo", "ma", "di", "wo", "do", "vr", "za"
132				],
133				dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
134			},
135			tr: { // Turkish
136				months: [
137					"Ocak", "Subat", "Mart", "Nisan", "Mayis", "Haziran", "Temmuz", "Agustos", "Eylül", "Ekim", "Kasim", "Aralik"
138				],
139				dayOfWeekShort: [
140					"Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
141				],
142				dayOfWeek: ["Pazar", "Pazartesi", "Sali", "Çarsamba", "Persembe", "Cuma", "Cumartesi"]
143			},
144			fr: { //French
145				months: [
146					"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
147				],
148				dayOfWeekShort: [
149					"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
150				],
151				dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
152			},
153			es: { // Spanish
154				months: [
155					"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
156				],
157				dayOfWeekShort: [
158					"Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
159				],
160				dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"]
161			},
162			th: { // Thai
163				months: [
164					'??????', '??????????', '??????', '??????', '???????', '????????', '???????', '???????', '???????', '??????', '?????????', '???????'
165				],
166				dayOfWeekShort: [
167					'??.', '?.', '?.', '?.', '??.', '?.', '?.'
168				],
169				dayOfWeek: ["???????", "??????", "??????", "???", "?????", "?????", "?????", "???????"]
170			},
171			pl: { // Polish
172				months: [
173					"styczen", "luty", "marzec", "kwiecien", "maj", "czerwiec", "lipiec", "sierpien", "wrzesien", "pazdziernik", "listopad", "grudzien"
174				],
175				dayOfWeekShort: [
176					"nd", "pn", "wt", "sr", "cz", "pt", "sb"
177				],
178				dayOfWeek: ["niedziela", "poniedzialek", "wtorek", "sroda", "czwartek", "piatek", "sobota"]
179			},
180			pt: { // Portuguese
181				months: [
182					"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
183				],
184				dayOfWeekShort: [
185					"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
186				],
187				dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
188			},
189			ch: { // Simplified Chinese
190				months: [
191					"??", "??", "??", "??", "??", "??", "??", "??", "??", "??", "???", "???"
192				],
193				dayOfWeekShort: [
194					"?", "?", "?", "?", "?", "?", "?"
195				]
196			},
197			se: { // Swedish
198				months: [
199					"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September",  "Oktober", "November", "December"
200				],
201				dayOfWeekShort: [
202					"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
203				]
204			},
205			km: { // Khmer (?????????)
206				months: [
207					"?????", "??????", "?????", "?????", "?????", "???????", "???????", "?????", "??????", "?????", "????????", "?????"
208				],
209				dayOfWeekShort: ["?????", "??????", "???????", "????", "??????", "??????", "????"],
210				dayOfWeek: ["????????", "??????", "???????", "????", "???????????", "??????", "????"]
211			},
212			kr: { // Korean
213				months: [
214					"1?", "2?", "3?", "4?", "5?", "6?", "7?", "8?", "9?", "10?", "11?", "12?"
215				],
216				dayOfWeekShort: [
217					"?", "?", "?", "?", "?", "?", "?"
218				],
219				dayOfWeek: ["???", "???", "???", "???", "???", "???", "???"]
220			},
221			it: { // Italian
222				months: [
223					"Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
224				],
225				dayOfWeekShort: [
226					"Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
227				],
228				dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"]
229			},
230			da: { // Dansk
231				months: [
232					"Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "
232November", "December"
233				],
234				dayOfWeekShort: [
235					"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
236				],
237				dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"]
238			},
239			no: { // Norwegian
240				months: [
241					"Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
242				],
243				dayOfWeekShort: [
244					"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
245				],
246				dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag']
247			},
248			ja: { // Japanese
249				months: [
250					"1?", "2?", "3?", "4?", "5?", "6?", "7?", "8?", "9?", "10?", "11?", "12?"
251				],
252				dayOfWeekShort: [
253					"?", "?", "?", "?", "?", "?", "?"
254				],
255				dayOfWeek: ["??", "??", "??", "??", "??", "??", "??"]
256			}, 
257			vi: { // Vietnamese
258				months: [
259					"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"
260				],
261				dayOfWeekShort: [
262					"CN", "T2", "T3", "T4", "T5", "T6", "T7"
263				],
264				dayOfWeek: ["Ch? nh?t", "Th? hai", "Th? ba", "Th? tu", "Th? nam", "Th? sáu", "Th? b?y"]
265			},
266			sl: { // Slovenšcina
267				months: [
268					"Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"
269				],
270				dayOfWeekShort: [
271					"Ned", "Pon", "Tor", "Sre", "Cet", "Pet", "Sob"
272				],
273				dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Cetrtek", "Petek", "Sobota"]
274			},
275			cs: { // Ceština
276				months: [
277					"Leden", "Únor", "Brezen", "Duben", "Kveten", "Cerven", "Cervenec", "Srpen", "Zárí", "Ríjen", "Listopad", "Prosinec"
278				],
279				dayOfWeekShort: [
280					"Ne", "Po", "Út", "St", "Ct", "Pá", "So"
281				]
282			},
283			hu: { // Hungarian
284				months: [
285					"Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
286				],
287				dayOfWeekShort: [
288					"Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
289				],
290				dayOfWeek: ["vasárnap", "hétfo", "kedd", "szerda", "csütörtök", "péntek", "szombat"]
291			},
292			az: { //Azerbaijanian (Azeri)
293				months: [
294					"Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
295				],
296				dayOfWeekShort: [
297					"B", "Be", "Ça", "Ç", "Ca", "C", "S"
298				],
299				dayOfWeek: ["Bazar", "Bazar ert?si", "Ç?rs?nb? axsami", "Ç?rs?nb?", "Cüm? axsami", "Cüm?", "S?nb?"]
300			},
301			bs: { //Bosanski
302				months: [
303					"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
304				],
305				dayOfWeekShort: [
306					"Ned", "Pon", "Uto", "Sri", "Cet", "Pet", "Sub"
307				],
308				dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Cetvrtak", "Petak", "Subota"]
309			},
310			ca: { //Català
311				months: [
312					"Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
313				],
314				dayOfWeekShort: [
315					"Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
316				],
317				dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"]
318			},
319			'en-GB': { //English (British)
320				months: [
321					"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
321November", "December"
322				],
323				dayOfWeekShort: [
324					"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
325				],
326				dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
327			},
328			et: { //"Eesti"
329				months: [
330					"Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
331				],
332				dayOfWeekShort: [
333					"P", "E", "T", "K", "N", "R", "L"
334				],
335				dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"]
336			},
337			eu: { //Euskara
338				months: [
339					"Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
340				],
341				dayOfWeekShort: [
342					"Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
343				],
344				dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata']
345			},
346			fi: { //Finnish (Suomi)
347				months: [
348					"Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
349				],
350				dayOfWeekShort: [
351					"Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
352				],
353				dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"]
354			},
355			gl: { //Galego
356				months: [
357					"Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
358				],
359				dayOfWeekShort: [
360					"Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
361				],
362				dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"]
363			},
364			hr: { //Hrvatski
365				months: [
366					"Sijecanj", "Veljaca", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
367				],
368				dayOfWeekShort: [
369					"Ned", "Pon", "Uto", "Sri", "Cet", "Pet", "Sub"
370				],
371				dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Cetvrtak", "Petak", "Subota"]
372			},
373			ko: { //Korean (???)
374				months: [
375					"1?", "2?", "3?", "4?", "5?", "6?", "7?", "8?", "9?", "10?", "11?", "12?"
376				],
377				dayOfWeekShort: [
378					"?", "?", "?", "?", "?", "?", "?"
379				],
380				dayOfWeek: ["???", "???", "???", "???", "???", "???", "???"]
381			},
382			lt: { //Lithuanian (lietuviu)
383				months: [
384					"Sausio", "Vasario", "Kovo", "Balandžio", "Gegužes", "Birželio", "Liepos", "Rugpjucio", "Rugsejo", "Spalio", "Lapkricio", "Gruodžio"
385				],
386				dayOfWeekShort: [
387					"Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš"
388				],
389				dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Treciadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"]
390			},
391			lv: { //Latvian (Latviešu)
392				months: [
393					"Janvaris", "Februaris", "Marts", "Aprilis ", "Maijs", "Junijs", "Julijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
394				],
395				dayOfWeekShort: [
396					"Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
397				],
398				dayOfWeek: ["Svetdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"]
399			},
400			mk: { //Macedonian (??????????)
401				months: [
402					"???????", "????????", "????", "?????", "???", "????", "????", "??????", "?????????", "????????", "???????", "????????"
403				],
404				dayOfWeekShort: [
405					"???", "???", "???", "???", "???", "???", "???"
406				],
407				dayOfWeek: ["??????", "??????????", "???????", "?????", "????????", "?????", "??????"]
408			},
409			mn: { //Mongolian (??????)
410				months: [
411					"1-? ???", "2-? ???", "3-? ???", "4-? ???", "5-? ???", "6-? ???", "7-? ???", "8-? ???", "9-? ???", "10-? ???", "11-? ???", "12-? ???"
412				],
413				dayOfWeekShort: [
414					"???", "???", "???", "???", "???", "???", "???"
415				],
416				dayOfWeek: ["?????", "??????", "??????", "?????", "??????", "?????", "???"]
417			},
418			'pt-BR': { //Português(Brasil)
419				months: [
420					"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
421				],
422				dayOfWeekShort: [
423					"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"
424				],
425				dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "SÃ
425¡bado"]
426			},
427			sk: { //Slovencina
428				months: [
429					"Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
430				],
431				dayOfWeekShort: [
432					"Ne", "Po", "Ut", "St", "Å t", "Pi", "So"
433				],
434				dayOfWeek: ["Nedela", "Pondelok", "Utorok", "Streda", "Å tvrtok", "Piatok", "Sobota"]
435			},
436			sq: { //Albanian (Shqip)
437				months: [
438					"Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor"
439				],
440				dayOfWeekShort: [
441					"Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu"
442				],
443				dayOfWeek: ["E Diel", "E Hënë", "E Marte", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"]
444			},
445			'sr-YU': { //Serbian (Srpski)
446				months: [
447					"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
448				],
449				dayOfWeekShort: [
450					"Ned", "Pon", "Uto", "Sre", "cet", "Pet", "Sub"
451				],
452				dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Cetvrtak", "Petak", "Subota"]
453			},
454			sr: { //Serbian Cyrillic (??????)
455				months: [
456					"??????", "???????", "????", "?????", "???", "???", "???", "??????", "?????????", "???????", "????????", "????????"
457				],
458				dayOfWeekShort: [
459					"???", "???", "???", "???", "???", "???", "???"
460				],
461				dayOfWeek: ["??????","?????????", "??????", "?????", "????????", "?????", "??????"]
462			},
463			sv: { //Svenska
464				months: [
465					"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
466				],
467				dayOfWeekShort: [
468					"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
469				],
470				dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"]
471			},
472			'zh-TW': { //Traditional Chinese (????)
473				months: [
474					"??", "??", "??", "??", "??", "??", "??", "??", "??", "??", "???", "???"
475				],
476				dayOfWeekShort: [
477					"?", "?", "?", "?", "?", "?", "?"
478				],
479				dayOfWeek: ["???", "???", "???", "???", "???", "???", "???"]
480			},
481			zh: { //Simplified Chinese (????)
482				months: [
483					"??", "??", "??", "??", "??", "??", "??", "??", "??", "??", "???", "???"
484				],
485				dayOfWeekShort: [
486					"?", "?", "?", "?", "?", "?", "?"
487				],
488				dayOfWeek: ["???", "???", "???", "???", "???", "???", "???"]
489			},
490			ug:{ // Uyghur(????????)
491				months: [
492					"1-???","2-???","3-???","4-???","5-???","6-???","7-???","8-???","9-???","10-???","11-???","12-???"
493				],
494				dayOfWeek: [
495					"????????", "???????","????????","????????","????????","????","?????"
496				]
497			},
498			he: { //Hebrew (?????)
499				months: [
500					'?????', '??????', '???', '?????', '???', '????', '????', '??????', '??????', '???????', '??????', '?????'
501				],
502				dayOfWeekShort: [
503					'?\'', '?\'', '?\'', '?\'', '?\'', '?\'', '???'
504				],
505				dayOfWeek: ["?????", "???", "?????", "?????", "?????", "????", "???", "?????"]
506			},
507			hy: { // Armenian
508				months: [
509					"???????", "???????", "????", "?????", "?????", "??????", "??????", "???????", "?????????", "?????????", "????????", "?????????"
510				],
511				dayOfWeekShort: [
512					"??", "???", "???", "???", "???", "????", "???"
513				],
514				dayOfWeek: ["??????", "??????????", "?????????", "??????????", "?????????", "??????", "?????"]
515			},
516			kg: { // Kyrgyz
517				months: [
518					'????? ???', '?????? ???', '?????? ?????', '??? ?????', '????', '?????', '????', '??? ????', '??? ????', '???????? ???', '??????? ???', '?????? ???'
519				],
520				dayOfWeekShort: [
521					"???", "???", "???", "???", "???", "???", "???"
522				],
523				dayOfWeek: [
524					"???????", "???????", "???????", "???????", "????????", "????", "?????"
525				]
526			},
527			rm: { // Romansh
528				months: [
529					"Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "
vendor: 10,880 bytes, lines 529-905
529November", "December"
530				],
531				dayOfWeekShort: [
532					"Du", "Gli", "Ma", "Me", "Gie", "Ve", "So"
533				],
534				dayOfWeek: [
535					"Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda"
536				]
537			},
538			ka: { // Georgian
539				months: [
540					'???????', '?????????', '?????', '??????', '?????', '??????', '??????', '???????', '??????????', '?????????', '????????', '?????????'
541				],
542				dayOfWeekShort: [
543					"??", "???", "????", "???", "???", "???", "???"
544				],
545				dayOfWeek: ["?????", "????????", "?????????", "?????????", "?????????", "?????????", "??????"]
546			}
547		},
548
549		ownerDocument: document,
550		contentWindow: window,
551
552		value: '',
553		rtl: false,
554
555		format:	'Y/m/d H:i',
556		formatTime:	'H:i',
557		formatDate:	'Y/m/d',
558
559		startDate:	false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
560		step: 60,
561		monthChangeSpinner: true,
562
563		closeOnDateSelect: false,
564		closeOnTimeSelect: true,
565		closeOnWithoutClick: true,
566		closeOnInputClick: true,
567		openOnFocus: true,
568
569		timepicker: true,
570		datepicker: true,
571		weeks: false,
572
573		defaultTime: false,	// use formatTime format (ex. '10:00' for formatTime:	'H:i')
574		defaultDate: false,	// use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
575
576		minDate: false,
577		maxDate: false,
578		minTime: false,
579		maxTime: false,
580		minDateTime: false,
581		maxDateTime: false,
582
583		allowTimes: [],
584		opened: false,
585		initTime: true,
586		inline: false,
587		theme: '',
588		touchMovedThreshold: 5,
589
590		onSelectDate: function () {},
591		onSelectTime: function () {},
592		onChangeMonth: function () {},
593		onGetWeekOfYear: function () {},
594		onChangeYear: function () {},
595		onChangeDateTime: function () {},
596		onShow: function () {},
597		onClose: function () {},
598		onGenerate: function () {},
599
600		withoutCopyright: true,
601		inverseButton: false,
602		hours12: false,
603		next: 'xdsoft_next',
604		prev : 'xdsoft_prev',
605		dayOfWeekStart: 0,
606		parentID: 'body',
607		timeHeightInTimePicker: 25,
608		timepickerScrollbar: true,
609		todayButton: true,
610		prevButton: true,
611		nextButton: true,
612		defaultSelect: true,
613
614		scrollMonth: true,
615		scrollTime: true,
616		scrollInput: true,
617
618		lazyInit: false,
619		mask: false,
620		validateOnBlur: true,
621		allowBlank: true,
622		yearStart: 1950,
623		yearEnd: 2050,
624		monthStart: 0,
625		monthEnd: 11,
626		style: '',
627		id: '',
628		fixed: false,
629		roundTime: 'round', // ceil, floor
630		className: '',
631		weekends: [],
632		highlightedDates: [],
633		highlightedPeriods: [],
634		allowDates : [],
635		allowDateRe : null,
636		disabledDates : [],
637		disabledWeekDays: [],
638		yearOffset: 0,
639		beforeShowDay: null,
640
641		enterLikeTab: true,
642		showApplyButton: false
643	};
644
645	var dateHelper = null,
646		defaultDateHelper = null,
647		globalLocaleDefault = 'en',
648		globalLocale = 'en';
649
650	var dateFormatterOptionsDefault = {
651		meridiem: ['AM', 'PM']
652	};
653
654	var initDateFormatter = function(){
655		var locale = default_options.i18n[globalLocale],
656			opts = {
657				days: locale.dayOfWeek,
658				daysShort: locale.dayOfWeekShort,
659				months: locale.months,
660				monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) })
661			};
662
663		if (typeof DateFormatter === 'function') {
664			dateHelper = defaultDateHelper = new DateFormatter({
665				dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
666			});
667		}
668	};
669
670	var dateFormatters = {
671		moment: {
672			default_options:{
673				format: 'YYYY/MM/DD HH:mm',
674				formatDate: 'YYYY/MM/DD',
675				formatTime: 'HH:mm',
676			},
677			formatter: {
678				parseDate: function (date, format) {
679					if(isFormatStandard(format)){
680						return defaultDateHelper.parseDate(date, format);
681					} 
682					var d = moment(date, format);
683					return d.isValid() ? d.toDate() : false;
684				},
685
686				formatDate: function (date, format) {
687					if(isFormatStandard(format)){
688						return defaultDateHelper.formatDate(date, format);
689					} 
690					return moment(date).format(format);
691				},
692
693				formatMask: function(format){
694					return format
695						.replace(/Y{4}/g, '9999')
696						.replace(/Y{2}/g, '99')
697						.replace(/M{2}/g, '19')
698						.replace(/D{2}/g, '39')
699						.replace(/H{2}/g, '29')
700						.replace(/m{2}/g, '59')
701						.replace(/s{2}/g, '59');
702				},
703			}
704		}
705	}
706
707	// for locale settings
708	$.datetimepicker = {
709		setLocale: function(locale){
710			var newLocale = default_options.i18n[locale] ? locale : globalLocaleDefault;
711			if (globalLocale !== newLocale) {
712				globalLocale = newLocale;
713				// reinit date formatter
714				initDateFormatter();
715			}
716		},
717
718		setDateFormatter: function(dateFormatter) {
719			if(typeof dateFormatter === 'string' && dateFormatters.hasOwnProperty(dateFormatter)){
720				var df = dateFormatters[dateFormatter];
721				$.extend(default_options, df.default_options);
722				dateHelper = df.formatter; 
723			}
724			else {
725				dateHelper = dateFormatter;
726			}
727		},
728	};
729
730	var standardFormats = {
731		RFC_2822: 'D, d M Y H:i:s O',
732		ATOM: 'Y-m-d\TH:i:sP',
733		ISO_8601: 'Y-m-d\TH:i:sO',
734		RFC_822: 'D, d M y H:i:s O',
735		RFC_850: 'l, d-M-y H:i:s T',
736		RFC_1036: 'D, d M y H:i:s O',
737		RFC_1123: 'D, d M Y H:i:s O',
738		RSS: 'D, d M Y H:i:s O',
739		W3C: 'Y-m-d\TH:i:sP'
740	}
741
742	var isFormatStandard = function(format){
743		return Object.values(standardFormats).indexOf(format) === -1 ? false : true;
744	}
745
746	$.extend($.datetimepicker, standardFormats);
747
748	// first init date formatter
749	initDateFormatter();
750
751	// fix for ie8
752	if (!window.getComputedStyle) {
753		window.getComputedStyle = function (el) {
754			this.el = el;
755			this.getPropertyValue = function (prop) {
756				var re = /(-([a-z]))/g;
757				if (prop === 'float') {
758					prop = 'styleFloat';
759				}
760				if (re.test(prop)) {
761					prop = prop.replace(re, function (a, b, c) {
762						return c.toUpperCase();
763					});
764				}
765				return el.currentStyle[prop] || null;
766			};
767			return this;
768		};
769	}
770	if (!Array.prototype.indexOf) {
771		Array.prototype.indexOf = function (obj, start) {
772			var i, j;
773			for (i = (start || 0), j = this.length; i < j; i += 1) {
774				if (this[i] === obj) { return i; }
775			}
776			return -1;
777		};
778	}
779
780	Date.prototype.countDaysInMonth = function () {
781		return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
782	};
783
784	$.fn.xdsoftScroller = function (options, percent) {
785		return this.each(function () {
786			var timeboxparent = $(this),
787				pointerEventToXY = function (e) {
788					var out = {x: 0, y: 0},
789						touch;
790					if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
791						touch  = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
792						out.x = touch.clientX;
793						out.y = touch.clientY;
794					} else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
795						out.x = e.clientX;
796						out.y = e.clientY;
797					}
798					return out;
799				},
800				timebox,
801				parentHeight,
802				height,
803				scrollbar,
804				scroller,
805				maximumOffset = 100,
806				start = false,
807				startY = 0,
808				startTop = 0,
809				h1 = 0,
810				touchStart = false,
811				startTopScroll = 0,
812				calcOffset = function () {};
813
814			if (percent === 'hide') {
815				timeboxparent.find('.xdsoft_scrollbar').hide();
816				return;
817			}
818
819			if (!$(this).hasClass('xdsoft_scroller_box')) {
820				timebox = timeboxparent.children().eq(0);
821				parentHeight = timeboxparent[0].clientHeight;
822				height = timebox[0].offsetHeight;
823				scrollbar = $('<div class="xdsoft_scrollbar"></div>');
824				scroller = $('<div class="xdsoft_scroller"></div>');
825				scrollbar.append(scroller);
826
827				timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
828				calcOffset = function calcOffset(event) {
829					var offset = pointerEventToXY(event).y - startY + startTopScroll;
830					if (offset < 0) {
831						offset = 0;
832					}
833					if (offset + scroller[0].offsetHeight > h1) {
834						offset = h1 - scroller[0].offsetHeight;
835					}
836					timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
837				};
838
839				scroller
840					.on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) {
841						if (!parentHeight) {
842							timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
843						}
844
845						startY = pointerEventToXY(event).y;
846						startTopScroll = parseInt(scroller.css('margin-top'), 10);
847						h1 = scrollbar[0].offsetHeight;
848
849						if (event.type === 'mousedown' || event.type === 'touchstart') {
850							if (options.ownerDocument) {
851								$(options.ownerDocument.body).addClass('xdsoft_noselect');
852							}
853							$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
854								$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
855									.off('mousemove.xdsoft_scroller', calcOffset)
856									.removeClass('xdsoft_noselect');
857							});
858							$(options.ownerDocument.body).on('mousemove.xdsoft_scroller', calcOffset);
859						} else {
860							touchStart = true;
861							event.stopPropagation();
862							event.preventDefault();
863						}
864					})
865					.on('touchmove', function (event) {
866						if (touchStart) {
867							event.preventDefault();
868							calcOffset(event);
869						}
870					})
871					.on('touchend touchcancel', function () {
872						touchStart =  false;
873						startTopScroll = 0;
874					});
875
876				timeboxparent
877					.on('scroll_element.xdsoft_scroller', function (event, percentage) {
878						if (!parentHeight) {
879							timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
880						}
881						percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
882
883						scroller.css('margin-top', maximumOffset * percentage);
884
885						setTimeout(function () {
886							timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10));
887						}, 10);
888					})
889					.on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
890						var percent, sh;
891						parentHeight = timeboxparent[0].clientHeight;
892						height = timebox[0].offsetHeight;
893						percent = parentHeight / height;
894						sh = percent * scrollbar[0].offsetHeight;
895						if (percent > 1) {
896							scroller.hide();
897						} else {
898							scroller.show();
899							scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
900							maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
901							if (noTriggerScroll !== true) {
902								timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]);
903							}
904						}
905					});
vendor: 4,323 bytes, lines 906-1033
906
907				timeboxparent.on('mousewheel', function (event) {
908					var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
909
910					top = top - (event.deltaY * 20);
911					if (top < 0) {
912						top = 0;
913					}
914
915					timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]);
916					event.stopPropagation();
917					return false;
918				});
919
920				timeboxparent.on('touchstart', function (event) {
921					start = pointerEventToXY(event);
922					startTop = Math.abs(parseInt(timebox.css('marginTop'), 10));
923				});
924
925				timeboxparent.on('touchmove', function (event) {
926					if (start) {
927						event.preventDefault();
928						var coord = pointerEventToXY(event);
929						timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]);
930					}
931				});
932
933				timeboxparent.on('touchend touchcancel', function () {
934					start = false;
935					startTop = 0;
936				});
937			}
938			timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
939		});
940	};
941
942	$.fn.datetimepicker = function (opt, opt2) {
943		var result = this,
944			KEY0 = 48,
945			KEY9 = 57,
946			_KEY0 = 96,
947			_KEY9 = 105,
948			CTRLKEY = 17,
949			DEL = 46,
950			ENTER = 13,
951			ESC = 27,
952			BACKSPACE = 8,
953			ARROWLEFT = 37,
954			ARROWUP = 38,
955			ARROWRIGHT = 39,
956			ARROWDOWN = 40,
957			TAB = 9,
958			F5 = 116,
959			AKEY = 65,
960			CKEY = 67,
961			VKEY = 86,
962			ZKEY = 90,
963			YKEY = 89,
964			ctrlDown	=	false,
965			options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
966
967			lazyInitTimer = 0,
968			createDateTimePicker,
969			destroyDateTimePicker,
970
971			lazyInit = function (input) {
972				input
973					.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() {
974						if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
975							return;
976						}
977						clearTimeout(lazyInitTimer);
978						lazyInitTimer = setTimeout(function () {
979
980							if (!input.data('xdsoft_datetimepicker')) {
981								createDateTimePicker(input);
982							}
983							input
984								.off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback)
985								.trigger('open.xdsoft');
986						}, 100);
987					});
988			};
989
990		createDateTimePicker = function (input) {
991			var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),
992				xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
993				datepicker = $('<div class="xdsoft_datepicker active"></div>'),
994				month_picker = $('<div class="xdsoft_monthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
995					'<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' +
996					'<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' +
997					'<button type="button" class="xdsoft_next"></button></div>'),
998				calendar = $('<div class="xdsoft_calendar"></div>'),
999				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>'),
1000				timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
1001				timebox = $('<div class="xdsoft_time_variant"></div>'),
1002				applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
1003
1004				monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
1005				yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
1006				triggerAfterOpen = false,
1007				XDSoft_datetime,
1008
1009				xchangeTimer,
1010				timerclick,
1011				current_time_index,
1012				setPos,
1013				timer = 0,
1014				_xdsoft_datetime,
1015				forEachAncestorOf;
1016
1017			if (options.id) {
1018				datetimepicker.attr('id', options.id);
1019			}
1020			if (options.style) {
1021				datetimepicker.attr('style', options.style);
1022			}
1023			if (options.weeks) {
1024				datetimepicker.addClass('xdsoft_showweeks');
1025			}
1026			if (options.rtl) {
1027				datetimepicker.addClass('xdsoft_rtl');
1028			}
1029
1030			datetimepicker.addClass('xdsoft_' + options.theme);
1031			datetimepicker.addClass(options.className);
1032
1033			month_picker
vendor: 10,033 bytes, lines 1034-1302
1034				.find('.xdsoft_month span')
1035				.after(monthselect);
1036			month_picker
1037				.find('.xdsoft_year span')
1038				.after(yearselect);
1039
1040			month_picker
1041				.find('.xdsoft_month,.xdsoft_year')
1042				.on('touchstart mousedown.xdsoft', function (event) {
1043					var select = $(this).find('.xdsoft_select').eq(0),
1044						val = 0,
1045						top = 0,
1046						visible = select.is(':visible'),
1047						items,
1048						i;
1049
1050					month_picker
1051						.find('.xdsoft_select')
1052						.hide();
1053					if (_xdsoft_datetime.currentTime) {
1054						val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
1055					}
1056
1057					select[visible ? 'hide' : 'show']();
1058					for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
1059						if (items.eq(i).data('value') === val) {
1060							break;
1061						} else {
1062							top += items[0].offsetHeight;
1063						}
1064					}
1065
1066					select.xdsoftScroller(options, top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
1067					event.stopPropagation();
1068					return false;
1069				});
1070
1071			var handleTouchMoved = function (event) {
1072				var evt = event.originalEvent;
1073				var touchPosition = evt.touches ? evt.touches[0] : evt;
1074				this.touchStartPosition = this.touchStartPosition || touchPosition;
1075				var xMovement = Math.abs(this.touchStartPosition.clientX - touchPosition.clientX);
1076				var yMovement = Math.abs(this.touchStartPosition.clientY - touchPosition.clientY);
1077				var distance = Math.sqrt(xMovement * xMovement + yMovement * yMovement);
1078				if(distance > options.touchMovedThreshold) {
1079					this.touchMoved = true;
1080				}
1081			}
1082
1083			month_picker
1084				.find('.xdsoft_select')
1085				.xdsoftScroller(options)
1086				.on('touchstart mousedown.xdsoft', function (event) {
1087					var evt = event.originalEvent;
1088					this.touchMoved = false;
1089					this.touchStartPosition = evt.touches ? evt.touches[0] : evt;
1090					event.stopPropagation();
1091					event.preventDefault();
1092				})
1093				.on('touchmove', '.xdsoft_option', handleTouchMoved)
1094				.on('touchend mousedown.xdsoft', '.xdsoft_option', function () {
1095					if (!this.touchMoved) {
1096						if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
1097							_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1098						}
1099
1100						var year = _xdsoft_datetime.currentTime.getFullYear();
1101						if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
1102							_xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
1103						}
1104
1105						$(this).parent().parent().hide();
1106
1107						datetimepicker.trigger('xchange.xdsoft');
1108						if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
1109							options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1110						}
1111
1112						if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
1113							options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1114						}
1115					}
1116				});
1117
1118			datetimepicker.getValue = function () {
1119				return _xdsoft_datetime.getCurrentTime();
1120			};
1121
1122			datetimepicker.setOptions = function (_options) {
1123				var highlightedDates = {};
1124
1125				options = $.extend(true, {}, options, _options);
1126
1127				if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
1128					options.allowTimes = $.extend(true, [], _options.allowTimes);
1129				}
1130
1131				if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) {
1132					options.weekends = $.extend(true, [], _options.weekends);
1133				}
1134
1135				if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) {
1136					options.allowDates = $.extend(true, [], _options.allowDates);
1137				}
1138
1139				if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") {
1140					options.allowDateRe = new RegExp(_options.allowDateRe);
1141				}
1142
1143				if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
1144					$.each(_options.highlightedDates, function (index, value) {
1145						var splitData = $.map(value.split(','), $.trim),
1146							exDesc,
1147							hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
1148							keyDate = dateHelper.formatDate(hDate.date, options.formatDate);
1149						if (highlightedDates[keyDate] !== undefined) {
1150							exDesc = highlightedDates[keyDate].desc;
1151							if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
1152								highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
1153							}
1154						} else {
1155							highlightedDates[keyDate] = hDate;
1156						}
1157					});
1158
1159					options.highlightedDates = $.extend(true, [], highlightedDates);
1160				}
1161
1162				if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
1163					highlightedDates = $.extend(true, [], options.highlightedDates);
1164					$.each(_options.highlightedPeriods, function (index, value) {
1165						var dateTest, // start date
1166							dateEnd,
1167							desc,
1168							hDate,
1169							keyDate,
1170							exDesc,
1171							style;
1172						if ($.isArray(value)) {
1173							dateTest = value[0];
1174							dateEnd = value[1];
1175							desc = value[2];
1176							style = value[3];
1177						}
1178						else {
1179							var splitData = $.map(value.split(','), $.trim);
1180							dateTest = dateHelper.parseDate(splitData[0], options.formatDate);
1181							dateEnd = dateHelper.parseDate(splitData[1], options.formatDate);
1182							desc = splitData[2];
1183							style = splitData[3];
1184						}
1185
1186						while (dateTest <= dateEnd) {
1187							hDate = new HighlightedDate(dateTest, desc, style);
1188							keyDate = dateHelper.formatDate(dateTest, options.formatDate);
1189							dateTest.setDate(dateTest.getDate() + 1);
1190							if (highlightedDates[keyDate] !== undefined) {
1191								exDesc = highlightedDates[keyDate].desc;
1192								if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
1193									highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
1194								}
1195							} else {
1196								highlightedDates[keyDate] = hDate;
1197							}
1198						}
1199					});
1200
1201					options.highlightedDates = $.extend(true, [], highlightedDates);
1202				}
1203
1204				if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
1205					options.disabledDates = $.extend(true, [], _options.disabledDates);
1206				}
1207
1208				if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
1209					options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
1210				}
1211
1212				if ((options.open || options.opened) && (!options.inline)) {
1213					input.trigger('open.xdsoft');
1214				}
1215
1216				if (options.inline) {
1217					triggerAfterOpen = true;
1218					datetimepicker.addClass('xdsoft_inline');
1219					input.after(datetimepicker).hide();
1220				}
1221
1222				if (options.inverseButton) {
1223					options.next = 'xdsoft_prev';
1224					options.prev = 'xdsoft_next';
1225				}
1226
1227				if (options.datepicker) {
1228					datepicker.addClass('active');
1229				} else {
1230					datepicker.removeClass('active');
1231				}
1232
1233				if (options.timepicker) {
1234					timepicker.addClass('active');
1235				} else {
1236					timepicker.removeClass('active');
1237				}
1238
1239				if (options.value) {
1240					_xdsoft_datetime.setCurrentTime(options.value);
1241					if (input && input.val) {
1242						input.val(_xdsoft_datetime.str);
1243					}
1244				}
1245
1246				if (isNaN(options.dayOfWeekStart)) {
1247					options.dayOfWeekStart = 0;
1248				} else {
1249					options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
1250				}
1251
1252				if (!options.timepickerScrollbar) {
1253					timeboxparent.xdsoftScroller(options, 'hide');
1254				}
1255
1256				if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
1257					options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate);
1258				}
1259
1260				if (options.maxDate &&  /^[\+\-](.*)$/.test(options.maxDate)) {
1261					options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate);
1262				}
1263
1264                if (options.minDateTime &&  /^\+(.*)$/.test(options.minDateTime)) {
1265                	options.minDateTime = _xdsoft_datetime.strToDateTime(options.minDateTime).dateFormat(options.formatDate);
1266                }
1267
1268                if (options.maxDateTime &&  /^\+(.*)$/.test(options.maxDateTime)) {
1269                	options.maxDateTime = _xdsoft_datetime.strToDateTime(options.maxDateTime).dateFormat(options.formatDate);
1270                }
1271
1272				applyButton.toggle(options.showApplyButton);
1273
1274				month_picker
1275					.find('.xdsoft_today_button')
1276					.css('visibility', !options.todayButton ? 'hidden' : 'visible');
1277
1278				month_picker
1279					.find('.' + options.prev)
1280					.css('visibility', !options.prevButton ? 'hidden' : 'visible');
1281
1282				month_picker
1283					.find('.' + options.next)
1284					.css('visibility', !options.nextButton ? 'hidden' : 'visible');
1285
1286				setMask(options);
1287
1288				if (options.validateOnBlur) {
1289					input
1290						.off('blur.xdsoft')
1291						.on('blur.xdsoft', function () {
1292							if (options.allowBlank && (!$.trim($(this).val()).length ||
1293									(typeof options.mask === "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) {
1294								$(this).val(null);
1295								datetimepicker.data('xdsoft_datetime').empty();
1296							} else {
1297								var d = dateHelper.parseDate($(this).val(), options.format);
1298								if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time
1299									$(this).val(dateHelper.formatDate(d, options.format));
1300								} else {
1301									var splittedHours   = +([$(this).val()[0], $(this).val()[1]].join('')),
1302										splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
vendor: 4,566 bytes, lines 1303-1460
1303
1304									// parse the numbers as 0312 => 03:12
1305									if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
1306										$(this).val([splittedHours, splittedMinutes].map(function (item) {
1307											return item > 9 ? item : '0' + item;
1308										}).join(':'));
1309									} else {
1310										$(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
1311									}
1312								}
1313								datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1314							}
1315
1316							datetimepicker.trigger('changedatetime.xdsoft');
1317							datetimepicker.trigger('close.xdsoft');
1318						});
1319				}
1320				options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
1321
1322				datetimepicker
1323					.trigger('xchange.xdsoft')
1324					.trigger('afterOpen.xdsoft');
1325			};
1326
1327			datetimepicker
1328				.data('options', options)
1329				.on('touchstart mousedown.xdsoft', function (event) {
1330					event.stopPropagation();
1331					event.preventDefault();
1332					yearselect.hide();
1333					monthselect.hide();
1334					return false;
1335				});
1336
1337			//scroll_element = timepicker.find('.xdsoft_time_box');
1338			timeboxparent.append(timebox);
1339			timeboxparent.xdsoftScroller(options);
1340
1341			datetimepicker.on('afterOpen.xdsoft', function () {
1342				timeboxparent.xdsoftScroller(options);
1343			});
1344
1345			datetimepicker
1346				.append(datepicker)
1347				.append(timepicker);
1348
1349			if (options.withoutCopyright !== true) {
1350				datetimepicker
1351					.append(xdsoft_copyright);
1352			}
1353
1354			datepicker
1355				.append(month_picker)
1356				.append(calendar)
1357				.append(applyButton);
1358
1359			$(options.parentID)
1360				.append(datetimepicker);
1361
1362			XDSoft_datetime = function () {
1363				var _this = this;
1364				_this.now = function (norecursion) {
1365					var d = new Date(),
1366						date,
1367						time;
1368
1369					if (!norecursion && options.defaultDate) {
1370						date = _this.strToDateTime(options.defaultDate);
1371						d.setFullYear(date.getFullYear());
1372						d.setMonth(date.getMonth());
1373						d.setDate(date.getDate());
1374					}
1375
1376					d.setFullYear(d.getFullYear());
1377
1378					if (!norecursion && options.defaultTime) {
1379						time = _this.strtotime(options.defaultTime);
1380						d.setHours(time.getHours());
1381						d.setMinutes(time.getMinutes());
1382						d.setSeconds(time.getSeconds());
1383						d.setMilliseconds(time.getMilliseconds());
1384					}
1385					return d;
1386				};
1387
1388				_this.isValidDate = function (d) {
1389					if (Object.prototype.toString.call(d) !== "[object Date]") {
1390						return false;
1391					}
1392					return !isNaN(d.getTime());
1393				};
1394
1395				_this.setCurrentTime = function (dTime, requireValidDate) {
1396					if (typeof dTime === 'string') {
1397						_this.currentTime = _this.strToDateTime(dTime);
1398					}
1399					else if (_this.isValidDate(dTime)) {
1400						_this.currentTime = dTime;
1401					}
1402					else if (!dTime && !requireValidDate && options.allowBlank && !options.inline) {
1403						_this.currentTime = null;
1404					}
1405					else {
1406						_this.currentTime = _this.now();
1407					}
1408
1409					datetimepicker.trigger('xchange.xdsoft');
1410				};
1411
1412				_this.empty = function () {
1413					_this.currentTime = null;
1414				};
1415
1416				_this.getCurrentTime = function () {
1417					return _this.currentTime;
1418				};
1419
1420				_this.nextMonth = function () {
1421
1422					if (_this.currentTime === undefined || _this.currentTime === null) {
1423						_this.currentTime = _this.now();
1424					}
1425
1426					var month = _this.currentTime.getMonth() + 1,
1427						year;
1428					if (month === 12) {
1429						_this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
1430						month = 0;
1431					}
1432
1433					year = _this.currentTime.getFullYear();
1434
1435					_this.currentTime.setDate(
1436						Math.min(
1437							new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
1438							_this.currentTime.getDate()
1439						)
1440					);
1441					_this.currentTime.setMonth(month);
1442
1443					if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
1444						options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1445					}
1446
1447					if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
1448						options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1449					}
1450
1451					datetimepicker.trigger('xchange.xdsoft');
1452					return month;
1453				};
1454
1455				_this.prevMonth = function () {
1456
1457					if (_this.currentTime === undefined || _this.currentTime === null) {
1458						_this.currentTime = _this.now();
1459					}
1460
vendor: 27,152 bytes, lines 1461-2174
1461					var month = _this.currentTime.getMonth() - 1;
1462					if (month === -1) {
1463						_this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
1464						month = 11;
1465					}
1466					_this.currentTime.setDate(
1467						Math.min(
1468							new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
1469							_this.currentTime.getDate()
1470						)
1471					);
1472					_this.currentTime.setMonth(month);
1473					if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
1474						options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1475					}
1476					datetimepicker.trigger('xchange.xdsoft');
1477					return month;
1478				};
1479
1480				_this.getWeekOfYear = function (datetime) {
1481					if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) {
1482						var week = options.onGetWeekOfYear.call(datetimepicker, datetime);
1483						if (typeof week !== 'undefined') {
1484							return week;
1485						}
1486					}
1487					var onejan = new Date(datetime.getFullYear(), 0, 1);
1488
1489					//First week of the year is th one with the first Thursday according to ISO8601
1490					if (onejan.getDay() !== 4) {
1491						onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7));
1492					}
1493
1494					return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
1495				};
1496
1497				_this.strToDateTime = function (sDateTime) {
1498					var tmpDate = [], timeOffset, currentTime;
1499
1500					if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
1501						return sDateTime;
1502					}
1503
1504					tmpDate = /^([+-]{1})(.*)$/.exec(sDateTime);
1505
1506					if (tmpDate) {
1507						tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate);
1508					}
1509
1510					if (tmpDate  && tmpDate[2]) {
1511						timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
1512						currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
1513					} else {
1514						currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now();
1515					}
1516
1517					if (!_this.isValidDate(currentTime)) {
1518						currentTime = _this.now();
1519					}
1520
1521					return currentTime;
1522				};
1523
1524				_this.strToDate = function (sDate) {
1525					if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
1526						return sDate;
1527					}
1528
1529					var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true);
1530					if (!_this.isValidDate(currentTime)) {
1531						currentTime = _this.now(true);
1532					}
1533					return currentTime;
1534				};
1535
1536				_this.strtotime = function (sTime) {
1537					if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
1538						return sTime;
1539					}
1540					var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true);
1541					if (!_this.isValidDate(currentTime)) {
1542						currentTime = _this.now(true);
1543					}
1544					return currentTime;
1545				};
1546
1547				_this.str = function () {
1548					var format = options.format;
1549					if (options.yearOffset) {
1550						format = format.replace('Y', _this.currentTime.getFullYear() + options.yearOffset);
1551						format = format.replace('y', String(_this.currentTime.getFullYear() + options.yearOffset).substring(2, 4));
1552					}
1553					return dateHelper.formatDate(_this.currentTime, format);
1554				};
1555				_this.currentTime = this.now();
1556			};
1557
1558			_xdsoft_datetime = new XDSoft_datetime();
1559
1560			applyButton.on('touchend click', function (e) {//pathbrite
1561				e.preventDefault();
1562				datetimepicker.data('changed', true);
1563				_xdsoft_datetime.setCurrentTime(getCurrentValue());
1564				input.val(_xdsoft_datetime.str());
1565				datetimepicker.trigger('close.xdsoft');
1566			});
1567			month_picker
1568				.find('.xdsoft_today_button')
1569				.on('touchend mousedown.xdsoft', function () {
1570					datetimepicker.data('changed', true);
1571					_xdsoft_datetime.setCurrentTime(0, true);
1572					datetimepicker.trigger('afterOpen.xdsoft');
1573				}).on('dblclick.xdsoft', function () {
1574				var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
1575				currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
1576				minDate = _xdsoft_datetime.strToDate(options.minDate);
1577				minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
1578				if (currentDate < minDate) {
1579					return;
1580				}
1581				maxDate = _xdsoft_datetime.strToDate(options.maxDate);
1582				maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
1583				if (currentDate > maxDate) {
1584					return;
1585				}
1586				input.val(_xdsoft_datetime.str());
1587				input.trigger('change');
1588				datetimepicker.trigger('close.xdsoft');
1589			});
1590			month_picker
1591				.find('.xdsoft_prev,.xdsoft_next')
1592				.on('touchend mousedown.xdsoft', function () {
1593					var $this = $(this),
1594						timer = 0,
1595						stop = false;
1596
1597					(function arguments_callee1(v) {
1598						if ($this.hasClass(options.next)) {
1599							_xdsoft_datetime.nextMonth();
1600						} else if ($this.hasClass(options.prev)) {
1601							_xdsoft_datetime.prevMonth();
1602						}
1603						if (options.monthChangeSpinner) {
1604							if (!stop) {
1605								timer = setTimeout(arguments_callee1, v || 100);
1606							}
1607						}
1608					}(500));
1609
1610					$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee2() {
1611						clearTimeout(timer);
1612						stop = true;
1613						$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft', arguments_callee2);
1614					});
1615				});
1616
1617			timepicker
1618				.find('.xdsoft_prev,.xdsoft_next')
1619				.on('touchend mousedown.xdsoft', function () {
1620					var $this = $(this),
1621						timer = 0,
1622						stop = false,
1623						period = 110;
1624					(function arguments_callee4(v) {
1625						var pheight = timeboxparent[0].clientHeight,
1626							height = timebox[0].offsetHeight,
1627							top = Math.abs(parseInt(timebox.css('marginTop'), 10));
1628						if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
1629							timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
1630						} else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
1631							timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
1632						}
1633						/**
1634						 * Fixed bug:
1635						 * When using css3 transition, it will cause a bug that you cannot scroll the timepicker list.
1636						 * The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this
1637						 * would cause a bug when you use jquery.css method.
1638						 * Let's say: * { transition: all .5s ease; }
1639						 * jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button,
1640						 * meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the
1641						 * next/prev button.
1642						 *
1643						 * What we should do:
1644						 * Replace timebox.css('marginTop') with timebox[0].style.marginTop.
1645						 */
1646						timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]);
1647						period = (period > 10) ? 10 : period - 10;
1648						if (!stop) {
1649							timer = setTimeout(arguments_callee4, v || period);
1650						}
1651					}(500));
1652					$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee5() {
1653						clearTimeout(timer);
1654						stop = true;
1655						$([options.ownerDocument.body, options.contentWindow])
1656							.off('touchend mouseup.xdsoft', arguments_callee5);
1657					});
1658				});
1659
1660			xchangeTimer = 0;
1661			// base handler - generating a calendar and timepicker
1662			datetimepicker
1663				.on('xchange.xdsoft', function (event) {
1664					clearTimeout(xchangeTimer);
1665					xchangeTimer = setTimeout(function () {
1666
1667						if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
1668							_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1669						}
1670
1671						var table =	'',
1672							start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
1673							i = 0,
1674							j,
1675							today = _xdsoft_datetime.now(),
1676							maxDate = false,
1677							minDate = false,
1678							minDateTime = false,
1679							maxDateTime = false,
1680							hDate,
1681							day,
1682							d,
1683							y,
1684							m,
1685							w,
1686							classes = [],
1687							customDateSettings,
1688							newRow = true,
1689							time = '',
1690							h,
1691							line_time,
1692							description;
1693
1694						while (start.getDay() !== options.dayOfWeekStart) {
1695							start.setDate(start.getDate() - 1);
1696						}
1697
1698						table += '<table><thead><tr>';
1699
1700						if (options.weeks) {
1701							table += '<th></th>';
1702						}
1703
1704						for (j = 0; j < 7; j += 1) {
1705							table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>';
1706						}
1707
1708						table += '</tr></thead>';
1709						table += '<tbody>';
1710
1711						if (options.maxDate !== false) {
1712							maxDate = _xdsoft_datetime.strToDate(options.maxDate);
1713							maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
1714						}
1715
1716						if (options.minDate !== false) {
1717							minDate = _xdsoft_datetime.strToDate(options.minDate);
1718							minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
1719						}
1720
1721                        if (options.minDateTime !== false) {
1722							minDateTime = _xdsoft_datetime.strToDate(options.minDateTime);
1723							minDateTime = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), minDateTime.getHours(), minDateTime.getMinutes(), minDateTime.getSeconds());
1724						}
1725
1726                        if (options.maxDateTime !== false) {
1727							maxDateTime = _xdsoft_datetime.strToDate(options.maxDateTime);
1728							maxDateTime = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), maxDateTime.getHours(), maxDateTime.getMinutes(), maxDateTime.getSeconds());
1729						}
1730
1731						var maxDateTimeDay;
1732						if (maxDateTime !== false) {
1733							maxDateTimeDay = ((maxDateTime.getFullYear() * 12) + maxDateTime.getMonth()) * 31 + maxDateTime.getDate();
1734						}
1735
1736						while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
1737							classes = [];
1738							i += 1;
1739
1740							day = start.getDay();
1741							d = start.getDate();
1742							y = start.getFullYear();
1743							m = start.getMonth();
1744							w = _xdsoft_datetime.getWeekOfYear(start);
1745							description = '';
1746
1747							classes.push('xdsoft_date');
1748
1749							if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) {
1750								customDateSettings = options.beforeShowDay.call(datetimepicker, start);
1751							} else {
1752								customDateSettings = null;
1753							}
1754
1755							if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){
1756								if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){
1757									classes.push('xdsoft_disabled');
1758								}
1759							}
1760							
1761							if(options.allowDates && options.allowDates.length>0){
1762								if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){
1763									classes.push('xdsoft_disabled');
1764								}
1765							}
1766							
1767							var currentDay = ((start.getFullYear() * 12) + start.getMonth()) * 31 + start.getDate();
1768							if ((maxDate !== false && start > maxDate) || (minDateTime !== false && start < minDateTime)  || (minDate !== false && start < minDate) || (maxDateTime !== false && currentDay > maxDateTimeDay) || (customDateSettings && customDateSettings[0] === false)) {
1769								classes.push('xdsoft_disabled');
1770							}
1771							
1772							if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
1773								classes.push('xdsoft_disabled');
1774							}
1775							
1776							if (options.disabledWeekDays.indexOf(day) !== -1) {
1777								classes.push('xdsoft_disabled');
1778							}
1779							
1780							if (input.is('[disabled]')) {
1781								classes.push('xdsoft_disabled');
1782							}
1783
1784							if (customDateSettings && customDateSettings[1] !== "") {
1785								classes.push(customDateSettings[1]);
1786							}
1787
1788							if (_xdsoft_datetime.currentTime.getMonth() !== m) {
1789								classes.push('xdsoft_other_month');
1790							}
1791
1792							if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
1793								classes.push('xdsoft_current');
1794							}
1795
1796							if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
1797								classes.push('xdsoft_today');
1798							}
1799
1800							if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
1801								classes.push('xdsoft_weekend');
1802							}
1803
1804							if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) {
1805								hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)];
1806								classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
1807								description = hDate.desc === undefined ? '' : hDate.desc;
1808							}
1809
1810							if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
1811								classes.push(options.beforeShowDay(start));
1812							}
1813
1814							if (newRow) {
1815								table += '<tr>';
1816								newRow = false;
1817								if (options.weeks) {
1818									table += '<th>' + w + '</th>';
1819								}
1820							}
1821
1822							table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
1823								'<div>' + d + '</div>' +
1824								'</td>';
1825
1826							if (start.getDay() === options.dayOfWeekStartPrev) {
1827								table += '</tr>';
1828								newRow = true;
1829							}
1830
1831							start.setDate(d + 1);
1832						}
1833						table += '</tbody></table>';
1834
1835						calendar.html(table);
1836
1837						month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]);
1838						month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear() + options.yearOffset);
1839
1840						// generate timebox
1841						time = '';
1842						h = '';
1843						m = '';
1844
1845						var minTimeMinutesOfDay = 0;
1846						if (options.minTime !== false) {
1847						    var t = _xdsoft_datetime.strtotime(options.minTime);
1848						    minTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes();
1849						}
1850						var maxTimeMinutesOfDay = 24 * 60;
1851						if (options.maxTime !== false) {
1852						    var t = _xdsoft_datetime.strtotime(options.maxTime);
1853						    maxTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes();
1854						}
1855
1856						if (options.minDateTime !== false) {
1857							var t = _xdsoft_datetime.strToDateTime(options.minDateTime);
1858						        var currentDayIsMinDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate);
1859							if (currentDayIsMinDateTimeDay) {
1860								var m = 60 * t.getHours() + t.getMinutes();
1861								if (m > minTimeMinutesOfDay) minTimeMinutesOfDay = m;
1862							}
1863						}
1864
1865						if (options.maxDateTime !== false) {
1866							var t = _xdsoft_datetime.strToDateTime(options.maxDateTime);
1867						        var currentDayIsMaxDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate);
1868							if (currentDayIsMaxDateTimeDay) {
1869								var m = 60 * t.getHours() + t.getMinutes();
1870								if (m < maxTimeMinutesOfDay) maxTimeMinutesOfDay = m;
1871							}
1872						}
1873
1874						line_time = function line_time(h, m) {
1875							var now = _xdsoft_datetime.now(), current_time,
1876								isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
1877							now.setHours(h);
1878							h = parseInt(now.getHours(), 10);
1879							now.setMinutes(m);
1880							m = parseInt(now.getMinutes(), 10);
1881							classes = [];
1882							var currentMinutesOfDay = 60 * h + m;
1883							if (input.is('[disabled]') || (currentMinutesOfDay >= maxTimeMinutesOfDay) || (currentMinutesOfDay < minTimeMinutesOfDay)) {
1884								classes.push('xdsoft_disabled');
1885							}
1886
1887							current_time = new Date(_xdsoft_datetime.currentTime);
1888							current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
1889
1890							if (!isALlowTimesInit) {
1891								current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
1892							}
1893
1894							if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
1895								if (options.defaultSelect || datetimepicker.data('changed')) {
1896									classes.push('xdsoft_current');
1897								} else if (options.initTime) {
1898									classes.push('xdsoft_init_time');
1899								}
1900							}
1901							if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
1902								classes.push('xdsoft_today');
1903							}
1904							time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>';
1905						};
1906
1907						if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
1908							for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) {
1909								for (j = 0; j < 60; j += options.step) {
1910								        var currentMinutesOfDay = i * 60 + j;
1911								        if (currentMinutesOfDay < minTimeMinutesOfDay) continue;
1912								        if (currentMinutesOfDay >= maxTimeMinutesOfDay) continue;
1913									h = (i < 10 ? '0' : '') + i;
1914									m = (j < 10 ? '0' : '') + j;
1915									line_time(h, m);
1916								}
1917							}
1918						} else {
1919							for (i = 0; i < options.allowTimes.length; i += 1) {
1920								h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
1921								m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
1922								line_time(h, m);
1923							}
1924						}
1925
1926						timebox.html(time);
1927
1928						opt = '';
1929
1930						for (i = parseInt(options.yearStart, 10); i <= parseInt(options.yearEnd, 10); i += 1) {
1931							opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + (i + options.yearOffset) + '</div>';
1932						}
1933						yearselect.children().eq(0)
1934							.html(opt);
1935
1936						for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
1937							opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>';
1938						}
1939						monthselect.children().eq(0).html(opt);
1940						$(datetimepicker)
1941							.trigger('generate.xdsoft');
1942					}, 10);
1943					event.stopPropagation();
1944				})
1945				.on('afterOpen.xdsoft', function () {
1946					if (options.timepicker) {
1947						var classType, pheight, height, top;
1948						if (timebox.find('.xdsoft_current').length) {
1949							classType = '.xdsoft_current';
1950						} else if (timebox.find('.xdsoft_init_time').length) {
1951							classType = '.xdsoft_init_time';
1952						}
1953						if (classType) {
1954							pheight = timeboxparent[0].clientHeight;
1955							height = timebox[0].offsetHeight;
1956							top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
1957							if ((height - pheight) < top) {
1958								top = height - pheight;
1959							}
1960							timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
1961						} else {
1962							timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
1963						}
1964					}
1965				});
1966
1967			timerclick = 0;
1968			calendar
1969				.on('touchend click.xdsoft', 'td', function (xdevent) {
1970					xdevent.stopPropagation();  // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
1971					timerclick += 1;
1972					var $this = $(this),
1973						currentTime = _xdsoft_datetime.currentTime;
1974
1975					if (currentTime === undefined || currentTime === null) {
1976						_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1977						currentTime = _xdsoft_datetime.currentTime;
1978					}
1979
1980					if ($this.hasClass('xdsoft_disabled')) {
1981						return false;
1982					}
1983
1984					currentTime.setDate(1);
1985					currentTime.setFullYear($this.data('year'));
1986					currentTime.setMonth($this.data('month'));
1987					currentTime.setDate($this.data('date'));
1988
1989					datetimepicker.trigger('select.xdsoft', [currentTime]);
1990
1991					input.val(_xdsoft_datetime.str());
1992
1993					if (options.onSelectDate &&	$.isFunction(options.onSelectDate)) {
1994						options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
1995					}
1996
1997					datetimepicker.data('changed', true);
1998					datetimepicker.trigger('xchange.xdsoft');
1999					datetimepicker.trigger('changedatetime.xdsoft');
2000					if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
2001						datetimepicker.trigger('close.xdsoft');
2002					}
2003					setTimeout(function () {
2004						timerclick = 0;
2005					}, 200);
2006				});
2007
2008			timebox
2009				.on('touchstart', 'div', function (xdevent) {
2010					this.touchMoved = false;
2011				})
2012				.on('touchmove', 'div', handleTouchMoved)
2013				.on('touchend click.xdsoft', 'div', function (xdevent) {
2014					if (!this.touchMoved) {
2015						xdevent.stopPropagation();
2016						var $this = $(this),
2017							currentTime = _xdsoft_datetime.currentTime;
2018
2019						if (currentTime === undefined || currentTime === null) {
2020							_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
2021							currentTime = _xdsoft_datetime.currentTime;
2022						}
2023
2024						if ($this.hasClass('xdsoft_disabled')) {
2025							return false;
2026						}
2027						currentTime.setHours($this.data('hour'));
2028						currentTime.setMinutes($this.data('minute'));
2029						datetimepicker.trigger('select.xdsoft', [currentTime]);
2030
2031						datetimepicker.data('input').val(_xdsoft_datetime.str());
2032
2033						if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
2034							options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
2035						}
2036						datetimepicker.data('changed', true);
2037						datetimepicker.trigger('xchange.xdsoft');
2038						datetimepicker.trigger('changedatetime.xdsoft');
2039						if (options.inline !== true && options.closeOnTimeSelect === true) {
2040							datetimepicker.trigger('close.xdsoft');
2041						}
2042					}
2043				});
2044
2045			datepicker
2046				.on('mousewheel.xdsoft', function (event) {
2047					if (!options.scrollMonth) {
2048						return true;
2049					}
2050					if (event.deltaY < 0) {
2051						_xdsoft_datetime.nextMonth();
2052					} else {
2053						_xdsoft_datetime.prevMonth();
2054					}
2055					return false;
2056				});
2057
2058			input
2059				.on('mousewheel.xdsoft', function (event) {
2060					if (!options.scrollInput) {
2061						return true;
2062					}
2063					if (!options.datepicker && options.timepicker) {
2064						current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
2065						if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) {
2066							current_time_index += event.deltaY;
2067						}
2068						if (timebox.children().eq(current_time_index).length) {
2069							timebox.children().eq(current_time_index).trigger('mousedown');
2070						}
2071						return false;
2072					}
2073					if (options.datepicker && !options.timepicker) {
2074						datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]);
2075						if (input.val) {
2076							input.val(_xdsoft_datetime.str());
2077						}
2078						datetimepicker.trigger('changedatetime.xdsoft');
2079						return false;
2080					}
2081				});
2082
2083			datetimepicker
2084				.on('changedatetime.xdsoft', function (event) {
2085					if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) {
2086						var $input = datetimepicker.data('input');
2087						options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
2088						delete options.value;
2089						$input.trigger('change');
2090					}
2091				})
2092				.on('generate.xdsoft', function () {
2093					if (options.onGenerate && $.isFunction(options.onGenerate)) {
2094						options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
2095					}
2096					if (triggerAfterOpen) {
2097						datetimepicker.trigger('afterOpen.xdsoft');
2098						triggerAfterOpen = false;
2099					}
2100				})
2101				.on('click.xdsoft', function (xdevent) {
2102					xdevent.stopPropagation();
2103				});
2104
2105			current_time_index = 0;
2106
2107			/**
2108			 * Runs the callback for each of the specified node's ancestors.
2109			 *
2110			 * Return FALSE from the callback to stop ascending.
2111			 *
2112			 * @param {DOMNode} node
2113			 * @param {Function} callback
2114			 * @returns {undefined}
2115			 */
2116			forEachAncestorOf = function (node, callback) {
2117				do {
2118					node = node.parentNode;
2119
2120					if (!node || callback(node) === false) {
2121						break;
2122					}
2123				} while (node.nodeName !== 'HTML');
2124			};
2125
2126			/**
2127			 * Sets the position of the picker.
2128			 *
2129			 * @returns {undefined}
2130			 */
2131			setPos = function () {
2132				var dateInputOffset,
2133					dateInputElem,
2134					verticalPosition,
2135					left,
2136					position,
2137					datetimepickerElem,
2138					dateInputHasFixedAncestor,
2139					$dateInput,
2140					windowWidth,
2141					verticalAnchorEdge,
2142					datetimepickerCss,
2143					windowHeight,
2144					windowScrollTop;
2145
2146				$dateInput = datetimepicker.data('input');
2147				dateInputOffset = $dateInput.offset();
2148				dateInputElem = $dateInput[0];
2149
2150				verticalAnchorEdge = 'top';
2151				verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1;
2152				left = dateInputOffset.left;
2153				position = "absolute";
2154
2155				windowWidth = $(options.contentWindow).width();
2156				windowHeight = $(options.contentWindow).height();
2157				windowScrollTop = $(options.contentWindow).scrollTop();
2158
2159				if ((options.ownerDocument.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) {
2160					var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth;
2161					left = left - diff;
2162				}
2163
2164				if ($dateInput.parent().css('direction') === 'rtl') {
2165					left -= (datetimepicker.outerWidth() - $dateInput.outerWidth());
2166				}
2167
2168				if (options.fixed) {
2169					verticalPosition -= windowScrollTop;
2170					left -= $(options.contentWindow).scrollLeft();
2171					position = "fixed";
2172				} else {
2173					dateInputHasFixedAncestor = false;
2174
vendor: 3,243 bytes, lines 2175-2265
2175					forEachAncestorOf(dateInputElem, function (ancestorNode) {
2176						if (ancestorNode === null) {
2177							return false;
2178						}
2179
2180						if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
2181							dateInputHasFixedAncestor = true;
2182							return false;
2183						}
2184					});
2185
2186					if (dateInputHasFixedAncestor) {
2187						position = 'fixed';
2188
2189						//If the picker won't fit entirely within the viewport then display it above the date input.
2190						if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) {
2191							verticalAnchorEdge = 'bottom';
2192							verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top;
2193						} else {
2194							verticalPosition -= windowScrollTop;
2195						}
2196					} else {
2197						if (verticalPosition + datetimepicker[0].offsetHeight > windowHeight + windowScrollTop) {
2198							verticalPosition = dateInputOffset.top - datetimepicker[0].offsetHeight + 1;
2199						}
2200					}
2201
2202					if (verticalPosition < 0) {
2203						verticalPosition = 0;
2204					}
2205
2206					if (left + dateInputElem.offsetWidth > windowWidth) {
2207						left = windowWidth - dateInputElem.offsetWidth;
2208					}
2209				}
2210
2211				datetimepickerElem = datetimepicker[0];
2212
2213				forEachAncestorOf(datetimepickerElem, function (ancestorNode) {
2214					var ancestorNodePosition;
2215
2216					ancestorNodePosition = options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position');
2217
2218					if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) {
2219						left = left - ((windowWidth - ancestorNode.offsetWidth) / 2);
2220						return false;
2221					}
2222				});
2223
2224				datetimepickerCss = {
2225					position: position,
2226					left: left,
2227					top: '',  //Initialize to prevent previous values interfering with new ones.
2228					bottom: ''  //Initialize to prevent previous values interfering with new ones.
2229				};
2230
2231				datetimepickerCss[verticalAnchorEdge] = verticalPosition;
2232
2233				datetimepicker.css(datetimepickerCss);
2234			};
2235
2236			datetimepicker
2237				.on('open.xdsoft', function (event) {
2238					var onShow = true;
2239					if (options.onShow && $.isFunction(options.onShow)) {
2240						onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
2241					}
2242					if (onShow !== false) {
2243						datetimepicker.show();
2244						setPos();
2245						$(options.contentWindow)
2246							.off('resize.xdsoft', setPos)
2247							.on('resize.xdsoft', setPos);
2248
2249						if (options.closeOnWithoutClick) {
2250							$([options.ownerDocument.body, options.contentWindow]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
2251								datetimepicker.trigger('close.xdsoft');
2252								$([options.ownerDocument.body, options.contentWindow]).off('touchstart mousedown.xdsoft', arguments_callee6);
2253							});
2254						}
2255					}
2256				})
2257				.on('close.xdsoft', function (event) {
2258					var onClose = true;
2259					month_picker
2260						.find('.xdsoft_month,.xdsoft_year')
2261						.find('.xdsoft_select')
2262						.hide();
2263					if (options.onClose && $.isFunction(options.onClose)) {
2264						onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
2265					}
vendor: 20,103 bytes, lines 2266-2855
2266					if (onClose !== false && !options.opened && !options.inline) {
2267						datetimepicker.hide();
2268					}
2269					event.stopPropagation();
2270				})
2271				.on('toggle.xdsoft', function () {
2272					if (datetimepicker.is(':visible')) {
2273						datetimepicker.trigger('close.xdsoft');
2274					} else {
2275						datetimepicker.trigger('open.xdsoft');
2276					}
2277				})
2278				.data('input', input);
2279
2280			timer = 0;
2281
2282			datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
2283			datetimepicker.setOptions(options);
2284
2285			function getCurrentValue() {
2286				var ct = false, time;
2287
2288				if (options.startDate) {
2289					ct = _xdsoft_datetime.strToDate(options.startDate);
2290				} else {
2291					ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
2292					if (ct) {
2293						ct = _xdsoft_datetime.strToDateTime(ct);
2294						if (options.yearOffset) {
2295							ct = new Date(ct.getFullYear() - options.yearOffset, ct.getMonth(), ct.getDate(), ct.getHours(), ct.getMinutes(), ct.getSeconds(), ct.getMilliseconds());
2296						}
2297					} else if (options.defaultDate) {
2298						ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
2299						if (options.defaultTime) {
2300							time = _xdsoft_datetime.strtotime(options.defaultTime);
2301							ct.setHours(time.getHours());
2302							ct.setMinutes(time.getMinutes());
2303						}
2304					}
2305				}
2306
2307				if (ct && _xdsoft_datetime.isValidDate(ct)) {
2308					datetimepicker.data('changed', true);
2309				} else {
2310					ct = '';
2311				}
2312
2313				return ct || 0;
2314			}
2315
2316			function setMask(options) {
2317
2318				var isValidValue = function (mask, value) {
2319						var reg = mask
2320							.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
2321							.replace(/_/g, '{digit+}')
2322							.replace(/([0-9]{1})/g, '{digit$1}')
2323							.replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
2324							.replace(/\{digit[\+]\}/g, '[0-9_]{1}');
2325						return (new RegExp(reg)).test(value);
2326					},
2327					getCaretPos = function (input) {
2328						try {
2329							if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) {
2330								var range = options.ownerDocument.selection.createRange();
2331								return range.getBookmark().charCodeAt(2) - 2;
2332							}
2333							if (input.setSelectionRange) {
2334								return input.selectionStart;
2335							}
2336						} catch (e) {
2337							return 0;
2338						}
2339					},
2340					setCaretPos = function (node, pos) {
2341						node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node;
2342						if (!node) {
2343							return false;
2344						}
2345						if (node.createTextRange) {
2346							var textRange = node.createTextRange();
2347							textRange.collapse(true);
2348							textRange.moveEnd('character', pos);
2349							textRange.moveStart('character', pos);
2350							textRange.select();
2351							return true;
2352						}
2353						if (node.setSelectionRange) {
2354							node.setSelectionRange(pos, pos);
2355							return true;
2356						}
2357						return false;
2358					};
2359
2360				if(options.mask) {
2361					input.off('keydown.xdsoft');
2362				}
2363
2364				if (options.mask === true) {
2365					if (dateHelper.formatMask) {
2366						options.mask = dateHelper.formatMask(options.format)
2367					} else {
2368						options.mask = options.format
2369							.replace(/Y/g, '9999')
2370							.replace(/F/g, '9999')
2371							.replace(/m/g, '19')
2372							.replace(/d/g, '39')
2373							.replace(/H/g, '29')
2374							.replace(/i/g, '59')
2375							.replace(/s/g, '59');
2376					}
2377				}
2378
2379				if ($.type(options.mask) === 'string') {
2380					if (!isValidValue(options.mask, input.val())) {
2381						input.val(options.mask.replace(/[0-9]/g, '_'));
2382						setCaretPos(input[0], 0);
2383					}
2384
2385					input.on('paste.xdsoft', function (event) {
2386					    // couple options here
2387					    // 1. return false - tell them they can't paste
2388					    // 2. insert over current characters - minimal validation
2389					    // 3. full fledged parsing and validation
2390					    // let's go option 2 for now
2391
2392					    // fires multiple times for some reason
2393
2394					    // https://stackoverflow.com/a/30496488/1366033
2395					    var clipboardData = event.clipboardData || event.originalEvent.clipboardData || window.clipboardData,
2396						pastedData = clipboardData.getData('text'),
2397						val = this.value,
2398						pos = this.selectionStart
2399
2400					    var valueBeforeCursor = val.substr(0, pos);
2401					    var valueAfterPaste = val.substr(pos + pastedData.length);
2402
2403					    val = valueBeforeCursor + pastedData + valueAfterPaste;           
2404					    pos += pastedData.length;
2405
2406					    if (isValidValue(options.mask, val)) {
2407						this.value = val;
2408						setCaretPos(this, pos);
2409					    } else if ($.trim(val) === '') {
2410						this.value = options.mask.replace(/[0-9]/g, '_');
2411					    } else {
2412						input.trigger('error_input.xdsoft');
2413					    }
2414
2415					    event.preventDefault();
2416					    return false;
2417					  });
2418
2419					  input.on('keydown.xdsoft', function (event) {
2420					    var val = this.value,
2421						key = event.which,
2422						pos = this.selectionStart,
2423						selEnd = this.selectionEnd,
2424						hasSel = pos !== selEnd,
2425						digit;
2426
2427					    // only alow these characters
2428					    if (((key >=  KEY0 && key <=  KEY9)  ||
2429						 (key >= _KEY0 && key <= _KEY9)) || 
2430						 (key === BACKSPACE || key === DEL)) {
2431
2432					      // get char to insert which is new character or placeholder ('_')
2433					      digit = (key === BACKSPACE || key === DEL) ? '_' :
2434							  String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key);
2435
2436						// we're deleting something, we're not at the start, and have normal cursor, move back one
2437						// if we have a selection length, cursor actually sits behind deletable char, not in front
2438						if (key === BACKSPACE && pos && !hasSel) {
2439						    pos -= 1;
2440						}
2441
2442						// don't stop on a separator, continue whatever direction you were going
2443						//   value char - keep incrementing position while on separator char and we still have room
2444						//   del char   - keep decrementing position while on separator char and we still have room
2445						while (true) {
2446						  var maskValueAtCurPos = options.mask.substr(pos, 1);
2447						  var posShorterThanMaskLength = pos < options.mask.length;
2448						  var posGreaterThanZero = pos > 0;
2449						  var notNumberOrPlaceholder = /[^0-9_]/;
2450						  var curPosOnSep = notNumberOrPlaceholder.test(maskValueAtCurPos);
2451						  var continueMovingPosition = curPosOnSep && posShorterThanMaskLength && posGreaterThanZero
2452
2453						  // if we hit a real char, stay where we are
2454						  if (!continueMovingPosition) break;
2455
2456						  // hitting backspace in a selection, you can possibly go back any further - go forward
2457						  pos += (key === BACKSPACE && !hasSel) ? -1 : 1;
2458
2459						}
2460
2461
2462						if (hasSel) {
2463						  // pos might have moved so re-calc length
2464						  var selLength = selEnd - pos
2465
2466						  // if we have a selection length we will wipe out entire selection and replace with default template for that range
2467						  var defaultBlank = options.mask.replace(/[0-9]/g, '_');
2468						  var defaultBlankSelectionReplacement = defaultBlank.substr(pos, selLength); 
2469						  var selReplacementRemainder = defaultBlankSelectionReplacement.substr(1) // might be empty
2470
2471						  var valueBeforeSel = val.substr(0, pos);
2472						  var insertChars = digit + selReplacementRemainder;
2473						  var charsAfterSelection = val.substr(pos + selLength);
2474
2475						  val = valueBeforeSel + insertChars + charsAfterSelection
2476
2477						} else {
2478						  var valueBeforeCursor = val.substr(0, pos);
2479						  var insertChar = digit;
2480						  var valueAfterNextChar = val.substr(pos + 1);
2481
2482						  val = valueBeforeCursor + insertChar + valueAfterNextChar
2483						}
2484
2485						if ($.trim(val) === '') {
2486						  // if empty, set to default
2487						    val = defaultBlank
2488						} else {
2489						  // if at the last character don't need to do anything
2490						    if (pos === options.mask.length) {
2491							event.preventDefault();
2492							return false;
2493						    }
2494						}
2495
2496						// resume cursor location
2497						pos += (key === BACKSPACE) ? 0 : 1;
2498						// don't stop on a separator, continue whatever direction you were going
2499						while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
2500						    pos += (key === BACKSPACE) ? 0 : 1;
2501						}
2502
2503						if (isValidValue(options.mask, val)) {
2504						    this.value = val;
2505						    setCaretPos(this, pos);
2506						} else if ($.trim(val) === '') {
2507						    this.value = options.mask.replace(/[0-9]/g, '_');
2508						} else {
2509						    input.trigger('error_input.xdsoft');
2510						}
2511					    } else {
2512						if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
2513						    return true;
2514						}
2515					    }
2516
2517					    event.preventDefault();
2518					    return false;
2519					  });
2520				}
2521			}
2522
2523			_xdsoft_datetime.setCurrentTime(getCurrentValue());
2524
2525			input
2526				.data('xdsoft_datetimepicker', datetimepicker)
2527				.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () {
2528					if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
2529						return;
2530					}
2531					if (!options.openOnFocus) {
2532						return;
2533					}
2534					clearTimeout(timer);
2535					timer = setTimeout(function () {
2536						if (input.is(':disabled')) {
2537							return;
2538						}
2539
2540						triggerAfterOpen = true;
2541						_xdsoft_datetime.setCurrentTime(getCurrentValue(), true);
2542						if(options.mask) {
2543							setMask(options);
2544						}
2545						datetimepicker.trigger('open.xdsoft');
2546					}, 100);
2547				})
2548				.on('keydown.xdsoft', function (event) {
2549					var elementSelector,
2550						key = event.which;
2551					if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
2552						elementSelector = $("input:visible,textarea:visible,button:visible,a:visible");
2553						datetimepicker.trigger('close.xdsoft');
2554						elementSelector.eq(elementSelector.index(this) + 1).focus();
2555						return false;
2556					}
2557					if ([TAB].indexOf(key) !== -1) {
2558						datetimepicker.trigger('close.xdsoft');
2559						return true;
2560					}
2561				})
2562				.on('blur.xdsoft', function () {
2563					datetimepicker.trigger('close.xdsoft');
2564				});
2565		};
2566		destroyDateTimePicker = function (input) {
2567			var datetimepicker = input.data('xdsoft_datetimepicker');
2568			if (datetimepicker) {
2569				datetimepicker.data('xdsoft_datetime', null);
2570				datetimepicker.remove();
2571				input
2572					.data('xdsoft_datetimepicker', null)
2573					.off('.xdsoft');
2574				$(options.contentWindow).off('resize.xdsoft');
2575				$([options.contentWindow, options.ownerDocument.body]).off('mousedown.xdsoft touchstart');
2576				if (input.unmousewheel) {
2577					input.unmousewheel();
2578				}
2579			}
2580		};
2581		$(options.ownerDocument)
2582			.off('keydown.xdsoftctrl keyup.xdsoftctrl')
2583			.on('keydown.xdsoftctrl', function (e) {
2584				if (e.keyCode === CTRLKEY) {
2585					ctrlDown = true;
2586				}
2587			})
2588			.on('keyup.xdsoftctrl', function (e) {
2589				if (e.keyCode === CTRLKEY) {
2590					ctrlDown = false;
2591				}
2592			});
2593
2594		this.each(function () {
2595			var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
2596			if (datetimepicker) {
2597				if ($.type(opt) === 'string') {
2598					switch (opt) {
2599						case 'show':
2600							$(this).select().focus();
2601							datetimepicker.trigger('open.xdsoft');
2602							break;
2603						case 'hide':
2604							datetimepicker.trigger('close.xdsoft');
2605							break;
2606						case 'toggle':
2607							datetimepicker.trigger('toggle.xdsoft');
2608							break;
2609						case 'destroy':
2610							destroyDateTimePicker($(this));
2611							break;
2612						case 'reset':
2613							this.value = this.defaultValue;
2614							if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) {
2615								datetimepicker.data('changed', false);
2616							}
2617							datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
2618							break;
2619						case 'validate':
2620							$input = datetimepicker.data('input');
2621							$input.trigger('blur.xdsoft');
2622							break;
2623						default:
2624							if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) {
2625								result = datetimepicker[opt](opt2);
2626							}
2627					}
2628				} else {
2629					datetimepicker
2630						.setOptions(opt);
2631				}
2632				return 0;
2633			}
2634			if ($.type(opt) !== 'string') {
2635				if (!options.lazyInit || options.open || options.inline) {
2636					createDateTimePicker($(this));
2637				} else {
2638					lazyInit($(this));
2639				}
2640			}
2641		});
2642
2643		return result;
2644	};
2645
2646	$.fn.datetimepicker.defaults = default_options;
2647
2648	function HighlightedDate(date, desc, style) {
2649		"use strict";
2650		this.date = date;
2651		this.desc = desc;
2652		this.style = style;
2653	}
2654};
2655;(function (factory) {
2656	if ( typeof define === 'function' && define.amd ) {
2657		// AMD. Register as an anonymous module.
2658		define(['jquery', 'jquery-mousewheel'], factory);
2659	} else if (typeof exports === 'object') {
2660		// Node/CommonJS style for Browserify
2661		module.exports = factory(require('jquery'));;
2662	} else {
2663		// Browser globals
2664		factory(jQuery);
2665	}
2666}(datetimepickerFactory));
2667
2668
2669/*!
2670 * jQuery Mousewheel 3.1.13
2671 *
2672 * Copyright jQuery Foundation and other contributors
2673 * Released under the MIT license
2674 * http://jquery.org/license
2675 */
2676
2677(function (factory) {
2678    if ( typeof define === 'function' && define.amd ) {
2679        // AMD. Register as an anonymous module.
2680        define(['jquery'], factory);
2681    } else if (typeof exports === 'object') {
2682        // Node/CommonJS style for Browserify
2683        module.exports = factory;
2684    } else {
2685        // Browser globals
2686        factory(jQuery);
2687    }
2688}(function ($) {
2689
2690    var toFix  = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
2691        toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
2692                    ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
2693        slice  = Array.prototype.slice,
2694        nullLowestDeltaTimeout, lowestDelta;
2695
2696    if ( $.event.fixHooks ) {
2697        for ( var i = toFix.length; i; ) {
2698            $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
2699        }
2700    }
2701
2702    var special = $.event.special.mousewheel = {
2703        version: '3.1.12',
2704
2705        setup: function() {
2706            if ( this.addEventListener ) {
2707                for ( var i = toBind.length; i; ) {
2708                    this.addEventListener( toBind[--i], handler, false );
2709                }
2710            } else {
2711                this.onmousewheel = handler;
2712            }
2713            // Store the line height and page height for this particular element
2714            $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
2715            $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
2716        },
2717
2718        teardown: function() {
2719            if ( this.removeEventListener ) {
2720                for ( var i = toBind.length; i; ) {
2721                    this.removeEventListener( toBind[--i], handler, false );
2722                }
2723            } else {
2724                this.onmousewheel = null;
2725            }
2726            // Clean up the data we added to the element
2727            $.removeData(this, 'mousewheel-line-height');
2728            $.removeData(this, 'mousewheel-page-height');
2729        },
2730
2731        getLineHeight: function(elem) {
2732            var $elem = $(elem),
2733                $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
2734            if (!$parent.length) {
2735                $parent = $('body');
2736            }
2737            return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
2738        },
2739
2740        getPageHeight: function(elem) {
2741            return $(elem).height();
2742        },
2743
2744        settings: {
2745            adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
2746            normalizeOffset: true  // calls getBoundingClientRect for each event
2747        }
2748    };
2749
2750    $.fn.extend({
2751        mousewheel: function(fn) {
2752            return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
2753        },
2754
2755        unmousewheel: function(fn) {
2756            return this.unbind('mousewheel', fn);
2757        }
2758    });
2759
2760
2761    function handler(event) {
2762        var orgEvent   = event || window.event,
2763            args       = slice.call(arguments, 1),
2764            delta      = 0,
2765            deltaX     = 0,
2766            deltaY     = 0,
2767            absDelta   = 0,
2768            offsetX    = 0,
2769            offsetY    = 0;
2770        event = $.event.fix(orgEvent);
2771        event.type = 'mousewheel';
2772
2773        // Old school scrollwheel delta
2774        if ( 'detail'      in orgEvent ) { deltaY = orgEvent.detail * -1;      }
2775        if ( 'wheelDelta'  in orgEvent ) { deltaY = orgEvent.wheelDelta;       }
2776        if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY;      }
2777        if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
2778
2779        // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
2780        if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
2781            deltaX = deltaY * -1;
2782            deltaY = 0;
2783        }
2784
2785        // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
2786        delta = deltaY === 0 ? deltaX : deltaY;
2787
2788        // New school wheel delta (wheel event)
2789        if ( 'deltaY' in orgEvent ) {
2790            deltaY = orgEvent.deltaY * -1;
2791            delta  = deltaY;
2792        }
2793        if ( 'deltaX' in orgEvent ) {
2794            deltaX = orgEvent.deltaX;
2795            if ( deltaY === 0 ) { delta  = deltaX * -1; }
2796        }
2797
2798        // No change actually happened, no reason to go any further
2799        if ( deltaY === 0 && deltaX === 0 ) { return; }
2800
2801        // Need to convert lines and pages to pixels if we aren't already in pixels
2802        // There are three delta modes:
2803        //   * deltaMode 0 is by pixels, nothing to do
2804        //   * deltaMode 1 is by lines
2805        //   * deltaMode 2 is by pages
2806        if ( orgEvent.deltaMode === 1 ) {
2807            var lineHeight = $.data(this, 'mousewheel-line-height');
2808            delta  *= lineHeight;
2809            deltaY *= lineHeight;
2810            deltaX *= lineHeight;
2811        } else if ( orgEvent.deltaMode === 2 ) {
2812            var pageHeight = $.data(this, 'mousewheel-page-height');
2813            delta  *= pageHeight;
2814            deltaY *= pageHeight;
2815            deltaX *= pageHeight;
2816        }
2817
2818        // Store lowest absolute delta to normalize the delta values
2819        absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
2820
2821        if ( !lowestDelta || absDelta < lowestDelta ) {
2822            lowestDelta = absDelta;
2823
2824            // Adjust older deltas if necessary
2825            if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
2826                lowestDelta /= 40;
2827            }
2828        }
2829
2830        // Adjust older deltas if necessary
2831        if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
2832            // Divide all the things by 40!
2833            delta  /= 40;
2834            deltaX /= 40;
2835            deltaY /= 40;
2836        }
2837
2838        // Get a whole, normalized value for the deltas
2839        delta  = Math[ delta  >= 1 ? 'floor' : 'ceil' ](delta  / lowestDelta);
2840        deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
2841        deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
2842
2843        // Normalise offsetX and offsetY properties
2844        if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
2845            var boundingRect = this.getBoundingClientRect();
2846            offsetX = event.clientX - boundingRect.left;
2847            offsetY = event.clientY - boundingRect.top;
2848        }
2849
2850        // Add information to the event object
2851        event.deltaX = deltaX;
2852        event.deltaY = deltaY;
2853        event.deltaFactor = lowestDelta;
2854        event.offsetX = offsetX;
2855        event.offsetY = offsetY
vendor: 1,567 bytes, lines 2855-2889
2855;
2856        // Go ahead and set deltaMode to 0 since we converted to pixels
2857        // Although this is a little odd since we overwrite the deltaX/Y
2858        // properties with normalized deltas.
2859        event.deltaMode = 0;
2860
2861        // Add event and delta to the front of the arguments
2862        args.unshift(event, delta, deltaX, deltaY);
2863
2864        // Clearout lowestDelta after sometime to better
2865        // handle multiple device types that give different
2866        // a different lowestDelta
2867        // Ex: trackpad = 3 and mouse wheel = 120
2868        if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
2869        nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
2870
2871        return ($.event.dispatch || $.event.handle).apply(this, args);
2872    }
2873
2874    function nullLowestDelta() {
2875        lowestDelta = null;
2876    }
2877
2878    function shouldAdjustOldDeltas(orgEvent, absDelta) {
2879        // If this is an older event and the delta is divisable by 120,
2880        // then we are assuming that the browser is treating this as an
2881        // older mouse wheel event and that we should divide the deltas
2882        // by 40 to try and get a more usable deltaFactor.
2883        // Side note, this actually impacts the reported scroll distance
2884        // in older browsers and can cause scrolling to be slower than native.
2885        // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
2886        return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
2887    }
2888
2889}));

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.