simple_form_extension 1.3.7 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b6cd251b02e5f877643079599cb894c07dadcef
4
- data.tar.gz: 65e7150a8a2678f7b041f21dc67325dc1754f372
3
+ metadata.gz: 9637f17ac641bcf340d0ef41ee49217d8cc5b6a2
4
+ data.tar.gz: 4875e0b22ab853b2358a1eeaa156c8d30d353123
5
5
  SHA512:
6
- metadata.gz: 07778969d558d16740a5ddcdb19e5bcf5935c0160247ae1e20197ab75548ebd67856fc9fadec4517ccda60c71c8d12860d8ffc2d70724d00be14d62bc97a75d4
7
- data.tar.gz: ea8486c3461303aeae6cf58710ade206e4d1f3e759de19727197f201d606b7c0372117a5ad76efa1fd64a4577b1f2621f00b6b8ad89eb8ffad9ec46912886110
6
+ metadata.gz: 8040f79b8b55fcd8254540ca5d13450f74f975922b8eb023fb567f998bb5cb76f03368efc370c863788f73742bb251f6d67b130b481bb23678342b50cea2ab21
7
+ data.tar.gz: 12113ebcae852f40b737d854614d4bd8cbee8eab49d8364600bc052e6ea4e12b3c1b67c6f2c2c9d60dbc38c39e2070375e5d2b83f95d52d903eca1ae25965bff
@@ -1,3 +1,3 @@
1
1
  module SimpleFormExtension
2
- VERSION = "1.3.7"
2
+ VERSION = "1.3.8"
3
3
  end
@@ -1,437 +1,799 @@
1
1
  /**
2
- * @preserve jQuery DateTimePicker plugin v2.3.6
2
+ * @preserve jQuery DateTimePicker plugin v2.4.5
3
3
  * @homepage http://xdsoft.net/jqplugins/datetimepicker/
4
4
  * (c) 2014, Chupurnov Valeriy.
5
5
  */
6
- (function( $ ) {
6
+ /*global document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
7
+ ;(function (factory) {
8
+ if ( typeof define === 'function' && define.amd ) {
9
+ // AMD. Register as an anonymous module.
10
+ define(['jquery', 'jquery-mousewheel', 'date-functions'], factory);
11
+ } else if (typeof exports === 'object') {
12
+ // Node/CommonJS style for Browserify
13
+ module.exports = factory;
14
+ } else {
15
+ // Browser globals
16
+ factory(jQuery);
17
+ }
18
+ }(function ($) {
7
19
  'use strict';
8
20
  var default_options = {
9
- i18n:{
21
+ i18n: {
10
22
  ar: { // Arabic
11
23
  months: [
12
24
  "كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"
13
25
  ],
14
- dayOfWeek: [
26
+ dayOfWeekShort: [
15
27
  "ن", "ث", "ع", "خ", "ج", "س", "ح"
16
- ]
28
+ ],
29
+ dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"]
17
30
  },
18
31
  ro: { // Romanian
19
32
  months: [
20
- "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie"
33
+ "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
21
34
  ],
22
- dayOfWeek: [
23
- "l", "ma", "mi", "j", "v", "s", "d"
24
- ]
35
+ dayOfWeekShort: [
36
+ "Du", "Lu", "Ma", "Mi", "Jo", "Vi", ""
37
+ ],
38
+ dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"]
25
39
  },
26
40
  id: { // Indonesian
27
41
  months: [
28
42
  "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
29
43
  ],
30
- dayOfWeek: [
31
- "Sen", "Sel", "Rab", "Kam", "Jum", "Sab", "Min"
32
- ]
44
+ dayOfWeekShort: [
45
+ "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
46
+ ],
47
+ dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
48
+ },
49
+ is: { // Icelandic
50
+ months: [
51
+ "Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"
52
+ ],
53
+ dayOfWeekShort: [
54
+ "Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau"
55
+ ],
56
+ dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"]
33
57
  },
34
- bg:{ // Bulgarian
35
- months:[
58
+ bg: { // Bulgarian
59
+ months: [
36
60
  "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
37
61
  ],
38
- dayOfWeek:[
62
+ dayOfWeekShort: [
39
63
  "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
40
- ]
64
+ ],
65
+ dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"]
41
66
  },
42
- fa:{ // Persian/Farsi
43
- months:[
67
+ fa: { // Persian/Farsi
68
+ months: [
44
69
  'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'
45
70
  ],
46
- dayOfWeek:[
71
+ dayOfWeekShort: [
47
72
  'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'
48
- ]
73
+ ],
74
+ dayOfWeek: ["یک‌شنبه", "دوشنبه", "سه‌شنبه", "چهارشنبه", "پنج‌شنبه", "جمعه", "شنبه", "یک‌شنبه"]
49
75
  },
50
- ru:{ // Russian
51
- months:[
52
- 'Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'
76
+ ru: { // Russian
77
+ months: [
78
+ 'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
53
79
  ],
54
- dayOfWeek:[
55
- "Вск", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
56
- ]
80
+ dayOfWeekShort: [
81
+ "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
82
+ ],
83
+ dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"]
57
84
  },
58
- uk:{ // Ukrainian
59
- months:[
60
- 'Січень','Лютий','Березень','Квітень','Травень','Червень','Липень','Серпень','Вересень','Жовтень','Листопад','Грудень'
85
+ uk: { // Ukrainian
86
+ months: [
87
+ 'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
61
88
  ],
62
- dayOfWeek:[
89
+ dayOfWeekShort: [
63
90
  "Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
64
- ]
91
+ ],
92
+ dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
65
93
  },
66
- en:{ // English
94
+ en: { // English
67
95
  months: [
68
96
  "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
69
97
  ],
70
- dayOfWeek: [
98
+ dayOfWeekShort: [
71
99
  "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
72
- ]
100
+ ],
101
+ dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
73
102
  },
74
- el:{ // Ελληνικά
103
+ el: { // Ελληνικά
75
104
  months: [
76
105
  "Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
77
106
  ],
78
- dayOfWeek: [
107
+ dayOfWeekShort: [
79
108
  "Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"
80
- ]
109
+ ],
110
+ dayOfWeek: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"]
81
111
  },
82
- de:{ // German
83
- months:[
84
- 'Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'
112
+ de: { // German
113
+ months: [
114
+ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
85
115
  ],
86
- dayOfWeek:[
116
+ dayOfWeekShort: [
87
117
  "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
88
- ]
118
+ ],
119
+ dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
89
120
  },
90
- nl:{ // Dutch
91
- months:[
121
+ nl: { // Dutch
122
+ months: [
92
123
  "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
93
124
  ],
94
- dayOfWeek:[
125
+ dayOfWeekShort: [
95
126
  "zo", "ma", "di", "wo", "do", "vr", "za"
96
- ]
127
+ ],
128
+ dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
97
129
  },
98
- tr:{ // Turkish
99
- months:[
130
+ tr: { // Turkish
131
+ months: [
100
132
  "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
101
133
  ],
102
- dayOfWeek:[
134
+ dayOfWeekShort: [
103
135
  "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
104
- ]
136
+ ],
137
+ dayOfWeek: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"]
105
138
  },
106
- fr:{ //French
107
- months:[
139
+ fr: { //French
140
+ months: [
108
141
  "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
109
142
  ],
110
- dayOfWeek:[
143
+ dayOfWeekShort: [
111
144
  "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
112
- ]
145
+ ],
146
+ dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
113
147
  },
114
- es:{ // Spanish
148
+ es: { // Spanish
115
149
  months: [
116
150
  "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
117
151
  ],
118
- dayOfWeek: [
152
+ dayOfWeekShort: [
119
153
  "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
120
- ]
154
+ ],
155
+ dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"]
121
156
  },
122
- th:{ // Thai
123
- months:[
124
- 'มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'
157
+ th: { // Thai
158
+ months: [
159
+ 'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'
125
160
  ],
126
- dayOfWeek:[
127
- 'อา.','จ.','อ.','พ.','พฤ.','ศ.','ส.'
128
- ]
161
+ dayOfWeekShort: [
162
+ 'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'
163
+ ],
164
+ dayOfWeek: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"]
129
165
  },
130
- pl:{ // Polish
166
+ pl: { // Polish
131
167
  months: [
132
168
  "styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"
133
169
  ],
134
- dayOfWeek: [
170
+ dayOfWeekShort: [
135
171
  "nd", "pn", "wt", "śr", "cz", "pt", "sb"
136
- ]
172
+ ],
173
+ dayOfWeek: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"]
137
174
  },
138
- pt:{ // Portuguese
175
+ pt: { // Portuguese
139
176
  months: [
140
177
  "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
141
178
  ],
142
- dayOfWeek: [
179
+ dayOfWeekShort: [
143
180
  "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
144
- ]
181
+ ],
182
+ dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
145
183
  },
146
- ch:{ // Simplified Chinese
184
+ ch: { // Simplified Chinese
147
185
  months: [
148
- "一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"
186
+ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
149
187
  ],
150
- dayOfWeek: [
151
- "日", "一","二","三","四","五","六"
188
+ dayOfWeekShort: [
189
+ "日", "一", "二", "三", "四", "五", "六"
152
190
  ]
153
191
  },
154
- se:{ // Swedish
192
+ se: { // Swedish
155
193
  months: [
156
- "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September","Oktober", "November", "December"
194
+ "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
157
195
  ],
158
- dayOfWeek: [
196
+ dayOfWeekShort: [
159
197
  "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
160
198
  ]
161
199
  },
162
- kr:{ // Korean
200
+ kr: { // Korean
163
201
  months: [
164
202
  "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
165
203
  ],
166
- dayOfWeek: [
204
+ dayOfWeekShort: [
167
205
  "일", "월", "화", "수", "목", "금", "토"
168
- ]
206
+ ],
207
+ dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
169
208
  },
170
- it:{ // Italian
209
+ it: { // Italian
171
210
  months: [
172
211
  "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
173
212
  ],
174
- dayOfWeek: [
213
+ dayOfWeekShort: [
175
214
  "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
176
- ]
215
+ ],
216
+ dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"]
177
217
  },
178
- da:{ // Dansk
218
+ da: { // Dansk
179
219
  months: [
180
220
  "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December"
181
221
  ],
182
- dayOfWeek: [
222
+ dayOfWeekShort: [
183
223
  "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
184
- ]
224
+ ],
225
+ dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"]
185
226
  },
186
- no:{ // Norwegian
227
+ no: { // Norwegian
187
228
  months: [
188
229
  "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
189
230
  ],
190
- dayOfWeek: [
231
+ dayOfWeekShort: [
191
232
  "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
192
- ]
233
+ ],
234
+ dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag']
193
235
  },
194
- ja:{ // Japanese
236
+ ja: { // Japanese
195
237
  months: [
196
238
  "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
197
239
  ],
198
- dayOfWeek: [
240
+ dayOfWeekShort: [
199
241
  "日", "月", "火", "水", "木", "金", "土"
200
- ]
242
+ ],
243
+ dayOfWeek: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"]
201
244
  },
202
- vi:{ // Vietnamese
245
+ vi: { // Vietnamese
203
246
  months: [
204
247
  "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"
205
248
  ],
206
- dayOfWeek: [
249
+ dayOfWeekShort: [
207
250
  "CN", "T2", "T3", "T4", "T5", "T6", "T7"
208
- ]
251
+ ],
252
+ dayOfWeek: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"]
209
253
  },
210
- sl:{ // Slovenščina
254
+ sl: { // Slovenščina
211
255
  months: [
212
256
  "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"
213
257
  ],
214
- dayOfWeek: [
258
+ dayOfWeekShort: [
215
259
  "Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"
216
- ]
260
+ ],
261
+ dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"]
217
262
  },
218
- cs:{ // Čeština
263
+ cs: { // Čeština
219
264
  months: [
220
265
  "Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
221
266
  ],
222
- dayOfWeek: [
267
+ dayOfWeekShort: [
223
268
  "Ne", "Po", "Út", "St", "Čt", "Pá", "So"
224
269
  ]
225
270
  },
226
- hu:{ // Hungarian
227
- months: [
271
+ hu: { // Hungarian
272
+ months: [
228
273
  "Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
229
- ],
230
- dayOfWeek: [
274
+ ],
275
+ dayOfWeekShort: [
231
276
  "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
232
- ]
233
- }
277
+ ],
278
+ dayOfWeek: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"]
279
+ },
280
+ az: { //Azerbaijanian (Azeri)
281
+ months: [
282
+ "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
283
+ ],
284
+ dayOfWeekShort: [
285
+ "B", "Be", "Ça", "Ç", "Ca", "C", "Ş"
286
+ ],
287
+ dayOfWeek: ["Bazar", "Bazar ertəsi", "Çərşənbə axşamı", "Çərşənbə", "Cümə axşamı", "Cümə", "Şənbə"]
288
+ },
289
+ bs: { //Bosanski
290
+ months: [
291
+ "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
292
+ ],
293
+ dayOfWeekShort: [
294
+ "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
295
+ ],
296
+ dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
297
+ },
298
+ ca: { //Català
299
+ months: [
300
+ "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
301
+ ],
302
+ dayOfWeekShort: [
303
+ "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
304
+ ],
305
+ dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"]
306
+ },
307
+ 'en-GB': { //English (British)
308
+ months: [
309
+ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
310
+ ],
311
+ dayOfWeekShort: [
312
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
313
+ ],
314
+ dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
315
+ },
316
+ et: { //"Eesti"
317
+ months: [
318
+ "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
319
+ ],
320
+ dayOfWeekShort: [
321
+ "P", "E", "T", "K", "N", "R", "L"
322
+ ],
323
+ dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"]
324
+ },
325
+ eu: { //Euskara
326
+ months: [
327
+ "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
328
+ ],
329
+ dayOfWeekShort: [
330
+ "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
331
+ ],
332
+ dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata']
333
+ },
334
+ fi: { //Finnish (Suomi)
335
+ months: [
336
+ "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
337
+ ],
338
+ dayOfWeekShort: [
339
+ "Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
340
+ ],
341
+ dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"]
342
+ },
343
+ gl: { //Galego
344
+ months: [
345
+ "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
346
+ ],
347
+ dayOfWeekShort: [
348
+ "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
349
+ ],
350
+ dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"]
351
+ },
352
+ hr: { //Hrvatski
353
+ months: [
354
+ "Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
355
+ ],
356
+ dayOfWeekShort: [
357
+ "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
358
+ ],
359
+ dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
360
+ },
361
+ ko: { //Korean (한국어)
362
+ months: [
363
+ "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
364
+ ],
365
+ dayOfWeekShort: [
366
+ "일", "월", "화", "수", "목", "금", "토"
367
+ ],
368
+ dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
369
+ },
370
+ lt: { //Lithuanian (lietuvių)
371
+ months: [
372
+ "Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio"
373
+ ],
374
+ dayOfWeekShort: [
375
+ "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš"
376
+ ],
377
+ dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"]
378
+ },
379
+ lv: { //Latvian (Latviešu)
380
+ months: [
381
+ "Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
382
+ ],
383
+ dayOfWeekShort: [
384
+ "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
385
+ ],
386
+ dayOfWeek: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"]
387
+ },
388
+ mk: { //Macedonian (Македонски)
389
+ months: [
390
+ "јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"
391
+ ],
392
+ dayOfWeekShort: [
393
+ "нед", "пон", "вто", "сре", "чет", "пет", "саб"
394
+ ],
395
+ dayOfWeek: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота"]
396
+ },
397
+ mn: { //Mongolian (Монгол)
398
+ months: [
399
+ "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"
400
+ ],
401
+ dayOfWeekShort: [
402
+ "Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням"
403
+ ],
404
+ dayOfWeek: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"]
405
+ },
406
+ 'pt-BR': { //Português(Brasil)
407
+ months: [
408
+ "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
409
+ ],
410
+ dayOfWeekShort: [
411
+ "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"
412
+ ],
413
+ dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
414
+ },
415
+ sk: { //Slovenčina
416
+ months: [
417
+ "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
418
+ ],
419
+ dayOfWeekShort: [
420
+ "Ne", "Po", "Ut", "St", "Št", "Pi", "So"
421
+ ],
422
+ dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"]
423
+ },
424
+ sq: { //Albanian (Shqip)
425
+ months: [
426
+ "Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor"
427
+ ],
428
+ dayOfWeekShort: [
429
+ "Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu"
430
+ ],
431
+ dayOfWeek: ["E Diel", "E Hënë", "E Martē", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"]
432
+ },
433
+ 'sr-YU': { //Serbian (Srpski)
434
+ months: [
435
+ "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
436
+ ],
437
+ dayOfWeekShort: [
438
+ "Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub"
439
+ ],
440
+ dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota"]
441
+ },
442
+ sr: { //Serbian Cyrillic (Српски)
443
+ months: [
444
+ "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"
445
+ ],
446
+ dayOfWeekShort: [
447
+ "нед", "пон", "уто", "сре", "чет", "пет", "суб"
448
+ ],
449
+ dayOfWeek: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"]
450
+ },
451
+ sv: { //Svenska
452
+ months: [
453
+ "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
454
+ ],
455
+ dayOfWeekShort: [
456
+ "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
457
+ ],
458
+ dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"]
459
+ },
460
+ 'zh-TW': { //Traditional Chinese (繁體中文)
461
+ months: [
462
+ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
463
+ ],
464
+ dayOfWeekShort: [
465
+ "日", "一", "二", "三", "四", "五", "六"
466
+ ],
467
+ dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
468
+ },
469
+ zh: { //Simplified Chinese (简体中文)
470
+ months: [
471
+ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
472
+ ],
473
+ dayOfWeekShort: [
474
+ "日", "一", "二", "三", "四", "五", "六"
475
+ ],
476
+ dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
477
+ },
478
+ he: { //Hebrew (עברית)
479
+ months: [
480
+ 'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'
481
+ ],
482
+ dayOfWeekShort: [
483
+ 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת'
484
+ ],
485
+ dayOfWeek: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"]
486
+ },
487
+ hy: { // Armenian
488
+ months: [
489
+ "Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր"
490
+ ],
491
+ dayOfWeekShort: [
492
+ "Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ"
493
+ ],
494
+ dayOfWeek: ["Կիրակի", "Երկուշաբթի", "Երեքշաբթի", "Չորեքշաբթի", "Հինգշաբթի", "Ուրբաթ", "Շաբաթ"]
495
+ },
496
+ kg: { // Kyrgyz
497
+ months: [
498
+ 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы'
499
+ ],
500
+ dayOfWeekShort: [
501
+ "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише"
502
+ ],
503
+ dayOfWeek: [
504
+ "Жекшемб", "Дүйшөмб", "Шейшемб", "Шаршемб", "Бейшемби", "Жума", "Ишенб"
505
+ ]
506
+ }
234
507
  },
235
- value:'',
236
- lang:'en',
508
+ value: '',
509
+ rtl: false,
237
510
 
238
511
  format: 'Y/m/d H:i',
239
512
  formatTime: 'H:i',
240
513
  formatDate: 'Y/m/d',
241
514
 
242
515
  startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
516
+ step: 60,
517
+ monthChangeSpinner: true,
243
518
 
244
- step:60,
245
- monthChangeSpinner:true,
246
- closeOnDateSelect:false,
247
- closeOnWithoutClick:true,
519
+ closeOnDateSelect: false,
520
+ closeOnTimeSelect: true,
521
+ closeOnWithoutClick: true,
248
522
  closeOnInputClick: true,
249
523
 
250
- timepicker:true,
251
- datepicker:true,
252
- weeks:false,
253
-
254
- defaultTime:false, // use formatTime format (ex. '10:00' for formatTime: 'H:i')
255
- defaultDate:false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
256
-
257
- minDate:false,
258
- maxDate:false,
259
- minTime:false,
260
- maxTime:false,
261
-
262
- allowTimes:[],
263
- opened:false,
264
- initTime:true,
265
- inline:false,
266
-
267
- theme:'',
268
-
269
- onSelectDate:function() {},
270
- onSelectTime:function() {},
271
- onChangeMonth:function() {},
272
- onChangeYear:function() {},
273
- onChangeDateTime:function() {},
274
- onShow:function() {},
275
- onClose:function() {},
276
- onGenerate:function() {},
277
-
278
- withoutCopyright:true,
279
-
280
- inverseButton:false,
281
- hours12:false,
524
+ timepicker: true,
525
+ datepicker: true,
526
+ weeks: false,
527
+
528
+ defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i')
529
+ defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
530
+
531
+ minDate: false,
532
+ maxDate: false,
533
+ minTime: false,
534
+ maxTime: false,
535
+ disabledMinTime: false,
536
+ disabledMaxTime: false,
537
+
538
+ allowTimes: [],
539
+ opened: false,
540
+ initTime: true,
541
+ inline: false,
542
+ theme: '',
543
+
544
+ onSelectDate: function () {},
545
+ onSelectTime: function () {},
546
+ onChangeMonth: function () {},
547
+ onChangeYear: function () {},
548
+ onChangeDateTime: function () {},
549
+ onShow: function () {},
550
+ onClose: function () {},
551
+ onGenerate: function () {},
552
+
553
+ withoutCopyright: true,
554
+ inverseButton: false,
555
+ hours12: false,
282
556
  next: 'xdsoft_next',
283
557
  prev : 'xdsoft_prev',
284
- dayOfWeekStart:0,
285
-
558
+ dayOfWeekStart: 0,
286
559
  parentID: 'body',
287
-
288
- timeHeightInTimePicker:25,
289
- timepickerScrollbar:true,
290
-
291
- todayButton:true,
292
- defaultSelect:true,
293
-
294
- scrollMonth:true,
295
- scrollTime:true,
296
- scrollInput:true,
297
-
298
- lazyInit:false,
299
-
300
- mask:false,
301
- validateOnBlur:true,
302
- allowBlank:true,
303
-
304
- yearStart:1950,
305
- yearEnd:2050,
306
-
307
- style:'',
308
- id:'',
309
-
560
+ timeHeightInTimePicker: 25,
561
+ timepickerScrollbar: true,
562
+ todayButton: true,
563
+ prevButton: true,
564
+ nextButton: true,
565
+ defaultSelect: true,
566
+
567
+ scrollMonth: true,
568
+ scrollTime: true,
569
+ scrollInput: true,
570
+
571
+ lazyInit: false,
572
+ mask: false,
573
+ validateOnBlur: true,
574
+ allowBlank: true,
575
+ yearStart: 1950,
576
+ yearEnd: 2050,
577
+ monthStart: 0,
578
+ monthEnd: 11,
579
+ style: '',
580
+ id: '',
310
581
  fixed: false,
582
+ roundTime: 'round', // ceil, floor
583
+ className: '',
584
+ weekends: [],
585
+ highlightedDates: [],
586
+ highlightedPeriods: [],
587
+ disabledDates : [],
588
+ disabledWeekDays: [],
589
+ yearOffset: 0,
590
+ beforeShowDay: null,
591
+
592
+ enterLikeTab: true,
593
+ showApplyButton: false
594
+ };
311
595
 
312
- roundTime:'round', // ceil, floor
313
- className:'',
314
-
315
- weekends : [],
316
- yearOffset:0,
317
- beforeShowDay: null
596
+ var globalLocaleDefault = 'en',
597
+ globalLocale = 'en';
598
+ // for locale settings
599
+ $.datetimepicker = {
600
+ setLocale: function(locale){
601
+ globalLocale = default_options.i18n[locale]?locale:globalLocaleDefault;
602
+ // Override Parse and Format Library entities
603
+ Date.monthNames = default_options.i18n[globalLocale].months;
604
+ Date.dayNames = default_options.i18n[globalLocale].dayOfWeek;
605
+ }
318
606
  };
319
607
 
320
608
  // fix for ie8
321
- if ( !Array.prototype.indexOf ) {
322
- Array.prototype.indexOf = function(obj, start) {
323
- for (var i = (start || 0), j = this.length; i < j; i++) {
324
- if (this[i] === obj) { return i; }
325
- }
326
- return -1;
327
- }
609
+ if (!window.getComputedStyle) {
610
+ window.getComputedStyle = function (el, pseudo) {
611
+ this.el = el;
612
+ this.getPropertyValue = function (prop) {
613
+ var re = /(\-([a-z]){1})/g;
614
+ if (prop === 'float') {
615
+ prop = 'styleFloat';
616
+ }
617
+ if (re.test(prop)) {
618
+ prop = prop.replace(re, function (a, b, c) {
619
+ return c.toUpperCase();
620
+ });
621
+ }
622
+ return el.currentStyle[prop] || null;
623
+ };
624
+ return this;
625
+ };
328
626
  }
329
-
330
- Date.prototype.countDaysInMonth = function(){
331
- return new Date(this.getFullYear(), this.getMonth()+1, 0).getDate();
627
+ if (!Array.prototype.indexOf) {
628
+ Array.prototype.indexOf = function (obj, start) {
629
+ var i, j;
630
+ for (i = (start || 0), j = this.length; i < j; i += 1) {
631
+ if (this[i] === obj) { return i; }
632
+ }
633
+ return -1;
634
+ };
635
+ }
636
+ Date.prototype.countDaysInMonth = function () {
637
+ return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
332
638
  };
333
-
334
- $.fn.xdsoftScroller = function( _percent ) {
335
- return this.each(function() {
336
- var timeboxparent = $(this);
337
- if( !$(this).hasClass('xdsoft_scroller_box') ) {
338
- var pointerEventToXY = function( e ) {
339
- var out = {x:0, y:0};
340
- if( e.type == 'touchstart' || e.type == 'touchmove' || e.type == 'touchend' || e.type == 'touchcancel' ) {
341
- var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
342
- out.x = touch.pageX;
343
- out.y = touch.pageY;
344
- }else if (e.type == 'mousedown' || e.type == 'mouseup' || e.type == 'mousemove' || e.type == 'mouseover'|| e.type=='mouseout' || e.type=='mouseenter' || e.type=='mouseleave') {
345
- out.x = e.pageX;
346
- out.y = e.pageY;
347
- }
348
- return out;
349
- },
350
- move = 0,
351
- timebox = timeboxparent.children().eq(0),
352
- parentHeight = timeboxparent[0].clientHeight,
353
- height = timebox[0].offsetHeight,
354
- scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
355
- scroller = $('<div class="xdsoft_scroller"></div>'),
356
- maximumOffset = 100,
357
- start = false;
358
-
639
+ $.fn.xdsoftScroller = function (percent) {
640
+ return this.each(function () {
641
+ var timeboxparent = $(this),
642
+ pointerEventToXY = function (e) {
643
+ var out = {x: 0, y: 0},
644
+ touch;
645
+ if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
646
+ touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
647
+ out.x = touch.clientX;
648
+ out.y = touch.clientY;
649
+ } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
650
+ out.x = e.clientX;
651
+ out.y = e.clientY;
652
+ }
653
+ return out;
654
+ },
655
+ move = 0,
656
+ timebox,
657
+ parentHeight,
658
+ height,
659
+ scrollbar,
660
+ scroller,
661
+ maximumOffset = 100,
662
+ start = false,
663
+ startY = 0,
664
+ startTop = 0,
665
+ h1 = 0,
666
+ touchStart = false,
667
+ startTopScroll = 0,
668
+ calcOffset = function () {};
669
+ if (percent === 'hide') {
670
+ timeboxparent.find('.xdsoft_scrollbar').hide();
671
+ return;
672
+ }
673
+ if (!$(this).hasClass('xdsoft_scroller_box')) {
674
+ timebox = timeboxparent.children().eq(0);
675
+ parentHeight = timeboxparent[0].clientHeight;
676
+ height = timebox[0].offsetHeight;
677
+ scrollbar = $('<div class="xdsoft_scrollbar"></div>');
678
+ scroller = $('<div class="xdsoft_scroller"></div>');
359
679
  scrollbar.append(scroller);
360
680
 
361
681
  timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
362
- scroller.on('mousedown.xdsoft_scroller',function ( event ) {
363
- if( !parentHeight )
364
- timeboxparent.trigger('resize_scroll.xdsoft_scroller',[_percent]);
365
- var pageY = event.pageY,
366
- top = parseInt(scroller.css('margin-top')),
682
+ calcOffset = function calcOffset(event) {
683
+ var offset = pointerEventToXY(event).y - startY + startTopScroll;
684
+ if (offset < 0) {
685
+ offset = 0;
686
+ }
687
+ if (offset + scroller[0].offsetHeight > h1) {
688
+ offset = h1 - scroller[0].offsetHeight;
689
+ }
690
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
691
+ };
692
+
693
+ scroller
694
+ .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) {
695
+ if (!parentHeight) {
696
+ timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
697
+ }
698
+
699
+ startY = pointerEventToXY(event).y;
700
+ startTopScroll = parseInt(scroller.css('margin-top'), 10);
367
701
  h1 = scrollbar[0].offsetHeight;
368
- $(document.body).addClass('xdsoft_noselect');
369
- $([document.body,window]).on('mouseup.xdsoft_scroller',function arguments_callee() {
370
- $([document.body,window]).off('mouseup.xdsoft_scroller',arguments_callee)
371
- .off('mousemove.xdsoft_scroller',move)
372
- .removeClass('xdsoft_noselect');
373
- });
374
- $(document.body).on('mousemove.xdsoft_scroller',move = function(event) {
375
- var offset = event.pageY-pageY+top;
376
- if( offset<0 )
377
- offset = 0;
378
- if( offset+scroller[0].offsetHeight>h1 )
379
- offset = h1-scroller[0].offsetHeight;
380
- timeboxparent.trigger('scroll_element.xdsoft_scroller',[maximumOffset?offset/maximumOffset:0]);
702
+
703
+ if (event.type === 'mousedown' || event.type === 'touchstart') {
704
+ if (document) {
705
+ $(document.body).addClass('xdsoft_noselect');
706
+ }
707
+ $([document.body, window]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
708
+ $([document.body, window]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
709
+ .off('mousemove.xdsoft_scroller', calcOffset)
710
+ .removeClass('xdsoft_noselect');
711
+ });
712
+ $(document.body).on('mousemove.xdsoft_scroller', calcOffset);
713
+ } else {
714
+ touchStart = true;
715
+ event.stopPropagation();
716
+ event.preventDefault();
717
+ }
718
+ })
719
+ .on('touchmove', function (event) {
720
+ if (touchStart) {
721
+ event.preventDefault();
722
+ calcOffset(event);
723
+ }
724
+ })
725
+ .on('touchend touchcancel', function (event) {
726
+ touchStart = false;
727
+ startTopScroll = 0;
381
728
  });
382
- });
383
729
 
384
730
  timeboxparent
385
- .on('scroll_element.xdsoft_scroller',function( event,percent ) {
386
- if( !parentHeight )
387
- timeboxparent.trigger('resize_scroll.xdsoft_scroller',[percent,true]);
388
- percent = percent>1?1:(percent<0||isNaN(percent))?0:percent;
389
- scroller.css('margin-top',maximumOffset*percent);
390
- setTimeout(function(){
391
- timebox.css('marginTop',-parseInt((timebox[0].offsetHeight-parentHeight)*percent))
392
- },10);
731
+ .on('scroll_element.xdsoft_scroller', function (event, percentage) {
732
+ if (!parentHeight) {
733
+ timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
734
+ }
735
+ percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
736
+
737
+ scroller.css('margin-top', maximumOffset * percentage);
738
+
739
+ setTimeout(function () {
740
+ timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10));
741
+ }, 10);
393
742
  })
394
- .on('resize_scroll.xdsoft_scroller',function( event,_percent,noTriggerScroll ) {
743
+ .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
744
+ var percent, sh;
395
745
  parentHeight = timeboxparent[0].clientHeight;
396
746
  height = timebox[0].offsetHeight;
397
- var percent = parentHeight/height,
398
- sh = percent*scrollbar[0].offsetHeight;
399
- if( percent>1 )
747
+ percent = parentHeight / height;
748
+ sh = percent * scrollbar[0].offsetHeight;
749
+ if (percent > 1) {
400
750
  scroller.hide();
401
- else{
751
+ } else {
402
752
  scroller.show();
403
- scroller.css('height',parseInt(sh>10?sh:10));
404
- maximumOffset = scrollbar[0].offsetHeight-scroller[0].offsetHeight;
405
- if( noTriggerScroll!==true )
406
- timeboxparent.trigger('scroll_element.xdsoft_scroller',[_percent?_percent:Math.abs(parseInt(timebox.css('marginTop')))/(height-parentHeight)]);
753
+ scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
754
+ maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
755
+ if (noTriggerScroll !== true) {
756
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]);
757
+ }
407
758
  }
408
759
  });
409
- timeboxparent.mousewheel&&timeboxparent.mousewheel(function(event, delta, deltaX, deltaY) {
410
- var top = Math.abs(parseInt(timebox.css('marginTop')));
411
- timeboxparent.trigger('scroll_element.xdsoft_scroller',[(top-delta*20)/(height-parentHeight)]);
760
+
761
+ timeboxparent.on('mousewheel', function (event) {
762
+ var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
763
+
764
+ top = top - (event.deltaY * 20);
765
+ if (top < 0) {
766
+ top = 0;
767
+ }
768
+
769
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]);
412
770
  event.stopPropagation();
413
771
  return false;
414
772
  });
415
- timeboxparent.on('touchstart',function( event ) {
773
+
774
+ timeboxparent.on('touchstart', function (event) {
416
775
  start = pointerEventToXY(event);
776
+ startTop = Math.abs(parseInt(timebox.css('marginTop'), 10));
417
777
  });
418
- timeboxparent.on('touchmove',function( event ) {
419
- if( start ) {
420
- var coord = pointerEventToXY(event), top = Math.abs(parseInt(timebox.css('marginTop')));
421
- timeboxparent.trigger('scroll_element.xdsoft_scroller',[(top-(coord.y-start.y))/(height-parentHeight)]);
422
- event.stopPropagation();
778
+
779
+ timeboxparent.on('touchmove', function (event) {
780
+ if (start) {
423
781
  event.preventDefault();
424
- start = pointerEventToXY(event);
782
+ var coord = pointerEventToXY(event);
783
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]);
425
784
  }
426
785
  });
427
- timeboxparent.on('touchend touchcancel',function( event ) {
786
+
787
+ timeboxparent.on('touchend touchcancel', function (event) {
428
788
  start = false;
789
+ startTop = 0;
429
790
  });
430
791
  }
431
- timeboxparent.trigger('resize_scroll.xdsoft_scroller',[_percent]);
792
+ timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
432
793
  });
433
794
  };
434
- $.fn.datetimepicker = function( opt ) {
795
+
796
+ $.fn.datetimepicker = function (opt) {
435
797
  var KEY0 = 48,
436
798
  KEY9 = 57,
437
799
  _KEY0 = 96,
@@ -453,1086 +815,1330 @@
453
815
  ZKEY = 90,
454
816
  YKEY = 89,
455
817
  ctrlDown = false,
456
- options = ($.isPlainObject(opt)||!opt)?$.extend(true,{},default_options,opt):$.extend(true,{},default_options),
818
+ options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
457
819
 
458
820
  lazyInitTimer = 0,
821
+ createDateTimePicker,
822
+ destroyDateTimePicker,
459
823
 
460
- lazyInit = function( input ){
824
+ lazyInit = function (input) {
461
825
  input
462
- .on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function initOnActionCallback(event) {
463
- if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible')||input.data( 'xdsoft_datetimepicker') )
826
+ .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback(event) {
827
+ if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
464
828
  return;
465
-
829
+ }
466
830
  clearTimeout(lazyInitTimer);
831
+ lazyInitTimer = setTimeout(function () {
467
832
 
468
- lazyInitTimer = setTimeout(function() {
469
-
470
- if( !input.data( 'xdsoft_datetimepicker') )
833
+ if (!input.data('xdsoft_datetimepicker')) {
471
834
  createDateTimePicker(input);
472
-
835
+ }
473
836
  input
474
- .off('open.xdsoft focusin.xdsoft mousedown.xdsoft',initOnActionCallback)
837
+ .off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback)
475
838
  .trigger('open.xdsoft');
476
- },100);
477
-
839
+ }, 100);
478
840
  });
479
- },
841
+ };
480
842
 
481
- createDateTimePicker = function( input ) {
482
-
483
- var datetimepicker = $('<div '+(options.id?'id="'+options.id+'"':'')+' '+(options.style?'style="'+options.style+'"':'')+' class="xdsoft_datetimepicker xdsoft_'+options.theme+' xdsoft_noselect '+(options.weeks?' xdsoft_showweeks':'')+options.className+'"></div>'),
484
- xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
485
- datepicker = $('<div class="xdsoft_datepicker active"></div>'),
486
- mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>'+
487
- '<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>'+
488
- '<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>'+
489
- '<button type="button" class="xdsoft_next"></button></div>'),
490
- calendar = $('<div class="xdsoft_calendar"></div>'),
491
- 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>'),
492
- timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
493
- timebox = $('<div class="xdsoft_time_variant"></div>'),
494
- scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
495
- scroller = $('<div class="xdsoft_scroller"></div>'),
496
- monthselect =$('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
497
- yearselect =$('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>');
843
+ createDateTimePicker = function (input) {
844
+ var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),
845
+ xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
846
+ datepicker = $('<div class="xdsoft_datepicker active"></div>'),
847
+ mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
848
+ '<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' +
849
+ '<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' +
850
+ '<button type="button" class="xdsoft_next"></button></div>'),
851
+ calendar = $('<div class="xdsoft_calendar"></div>'),
852
+ 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>'),
853
+ timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
854
+ timebox = $('<div class="xdsoft_time_variant"></div>'),
855
+ applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
856
+ /*scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
857
+ scroller = $('<div class="xdsoft_scroller"></div>'),*/
858
+ monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
859
+ yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
860
+ triggerAfterOpen = false,
861
+ XDSoft_datetime,
862
+ //scroll_element,
863
+ xchangeTimer,
864
+ timerclick,
865
+ current_time_index,
866
+ setPos,
867
+ timer = 0,
868
+ timer1 = 0,
869
+ _xdsoft_datetime;
870
+
871
+ if (options.id) {
872
+ datetimepicker.attr('id', options.id);
873
+ }
874
+ if (options.style) {
875
+ datetimepicker.attr('style', options.style);
876
+ }
877
+ if (options.weeks) {
878
+ datetimepicker.addClass('xdsoft_showweeks');
879
+ }
880
+ if (options.rtl) {
881
+ datetimepicker.addClass('xdsoft_rtl');
882
+ }
498
883
 
499
- mounth_picker
500
- .find('.xdsoft_month span')
501
- .after(monthselect);
502
- mounth_picker
503
- .find('.xdsoft_year span')
504
- .after(yearselect);
884
+ datetimepicker.addClass('xdsoft_' + options.theme);
885
+ datetimepicker.addClass(options.className);
886
+
887
+ mounth_picker
888
+ .find('.xdsoft_month span')
889
+ .after(monthselect);
890
+ mounth_picker
891
+ .find('.xdsoft_year span')
892
+ .after(yearselect);
893
+
894
+ mounth_picker
895
+ .find('.xdsoft_month,.xdsoft_year')
896
+ .on('touchstart mousedown.xdsoft', function (event) {
897
+ var select = $(this).find('.xdsoft_select').eq(0),
898
+ val = 0,
899
+ top = 0,
900
+ visible = select.is(':visible'),
901
+ items,
902
+ i;
505
903
 
506
- mounth_picker
507
- .find('.xdsoft_month,.xdsoft_year')
508
- .on('mousedown.xdsoft',function(event) {
509
- var select = $(this).find('.xdsoft_select').eq(0),
510
- val = 0,
511
- top = 0,
512
- visible = select.is(':visible');
904
+ mounth_picker
905
+ .find('.xdsoft_select')
906
+ .hide();
907
+ if (_xdsoft_datetime.currentTime) {
908
+ val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
909
+ }
513
910
 
911
+ select[visible ? 'hide' : 'show']();
912
+ for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
913
+ if (items.eq(i).data('value') === val) {
914
+ break;
915
+ } else {
916
+ top += items[0].offsetHeight;
917
+ }
918
+ }
514
919
 
515
- mounth_picker
516
- .find('.xdsoft_select')
517
- .hide();
920
+ select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
921
+ event.stopPropagation();
922
+ return false;
923
+ });
518
924
 
925
+ mounth_picker
926
+ .find('.xdsoft_select')
927
+ .xdsoftScroller()
928
+ .on('touchstart mousedown.xdsoft', function (event) {
929
+ event.stopPropagation();
930
+ event.preventDefault();
931
+ })
932
+ .on('touchstart mousedown.xdsoft', '.xdsoft_option', function (event) {
933
+ if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
934
+ _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
935
+ }
519
936
 
937
+ var year = _xdsoft_datetime.currentTime.getFullYear();
938
+ if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
939
+ _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
940
+ }
520
941
 
521
- if( _xdsoft_datetime.currentTime )
522
- val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month')?'getMonth':'getFullYear']();
942
+ $(this).parent().parent().hide();
523
943
 
524
- select[visible?'hide':'show']();
944
+ datetimepicker.trigger('xchange.xdsoft');
945
+ if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
946
+ options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
947
+ }
525
948
 
526
- for(var items = select.find('div.xdsoft_option'),i = 0;i<items.length;i++) {
527
- if( items.eq(i).data('value')==val ) {
528
- break;
529
- }else top+=items[0].offsetHeight;
949
+ if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
950
+ options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
951
+ }
952
+ });
953
+
954
+ datetimepicker.setOptions = function (_options) {
955
+ var highlightedDates = {},
956
+ getCaretPos = function (input) {
957
+ try {
958
+ if (document.selection && document.selection.createRange) {
959
+ var range = document.selection.createRange();
960
+ return range.getBookmark().charCodeAt(2) - 2;
530
961
  }
962
+ if (input.setSelectionRange) {
963
+ return input.selectionStart;
964
+ }
965
+ } catch (e) {
966
+ return 0;
967
+ }
968
+ },
969
+ setCaretPos = function (node, pos) {
970
+ node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node;
971
+ if (!node) {
972
+ return false;
973
+ }
974
+ if (node.createTextRange) {
975
+ var textRange = node.createTextRange();
976
+ textRange.collapse(true);
977
+ textRange.moveEnd('character', pos);
978
+ textRange.moveStart('character', pos);
979
+ textRange.select();
980
+ return true;
981
+ }
982
+ if (node.setSelectionRange) {
983
+ node.setSelectionRange(pos, pos);
984
+ return true;
985
+ }
986
+ return false;
987
+ },
988
+ isValidValue = function (mask, value) {
989
+ var reg = mask
990
+ .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
991
+ .replace(/_/g, '{digit+}')
992
+ .replace(/([0-9]{1})/g, '{digit$1}')
993
+ .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
994
+ .replace(/\{digit[\+]\}/g, '[0-9_]{1}');
995
+ return (new RegExp(reg)).test(value);
996
+ };
997
+ options = $.extend(true, {}, options, _options);
531
998
 
532
- select.xdsoftScroller(top/(select.children()[0].offsetHeight-(select[0].clientHeight)));
533
- event.stopPropagation();
999
+ if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
1000
+ options.allowTimes = $.extend(true, [], _options.allowTimes);
1001
+ }
534
1002
 
535
- return false;
536
- });
1003
+ if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) {
1004
+ options.weekends = $.extend(true, [], _options.weekends);
1005
+ }
537
1006
 
538
- mounth_picker
539
- .find('.xdsoft_select')
540
- .xdsoftScroller()
541
- .on('mousedown.xdsoft',function( event ) {
542
- event.stopPropagation();
543
- event.preventDefault();
544
- })
545
- .on('mousedown.xdsoft','.xdsoft_option',function( event ) {
546
- var year = _xdsoft_datetime.currentTime.getFullYear();
547
- if( _xdsoft_datetime&&_xdsoft_datetime.currentTime )
548
- _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect')?'setMonth':'setFullYear']($(this).data('value'));
1007
+ if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
1008
+ $.each(_options.highlightedDates, function (index, value) {
1009
+ var splitData = $.map(value.split(','), $.trim),
1010
+ exDesc,
1011
+ hDate = new HighlightedDate(Date.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
1012
+ keyDate = hDate.date.dateFormat(options.formatDate);
1013
+ if (highlightedDates[keyDate] !== undefined) {
1014
+ exDesc = highlightedDates[keyDate].desc;
1015
+ if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
1016
+ highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
1017
+ }
1018
+ } else {
1019
+ highlightedDates[keyDate] = hDate;
1020
+ }
1021
+ });
549
1022
 
550
- $(this).parent().parent().hide();
1023
+ options.highlightedDates = $.extend(true, [], highlightedDates);
1024
+ }
551
1025
 
552
- datetimepicker.trigger('xchange.xdsoft');
553
- options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1026
+ if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
1027
+ highlightedDates = $.extend(true, [], options.highlightedDates);
1028
+ $.each(_options.highlightedPeriods, function (index, value) {
1029
+ var dateTest, // start date
1030
+ dateEnd,
1031
+ desc,
1032
+ hDate,
1033
+ keyDate,
1034
+ exDesc,
1035
+ style;
1036
+ if ($.isArray(value)) {
1037
+ dateTest = value[0];
1038
+ dateEnd = value[1];
1039
+ desc = value[2];
1040
+ style = value[3];
1041
+ }
1042
+ else {
1043
+ var splitData = $.map(value.split(','), $.trim);
1044
+ dateTest = Date.parseDate(splitData[0], options.formatDate);
1045
+ dateEnd = Date.parseDate(splitData[1], options.formatDate);
1046
+ desc = splitData[2];
1047
+ style = splitData[3];
1048
+ }
554
1049
 
555
- if( year!=_xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear) ){
556
- options.onChangeYear.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1050
+ while (dateTest <= dateEnd) {
1051
+ hDate = new HighlightedDate(dateTest, desc, style);
1052
+ keyDate = dateTest.dateFormat(options.formatDate);
1053
+ dateTest.setDate(dateTest.getDate() + 1);
1054
+ if (highlightedDates[keyDate] !== undefined) {
1055
+ exDesc = highlightedDates[keyDate].desc;
1056
+ if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
1057
+ highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
1058
+ }
1059
+ } else {
1060
+ highlightedDates[keyDate] = hDate;
557
1061
  }
558
- });
1062
+ }
1063
+ });
559
1064
 
560
- datetimepicker.setOptions = function( _options ) {
561
- options = $.extend(true,{},options,_options);
1065
+ options.highlightedDates = $.extend(true, [], highlightedDates);
1066
+ }
562
1067
 
563
- if( _options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length ){
564
- options['allowTimes'] = $.extend(true,[],_options.allowTimes);
565
- }
1068
+ if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
1069
+ options.disabledDates = $.extend(true, [], _options.disabledDates);
1070
+ }
566
1071
 
567
- if( _options.weekends && $.isArray(_options.weekends) && _options.weekends.length ){
568
- options['weekends'] = $.extend(true,[],_options.weekends);
569
- }
1072
+ if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
1073
+ options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
1074
+ }
570
1075
 
571
- if( (options.open||options.opened)&&(!options.inline) ) {
572
- input.trigger('open.xdsoft');
573
- }
1076
+ if ((options.open || options.opened) && (!options.inline)) {
1077
+ input.trigger('open.xdsoft');
1078
+ }
574
1079
 
575
- if( options.inline ) {
576
- triggerAfterOpen = true;
577
- datetimepicker.addClass('xdsoft_inline');
578
- input.after(datetimepicker).hide();
579
- }
1080
+ if (options.inline) {
1081
+ triggerAfterOpen = true;
1082
+ datetimepicker.addClass('xdsoft_inline');
1083
+ input.after(datetimepicker).hide();
1084
+ }
580
1085
 
581
- if( options.inverseButton ) {
582
- options.next = 'xdsoft_prev';
583
- options.prev = 'xdsoft_next';
584
- }
1086
+ if (options.inverseButton) {
1087
+ options.next = 'xdsoft_prev';
1088
+ options.prev = 'xdsoft_next';
1089
+ }
585
1090
 
586
- if( options.datepicker )
587
- datepicker.addClass('active');
588
- else
589
- datepicker.removeClass('active');
1091
+ if (options.datepicker) {
1092
+ datepicker.addClass('active');
1093
+ } else {
1094
+ datepicker.removeClass('active');
1095
+ }
590
1096
 
591
- if( options.timepicker )
592
- timepicker.addClass('active');
593
- else
594
- timepicker.removeClass('active');
1097
+ if (options.timepicker) {
1098
+ timepicker.addClass('active');
1099
+ } else {
1100
+ timepicker.removeClass('active');
1101
+ }
595
1102
 
596
- if( options.value ){
597
- input&&input.val&&input.val(options.value);
598
- _xdsoft_datetime.setCurrentTime(options.value);
1103
+ if (options.value) {
1104
+ _xdsoft_datetime.setCurrentTime(options.value);
1105
+ if (input && input.val) {
1106
+ input.val(_xdsoft_datetime.str);
599
1107
  }
1108
+ }
1109
+
1110
+ if (isNaN(options.dayOfWeekStart)) {
1111
+ options.dayOfWeekStart = 0;
1112
+ } else {
1113
+ options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
1114
+ }
600
1115
 
601
- if( isNaN(options.dayOfWeekStart) )
602
- options.dayOfWeekStart = 0;
603
- else
604
- options.dayOfWeekStart = parseInt(options.dayOfWeekStart)%7;
1116
+ if (!options.timepickerScrollbar) {
1117
+ timeboxparent.xdsoftScroller('hide');
1118
+ }
605
1119
 
606
- if( !options.timepickerScrollbar )
607
- scrollbar.hide();
1120
+ if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
1121
+ options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat(options.formatDate);
1122
+ }
608
1123
 
609
- if( options.minDate && /^-(.*)$/.test(options.minDate) ){
610
- options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat( options.formatDate );
611
- }
1124
+ if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) {
1125
+ options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat(options.formatDate);
1126
+ }
1127
+
1128
+ applyButton.toggle(options.showApplyButton);
1129
+
1130
+ mounth_picker
1131
+ .find('.xdsoft_today_button')
1132
+ .css('visibility', !options.todayButton ? 'hidden' : 'visible');
612
1133
 
613
- if( options.maxDate && /^\+(.*)$/.test(options.maxDate) ) {
614
- options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat( options.formatDate );
1134
+ mounth_picker
1135
+ .find('.' + options.prev)
1136
+ .css('visibility', !options.prevButton ? 'hidden' : 'visible');
1137
+
1138
+ mounth_picker
1139
+ .find('.' + options.next)
1140
+ .css('visibility', !options.nextButton ? 'hidden' : 'visible');
1141
+
1142
+ if (options.mask) {
1143
+ input.off('keydown.xdsoft');
1144
+
1145
+ if (options.mask === true) {
1146
+ options.mask = options.format
1147
+ .replace(/Y/g, '9999')
1148
+ .replace(/F/g, '9999')
1149
+ .replace(/m/g, '19')
1150
+ .replace(/d/g, '39')
1151
+ .replace(/H/g, '29')
1152
+ .replace(/i/g, '59')
1153
+ .replace(/s/g, '59');
615
1154
  }
616
1155
 
617
- mounth_picker
618
- .find('.xdsoft_today_button')
619
- .css('visibility',!options.todayButton?'hidden':'visible');
620
-
621
- if( options.mask ) {
622
- var e,
623
- getCaretPos = function ( input ) {
624
- try{
625
- if ( document.selection && document.selection.createRange ) {
626
- var range = document.selection.createRange();
627
- return range.getBookmark().charCodeAt(2) - 2;
628
- }else
629
- if ( input.setSelectionRange )
630
- return input.selectionStart;
631
- }catch(e) {
632
- return 0;
1156
+ if ($.type(options.mask) === 'string') {
1157
+ if (!isValidValue(options.mask, input.val())) {
1158
+ input.val(options.mask.replace(/[0-9]/g, '_'));
1159
+ }
1160
+
1161
+ input.on('keydown.xdsoft', function (event) {
1162
+ var val = this.value,
1163
+ key = event.which,
1164
+ pos,
1165
+ digit;
1166
+
1167
+ if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) {
1168
+ pos = getCaretPos(this);
1169
+ digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_';
1170
+
1171
+ if ((key === BACKSPACE || key === DEL) && pos) {
1172
+ pos -= 1;
1173
+ digit = '_';
633
1174
  }
634
- },
635
- setCaretPos = function ( node,pos ) {
636
- node = (typeof node == "string" || node instanceof String) ? document.getElementById(node) : node;
637
- if(!node) {
638
- return false;
639
- }else if(node.createTextRange) {
640
- var textRange = node.createTextRange();
641
- textRange.collapse(true);
642
- textRange.moveEnd(pos);
643
- textRange.moveStart(pos);
644
- textRange.select();
645
- return true;
646
- }else if(node.setSelectionRange) {
647
- node.setSelectionRange(pos,pos);
648
- return true;
1175
+
1176
+ while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
1177
+ pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
649
1178
  }
650
- return false;
651
- },
652
- isValidValue = function ( mask,value ) {
653
- var reg = mask
654
- .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,'\\$1')
655
- .replace(/_/g,'{digit+}')
656
- .replace(/([0-9]{1})/g,'{digit$1}')
657
- .replace(/\{digit([0-9]{1})\}/g,'[0-$1_]{1}')
658
- .replace(/\{digit[\+]\}/g,'[0-9_]{1}');
659
- return RegExp(reg).test(value);
660
- };
661
- input.off('keydown.xdsoft');
662
- switch(true) {
663
- case ( options.mask===true ):
664
-
665
- options.mask = options.format
666
- .replace(/Y/g,'9999')
667
- .replace(/F/g,'9999')
668
- .replace(/m/g,'19')
669
- .replace(/d/g,'39')
670
- .replace(/H/g,'29')
671
- .replace(/i/g,'59')
672
- .replace(/s/g,'59');
673
-
674
- case ( $.type(options.mask) == 'string' ):
675
-
676
- if( !isValidValue( options.mask,input.val() ) )
677
- input.val(options.mask.replace(/[0-9]/g,'_'));
678
-
679
- input.on('keydown.xdsoft',function( event ) {
680
- var val = this.value,
681
- key = event.which;
682
-
683
- switch(true) {
684
- case (( key>=KEY0&&key<=KEY9 )||( key>=_KEY0&&key<=_KEY9 ))||(key==BACKSPACE||key==DEL):
685
- var pos = getCaretPos(this),
686
- digit = ( key!=BACKSPACE&&key!=DEL )?String.fromCharCode((_KEY0 <= key && key <= _KEY9)? key-KEY0 : key):'_';
687
-
688
- if( (key==BACKSPACE||key==DEL)&&pos ) {
689
- pos--;
690
- digit='_';
691
- }
692
-
693
- while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
694
- pos+=( key==BACKSPACE||key==DEL )?-1:1;
695
-
696
- val = val.substr(0,pos)+digit+val.substr(pos+1);
697
- if( $.trim(val)=='' ){
698
- val = options.mask.replace(/[0-9]/g,'_');
699
- }else{
700
- if( pos==options.mask.length )
701
- break;
702
- }
703
-
704
- pos+=(key==BACKSPACE||key==DEL)?0:1;
705
- while( /[^0-9_]/.test(options.mask.substr(pos,1))&&pos<options.mask.length&&pos>0 )
706
- pos+=(key==BACKSPACE||key==DEL)?-1:1;
707
-
708
- if( isValidValue( options.mask,val ) ) {
709
- this.value = val;
710
- setCaretPos(this,pos);
711
- }else if( $.trim(val)=='' )
712
- this.value = options.mask.replace(/[0-9]/g,'_');
713
- else{
714
- input.trigger('error_input.xdsoft');
715
- }
716
- break;
717
- case ( !!~([AKEY,CKEY,VKEY,ZKEY,YKEY].indexOf(key))&&ctrlDown ):
718
- case !!~([ESC,ARROWUP,ARROWDOWN,ARROWLEFT,ARROWRIGHT,F5,CTRLKEY,TAB,ENTER].indexOf(key)):
719
- return true;
1179
+
1180
+ val = val.substr(0, pos) + digit + val.substr(pos + 1);
1181
+ if ($.trim(val) === '') {
1182
+ val = options.mask.replace(/[0-9]/g, '_');
1183
+ } else {
1184
+ if (pos === options.mask.length) {
1185
+ event.preventDefault();
1186
+ return false;
720
1187
  }
721
- event.preventDefault();
722
- return false;
723
- });
724
- break;
725
- }
726
- }
727
- if( options.validateOnBlur ) {
728
- input
729
- .off('blur.xdsoft')
730
- .on('blur.xdsoft', function() {
731
- if( options.allowBlank && !$.trim($(this).val()).length ) {
732
- $(this).val(null);
733
- datetimepicker.data('xdsoft_datetime').empty();
734
- }else if( !Date.parseDate( $(this).val(), options.format ) ) {
735
- $(this).val((_xdsoft_datetime.now()).dateFormat( options.format ));
736
- datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
737
1188
  }
738
- else{
739
- datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1189
+
1190
+ pos += (key === BACKSPACE || key === DEL) ? 0 : 1;
1191
+ while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
1192
+ pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
740
1193
  }
741
- datetimepicker.trigger('changedatetime.xdsoft');
742
- });
1194
+
1195
+ if (isValidValue(options.mask, val)) {
1196
+ this.value = val;
1197
+ setCaretPos(this, pos);
1198
+ } else if ($.trim(val) === '') {
1199
+ this.value = options.mask.replace(/[0-9]/g, '_');
1200
+ } else {
1201
+ input.trigger('error_input.xdsoft');
1202
+ }
1203
+ } else {
1204
+ if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
1205
+ return true;
1206
+ }
1207
+ }
1208
+
1209
+ event.preventDefault();
1210
+ return false;
1211
+ });
743
1212
  }
744
- options.dayOfWeekStartPrev = (options.dayOfWeekStart==0)?6:options.dayOfWeekStart-1;
1213
+ }
1214
+ if (options.validateOnBlur) {
1215
+ input
1216
+ .off('blur.xdsoft')
1217
+ .on('blur.xdsoft', function () {
1218
+ if (options.allowBlank && !$.trim($(this).val()).length) {
1219
+ $(this).val(null);
1220
+ datetimepicker.data('xdsoft_datetime').empty();
1221
+ } else if (!Date.parseDate($(this).val(), options.format)) {
1222
+ var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
1223
+ splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
1224
+
1225
+ // parse the numbers as 0312 => 03:12
1226
+ if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
1227
+ $(this).val([splittedHours, splittedMinutes].map(function (item) {
1228
+ return item > 9 ? item : '0' + item;
1229
+ }).join(':'));
1230
+ } else {
1231
+ $(this).val((_xdsoft_datetime.now()).dateFormat(options.format));
1232
+ }
745
1233
 
746
- datetimepicker
747
- .trigger('xchange.xdsoft')
748
- .trigger('afterOpen.xdsoft')
749
- };
1234
+ datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1235
+ } else {
1236
+ datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
1237
+ }
750
1238
 
751
- datetimepicker
752
- .data('options',options)
753
- .on('mousedown.xdsoft',function( event ) {
754
- event.stopPropagation();
755
- event.preventDefault();
756
- yearselect.hide();
757
- monthselect.hide();
758
- return false;
759
- });
1239
+ datetimepicker.trigger('changedatetime.xdsoft');
1240
+ });
1241
+ }
1242
+ options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
760
1243
 
761
- var scroll_element = timepicker.find('.xdsoft_time_box');
762
- scroll_element.append(timebox);
763
- scroll_element.xdsoftScroller();
1244
+ datetimepicker
1245
+ .trigger('xchange.xdsoft')
1246
+ .trigger('afterOpen.xdsoft');
1247
+ };
764
1248
 
765
- datetimepicker.on('afterOpen.xdsoft',function() {
766
- scroll_element.xdsoftScroller();
1249
+ datetimepicker
1250
+ .data('options', options)
1251
+ .on('touchstart mousedown.xdsoft', function (event) {
1252
+ event.stopPropagation();
1253
+ event.preventDefault();
1254
+ yearselect.hide();
1255
+ monthselect.hide();
1256
+ return false;
767
1257
  });
768
1258
 
769
- datetimepicker
770
- .append(datepicker)
771
- .append(timepicker);
1259
+ //scroll_element = timepicker.find('.xdsoft_time_box');
1260
+ timeboxparent.append(timebox);
1261
+ timeboxparent.xdsoftScroller();
772
1262
 
773
- if( options.withoutCopyright!==true )
774
- datetimepicker
775
- .append(xdsoft_copyright);
1263
+ datetimepicker.on('afterOpen.xdsoft', function () {
1264
+ timeboxparent.xdsoftScroller();
1265
+ });
776
1266
 
777
- datepicker
778
- .append(mounth_picker)
779
- .append(calendar);
1267
+ datetimepicker
1268
+ .append(datepicker)
1269
+ .append(timepicker);
780
1270
 
781
- $(options.parentID)
782
- .append(datetimepicker);
1271
+ if (options.withoutCopyright !== true) {
1272
+ datetimepicker
1273
+ .append(xdsoft_copyright);
1274
+ }
783
1275
 
784
- var _xdsoft_datetime = new function() {
785
- var _this = this;
786
- _this.now = function( norecursion ) {
787
- var d = new Date();
1276
+ datepicker
1277
+ .append(mounth_picker)
1278
+ .append(calendar)
1279
+ .append(applyButton);
1280
+
1281
+ $(options.parentID)
1282
+ .append(datetimepicker);
1283
+
1284
+ XDSoft_datetime = function () {
1285
+ var _this = this;
1286
+ _this.now = function (norecursion) {
1287
+ var d = new Date(),
1288
+ date,
1289
+ time;
1290
+
1291
+ if (!norecursion && options.defaultDate) {
1292
+ date = _this.strToDateTime(options.defaultDate);
1293
+ d.setFullYear(date.getFullYear());
1294
+ d.setMonth(date.getMonth());
1295
+ d.setDate(date.getDate());
1296
+ }
788
1297
 
789
- if( !norecursion && options.defaultDate ){
790
- var date = _this.strToDate(options.defaultDate);
791
- d.setFullYear( date.getFullYear() );
792
- d.setMonth( date.getMonth() );
793
- d.setDate( date.getDate() );
794
- }
1298
+ if (options.yearOffset) {
1299
+ d.setFullYear(d.getFullYear() + options.yearOffset);
1300
+ }
795
1301
 
796
- if( options.yearOffset ){
797
- d.setFullYear(d.getFullYear()+options.yearOffset);
798
- }
1302
+ if (!norecursion && options.defaultTime) {
1303
+ time = _this.strtotime(options.defaultTime);
1304
+ d.setHours(time.getHours());
1305
+ d.setMinutes(time.getMinutes());
1306
+ }
1307
+ return d;
1308
+ };
799
1309
 
800
- if( !norecursion && options.defaultTime ){
801
- var time = _this.strtotime(options.defaultTime);
802
- d.setHours( time.getHours() );
803
- d.setMinutes( time.getMinutes() );
804
- }
1310
+ _this.isValidDate = function (d) {
1311
+ if (Object.prototype.toString.call(d) !== "[object Date]") {
1312
+ return false;
1313
+ }
1314
+ return !isNaN(d.getTime());
1315
+ };
805
1316
 
806
- return d;
807
- };
1317
+ _this.setCurrentTime = function (dTime) {
1318
+ _this.currentTime = (typeof dTime === 'string') ? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime : _this.now();
1319
+ datetimepicker.trigger('xchange.xdsoft');
1320
+ };
808
1321
 
1322
+ _this.empty = function () {
1323
+ _this.currentTime = null;
1324
+ };
809
1325
 
810
- _this.isValidDate = function (d) {
811
- if ( Object.prototype.toString.call(d) !== "[object Date]" )
812
- return false;
813
- return !isNaN(d.getTime());
814
- };
1326
+ _this.getCurrentTime = function (dTime) {
1327
+ return _this.currentTime;
1328
+ };
815
1329
 
816
- _this.setCurrentTime = function( dTime ) {
817
- _this.currentTime = (typeof dTime == 'string')? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime: _this.now();
818
- datetimepicker.trigger('xchange.xdsoft');
819
- };
1330
+ _this.nextMonth = function () {
820
1331
 
821
- _this.empty = function() {
822
- _this.currentTime = null;
823
- };
1332
+ if (_this.currentTime === undefined || _this.currentTime === null) {
1333
+ _this.currentTime = _this.now();
1334
+ }
824
1335
 
825
- _this.getCurrentTime = function( dTime) {
826
- return _this.currentTime;
827
- };
1336
+ var month = _this.currentTime.getMonth() + 1,
1337
+ year;
1338
+ if (month === 12) {
1339
+ _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
1340
+ month = 0;
1341
+ }
828
1342
 
829
- _this.nextMonth = function() {
830
- var month = _this.currentTime.getMonth()+1;
831
- if( month==12 ) {
832
- _this.currentTime.setFullYear(_this.currentTime.getFullYear()+1);
833
- month = 0;
834
- }
835
- var year = _this.currentTime.getFullYear();
836
-
837
- _this.currentTime.setDate(
838
- Math.min(
839
- new Date(_this.currentTime.getFullYear(), month+1, 0).getDate(),
840
- _this.currentTime.getDate()
841
- )
842
- );
843
- _this.currentTime.setMonth(month);
844
- options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
845
-
846
- if( year!=_this.currentTime.getFullYear() && $.isFunction(options.onChangeYear) ){
847
- options.onChangeYear.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
848
- }
1343
+ year = _this.currentTime.getFullYear();
849
1344
 
850
- datetimepicker.trigger('xchange.xdsoft');
851
- return month;
852
- };
1345
+ _this.currentTime.setDate(
1346
+ Math.min(
1347
+ new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
1348
+ _this.currentTime.getDate()
1349
+ )
1350
+ );
1351
+ _this.currentTime.setMonth(month);
853
1352
 
854
- _this.prevMonth = function() {
855
- var month = _this.currentTime.getMonth()-1;
856
- if( month==-1 ) {
857
- _this.currentTime.setFullYear(_this.currentTime.getFullYear()-1);
858
- month = 11;
859
- }
860
- _this.currentTime.setDate(
861
- Math.min(
862
- new Date(_this.currentTime.getFullYear(), month+1, 0).getDate(),
863
- _this.currentTime.getDate()
864
- )
865
- );
866
- _this.currentTime.setMonth(month);
867
- options.onChangeMonth&&options.onChangeMonth.call&&options.onChangeMonth.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
868
- datetimepicker.trigger('xchange.xdsoft');
869
- return month;
870
- };
1353
+ if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
1354
+ options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1355
+ }
871
1356
 
872
- _this.getWeekOfYear = function( datetime ) {
873
- var onejan = new Date( datetime.getFullYear(),0,1 );
874
- return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay()+1)/7);
875
- };
1357
+ if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
1358
+ options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1359
+ }
876
1360
 
877
- _this.strToDateTime = function( sDateTime ) {
878
- if( sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime) )
879
- return sDateTime;
1361
+ datetimepicker.trigger('xchange.xdsoft');
1362
+ return month;
1363
+ };
880
1364
 
881
- var tmpDate = [],timeOffset,currentTime;
1365
+ _this.prevMonth = function () {
882
1366
 
883
- if( ( tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime) ) && ( tmpDate[2]=Date.parseDate(tmpDate[2], options.formatDate) ) ) {
884
- timeOffset = tmpDate[2].getTime()-(tmpDate[2].getTimezoneOffset())*60000;
885
- currentTime = new Date((_xdsoft_datetime.now()).getTime()+parseInt(tmpDate[1]+'1')*timeOffset);
886
- }else
887
- currentTime = sDateTime?Date.parseDate(sDateTime, options.format):_this.now();
1367
+ if (_this.currentTime === undefined || _this.currentTime === null) {
1368
+ _this.currentTime = _this.now();
1369
+ }
888
1370
 
889
- if( !_this.isValidDate(currentTime) )
890
- currentTime = _this.now();
1371
+ var month = _this.currentTime.getMonth() - 1;
1372
+ if (month === -1) {
1373
+ _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
1374
+ month = 11;
1375
+ }
1376
+ _this.currentTime.setDate(
1377
+ Math.min(
1378
+ new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
1379
+ _this.currentTime.getDate()
1380
+ )
1381
+ );
1382
+ _this.currentTime.setMonth(month);
1383
+ if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
1384
+ options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1385
+ }
1386
+ datetimepicker.trigger('xchange.xdsoft');
1387
+ return month;
1388
+ };
891
1389
 
892
- return currentTime;
893
- };
1390
+ _this.getWeekOfYear = function (datetime) {
1391
+ var onejan = new Date(datetime.getFullYear(), 0, 1);
1392
+ return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
1393
+ };
894
1394
 
895
- _this.strToDate = function( sDate ) {
896
- if( sDate && sDate instanceof Date && _this.isValidDate(sDate) )
897
- return sDate;
1395
+ _this.strToDateTime = function (sDateTime) {
1396
+ var tmpDate = [], timeOffset, currentTime;
898
1397
 
899
- var currentTime = sDate?Date.parseDate(sDate, options.formatDate):_this.now(true);
900
- if( !_this.isValidDate(currentTime) )
901
- currentTime = _this.now(true);
1398
+ if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
1399
+ return sDateTime;
1400
+ }
902
1401
 
903
- return currentTime;
904
- };
1402
+ tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime);
1403
+ if (tmpDate) {
1404
+ tmpDate[2] = Date.parseDate(tmpDate[2], options.formatDate);
1405
+ }
1406
+ if (tmpDate && tmpDate[2]) {
1407
+ timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
1408
+ currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
1409
+ } else {
1410
+ currentTime = sDateTime ? Date.parseDate(sDateTime, options.format) : _this.now();
1411
+ }
905
1412
 
906
- _this.strtotime = function( sTime ) {
907
- if( sTime && sTime instanceof Date && _this.isValidDate(sTime) )
908
- return sTime;
1413
+ if (!_this.isValidDate(currentTime)) {
1414
+ currentTime = _this.now();
1415
+ }
909
1416
 
910
- var currentTime = sTime?Date.parseDate(sTime, options.formatTime):_this.now(true);
911
- if( !_this.isValidDate(currentTime) )
912
- currentTime = _this.now(true);
1417
+ return currentTime;
1418
+ };
913
1419
 
914
- return currentTime;
915
- };
1420
+ _this.strToDate = function (sDate) {
1421
+ if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
1422
+ return sDate;
1423
+ }
916
1424
 
917
- _this.str = function() {
918
- return _this.currentTime.dateFormat(options.format);
919
- };
1425
+ var currentTime = sDate ? Date.parseDate(sDate, options.formatDate) : _this.now(true);
1426
+ if (!_this.isValidDate(currentTime)) {
1427
+ currentTime = _this.now(true);
1428
+ }
1429
+ return currentTime;
1430
+ };
920
1431
 
921
- _this.currentTime = this.now();
1432
+ _this.strtotime = function (sTime) {
1433
+ if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
1434
+ return sTime;
1435
+ }
1436
+ var currentTime = sTime ? Date.parseDate(sTime, options.formatTime) : _this.now(true);
1437
+ if (!_this.isValidDate(currentTime)) {
1438
+ currentTime = _this.now(true);
1439
+ }
1440
+ return currentTime;
922
1441
  };
923
- mounth_picker
924
- .find('.xdsoft_today_button')
925
- .on('mousedown.xdsoft',function() {
926
- datetimepicker.data('changed',true);
927
- _xdsoft_datetime.setCurrentTime(0);
928
- datetimepicker.trigger('afterOpen.xdsoft');
929
- }).on('dblclick.xdsoft',function(){
930
- input.val( _xdsoft_datetime.str() );
931
- datetimepicker.trigger('close.xdsoft');
932
- });
933
- mounth_picker
934
- .find('.xdsoft_prev,.xdsoft_next')
935
- .on('mousedown.xdsoft',function() {
936
- var $this = $(this),
937
- timer = 0,
938
- stop = false;
939
-
940
- (function arguments_callee1(v) {
941
- var month = _xdsoft_datetime.currentTime.getMonth();
942
- if( $this.hasClass( options.next ) ) {
943
- _xdsoft_datetime.nextMonth();
944
- }else if( $this.hasClass( options.prev ) ) {
945
- _xdsoft_datetime.prevMonth();
946
- }
947
- if (options.monthChangeSpinner) {
948
- !stop&&(timer = setTimeout(arguments_callee1,v?v:100));
949
- }
950
- })(500);
951
1442
 
952
- $([document.body,window]).on('mouseup.xdsoft',function arguments_callee2() {
953
- clearTimeout(timer);
954
- stop = true;
955
- $([document.body,window]).off('mouseup.xdsoft',arguments_callee2);
956
- });
957
- });
1443
+ _this.str = function () {
1444
+ return _this.currentTime.dateFormat(options.format);
1445
+ };
1446
+ _this.currentTime = this.now();
1447
+ };
958
1448
 
959
- timepicker
960
- .find('.xdsoft_prev,.xdsoft_next')
961
- .on('mousedown.xdsoft',function() {
962
- var $this = $(this),
963
- timer = 0,
964
- stop = false,
965
- period = 110;
966
- (function arguments_callee4(v) {
967
- var pheight = timeboxparent[0].clientHeight,
968
- height = timebox[0].offsetHeight,
969
- top = Math.abs(parseInt(timebox.css('marginTop')));
970
- if( $this.hasClass(options.next) && (height-pheight)- options.timeHeightInTimePicker>=top ) {
971
- timebox.css('marginTop','-'+(top+options.timeHeightInTimePicker)+'px')
972
- }else if( $this.hasClass(options.prev) && top-options.timeHeightInTimePicker>=0 ) {
973
- timebox.css('marginTop','-'+(top-options.timeHeightInTimePicker)+'px')
974
- }
975
- timeboxparent.trigger('scroll_element.xdsoft_scroller',[Math.abs(parseInt(timebox.css('marginTop'))/(height-pheight))]);
976
- period= ( period>10 )?10:period-10;
977
- !stop&&(timer = setTimeout(arguments_callee4,v?v:period));
978
- })(500);
979
- $([document.body,window]).on('mouseup.xdsoft',function arguments_callee5() {
980
- clearTimeout(timer);
981
- stop = true;
982
- $([document.body,window])
983
- .off('mouseup.xdsoft',arguments_callee5);
984
- });
985
- });
1449
+ _xdsoft_datetime = new XDSoft_datetime();
986
1450
 
987
- var xchangeTimer = 0;
988
- // base handler - generating a calendar and timepicker
989
- datetimepicker
990
- .on('xchange.xdsoft',function( event ) {
991
- clearTimeout(xchangeTimer);
992
- xchangeTimer = setTimeout(function(){
993
- var table = '',
994
- start = new Date(_xdsoft_datetime.currentTime.getFullYear(),_xdsoft_datetime.currentTime.getMonth(),1, 12, 0, 0),
995
- i = 0,
996
- today = _xdsoft_datetime.now();
1451
+ applyButton.on('touchend click', function (e) {//pathbrite
1452
+ e.preventDefault();
1453
+ datetimepicker.data('changed', true);
1454
+ _xdsoft_datetime.setCurrentTime(getCurrentValue());
1455
+ input.val(_xdsoft_datetime.str());
1456
+ datetimepicker.trigger('close.xdsoft');
1457
+ });
1458
+ mounth_picker
1459
+ .find('.xdsoft_today_button')
1460
+ .on('touchend mousedown.xdsoft', function () {
1461
+ datetimepicker.data('changed', true);
1462
+ _xdsoft_datetime.setCurrentTime(0);
1463
+ datetimepicker.trigger('afterOpen.xdsoft');
1464
+ }).on('dblclick.xdsoft', function () {
1465
+ var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
1466
+ currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
1467
+ minDate = _xdsoft_datetime.strToDate(options.minDate);
1468
+ minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
1469
+ if (currentDate < minDate) {
1470
+ return;
1471
+ }
1472
+ maxDate = _xdsoft_datetime.strToDate(options.maxDate);
1473
+ maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
1474
+ if (currentDate > maxDate) {
1475
+ return;
1476
+ }
1477
+ input.val(_xdsoft_datetime.str());
1478
+ input.trigger('change');
1479
+ datetimepicker.trigger('close.xdsoft');
1480
+ });
1481
+ mounth_picker
1482
+ .find('.xdsoft_prev,.xdsoft_next')
1483
+ .on('touchend mousedown.xdsoft', function () {
1484
+ var $this = $(this),
1485
+ timer = 0,
1486
+ stop = false;
1487
+
1488
+ (function arguments_callee1(v) {
1489
+ if ($this.hasClass(options.next)) {
1490
+ _xdsoft_datetime.nextMonth();
1491
+ } else if ($this.hasClass(options.prev)) {
1492
+ _xdsoft_datetime.prevMonth();
1493
+ }
1494
+ if (options.monthChangeSpinner) {
1495
+ if (!stop) {
1496
+ timer = setTimeout(arguments_callee1, v || 100);
1497
+ }
1498
+ }
1499
+ }(500));
997
1500
 
998
- while( start.getDay()!=options.dayOfWeekStart )
999
- start.setDate(start.getDate()-1);
1501
+ $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee2() {
1502
+ clearTimeout(timer);
1503
+ stop = true;
1504
+ $([document.body, window]).off('touchend mouseup.xdsoft', arguments_callee2);
1505
+ });
1506
+ });
1000
1507
 
1001
- table+='<table><thead><tr>';
1508
+ timepicker
1509
+ .find('.xdsoft_prev,.xdsoft_next')
1510
+ .on('touchend mousedown.xdsoft', function () {
1511
+ var $this = $(this),
1512
+ timer = 0,
1513
+ stop = false,
1514
+ period = 110;
1515
+ (function arguments_callee4(v) {
1516
+ var pheight = timeboxparent[0].clientHeight,
1517
+ height = timebox[0].offsetHeight,
1518
+ top = Math.abs(parseInt(timebox.css('marginTop'), 10));
1519
+ if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
1520
+ timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
1521
+ } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
1522
+ timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
1523
+ }
1524
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox.css('marginTop'), 10) / (height - pheight))]);
1525
+ period = (period > 10) ? 10 : period - 10;
1526
+ if (!stop) {
1527
+ timer = setTimeout(arguments_callee4, v || period);
1528
+ }
1529
+ }(500));
1530
+ $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee5() {
1531
+ clearTimeout(timer);
1532
+ stop = true;
1533
+ $([document.body, window])
1534
+ .off('touchend mouseup.xdsoft', arguments_callee5);
1535
+ });
1536
+ });
1002
1537
 
1003
- if(options.weeks) {
1004
- table+='<th></th>';
1005
- }
1538
+ xchangeTimer = 0;
1539
+ // base handler - generating a calendar and timepicker
1540
+ datetimepicker
1541
+ .on('xchange.xdsoft', function (event) {
1542
+ clearTimeout(xchangeTimer);
1543
+ xchangeTimer = setTimeout(function () {
1006
1544
 
1007
- for(var j = 0; j<7; j++) {
1008
- table+='<th>'+options.i18n[options.lang].dayOfWeek[(j+options.dayOfWeekStart)%7]+'</th>';
1009
- }
1545
+ if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
1546
+ _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1547
+ }
1010
1548
 
1011
- table+='</tr></thead>';
1012
- table+='<tbody>';
1013
- var maxDate = false, minDate = false;
1549
+ var table = '',
1550
+ start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
1551
+ i = 0,
1552
+ j,
1553
+ today = _xdsoft_datetime.now(),
1554
+ maxDate = false,
1555
+ minDate = false,
1556
+ hDate,
1557
+ day,
1558
+ d,
1559
+ y,
1560
+ m,
1561
+ w,
1562
+ classes = [],
1563
+ customDateSettings,
1564
+ newRow = true,
1565
+ time = '',
1566
+ h = '',
1567
+ line_time,
1568
+ description;
1569
+
1570
+ while (start.getDay() !== options.dayOfWeekStart) {
1571
+ start.setDate(start.getDate() - 1);
1572
+ }
1014
1573
 
1015
- if( options.maxDate!==false ) {
1016
- maxDate = _xdsoft_datetime.strToDate(options.maxDate);
1017
- maxDate = new Date(maxDate.getFullYear(),maxDate.getMonth(),maxDate.getDate(),23,59,59,999);
1018
- }
1574
+ table += '<table><thead><tr>';
1019
1575
 
1020
- if( options.minDate!==false ) {
1021
- minDate = _xdsoft_datetime.strToDate(options.minDate);
1022
- minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
1023
- }
1576
+ if (options.weeks) {
1577
+ table += '<th></th>';
1578
+ }
1024
1579
 
1025
- var d,y,m,w,classes = [],customDateSettings,newRow=true;
1580
+ for (j = 0; j < 7; j += 1) {
1581
+ table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>';
1582
+ }
1026
1583
 
1027
- while( i<_xdsoft_datetime.currentTime.countDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) {
1028
- classes = [];
1029
- i++;
1584
+ table += '</tr></thead>';
1585
+ table += '<tbody>';
1030
1586
 
1031
- d = start.getDate();
1032
- y = start.getFullYear();
1033
- m = start.getMonth();
1034
- w = _xdsoft_datetime.getWeekOfYear(start);
1587
+ if (options.maxDate !== false) {
1588
+ maxDate = _xdsoft_datetime.strToDate(options.maxDate);
1589
+ maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
1590
+ }
1035
1591
 
1036
- classes.push('xdsoft_date');
1592
+ if (options.minDate !== false) {
1593
+ minDate = _xdsoft_datetime.strToDate(options.minDate);
1594
+ minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
1595
+ }
1037
1596
 
1038
- if ( options.beforeShowDay && options.beforeShowDay.call ) {
1039
- customDateSettings = options.beforeShowDay.call(datetimepicker, start);
1040
- } else {
1041
- customDateSettings = null;
1042
- }
1597
+ while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
1598
+ classes = [];
1599
+ i += 1;
1043
1600
 
1044
- if( ( maxDate!==false && start > maxDate )||( minDate!==false && start < minDate )||(customDateSettings && customDateSettings[0] === false) ){
1045
- classes.push('xdsoft_disabled');
1046
- }
1601
+ day = start.getDay();
1602
+ d = start.getDate();
1603
+ y = start.getFullYear();
1604
+ m = start.getMonth();
1605
+ w = _xdsoft_datetime.getWeekOfYear(start);
1606
+ description = '';
1047
1607
 
1048
- if ( customDateSettings && customDateSettings[1] != "" ) {
1049
- classes.push(customDateSettings[1]);
1050
- }
1608
+ classes.push('xdsoft_date');
1051
1609
 
1052
- if( _xdsoft_datetime.currentTime.getMonth()!=m ) classes.push('xdsoft_other_month');
1610
+ if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) {
1611
+ customDateSettings = options.beforeShowDay.call(datetimepicker, start);
1612
+ } else {
1613
+ customDateSettings = null;
1614
+ }
1053
1615
 
1054
- if( (options.defaultSelect||datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat( options.formatDate )==start.dateFormat( options.formatDate ) ) {
1055
- classes.push('xdsoft_current');
1056
- }
1616
+ if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) {
1617
+ classes.push('xdsoft_disabled');
1618
+ } else if (options.disabledDates.indexOf(start.dateFormat(options.formatDate)) !== -1) {
1619
+ classes.push('xdsoft_disabled');
1620
+ } else if (options.disabledWeekDays.indexOf(day) !== -1) {
1621
+ classes.push('xdsoft_disabled');
1622
+ }
1057
1623
 
1058
- if( today.dateFormat( options.formatDate )==start.dateFormat( options.formatDate ) ) {
1059
- classes.push('xdsoft_today');
1060
- }
1624
+ if (customDateSettings && customDateSettings[1] !== "") {
1625
+ classes.push(customDateSettings[1]);
1626
+ }
1061
1627
 
1062
- if( start.getDay()==0||start.getDay()==6||~options.weekends.indexOf(start.dateFormat( options.formatDate )) ) {
1063
- classes.push('xdsoft_weekend');
1064
- }
1628
+ if (_xdsoft_datetime.currentTime.getMonth() !== m) {
1629
+ classes.push('xdsoft_other_month');
1630
+ }
1065
1631
 
1066
- if(options.beforeShowDay && typeof options.beforeShowDay == 'function') {
1067
- classes.push(options.beforeShowDay(start))
1068
- }
1632
+ if ((options.defaultSelect || datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) {
1633
+ classes.push('xdsoft_current');
1634
+ }
1069
1635
 
1070
- if( newRow ) {
1071
- table+='<tr>';
1072
- newRow = false;
1636
+ if (today.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) {
1637
+ classes.push('xdsoft_today');
1638
+ }
1073
1639
 
1074
- if(options.weeks) {
1075
- table+='<th>'+w+'</th>';
1076
- }
1077
- }
1640
+ if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(start.dateFormat(options.formatDate)) !== -1) {
1641
+ classes.push('xdsoft_weekend');
1642
+ }
1078
1643
 
1079
- table+='<td data-date="'+d+'" data-month="'+m+'" data-year="'+y+'"'+' class="xdsoft_date xdsoft_day_of_week'+start.getDay()+' '+ classes.join(' ')+'">'+
1080
- '<div>'+d+'</div>'+
1081
- '</td>';
1644
+ if (options.highlightedDates[start.dateFormat(options.formatDate)] !== undefined) {
1645
+ hDate = options.highlightedDates[start.dateFormat(options.formatDate)];
1646
+ classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
1647
+ description = hDate.desc === undefined ? '' : hDate.desc;
1648
+ }
1082
1649
 
1083
- if( start.getDay()==options.dayOfWeekStartPrev ) {
1084
- table+='</tr>';
1085
- newRow = true;
1086
- }
1650
+ if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
1651
+ classes.push(options.beforeShowDay(start));
1652
+ }
1087
1653
 
1088
- start.setDate(d+1);
1089
- }
1090
- table+='</tbody></table>';
1091
-
1092
- calendar.html(table);
1093
-
1094
- mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]);
1095
- mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
1096
-
1097
- // generate timebox
1098
- var time = '',
1099
- h = '',
1100
- m ='',
1101
- line_time = function line_time( h,m ) {
1102
- var now = _xdsoft_datetime.now();
1103
- now.setHours(h);
1104
- h = parseInt(now.getHours());
1105
- now.setMinutes(m);
1106
- m = parseInt(now.getMinutes());
1107
-
1108
- classes = [];
1109
- if( (options.maxTime!==false&&_xdsoft_datetime.strtotime(options.maxTime).getTime()<now.getTime())||(options.minTime!==false&&_xdsoft_datetime.strtotime(options.minTime).getTime()>now.getTime()))
1110
- classes.push('xdsoft_disabled');
1111
- if( (options.initTime||options.defaultSelect||datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h)&&(options.step>59||Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m))) {
1112
- if( options.defaultSelect||datetimepicker.data('changed')) {
1113
- classes.push('xdsoft_current');
1114
- } else if( options.initTime ) {
1115
- classes.push('xdsoft_init_time');
1116
- }
1117
- }
1118
- if( parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))
1119
- classes.push('xdsoft_today');
1120
- time+= '<div class="xdsoft_time '+classes.join(' ')+'" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>';
1121
- };
1122
-
1123
- if( !options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length ) {
1124
- for( var i=0,j=0;i<(options.hours12?12:24);i++ ) {
1125
- for( j=0;j<60;j+=options.step ) {
1126
- h = (i<10?'0':'')+i;
1127
- m = (j<10?'0':'')+j;
1128
- line_time( h,m );
1129
- }
1130
- }
1131
- }else{
1132
- for( var i=0;i<options.allowTimes.length;i++ ) {
1133
- h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
1134
- m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
1135
- line_time( h,m );
1136
- }
1654
+ if (newRow) {
1655
+ table += '<tr>';
1656
+ newRow = false;
1657
+ if (options.weeks) {
1658
+ table += '<th>' + w + '</th>';
1137
1659
  }
1660
+ }
1138
1661
 
1139
- timebox.html(time);
1662
+ table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
1663
+ '<div>' + d + '</div>' +
1664
+ '</td>';
1140
1665
 
1141
- var opt = '',
1142
- i = 0;
1666
+ if (start.getDay() === options.dayOfWeekStartPrev) {
1667
+ table += '</tr>';
1668
+ newRow = true;
1669
+ }
1143
1670
 
1144
- for( i = parseInt(options.yearStart,10)+options.yearOffset;i<= parseInt(options.yearEnd,10)+options.yearOffset;i++ ) {
1145
- opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getFullYear()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+i+'</div>';
1146
- }
1147
- yearselect.children().eq(0)
1148
- .html(opt);
1671
+ start.setDate(d + 1);
1672
+ }
1673
+ table += '</tbody></table>';
1674
+
1675
+ calendar.html(table);
1676
+
1677
+ mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]);
1678
+ mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
1679
+
1680
+ // generate timebox
1681
+ time = '';
1682
+ h = '';
1683
+ m = '';
1684
+
1685
+ line_time = function line_time(h, m) {
1686
+ var now = _xdsoft_datetime.now(), optionDateTime, current_time,
1687
+ isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
1688
+ now.setHours(h);
1689
+ h = parseInt(now.getHours(), 10);
1690
+ now.setMinutes(m);
1691
+ m = parseInt(now.getMinutes(), 10);
1692
+ optionDateTime = new Date(_xdsoft_datetime.currentTime);
1693
+ optionDateTime.setHours(h);
1694
+ optionDateTime.setMinutes(m);
1695
+ classes = [];
1696
+ if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) {
1697
+ classes.push('xdsoft_disabled');
1698
+ }
1699
+ if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) {
1700
+ classes.push('xdsoft_disabled');
1701
+ }
1149
1702
 
1150
- for( i = 0,opt = '';i<= 11;i++ ) {
1151
- opt+='<div class="xdsoft_option '+(_xdsoft_datetime.currentTime.getMonth()==i?'xdsoft_current':'')+'" data-value="'+i+'">'+options.i18n[options.lang].months[i]+'</div>';
1152
- }
1153
- monthselect.children().eq(0).html(opt);
1154
- $(datetimepicker)
1155
- .trigger('generate.xdsoft');
1156
- },10);
1157
- event.stopPropagation();
1158
- })
1159
- .on('afterOpen.xdsoft',function() {
1160
- if( options.timepicker ) {
1161
- var classType;
1162
- if( timebox.find('.xdsoft_current').length ) {
1163
- classType = '.xdsoft_current';
1164
- } else if( timebox.find('.xdsoft_init_time').length ) {
1165
- classType = '.xdsoft_init_time';
1703
+ current_time = new Date(_xdsoft_datetime.currentTime);
1704
+ current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
1705
+
1706
+ if (!isALlowTimesInit) {
1707
+ current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
1166
1708
  }
1167
1709
 
1168
- if( classType ) {
1169
- var pheight = timeboxparent[0].clientHeight,
1170
- height = timebox[0].offsetHeight,
1171
- top = timebox.find(classType).index()*options.timeHeightInTimePicker+1;
1172
- if( (height-pheight)<top )
1173
- top = height-pheight;
1174
- timeboxparent.trigger('scroll_element.xdsoft_scroller',[parseInt(top)/(height-pheight)]);
1175
- }else{
1176
- timeboxparent.trigger('scroll_element.xdsoft_scroller',[0]);
1710
+ if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
1711
+ if (options.defaultSelect || datetimepicker.data('changed')) {
1712
+ classes.push('xdsoft_current');
1713
+ } else if (options.initTime) {
1714
+ classes.push('xdsoft_init_time');
1715
+ }
1716
+ }
1717
+ if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
1718
+ classes.push('xdsoft_today');
1719
+ }
1720
+ time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + now.dateFormat(options.formatTime) + '</div>';
1721
+ };
1722
+
1723
+ if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
1724
+ for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) {
1725
+ for (j = 0; j < 60; j += options.step) {
1726
+ h = (i < 10 ? '0' : '') + i;
1727
+ m = (j < 10 ? '0' : '') + j;
1728
+ line_time(h, m);
1729
+ }
1730
+ }
1731
+ } else {
1732
+ for (i = 0; i < options.allowTimes.length; i += 1) {
1733
+ h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
1734
+ m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
1735
+ line_time(h, m);
1177
1736
  }
1178
1737
  }
1179
- });
1180
1738
 
1181
- var timerclick = 0;
1739
+ timebox.html(time);
1182
1740
 
1183
- calendar
1184
- .on('click.xdsoft', 'td', function (xdevent) {
1185
- xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
1186
- timerclick++;
1187
- var $this = $(this),
1188
- currentTime = _xdsoft_datetime.currentTime;
1741
+ opt = '';
1742
+ i = 0;
1189
1743
 
1190
- if( currentTime===undefined||currentTime===null ){
1191
- _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1192
- currentTime = _xdsoft_datetime.currentTime;
1193
- }
1744
+ for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) {
1745
+ opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>';
1746
+ }
1747
+ yearselect.children().eq(0)
1748
+ .html(opt);
1194
1749
 
1195
- if( $this.hasClass('xdsoft_disabled') )
1196
- return false;
1750
+ for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
1751
+ opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>';
1752
+ }
1753
+ monthselect.children().eq(0).html(opt);
1754
+ $(datetimepicker)
1755
+ .trigger('generate.xdsoft');
1756
+ }, 10);
1757
+ event.stopPropagation();
1758
+ })
1759
+ .on('afterOpen.xdsoft', function () {
1760
+ if (options.timepicker) {
1761
+ var classType, pheight, height, top;
1762
+ if (timebox.find('.xdsoft_current').length) {
1763
+ classType = '.xdsoft_current';
1764
+ } else if (timebox.find('.xdsoft_init_time').length) {
1765
+ classType = '.xdsoft_init_time';
1766
+ }
1767
+ if (classType) {
1768
+ pheight = timeboxparent[0].clientHeight;
1769
+ height = timebox[0].offsetHeight;
1770
+ top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
1771
+ if ((height - pheight) < top) {
1772
+ top = height - pheight;
1773
+ }
1774
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
1775
+ } else {
1776
+ timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
1777
+ }
1778
+ }
1779
+ });
1197
1780
 
1198
- currentTime.setDate( 1 );
1199
- currentTime.setFullYear( $this.data('year') );
1200
- currentTime.setMonth( $this.data('month') );
1201
- currentTime.setDate( $this.data('date') );
1781
+ timerclick = 0;
1782
+ calendar
1783
+ .on('touchend click.xdsoft', 'td', function (xdevent) {
1784
+ xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
1785
+ timerclick += 1;
1786
+ var $this = $(this),
1787
+ currentTime = _xdsoft_datetime.currentTime;
1788
+
1789
+ if (currentTime === undefined || currentTime === null) {
1790
+ _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1791
+ currentTime = _xdsoft_datetime.currentTime;
1792
+ }
1202
1793
 
1203
- datetimepicker.trigger('select.xdsoft',[currentTime]);
1794
+ if ($this.hasClass('xdsoft_disabled')) {
1795
+ return false;
1796
+ }
1204
1797
 
1205
- input.val( _xdsoft_datetime.str() );
1206
- if( (timerclick>1||(options.closeOnDateSelect===true||( options.closeOnDateSelect===0&&!options.timepicker )))&&!options.inline ) {
1207
- datetimepicker.trigger('close.xdsoft');
1208
- }
1798
+ currentTime.setDate(1);
1799
+ currentTime.setFullYear($this.data('year'));
1800
+ currentTime.setMonth($this.data('month'));
1801
+ currentTime.setDate($this.data('date'));
1209
1802
 
1210
- if( options.onSelectDate && options.onSelectDate.call ) {
1211
- options.onSelectDate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1212
- }
1803
+ datetimepicker.trigger('select.xdsoft', [currentTime]);
1213
1804
 
1214
- datetimepicker.data('changed',true);
1215
- datetimepicker.trigger('xchange.xdsoft');
1216
- datetimepicker.trigger('changedatetime.xdsoft');
1217
- setTimeout(function(){
1218
- timerclick = 0;
1219
- },200);
1220
- });
1805
+ input.val(_xdsoft_datetime.str());
1221
1806
 
1222
- timebox
1223
- .on('click.xdsoft', 'div', function (xdevent) {
1224
- xdevent.stopPropagation();
1225
- var $this = $(this),
1226
- currentTime = _xdsoft_datetime.currentTime;
1807
+ if (options.onSelectDate && $.isFunction(options.onSelectDate)) {
1808
+ options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
1809
+ }
1227
1810
 
1228
- if( currentTime===undefined||currentTime===null ){
1229
- _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1230
- currentTime = _xdsoft_datetime.currentTime;
1231
- }
1811
+ datetimepicker.data('changed', true);
1812
+ datetimepicker.trigger('xchange.xdsoft');
1813
+ datetimepicker.trigger('changedatetime.xdsoft');
1814
+ if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
1815
+ datetimepicker.trigger('close.xdsoft');
1816
+ }
1817
+ setTimeout(function () {
1818
+ timerclick = 0;
1819
+ }, 200);
1820
+ });
1232
1821
 
1233
- if( $this.hasClass('xdsoft_disabled') )
1234
- return false;
1235
- currentTime.setHours($this.data('hour'));
1236
- currentTime.setMinutes($this.data('minute'));
1237
- datetimepicker.trigger('select.xdsoft',[currentTime]);
1822
+ timebox
1823
+ .on('touchend click.xdsoft', 'div', function (xdevent) {
1824
+ xdevent.stopPropagation();
1825
+ var $this = $(this),
1826
+ currentTime = _xdsoft_datetime.currentTime;
1238
1827
 
1239
- datetimepicker.data('input').val( _xdsoft_datetime.str() );
1828
+ if (currentTime === undefined || currentTime === null) {
1829
+ _xdsoft_datetime.currentTime = _xdsoft_datetime.now();
1830
+ currentTime = _xdsoft_datetime.currentTime;
1831
+ }
1240
1832
 
1241
- !options.inline&&datetimepicker.trigger('close.xdsoft');
1833
+ if ($this.hasClass('xdsoft_disabled')) {
1834
+ return false;
1835
+ }
1836
+ currentTime.setHours($this.data('hour'));
1837
+ currentTime.setMinutes($this.data('minute'));
1838
+ datetimepicker.trigger('select.xdsoft', [currentTime]);
1242
1839
 
1243
- if( options.onSelectTime&&options.onSelectTime.call ) {
1244
- options.onSelectTime.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1245
- }
1246
- datetimepicker.data('changed',true);
1247
- datetimepicker.trigger('xchange.xdsoft');
1248
- datetimepicker.trigger('changedatetime.xdsoft');
1249
- });
1840
+ datetimepicker.data('input').val(_xdsoft_datetime.str());
1250
1841
 
1251
- datetimepicker.mousewheel&&datepicker.mousewheel(function(event, delta, deltaX, deltaY) {
1252
- if( !options.scrollMonth )
1842
+ if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
1843
+ options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
1844
+ }
1845
+ datetimepicker.data('changed', true);
1846
+ datetimepicker.trigger('xchange.xdsoft');
1847
+ datetimepicker.trigger('changedatetime.xdsoft');
1848
+ if (options.inline !== true && options.closeOnTimeSelect === true) {
1849
+ datetimepicker.trigger('close.xdsoft');
1850
+ }
1851
+ });
1852
+
1853
+
1854
+ datepicker
1855
+ .on('mousewheel.xdsoft', function (event) {
1856
+ if (!options.scrollMonth) {
1253
1857
  return true;
1254
- if( delta<0 )
1858
+ }
1859
+ if (event.deltaY < 0) {
1255
1860
  _xdsoft_datetime.nextMonth();
1256
- else
1861
+ } else {
1257
1862
  _xdsoft_datetime.prevMonth();
1863
+ }
1258
1864
  return false;
1259
1865
  });
1260
1866
 
1261
- datetimepicker.mousewheel&&timeboxparent.unmousewheel().mousewheel(function(event, delta, deltaX, deltaY) {
1262
- if( !options.scrollTime )
1867
+ input
1868
+ .on('mousewheel.xdsoft', function (event) {
1869
+ if (!options.scrollInput) {
1263
1870
  return true;
1264
- var pheight = timeboxparent[0].clientHeight,
1265
- height = timebox[0].offsetHeight,
1266
- top = Math.abs(parseInt(timebox.css('marginTop'))),
1267
- fl = true;
1268
- if( delta<0 && (height-pheight)-options.timeHeightInTimePicker>=top ) {
1269
- timebox.css('marginTop','-'+(top+options.timeHeightInTimePicker)+'px');
1270
- fl = false;
1271
- }else if( delta>0&&top-options.timeHeightInTimePicker>=0 ) {
1272
- timebox.css('marginTop','-'+(top-options.timeHeightInTimePicker)+'px');
1273
- fl = false;
1274
- }
1275
- timeboxparent.trigger('scroll_element.xdsoft_scroller',[Math.abs(parseInt(timebox.css('marginTop'))/(height-pheight))]);
1276
- event.stopPropagation();
1277
- return fl;
1278
- });
1279
-
1280
- var triggerAfterOpen = false;
1281
- datetimepicker
1282
- .on('changedatetime.xdsoft',function() {
1283
- if( options.onChangeDateTime&&options.onChangeDateTime.call ) {
1284
- var $input = datetimepicker.data('input');
1285
- options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input);
1286
- delete options.value;
1287
- $input.trigger('change');
1871
+ }
1872
+ if (!options.datepicker && options.timepicker) {
1873
+ current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
1874
+ if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) {
1875
+ current_time_index += event.deltaY;
1288
1876
  }
1289
- })
1290
- .on('generate.xdsoft',function() {
1291
- if( options.onGenerate&&options.onGenerate.call )
1292
- options.onGenerate.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1293
- if( triggerAfterOpen ){
1294
- datetimepicker.trigger('afterOpen.xdsoft');
1295
- triggerAfterOpen = false;
1877
+ if (timebox.children().eq(current_time_index).length) {
1878
+ timebox.children().eq(current_time_index).trigger('mousedown');
1296
1879
  }
1297
- })
1298
- .on( 'click.xdsoft', function( xdevent ) {
1299
- xdevent.stopPropagation();
1300
- });
1301
-
1302
- var current_time_index = 0;
1303
- input.mousewheel&&input.mousewheel(function( event, delta, deltaX, deltaY ) {
1304
- if( !options.scrollInput )
1305
- return true;
1306
- if( !options.datepicker && options.timepicker ) {
1307
- current_time_index = timebox.find('.xdsoft_current').length?timebox.find('.xdsoft_current').eq(0).index():0;
1308
- if( current_time_index+delta>=0&&current_time_index+delta<timebox.children().length )
1309
- current_time_index+=delta;
1310
- timebox.children().eq(current_time_index).length&&timebox.children().eq(current_time_index).trigger('mousedown');
1311
1880
  return false;
1312
- }else if( options.datepicker && !options.timepicker ) {
1313
- datepicker.trigger( event, [delta, deltaX, deltaY]);
1314
- input.val&&input.val( _xdsoft_datetime.str() );
1881
+ }
1882
+ if (options.datepicker && !options.timepicker) {
1883
+ datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]);
1884
+ if (input.val) {
1885
+ input.val(_xdsoft_datetime.str());
1886
+ }
1315
1887
  datetimepicker.trigger('changedatetime.xdsoft');
1316
1888
  return false;
1317
1889
  }
1318
1890
  });
1319
- var setPos = function() {
1320
- var offset = datetimepicker.data('input').offset(), top = offset.top+datetimepicker.data('input')[0].offsetHeight-1, left = offset.left, position = "absolute";
1321
- if (options.fixed) {
1322
- top -= $(window).scrollTop();
1323
- left -= $(window).scrollLeft();
1324
- position = "fixed";
1325
- }else {
1326
- if( top+datetimepicker[0].offsetHeight>$(window).height()+$(window).scrollTop() )
1327
- top = offset.top-datetimepicker[0].offsetHeight+1;
1328
- if (top < 0)
1329
- top = 0;
1330
- if( left+datetimepicker[0].offsetWidth>$(window).width() )
1331
- left = $(window).width()-datetimepicker[0].offsetWidth;
1332
- }
1333
- datetimepicker.css({
1334
- left:left,
1335
- top:top,
1336
- position: position
1337
- });
1338
- };
1339
- datetimepicker
1340
- .on('open.xdsoft', function() {
1341
- var onShow = true;
1342
- if( options.onShow&&options.onShow.call) {
1343
- onShow = options.onShow.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1344
- }
1345
- if( onShow!==false ) {
1346
- datetimepicker.show();
1347
- setPos();
1348
- $(window)
1349
- .off('resize.xdsoft',setPos)
1350
- .on('resize.xdsoft',setPos);
1351
-
1352
- if( options.closeOnWithoutClick ) {
1353
- $([document.body,window]).on('mousedown.xdsoft',function arguments_callee6() {
1354
- datetimepicker.trigger('close.xdsoft');
1355
- $([document.body,window]).off('mousedown.xdsoft',arguments_callee6);
1356
- });
1357
- }
1358
- }
1359
- })
1360
- .on('close.xdsoft', function( event ) {
1361
- var onClose = true;
1362
1891
 
1363
- mounth_picker
1364
- .find('.xdsoft_month,.xdsoft_year')
1365
- .find('.xdsoft_select')
1366
- .hide();
1892
+ datetimepicker
1893
+ .on('changedatetime.xdsoft', function (event) {
1894
+ if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) {
1895
+ var $input = datetimepicker.data('input');
1896
+ options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
1897
+ delete options.value;
1898
+ $input.trigger('change');
1899
+ }
1900
+ })
1901
+ .on('generate.xdsoft', function () {
1902
+ if (options.onGenerate && $.isFunction(options.onGenerate)) {
1903
+ options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
1904
+ }
1905
+ if (triggerAfterOpen) {
1906
+ datetimepicker.trigger('afterOpen.xdsoft');
1907
+ triggerAfterOpen = false;
1908
+ }
1909
+ })
1910
+ .on('click.xdsoft', function (xdevent) {
1911
+ xdevent.stopPropagation();
1912
+ });
1367
1913
 
1368
- if( options.onClose&&options.onClose.call ) {
1369
- onClose=options.onClose.call(datetimepicker,_xdsoft_datetime.currentTime,datetimepicker.data('input'));
1370
- }
1371
- if( onClose!==false&&!options.opened&&!options.inline ) {
1372
- datetimepicker.hide();
1373
- }
1374
- event.stopPropagation();
1375
- })
1376
- .data('input',input);
1377
-
1378
- var timer = 0,
1379
- timer1 = 0;
1380
-
1381
- datetimepicker.data('xdsoft_datetime',_xdsoft_datetime);
1382
- datetimepicker.setOptions(options);
1383
-
1384
- function getCurrentValue(){
1385
-
1386
- var ct = false;
1387
-
1388
- if ( options.startDate ) {
1389
- ct = _xdsoft_datetime.strToDate(options.startDate);
1390
- } else {
1391
- ct = options.value?options.value:(input&&input.val&&input.val())?input.val():'';
1392
- if( ct ) {
1393
- ct = _xdsoft_datetime.strToDateTime(ct);
1394
- } else if ( options.defaultDate ) {
1395
- ct = _xdsoft_datetime.strToDate(options.defaultDate);
1396
- if( options.defaultTime ){
1397
- var time = _xdsoft_datetime.strtotime(options.defaultTime);
1398
- ct.setHours( time.getHours() );
1399
- ct.setMinutes( time.getMinutes() );
1400
- }
1401
- }
1402
- }
1914
+ current_time_index = 0;
1915
+
1916
+ setPos = function () {
1917
+ var offset = datetimepicker.data('input').offset(), top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, position = "absolute", node;
1918
+ if (datetimepicker.data('input').parent().css('direction') == 'rtl')
1919
+ left -= (datetimepicker.outerWidth() - datetimepicker.data('input').outerWidth());
1920
+ if (options.fixed) {
1921
+ top -= $(window).scrollTop();
1922
+ left -= $(window).scrollLeft();
1923
+ position = "fixed";
1924
+ } else {
1925
+ if (top + datetimepicker[0].offsetHeight > $(window).height() + $(window).scrollTop()) {
1926
+ top = offset.top - datetimepicker[0].offsetHeight + 1;
1927
+ }
1928
+ if (top < 0) {
1929
+ top = 0;
1930
+ }
1931
+ if (left + datetimepicker[0].offsetWidth > $(window).width()) {
1932
+ left = $(window).width() - datetimepicker[0].offsetWidth;
1933
+ }
1934
+ }
1403
1935
 
1404
- if ( ct && _xdsoft_datetime.isValidDate(ct) ) {
1405
- datetimepicker.data('changed',true);
1936
+ node = datetimepicker[0];
1937
+ do {
1938
+ node = node.parentNode;
1939
+ if (window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) {
1940
+ left = left - (($(window).width() - node.offsetWidth) / 2);
1941
+ break;
1942
+ }
1943
+ } while (node.nodeName !== 'HTML');
1944
+ datetimepicker.css({
1945
+ left: left,
1946
+ top: top,
1947
+ position: position
1948
+ });
1949
+ };
1950
+ datetimepicker
1951
+ .on('open.xdsoft', function (event) {
1952
+ var onShow = true;
1953
+ if (options.onShow && $.isFunction(options.onShow)) {
1954
+ onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
1955
+ }
1956
+ if (onShow !== false) {
1957
+ datetimepicker.show();
1958
+ setPos();
1959
+ $(window)
1960
+ .off('resize.xdsoft', setPos)
1961
+ .on('resize.xdsoft', setPos);
1962
+
1963
+ if (options.closeOnWithoutClick) {
1964
+ $([document.body, window]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
1965
+ datetimepicker.trigger('close.xdsoft');
1966
+ $([document.body, window]).off('touchstart mousedown.xdsoft', arguments_callee6);
1967
+ });
1968
+ }
1969
+ }
1970
+ })
1971
+ .on('close.xdsoft', function (event) {
1972
+ var onClose = true;
1973
+ mounth_picker
1974
+ .find('.xdsoft_month,.xdsoft_year')
1975
+ .find('.xdsoft_select')
1976
+ .hide();
1977
+ if (options.onClose && $.isFunction(options.onClose)) {
1978
+ onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
1979
+ }
1980
+ if (onClose !== false && !options.opened && !options.inline) {
1981
+ datetimepicker.hide();
1982
+ }
1983
+ event.stopPropagation();
1984
+ })
1985
+ .on('toggle.xdsoft', function (event) {
1986
+ if (datetimepicker.is(':visible')) {
1987
+ datetimepicker.trigger('close.xdsoft');
1406
1988
  } else {
1407
- ct = '';
1408
- }
1409
-
1410
- return ct?ct:0;
1989
+ datetimepicker.trigger('open.xdsoft');
1990
+ }
1991
+ })
1992
+ .data('input', input);
1993
+
1994
+ timer = 0;
1995
+ timer1 = 0;
1996
+
1997
+ datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
1998
+ datetimepicker.setOptions(options);
1999
+
2000
+ function getCurrentValue() {
2001
+ var ct = false, time;
2002
+
2003
+ if (options.startDate) {
2004
+ ct = _xdsoft_datetime.strToDate(options.startDate);
2005
+ } else {
2006
+ ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
2007
+ if (ct) {
2008
+ ct = _xdsoft_datetime.strToDateTime(ct);
2009
+ } else if (options.defaultDate) {
2010
+ ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
2011
+ if (options.defaultTime) {
2012
+ time = _xdsoft_datetime.strtotime(options.defaultTime);
2013
+ ct.setHours(time.getHours());
2014
+ ct.setMinutes(time.getMinutes());
2015
+ }
2016
+ }
1411
2017
  }
1412
2018
 
1413
- _xdsoft_datetime.setCurrentTime( getCurrentValue() );
2019
+ if (ct && _xdsoft_datetime.isValidDate(ct)) {
2020
+ datetimepicker.data('changed', true);
2021
+ } else {
2022
+ ct = '';
2023
+ }
1414
2024
 
1415
- input
1416
- .data( 'xdsoft_datetimepicker',datetimepicker )
1417
- .on('open.xdsoft focusin.xdsoft mousedown.xdsoft',function(event) {
1418
- if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible')||(input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick) )
1419
- return;
1420
- clearTimeout(timer);
1421
- timer = setTimeout(function() {
1422
- if( input.is(':disabled')||input.is(':hidden')||!input.is(':visible') )
1423
- return;
2025
+ return ct || 0;
2026
+ }
1424
2027
 
1425
- triggerAfterOpen = true;
1426
- _xdsoft_datetime.setCurrentTime(getCurrentValue());
2028
+ _xdsoft_datetime.setCurrentTime(getCurrentValue());
1427
2029
 
1428
- datetimepicker.trigger('open.xdsoft');
1429
- },100);
1430
- })
1431
- .on('keydown.xdsoft',function( event ) {
1432
- var val = this.value,
1433
- key = event.which;
1434
- switch(true) {
1435
- case !!~([ENTER].indexOf(key)):
1436
- var elementSelector = $("input:visible,textarea:visible");
1437
- datetimepicker.trigger('close.xdsoft');
1438
- elementSelector.eq(elementSelector.index(this) + 1).focus();
1439
- return false;
1440
- case !!~[TAB].indexOf(key):
1441
- datetimepicker.trigger('close.xdsoft');
1442
- return true;
2030
+ input
2031
+ .data('xdsoft_datetimepicker', datetimepicker)
2032
+ .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function (event) {
2033
+ if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
2034
+ return;
2035
+ }
2036
+ clearTimeout(timer);
2037
+ timer = setTimeout(function () {
2038
+ if (input.is(':disabled')) {
2039
+ return;
1443
2040
  }
1444
- });
1445
- },
1446
- destroyDateTimePicker = function( input ) {
1447
- var datetimepicker = input.data('xdsoft_datetimepicker');
1448
- if( datetimepicker ) {
1449
- datetimepicker.data('xdsoft_datetime',null);
1450
- datetimepicker.remove();
1451
- input
1452
- .data( 'xdsoft_datetimepicker',null )
1453
- .off( 'open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft blur.xdsoft keydown.xdsoft' );
1454
- $(window).off('resize.xdsoft');
1455
- $([window,document.body]).off('mousedown.xdsoft');
1456
- input.unmousewheel&&input.unmousewheel();
2041
+
2042
+ triggerAfterOpen = true;
2043
+ _xdsoft_datetime.setCurrentTime(getCurrentValue());
2044
+
2045
+ datetimepicker.trigger('open.xdsoft');
2046
+ }, 100);
2047
+ })
2048
+ .on('keydown.xdsoft', function (event) {
2049
+ var val = this.value, elementSelector,
2050
+ key = event.which;
2051
+ if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
2052
+ elementSelector = $("input:visible,textarea:visible");
2053
+ datetimepicker.trigger('close.xdsoft');
2054
+ elementSelector.eq(elementSelector.index(this) + 1).focus();
2055
+ return false;
2056
+ }
2057
+ if ([TAB].indexOf(key) !== -1) {
2058
+ datetimepicker.trigger('close.xdsoft');
2059
+ return true;
2060
+ }
2061
+ });
2062
+ };
2063
+ destroyDateTimePicker = function (input) {
2064
+ var datetimepicker = input.data('xdsoft_datetimepicker');
2065
+ if (datetimepicker) {
2066
+ datetimepicker.data('xdsoft_datetime', null);
2067
+ datetimepicker.remove();
2068
+ input
2069
+ .data('xdsoft_datetimepicker', null)
2070
+ .off('.xdsoft');
2071
+ $(window).off('resize.xdsoft');
2072
+ $([window, document.body]).off('mousedown.xdsoft touchstart');
2073
+ if (input.unmousewheel) {
2074
+ input.unmousewheel();
1457
2075
  }
1458
- };
2076
+ }
2077
+ };
1459
2078
  $(document)
1460
2079
  .off('keydown.xdsoftctrl keyup.xdsoftctrl')
1461
- .on('keydown.xdsoftctrl',function(e) {
1462
- if ( e.keyCode == CTRLKEY )
2080
+ .on('keydown.xdsoftctrl', function (e) {
2081
+ if (e.keyCode === CTRLKEY) {
1463
2082
  ctrlDown = true;
2083
+ }
1464
2084
  })
1465
- .on('keyup.xdsoftctrl',function(e) {
1466
- if ( e.keyCode == CTRLKEY )
2085
+ .on('keyup.xdsoftctrl', function (e) {
2086
+ if (e.keyCode === CTRLKEY) {
1467
2087
  ctrlDown = false;
2088
+ }
1468
2089
  });
1469
- return this.each(function() {
1470
- var datetimepicker;
1471
- if( datetimepicker = $(this).data('xdsoft_datetimepicker') ) {
1472
- if( $.type(opt) === 'string' ) {
1473
- switch(opt) {
1474
- case 'show':
1475
- $(this).select().focus();
1476
- datetimepicker.trigger( 'open.xdsoft' );
2090
+ return this.each(function () {
2091
+ var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
2092
+ if (datetimepicker) {
2093
+ if ($.type(opt) === 'string') {
2094
+ switch (opt) {
2095
+ case 'show':
2096
+ $(this).select().focus();
2097
+ datetimepicker.trigger('open.xdsoft');
2098
+ break;
2099
+ case 'hide':
2100
+ datetimepicker.trigger('close.xdsoft');
2101
+ break;
2102
+ case 'toggle':
2103
+ datetimepicker.trigger('toggle.xdsoft');
1477
2104
  break;
1478
- case 'hide':
1479
- datetimepicker.trigger('close.xdsoft');
2105
+ case 'destroy':
2106
+ destroyDateTimePicker($(this));
1480
2107
  break;
1481
- case 'destroy':
1482
- destroyDateTimePicker($(this));
2108
+ case 'reset':
2109
+ this.value = this.defaultValue;
2110
+ if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(Date.parseDate(this.value, options.format))) {
2111
+ datetimepicker.data('changed', false);
2112
+ }
2113
+ datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
1483
2114
  break;
1484
- case 'reset':
1485
- this.value = this.defaultValue;
1486
- if(!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(Date.parseDate(this.value, options.format)))
1487
- datetimepicker.data('changed',false);
1488
- datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
2115
+ case 'validate':
2116
+ $input = datetimepicker.data('input');
2117
+ $input.trigger('blur.xdsoft');
1489
2118
  break;
1490
2119
  }
1491
- }else{
2120
+ } else {
1492
2121
  datetimepicker
1493
2122
  .setOptions(opt);
1494
2123
  }
1495
2124
  return 0;
1496
- }else
1497
- if( ($.type(opt) !== 'string') ){
1498
- if( !options.lazyInit||options.open||options.inline ){
1499
- createDateTimePicker($(this));
1500
- }else
1501
- lazyInit($(this));
2125
+ }
2126
+ if ($.type(opt) !== 'string') {
2127
+ if (!options.lazyInit || options.open || options.inline) {
2128
+ createDateTimePicker($(this));
2129
+ } else {
2130
+ lazyInit($(this));
1502
2131
  }
2132
+ }
1503
2133
  });
1504
2134
  };
1505
2135
  $.fn.datetimepicker.defaults = default_options;
1506
- })( jQuery );
1507
-
1508
- /*
1509
- * Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
1510
- *
1511
- * Licensed under the MIT License (LICENSE.txt).
1512
- *
1513
- * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
1514
- * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
1515
- * Thanks to: Seamus Leahy for adding deltaX and deltaY
1516
- *
1517
- * Version: 3.1.3
1518
- *
1519
- * Requires: 1.2.2+
1520
- */
1521
- (function(factory) {if(typeof define==='function'&&define.amd) {define(['jquery'],factory)}else if(typeof exports==='object') {module.exports=factory}else{factory(jQuery)}}(function($) {var toFix=['wheel','mousewheel','DOMMouseScroll','MozMousePixelScroll'];var toBind='onwheel'in document||document.documentMode>=9?['wheel']:['mousewheel','DomMouseScroll','MozMousePixelScroll'];var lowestDelta,lowestDeltaXY;if($.event.fixHooks) {for(var i=toFix.length;i;) {$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}$.event.special.mousewheel={setup:function() {if(this.addEventListener) {for(var i=toBind.length;i;) {this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}},teardown:function() {if(this.removeEventListener) {for(var i=toBind.length;i;) {this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}}};$.fn.extend({mousewheel:function(fn) {return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn) {return this.unbind("mousewheel",fn)}});function handler(event) {var orgEvent=event||window.event,args=[].slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,absDeltaXY=0,fn;event=$.event.fix(orgEvent);event.type="mousewheel";if(orgEvent.wheelDelta) {delta=orgEvent.wheelDelta}if(orgEvent.detail) {delta=orgEvent.detail*-1}if(orgEvent.deltaY) {deltaY=orgEvent.deltaY*-1;delta=deltaY}if(orgEvent.deltaX) {deltaX=orgEvent.deltaX;delta=deltaX*-1}if(orgEvent.wheelDeltaY!==undefined) {deltaY=orgEvent.wheelDeltaY}if(orgEvent.wheelDeltaX!==undefined) {deltaX=orgEvent.wheelDeltaX*-1}absDelta=Math.abs(delta);if(!lowestDelta||absDelta<lowestDelta) {lowestDelta=absDelta}absDeltaXY=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDeltaXY||absDeltaXY<lowestDeltaXY) {lowestDeltaXY=absDeltaXY}fn=delta>0?'floor':'ceil';delta=Math[fn](delta/lowestDelta);deltaX=Math[fn](deltaX/lowestDeltaXY);deltaY=Math[fn](deltaY/lowestDeltaXY);args.unshift(event,delta,deltaX,deltaY);return($.event.dispatch||$.event.handle).apply(this,args)}}));
1522
-
1523
-
1524
- // Parse and Format Library
1525
- //http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/
1526
- /*
1527
- * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
1528
- *
1529
- * This program is free software; you can redistribute it and/or modify it
1530
- * under the terms of the GNU Lesser General Public License as published by the
1531
- * Free Software Foundation, version 2.1.
1532
- *
1533
- * This program is distributed in the hope that it will be useful, but WITHOUT
1534
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1535
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
1536
- * details.
1537
- */
1538
- Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function() {return ";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;code+="'"+String.escape(ch)+"' + ";}else{code+=Date.getFormatCode(ch);}}}eval(code.substring(0,code.length-3)+";}");};Date.getFormatCode=function(a){switch(a){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(a)+"' + ";}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;regex+=String.escape(ch);}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}}code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+a+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+a+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0");};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)));};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a;};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a;};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1");};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};
2136
+
2137
+ function HighlightedDate(date, desc, style) {
2138
+ "use strict";
2139
+ this.date = date;
2140
+ this.desc = desc;
2141
+ this.style = style;
2142
+ }
2143
+
2144
+ }));