PageSourceSearch

https://penaviation.com/wp-content/themes/motors/assets/js/stm_dt_picker.js?ver=4.0

js penaviation.com collected 2026-09-26 07:51:49 UTC 143,745 bytes, 2,896 lines download raw bytes

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

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.