1/** 2 * @preserve jQuery DateTimePicker 3 * @homepage http://xdsoft.net/jqplugins/datetimepicker/ 4 * @author Chupurnov Valeriy (<[email protected]>) 5 */ 6 7/** 8 * @param {jQuery} $ 9 */ 10var datetimepickerFactory = function ($) { 11 'use strict'; 12 13 var default_options = { 14 i18n: { 15 ar: { // Arabic 16 months: [ 17 "ÙØ§ÙÙÙ Ø§ÙØ«Ø§ÙÙ", "شباط", "آذار", "ÙÙØ³Ø§Ù", "٠اÙÙ", "ØØ²ÙراÙ", "ØªÙ ÙØ²", "آب", "Ø£ÙÙÙÙ", "تشرÙÙ Ø§ÙØ£ÙÙ", "تشرÙÙ Ø§ÙØ«Ø§ÙÙ", "ÙØ§ÙÙÙ Ø§ÙØ£ÙÙ" 18 ], 19 dayOfWeekShort: [ 20 "Ù", "Ø«", "ع", "Ø®", "ج", "س", "Ø" 21 ], 22 dayOfWeek: ["Ø§ÙØ£ØØ¯", "Ø§ÙØ§Ø«ÙÙÙ", "Ø§ÙØ«Ùاثاء", "Ø§ÙØ£Ø±Ø¨Ø¹Ø§Ø¡", "Ø§ÙØ®Ù ÙØ³", "Ø§ÙØ¬Ù عة", "Ø§ÙØ³Ø¨Øª", "Ø§ÙØ£ØØ¯"] 23 }, 24 ro: { // Romanian 25 months: [ 26 "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie" 27 ], 28 dayOfWeekShort: [ 29 "Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ" 30 ], 31 dayOfWeek: ["DuminicÄ", "Luni", "MarÅ£i", "Miercuri", "Joi", "Vineri", "SâmbÄtÄ"] 32 }, 33 id: { // Indonesian 34 months: [ 35 "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" 36 ], 37 dayOfWeekShort: [ 38 "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab" 39 ], 40 dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"] 41 }, 42 is: { // Icelandic 43 months: [ 44 "Janúar", "Febrúar", "Mars", "AprÃl", "MaÃ", "JúnÃ", "JúlÃ", "Ãgúst", "September", "Október", "Nóvember", "Desember" 45 ], 46 dayOfWeekShort: [ 47 "Sun", "Mán", "Ãrið", "Mið", "Fim", "Fös", "Lau" 48 ], 49 dayOfWeek: ["Sunnudagur", "Mánudagur", "Ãriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"] 50 }, 51 bg: { // Bulgarian 52 months: [ 53 "ЯнÑаÑи", "ФевÑÑаÑи", "ÐаÑÑ", "ÐпÑил", "Ðай", "Юни", "Юли", "ÐвгÑÑÑ", "СепÑемвÑи", "ÐкÑомвÑи", "ÐоемвÑи", "ÐекемвÑи" 54 ], 55 dayOfWeekShort: [ 56 "Ðд", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб" 57 ], 58 dayOfWeek: ["ÐеделÑ", "Ðонеделник", "ÐÑоÑник", "СÑÑда", "ЧеÑвÑÑÑÑк", "ÐеÑÑк", "СÑбоÑа"] 59 }, 60 fa: { // Persian/Farsi 61 months: [ 62 'ÙØ±ÙردÛÙ', 'Ø§Ø±Ø¯ÛØ¨Ùشت', 'خرداد', 'ØªÛØ±', '٠رداد', 'Ø´ÙØ±ÛÙØ±', 'Ù ÙØ±', 'آباÙ', 'آذر', 'دÛ', 'بÙÙ Ù', 'اسÙÙØ¯' 63 ], 64 dayOfWeekShort: [ 65 'ÛÚ©Ø´ÙØ¨Ù', 'Ø¯ÙØ´ÙبÙ', 'Ø³Ù Ø´ÙØ¨Ù', 'ÚÙØ§Ø±Ø´ÙبÙ', 'Ù¾ÙØ¬Ø´ÙبÙ', 'ج٠عÙ', 'Ø´ÙØ¨Ù' 66 ], 67 dayOfWeek: ["ÛÚ©âØ´ÙØ¨Ù", "Ø¯ÙØ´ÙبÙ", "سÙâØ´ÙØ¨Ù", "ÚÙØ§Ø±Ø´ÙبÙ", "Ù¾ÙØ¬âØ´ÙØ¨Ù", "ج٠عÙ", "Ø´ÙØ¨Ù", "ÛÚ©âØ´ÙØ¨Ù"] 68 }, 69 ru: { // Russian 70 months: [ 71 'ЯнваÑÑ', 'ФевÑалÑ', 'ÐаÑÑ', 'ÐпÑелÑ', 'Ðай', 'ÐÑнÑ', 'ÐÑлÑ', 'ÐвгÑÑÑ', 'СенÑÑбÑÑ', 'ÐкÑÑбÑÑ', 'ÐоÑбÑÑ', 'ÐекабÑÑ' 72 ], 73 dayOfWeekShort: [ 74 "ÐÑ", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб" 75 ], 76 dayOfWeek: ["ÐоÑкÑеÑенÑе", "ÐонеделÑник", "ÐÑоÑник", "СÑеда", "ЧеÑвеÑг", "ÐÑÑниÑа", "СÑббоÑа"] 77 }, 78 uk: { // Ukrainian 79 months: [ 80 'СÑÑенÑ', 'ÐÑÑий', 'ÐеÑезенÑ', 'ÐвÑÑенÑ', 'ТÑавенÑ', 'ЧеÑвенÑ', 'ÐипенÑ', 'СеÑпенÑ', 'ÐеÑеÑенÑ', 'ÐовÑенÑ', 'ÐиÑÑопад', 'ÐÑÑденÑ' 81 ], 82 dayOfWeekShort: [ 83 "Ðд", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб
vendor: 19,707 bytes, lines 83-534
83" 84 ], 85 dayOfWeek: ["ÐедÑлÑ", "ÐонедÑлок", "ÐÑвÑоÑок", "СеÑеда", "ЧеÑвеÑ", "Ð'ÑÑниÑÑ", "СÑбоÑа"] 86 }, 87 en: { // English 88 months: [ 89 "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" 90 ], 91 dayOfWeekShort: [ 92 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 93 ], 94 dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] 95 }, 96 el: { // Îλληνικά 97 months: [ 98 "ÎÎ±Î½Î¿Ï Î¬ÏιοÏ", "ΦεβÏÎ¿Ï Î¬ÏιοÏ", "ÎάÏÏιοÏ", "ÎÏÏίλιοÏ", "ÎάιοÏ", "ÎοÏνιοÏ", "ÎοÏλιοÏ", "ÎÏÎ³Î¿Ï ÏÏοÏ", "ΣεÏÏÎμβÏιοÏ", "ÎκÏÏβÏιοÏ", "ÎοÎμβÏιοÏ", "ÎεκÎμβÏιοÏ" 99 ], 100 dayOfWeekShort: [ 101 "ÎÏ Ï", "ÎÎµÏ ", "ΤÏι", "ΤεÏ", "Πεμ", "ΠαÏ", "Σαβ" 102 ], 103 dayOfWeek: ["ÎÏ Ïιακή", "ÎÎµÏ ÏÎÏα", "ΤÏίÏη", "ΤεÏάÏÏη", "Î ÎμÏÏη", "ΠαÏαÏÎºÎµÏ Î®", "ΣάββαÏο"] 104 }, 105 de: { // German 106 months: [ 107 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' 108 ], 109 dayOfWeekShort: [ 110 "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa" 111 ], 112 dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"] 113 }, 114 nl: { // Dutch 115 months: [ 116 "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december" 117 ], 118 dayOfWeekShort: [ 119 "zo", "ma", "di", "wo", "do", "vr", "za" 120 ], 121 dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"] 122 }, 123 tr: { // Turkish 124 months: [ 125 "Ocak", "Åubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "AÄustos", "Eylül", "Ekim", "Kasım", "Aralık" 126 ], 127 dayOfWeekShort: [ 128 "Paz", "Pts", "Sal", "Ãar", "Per", "Cum", "Cts" 129 ], 130 dayOfWeek: ["Pazar", "Pazartesi", "Salı", "ÃarÅamba", "PerÅembe", "Cuma", "Cumartesi"] 131 }, 132 fr: { //French 133 months: [ 134 "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" 135 ], 136 dayOfWeekShort: [ 137 "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" 138 ], 139 dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"] 140 }, 141 es: { // Spanish 142 months: [ 143 "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" 144 ], 145 dayOfWeekShort: [ 146 "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" 147 ], 148 dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"] 149 }, 150 th: { // Thai 151 months: [ 152 'มà¸à¸£à¸²à¸à¸¡', 'à¸à¸¸à¸¡à¸ าà¸à¸±à¸à¸à¹', 'มีà¸à¸²à¸à¸¡', 'à¹à¸¡à¸©à¸²à¸¢à¸', 'à¸à¸¤à¸©à¸ าà¸à¸¡', 'มิà¸à¸¸à¸à¸²à¸¢à¸', 'à¸à¸£à¸à¸à¸²à¸à¸¡', 'สิà¸à¸«à¸²à¸à¸¡', 'à¸à¸±à¸à¸¢à¸²à¸¢à¸', 'à¸à¸¸à¸¥à¸²à¸à¸¡', 'à¸à¸¤à¸¨à¸à¸´à¸à¸²à¸¢à¸', 'à¸à¸±à¸à¸§à¸²à¸à¸¡' 153 ], 154 dayOfWeekShort: [ 155 'à¸à¸².', 'à¸.', 'à¸.', 'à¸.', 'à¸à¸¤.', 'ศ.', 'ส.' 156 ], 157 dayOfWeek: ["à¸à¸²à¸à¸´à¸à¸¢à¹", "à¸à¸±à¸à¸à¸£à¹", "à¸à¸±à¸à¸à¸²à¸£", "à¸à¸¸à¸", "à¸à¸¤à¸«à¸±à¸ª", "ศุà¸à¸£à¹", "à¹à¸ªà¸²à¸£à¹", "à¸à¸²à¸à¸´à¸à¸¢à¹"] 158 }, 159 pl: { // Polish 160 months: [ 161 "styczeÅ", "luty", "marzec", "kwiecieÅ", "maj", "czerwiec", "lipiec", "sierpieÅ", "wrzesieÅ", "październik", "listopad", "grudzieÅ" 162 ], 163 dayOfWeekShort: [ 164 "nd", "pn", "wt", "År", "cz", "pt", "sb" 165 ], 166 dayOfWeek: ["niedziela", "poniedziaÅek", "wtorek", "Åroda", "czwartek", "piÄ tek", "sobota"] 167 }, 168 pt: { // Portuguese 169 months: [ 170 "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" 171 ], 172 dayOfWeekShort: [ 173 "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab" 174 ], 175 dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"] 176 }, 177 ch: { // Simplified Chinese 178 months: [ 179 "䏿", "äºæ", "䏿", "åæ", "äºæ", "å æ", "䏿", "å «æ", "乿", "åæ", "å䏿", "åäºæ" 180 ], 181 dayOfWeekShort: [ 182 "æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å " 183 ] 184 }, 185 se: { // Swedish 186 months: [ 187 "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" 188 ], 189 dayOfWeekShort: [ 190 "Sön", "MÃ¥n", "Tis", "Ons", "Tor", "Fre", "Lör" 191 ] 192 }, 193 km: { // Khmer (áá¶áá¶ááááá) 194 months: [ 195 "áááá¶â", "áá»áááá", "áá·áá¶â", "áááá¶â", "á§ááá¶â", "áá·áá»áá¶â", "áááááá¶â", "áá¸á á¶â", "ááááá¶â", "áá»áá¶â", "áá·á ááá·áá¶", "áááá¼â" 196 ], 197 dayOfWeekShort: ["á¢á¶áá·â", "á ááááâ", "á¢áááá¶áâ", "áá»áâ", "áááá ââ", "áá»áááâ", "áá áá"], 198 dayOfWeek: ["á¢á¶áá·áááâ", "á ááááâ", "á¢áááá¶áâ", "áá»áâ", "áááá ááááá·áâ", "áá»áááâ", "áá áá"] 199 }, 200 kr: { // Korean 201 months: [ 202 "1ì", "2ì", "3ì", "4ì", "5ì", "6ì", "7ì", "8ì", "9ì", "10ì", "11ì", "12ì" 203 ], 204 dayOfWeekShort: [ 205 "ì¼", "ì", "í", "ì", "목", "ê¸", "í " 206 ], 207 dayOfWeek: ["ì¼ìì¼", "ììì¼", "íìì¼", "ììì¼", "목ìì¼", "ê¸ìì¼", "í ìì¼"] 208 }, 209 it: { // Italian 210 months: [ 211 "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" 212 ], 213 dayOfWeekShort: [ 214 "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab" 215 ], 216 dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] 217 }, 218 da: { // Dansk 219 months: [ 220 "Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December" 221 ], 222 dayOfWeekShort: [ 223 "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" 224 ], 225 dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"] 226 }, 227 no: { // Norwegian 228 months: [ 229 "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember" 230 ], 231 dayOfWeekShort: [ 232 "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" 233 ], 234 dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'] 235 }, 236 ja: { // Japanese 237 months: [ 238 "1æ", "2æ", "3æ", "4æ", "5æ", "6æ", "7æ", "8æ", "9æ", "10æ", "11æ", "12æ" 239 ], 240 dayOfWeekShort: [ 241 "æ¥", "æ", "ç«", "æ°´", "æ¨", "é", "å" 242 ], 243 dayOfWeek: ["æ¥æ", "ææ", "ç«æ", "æ°´æ", "æ¨æ", "éæ", "åæ"] 244 }, 245 vi: { // Vietnamese 246 months: [ 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" 248 ], 249 dayOfWeekShort: [ 250 "CN", "T2", "T3", "T4", "T5", "T6", "T7" 251 ], 252 dayOfWeek: ["Chá»§ nháºt", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ nÄm", "Thứ sáu", "Thứ bảy"] 253 }, 254 sl: { // SlovenÅ¡Äina 255 months: [ 256 "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December" 257 ], 258 dayOfWeekShort: [ 259 "Ned", "Pon", "Tor", "Sre", "Äet", "Pet", "Sob" 260 ], 261 dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Äetrtek", "Petek", "Sobota"] 262 }, 263 cs: { // ÄeÅ¡tina 264 months: [ 265 "Leden", "Ãnor", "BÅezen", "Duben", "KvÄten", "Äerven", "Äervenec", "Srpen", "ZáÅÃ", "ÅÃjen", "Listopad", "Prosinec" 266 ], 267 dayOfWeekShort: [ 268 "Ne", "Po", "Ãt", "St", "Ät", "Pá", "So" 269 ] 270 }, 271 hu: { // Hungarian 272 months: [ 273 "Január", "Február", "Március", "Ãprilis", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" 274 ], 275 dayOfWeekShort: [ 276 "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo" 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 ug:{ // Uyghur(ئÛÙØºÛرÚÛ) 479 months: [ 480 "1-ئاÙ","2-ئاÙ","3-ئاÙ","4-ئاÙ","5-ئاÙ","6-ئاÙ","7-ئاÙ","8-ئاÙ","9-ئاÙ","10-ئاÙ","11-ئاÙ","12-ئاÙ" 481 ], 482 dayOfWeek: [ 483 "ÙÛÙØ´ÛÙØ¨Û", "Ø¯ÛØ´ÛÙØ¨Û","سÛÙØ´ÛÙØ¨Û","ÚØ§Ø±Ø´ÛÙØ¨Û","Ù¾ÛÙØ´ÛÙØ¨Û","جÛÙ Û","Ø´ÛÙØ¨Û" 484 ] 485 }, 486 he: { //Hebrew (×¢×ר×ת) 487 months: [ 488 '×× ××ר', 'פ×ר××ר', '×רץ', '×פר××', '×××', '××× ×', '××××', '××××ס×', 'ספ×××ר', '×××§×××ר', '× ××××ר', '×צ××ר' 489 ], 490 dayOfWeekShort: [ 491 '×\'', '×\'', '×\'', '×\'', '×\'', '×\'', 'ש×ת' 492 ], 493 dayOfWeek: ["ר×ש××", "×©× ×", "ש××ש×", "ר×××¢×", "×××ש×", "ש×ש×", "ש×ת", "ר×ש××"] 494 }, 495 hy: { // Armenian 496 months: [ 497 "ÕÕ¸ÖÕ¶Õ¾Õ¡Ö", "ÕÕ¥Õ¿ÖÕ¾Õ¡Ö", "ÕÕ¡ÖÕ¿", "Ô±ÕºÖÕ«Õ¬", "ÕÕ¡ÕµÕ«Õ½", "ÕÕ¸ÖÕ¶Õ«Õ½", "ÕÕ¸ÖÕ¬Õ«Õ½", "ÕÕ£Õ¸Õ½Õ¿Õ¸Õ½", "ÕÕ¥ÕºÕ¿Õ¥Õ´Õ¢Õ¥Ö", "ÕÕ¸Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö", "ÕÕ¸ÕµÕ¥Õ´Õ¢Õ¥Ö", "Ô´Õ¥Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö" 498 ], 499 dayOfWeekShort: [ 500 "Ô¿Õ«", "ÔµÖÕ¯", "ÔµÖÖ", "ÕÕ¸Ö", "ÕÕ¶Õ£", "ÕÖÖÕ¢", "ÕÕ¢Õ©" 501 ], 502 dayOfWeek: ["Ô¿Õ«ÖÕ¡Õ¯Õ«", "ÔµÖÕ¯Õ¸ÖÕ·Õ¡Õ¢Õ©Õ«", "ÔµÖÕ¥ÖÕ·Õ¡Õ¢Õ©Õ«", "ÕÕ¸ÖÕ¥ÖÕ·Õ¡Õ¢Õ©Õ«", "ÕÕ«Õ¶Õ£Õ·Õ¡Õ¢Õ©Õ«", "ÕÖÖÕ¢Õ¡Õ©", "ÕÕ¡Õ¢Õ¡Õ©"] 503 }, 504 kg: { // Kyrgyz 505 months: [ 506 'Ò®ÑÑүн айÑ', 'ÐиÑдин айÑ', 'Ðалган ÐÑÑан', 'ЧÑн ÐÑÑан', 'ÐÑгÑ', 'ÐÑлжа', 'Теке', 'ÐÐ°Ñ Ðона', 'ÐÑк Ðона', 'ТогÑздÑн айÑ', 'ÐеÑинин айÑ', 'ÐеÑÑин айÑ' 507 ], 508 dayOfWeekShort: [ 509 "Ðек", "Ðүй", "Шей", "ШаÑ", "Ðей", "ÐÑм", "ÐÑе" 510 ], 511 dayOfWeek: [ 512 "ÐекÑемб", "ÐүйÑөмб", "ШейÑемб", "ШаÑÑемб", "ÐейÑемби", "ÐÑма", "ÐÑенб" 513 ] 514 }, 515 rm: { // Romansh 516 months: [ 517 "Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December" 518 ], 519 dayOfWeekShort: [ 520 "Du", "Gli", "Ma", "Me", "Gie", "Ve", "So" 521 ], 522 dayOfWeek: [ 523 "Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda" 524 ] 525 }, 526 ka: { // Georgian 527 months: [ 528 'áááááá á', 'ááááá áááá', 'ááá á¢á', 'ááá ááá', 'áááá¡á', 'ááááá¡á', 'ááááá¡á', 'ááááá¡á¢á', 'á¡áá¥á¢ááááá á', 'áá¥á¢ááááá á', 'ááááááá á', 'áááááááá á' 529 ], 530 dayOfWeekShort: [ 531 "áá", "áá á¨", "á¡ááá¨", "ááá®", "á®á£á", "ááá ", "á¨áá" 532 ], 533 dayOfWeek: ["áááá á", "áá á¨ááááá", "á¡ááá¨ááááá", "ááá®á¨ááááá", "á®á£áá¨ááááá", "ááá áá¡áááá", "á¨ááááá"] 534 }
vendor: 3,550 bytes, lines 534-681
534, 535 kk: { // Kazakh 536 months: [ 537 'ÒаңÑаÑ', 'ÐÒпан', 'ÐаÑÑÑз', 'СÓÑÑÑ', 'ÐамÑÑ', 'ÐаÑÑÑм', 'ШÑлде', 'ТамÑз', 'ÒÑÑкүйек', 'Òазан', 'ÒаÑаÑа', 'ÐелÑоÒÑан' 538 ], 539 dayOfWeekShort: [ 540 "Ðк", "ÐÑ", "СÑ", "СÑ", "ÐÑ", "Ðм", "Сб" 541 ], 542 dayOfWeek: ["ÐекÑенбÑ", "ÐүйÑенбÑ", "СейÑенбÑ", "СÓÑÑенбÑ", "ÐейÑенбÑ", "Ðұма", "СенбÑ"] 543 } 544 }, 545 546 ownerDocument: document, 547 contentWindow: window, 548 549 value: '', 550 rtl: false, 551 552 format: 'Y/m/d H:i', 553 formatTime: 'H:i', 554 formatDate: 'Y/m/d', 555 556 startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05', 557 step: 60, 558 monthChangeSpinner: true, 559 560 closeOnDateSelect: false, 561 closeOnTimeSelect: true, 562 closeOnWithoutClick: true, 563 closeOnInputClick: true, 564 openOnFocus: true, 565 566 timepicker: true, 567 datepicker: true, 568 weeks: false, 569 570 defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i') 571 defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05') 572 573 minDate: false, 574 maxDate: false, 575 minTime: false, 576 maxTime: false, 577 minDateTime: false, 578 maxDateTime: false, 579 580 allowTimes: [], 581 opened: false, 582 initTime: true, 583 inline: false, 584 theme: '', 585 touchMovedThreshold: 5, 586 587 onSelectDate: function () {}, 588 onSelectTime: function () {}, 589 onChangeMonth: function () {}, 590 onGetWeekOfYear: function () {}, 591 onChangeYear: function () {}, 592 onChangeDateTime: function () {}, 593 onShow: function () {}, 594 onClose: function () {}, 595 onGenerate: function () {}, 596 597 withoutCopyright: true, 598 inverseButton: false, 599 hours12: false, 600 next: 'xdsoft_next', 601 prev : 'xdsoft_prev', 602 dayOfWeekStart: 0, 603 parentID: 'body', 604 timeHeightInTimePicker: 25, 605 timepickerScrollbar: true, 606 todayButton: true, 607 prevButton: true, 608 nextButton: true, 609 defaultSelect: true, 610 611 scrollMonth: true, 612 scrollTime: true, 613 scrollInput: true, 614 615 lazyInit: false, 616 mask: false, 617 validateOnBlur: true, 618 allowBlank: true, 619 yearStart: 1950, 620 yearEnd: 2050, 621 monthStart: 0, 622 monthEnd: 11, 623 style: '', 624 id: '', 625 fixed: false, 626 roundTime: 'round', // ceil, floor 627 className: '', 628 weekends: [], 629 highlightedDates: [], 630 highlightedPeriods: [], 631 allowDates : [], 632 allowDateRe : null, 633 disabledDates : [], 634 disabledWeekDays: [], 635 yearOffset: 0, 636 beforeShowDay: null, 637 638 enterLikeTab: true, 639 showApplyButton: false, 640 insideParent: false, 641 }; 642 643 var dateHelper = null, 644 defaultDateHelper = null, 645 globalLocaleDefault = 'en', 646 globalLocale = 'en'; 647 648 var dateFormatterOptionsDefault = { 649 meridiem: ['AM', 'PM'] 650 }; 651 652 var initDateFormatter = function(){ 653 var locale = default_options.i18n[globalLocale], 654 opts = { 655 days: locale.dayOfWeek, 656 daysShort: locale.dayOfWeekShort, 657 months: locale.months, 658 monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) }) 659 }; 660 661 if (typeof DateFormatter === 'function') { 662 dateHelper = defaultDateHelper = new DateFormatter({ 663 dateSettings: $.extend({}, dateFormatterOptionsDefault, opts) 664 }); 665 } 666 }; 667 668 var dateFormatters = { 669 moment: { 670 default_options:{ 671 format: 'YYYY/MM/DD HH:mm', 672 formatDate: 'YYYY/MM/DD', 673 formatTime: 'HH:mm', 674 }, 675 formatter: { 676 parseDate: function (date, format) { 677 if(isFormatStandard(format)){ 678 return defaultDateHelper.parseDate(date, format); 679 } 680 var d = moment(date, format); 681 return d.isValid() ? d.toDate() : false;
682 }, 683 684 formatDate: function (date, format) { 685 if(isFormatStandard(format)){ 686 return defaultDateHelper.formatDate(date, format); 687 } 688 return moment(date).format(format); 689 }, 690 691 formatMask: function(format){ 692 return format 693 .replace(/Y{4}/g, '9999') 694 .replace(/Y{2}/g, '99') 695 .replace(/M{2}/g, '19') 696 .replace(/D{2}/g, '39') 697 .replace(/H{2}/g, '29') 698 .replace(/m{2}/g, '59') 699 .replace(/s{2}/g, '59'); 700 }, 701 } 702 } 703 } 704 705 // for locale settings 706 $.datetimepicker = { 707 setLocale: function(locale){ 708 var newLocale = default_options.i18n[locale] ? locale : globalLocaleDefault; 709 if (globalLocale !== newLocale) { 710 globalLocale = newLocale; 711 // reinit date formatter 712 initDateFormatter(); 713 } 714 }, 715 716 setDateFormatter: function(dateFormatter) { 717 if(typeof dateFormatter === 'string' && dateFormatters.hasOwnProperty(dateFormatter)){ 718 var df = dateFormatters[dateFormatter]; 719 $.extend(default_options, df.default_options); 720 dateHelper = df.formatter; 721 } 722 else { 723 dateHelper = dateFormatter; 724 } 725 }, 726 }; 727 728 var standardFormats = { 729 RFC_2822: 'D, d M Y H:i:s O', 730 ATOM: 'Y-m-d\TH:i:sP', 731 ISO_8601: 'Y-m-d\TH:i:sO', 732 RFC_822: 'D, d M y H:i:s O', 733 RFC_850: 'l, d-M-y H:i:s T', 734 RFC_1036: 'D, d M y H:i:s O', 735 RFC_1123: 'D, d M Y H:i:s O', 736 RSS: 'D, d M Y H:i:s O', 737 W3C: 'Y-m-d\TH:i:sP' 738 } 739 740 var isFormatStandard = function(format){ 741 return Object.values(standardFormats).indexOf(format) === -1 ? false : true; 742 } 743 744 $.extend($.datetimepicker, standardFormats); 745 746 // first init date formatter 747 initDateFormatter(); 748 749 // fix for ie8 750 if (!window.getComputedStyle) { 751 window.getComputedStyle = function (el) { 752 this.el = el; 753 this.getPropertyValue = function (prop) { 754 var re = /(-([a-z]))/g; 755 if (prop === 'float') { 756 prop = 'styleFloat'; 757 } 758 if (re.test(prop)) { 759 prop = prop.replace(re, function (a, b, c) { 760 return c.toUpperCase(); 761 }); 762 } 763 return el.currentStyle[prop] || null; 764 }; 765 return this; 766 }; 767 } 768 if (!Array.prototype.indexOf) { 769 Array.prototype.indexOf = function (obj, start) { 770 var i, j; 771 for (i = (start || 0), j = this.length; i < j; i += 1) { 772 if (this[i] === obj) { return i; } 773 } 774 return -1; 775 }; 776 } 777 778 Date.prototype.countDaysInMonth = function () { 779 return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate(); 780 }; 781 782 $.fn.xdsoftScroller = function (options, percent) { 783 return this.each(function () { 784 var timeboxparent = $(this), 785 pointerEventToXY = function (e) { 786 var out = {x: 0, y: 0}, 787 touch; 788 if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') { 789 touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 790 out.x = touch.clientX; 791 out.y = touch.clientY; 792 } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') { 793 out.x = e.clientX; 794 out.y = e.clientY; 795 } 796 return out; 797 }, 798 getWheelDelta = function (e) { 799 var deltaY = 0; 800 801 if ('detail' in e) { deltaY = e.detail; } 802 if ('wheelDelta' in e) { deltaY = -e.wheelDelta / 120; } 803 if ('wheelDeltaY' in e) { deltaY = -e.wheelDeltaY / 120; } 804 if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { deltaY = 0; } 805 806 deltaY *= 10; 807 808 if ('deltaY' in e) { deltaY = -e.deltaY; } 809 810 if (deltaY && e.deltaMode) { 811 if (e.deltaMode === 1) { 812 deltaY *= 40; 813 } else { 814 deltaY *= 800; 815 } 816 } 817 818 return deltaY; 819 }, 820 timebox, 821 timeboxTop = 0, 822 parentHeight, 823 height, 824 scrollbar, 825 scroller, 826 maximumOffset = 100, 827 start = false, 828 startY = 0, 829 startTop = 0, 830 h1 = 0, 831 touchStart = false, 832 startTopScroll = 0, 833 calcOffset = function () {}; 834 835 if (percent === 'hide') { 836 timeboxparent.find('.xdsoft_scrollbar').hide(); 837 return; 838 } 839 840 if (!$(this).hasClass('xdsoft_scroller_box')) { 841 timebox = timeboxparent.children().eq(0); 842 timeboxTop = Math.abs(parseInt(timebox.css('marginTop'), 10)); 843 parentHeight = timeboxparent[0].clientHeight; 844 height = timebox[0].offsetHeight; 845 scrollbar = $('<div class="xdsoft_scrollbar"></div>');
vendor: 64,678 bytes, lines 846-2684
846 scroller = $('<div class="xdsoft_scroller"></div>'); 847 scrollbar.append(scroller); 848 849 timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar); 850 calcOffset = function calcOffset(event) { 851 var offset = pointerEventToXY(event).y - startY + startTopScroll; 852 if (offset < 0) { 853 offset = 0; 854 } 855 if (offset + scroller[0].offsetHeight > h1) { 856 offset = h1 - scroller[0].offsetHeight; 857 } 858 timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]); 859 }; 860 861 scroller 862 .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) { 863 if (!parentHeight) { 864 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); 865 } 866 867 startY = pointerEventToXY(event).y; 868 startTopScroll = parseInt(scroller.css('marginTop'), 10); 869 h1 = scrollbar[0].offsetHeight; 870 871 if (event.type === 'mousedown' || event.type === 'touchstart') { 872 if (options.ownerDocument) { 873 $(options.ownerDocument.body).addClass('xdsoft_noselect'); 874 } 875 $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() { 876 $([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft_scroller', arguments_callee) 877 .off('mousemove.xdsoft_scroller', calcOffset) 878 .removeClass('xdsoft_noselect'); 879 }); 880 $(options.ownerDocument.body).on('mousemove.xdsoft_scroller', calcOffset); 881 } else { 882 touchStart = true; 883 event.stopPropagation(); 884 event.preventDefault(); 885 } 886 }) 887 .on('touchmove', function (event) { 888 if (touchStart) { 889 event.preventDefault(); 890 calcOffset(event); 891 } 892 }) 893 .on('touchend touchcancel', function () { 894 touchStart = false; 895 startTopScroll = 0; 896 }); 897 898 timeboxparent 899 .on('scroll_element.xdsoft_scroller', function (event, percentage) { 900 if (!parentHeight) { 901 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]); 902 } 903 percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage; 904 timeboxTop = parseFloat(Math.abs((timebox[0].offsetHeight - parentHeight) * percentage).toFixed(4)); 905 906 scroller.css('marginTop', maximumOffset * percentage); 907 timebox.css('marginTop', -timeboxTop); 908 }) 909 .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) { 910 var percent, sh; 911 parentHeight = timeboxparent[0].clientHeight; 912 height = timebox[0].offsetHeight; 913 percent = parentHeight / height; 914 sh = percent * scrollbar[0].offsetHeight; 915 if (percent > 1) { 916 scroller.hide(); 917 } else { 918 scroller.show(); 919 scroller.css('height', parseInt(sh > 10 ? sh : 10, 10)); 920 maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight; 921 if (noTriggerScroll !== true) { 922 timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || timeboxTop / (height - parentHeight)]); 923 } 924 } 925 }); 926 927 timeboxparent.on('mousewheel', function (event) { 928 var deltaY = getWheelDelta(event.originalEvent); 929 var top = Math.max(0, timeboxTop - deltaY); 930 timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]); 931 event.stopPropagation(); 932 return false; 933 }); 934 935 timeboxparent.on('touchstart', function (event) { 936 start = pointerEventToXY(event); 937 startTop = timeboxTop; 938 }); 939 940 timeboxparent.on('touchmove', function (event) { 941 if (start) { 942 event.preventDefault(); 943 var coord = pointerEventToXY(event); 944 timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]); 945 } 946 }); 947 948 timeboxparent.on('touchend touchcancel', function () { 949 start = false; 950 startTop = 0; 951 }); 952 } 953 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); 954 }); 955 }; 956 957 $.fn.datetimepicker = function (opt, opt2) { 958 var result = this, 959 KEY0 = 48, 960 KEY9 = 57, 961 _KEY0 = 96, 962 _KEY9 = 105, 963 CTRLKEY = 17, 964 CMDKEY = 91, 965 DEL = 46, 966 ENTER = 13, 967 ESC = 27, 968 BACKSPACE = 8, 969 ARROWLEFT = 37, 970 ARROWUP = 38, 971 ARROWRIGHT = 39, 972 ARROWDOWN = 40, 973 TAB = 9, 974 F5 = 116, 975 AKEY = 65, 976 CKEY = 67, 977 VKEY = 86, 978 ZKEY = 90, 979 YKEY = 89, 980 ctrlDown = false, 981 cmdDown = false, 982 options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options), 983 984 lazyInitTimer = 0, 985 createDateTimePicker, 986 destroyDateTimePicker, 987 988 lazyInit = function (input) { 989 input 990 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() { 991 if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) { 992 return; 993 } 994 clearTimeout(lazyInitTimer); 995 lazyInitTimer = setTimeout(function () { 996 997 if (!input.data('xdsoft_datetimepicker')) { 998 createDateTimePicker(input); 999 } 1000 input 1001 .off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback) 1002 .trigger('open.xdsoft'); 1003 }, 100); 1004 }); 1005 }; 1006 1007 createDateTimePicker = function (input) { 1008 var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'), 1009 xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'), 1010 datepicker = $('<div class="xdsoft_datepicker active"></div>'), 1011 month_picker = $('<div class="xdsoft_monthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' + 1012 '<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' + 1013 '<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' + 1014 '<button type="button" class="xdsoft_next"></button></div>'), 1015 calendar = $('<div class="xdsoft_calendar"></div>'), 1016 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>'), 1017 timeboxparent = timepicker.find('.xdsoft_time_box').eq(0), 1018 timebox = $('<div class="xdsoft_time_variant"></div>'), 1019 applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'), 1020 1021 monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'), 1022 yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'), 1023 triggerAfterOpen = false, 1024 XDSoft_datetime, 1025 1026 xchangeTimer, 1027 timerclick, 1028 current_time_index, 1029 setPos, 1030 timer = 0, 1031 _xdsoft_datetime, 1032 forEachAncestorOf; 1033 1034 if (options.id) { 1035 datetimepicker.attr('id', options.id); 1036 } 1037 if (options.style) { 1038 datetimepicker.attr('style', options.style); 1039 } 1040 if (options.weeks) { 1041 datetimepicker.addClass('xdsoft_showweeks'); 1042 } 1043 if (options.rtl) { 1044 datetimepicker.addClass('xdsoft_rtl'); 1045 } 1046 1047 datetimepicker.addClass('xdsoft_' + options.theme); 1048 datetimepicker.addClass(options.className); 1049 1050 month_picker 1051 .find('.xdsoft_month span') 1052 .after(monthselect); 1053 month_picker 1054 .find('.xdsoft_year span') 1055 .after(yearselect); 1056 1057 month_picker 1058 .find('.xdsoft_month,.xdsoft_year') 1059 .on('touchstart mousedown.xdsoft', function (event) { 1060 var select = $(this).find('.xdsoft_select').eq(0), 1061 val = 0, 1062 top = 0, 1063 visible = select.is(':visible'), 1064 items, 1065 i; 1066 1067 month_picker 1068 .find('.xdsoft_select') 1069 .hide(); 1070 if (_xdsoft_datetime.currentTime) { 1071 val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear'](); 1072 } 1073 1074 select[visible ? 'hide' : 'show'](); 1075 for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) { 1076 if (items.eq(i).data('value') === val) { 1077 break; 1078 } else { 1079 top += items[0].offsetHeight; 1080 } 1081 } 1082 1083 select.xdsoftScroller(options, top / (select.children()[0].offsetHeight - (select[0].clientHeight))); 1084 event.stopPropagation(); 1085 return false; 1086 }); 1087 1088 var handleTouchMoved = function (event) { 1089 var evt = event.originalEvent; 1090 var touchPosition = evt.touches ? evt.touches[0] : evt; 1091 this.touchStartPosition = this.touchStartPosition || touchPosition; 1092 var xMovement = Math.abs(this.touchStartPosition.clientX - touchPosition.clientX); 1093 var yMovement = Math.abs(this.touchStartPosition.clientY - touchPosition.clientY); 1094 var distance = Math.sqrt(xMovement * xMovement + yMovement * yMovement); 1095 if(distance > options.touchMovedThreshold) { 1096 this.touchMoved = true; 1097 } 1098 } 1099 1100 month_picker 1101 .find('.xdsoft_select') 1102 .xdsoftScroller(options) 1103 .on('touchstart mousedown.xdsoft', function (event) { 1104 var evt = event.originalEvent; 1105 this.touchMoved = false; 1106 this.touchStartPosition = evt.touches ? evt.touches[0] : evt; 1107 event.stopPropagation(); 1108 event.preventDefault(); 1109 }) 1110 .on('touchmove', '.xdsoft_option', handleTouchMoved) 1111 .on('touchend mousedown.xdsoft', '.xdsoft_option', function () { 1112 if (!this.touchMoved) { 1113 if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { 1114 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 1115 } 1116 1117 var year = _xdsoft_datetime.currentTime.getFullYear(); 1118 if (_xdsoft_datetime && _xdsoft_datetime.currentTime) { 1119 _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value')); 1120 } 1121 1122 $(this).parent().parent().hide(); 1123 1124 datetimepicker.trigger('xchange.xdsoft'); 1125 if (options.onChangeMonth && typeof options.onChangeMonth === 'function') { 1126 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 1127 } 1128 1129 if (year !== _xdsoft_datetime.currentTime.getFullYear() && typeof options.onChangeYear === 'function') { 1130 options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 1131 } 1132 } 1133 }); 1134 1135 datetimepicker.getValue = function () { 1136 return _xdsoft_datetime.getCurrentTime(); 1137 }; 1138 1139 datetimepicker.setOptions = function (_options) { 1140 var highlightedDates = {}; 1141 1142 options = $.extend(true, {}, options, _options); 1143 1144 if (_options.allowTimes && Array.isArray(_options.allowTimes) && _options.allowTimes.length) { 1145 options.allowTimes = $.extend(true, [], _options.allowTimes); 1146 } 1147 1148 if (_options.weekends && Array.isArray(_options.weekends) && _options.weekends.length) { 1149 options.weekends = $.extend(true, [], _options.weekends); 1150 } 1151 1152 if (_options.allowDates && Array.isArray(_options.allowDates) && _options.allowDates.length) { 1153 options.allowDates = $.extend(true, [], _options.allowDates); 1154 } 1155 1156 if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") { 1157 options.allowDateRe = new RegExp(_options.allowDateRe); 1158 } 1159 1160 if (_options.highlightedDates && Array.isArray(_options.highlightedDates) && _options.highlightedDates.length) { 1161 $.each(_options.highlightedDates, function (index, value) { 1162 var splitData = $.map(value.split(','), $.trim), 1163 exDesc, 1164 hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style 1165 keyDate = dateHelper.formatDate(hDate.date, options.formatDate); 1166 if (highlightedDates[keyDate] !== undefined) { 1167 exDesc = highlightedDates[keyDate].desc; 1168 if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { 1169 highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; 1170 } 1171 } else { 1172 highlightedDates[keyDate] = hDate; 1173 } 1174 }); 1175 1176 options.highlightedDates = $.extend(true, [], highlightedDates); 1177 } 1178 1179 if (_options.highlightedPeriods && Array.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) { 1180 highlightedDates = $.extend(true, [], options.highlightedDates); 1181 $.each(_options.highlightedPeriods, function (index, value) { 1182 var dateTest, // start date 1183 dateEnd, 1184 desc, 1185 hDate, 1186 keyDate, 1187 exDesc, 1188 style; 1189 if (Array.isArray(value)) { 1190 dateTest = value[0]; 1191 dateEnd = value[1]; 1192 desc = value[2]; 1193 style = value[3]; 1194 } 1195 else { 1196 var splitData = $.map(value.split(','), $.trim); 1197 dateTest = dateHelper.parseDate(splitData[0], options.formatDate); 1198 dateEnd = dateHelper.parseDate(splitData[1], options.formatDate); 1199 desc = splitData[2]; 1200 style = splitData[3]; 1201 } 1202 1203 while (dateTest <= dateEnd) { 1204 hDate = new HighlightedDate(dateTest, desc, style); 1205 keyDate = dateHelper.formatDate(dateTest, options.formatDate); 1206 dateTest.setDate(dateTest.getDate() + 1); 1207 if (highlightedDates[keyDate] !== undefined) { 1208 exDesc = highlightedDates[keyDate].desc; 1209 if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { 1210 highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; 1211 } 1212 } else { 1213 highlightedDates[keyDate] = hDate; 1214 } 1215 } 1216 }); 1217 1218 options.highlightedDates = $.extend(true, [], highlightedDates); 1219 } 1220 1221 if (_options.disabledDates && Array.isArray(_options.disabledDates) && _options.disabledDates.length) { 1222 options.disabledDates = $.extend(true, [], _options.disabledDates); 1223 } 1224 1225 if (_options.disabledWeekDays && Array.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) { 1226 options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays); 1227 } 1228 1229 if ((options.open || options.opened) && (!options.inline)) { 1230 input.trigger('open.xdsoft'); 1231 } 1232 1233 if (options.inline) { 1234 triggerAfterOpen = true; 1235 datetimepicker.addClass('xdsoft_inline'); 1236 input.after(datetimepicker).hide(); 1237 } 1238 1239 if (options.inverseButton) { 1240 options.next = 'xdsoft_prev'; 1241 options.prev = 'xdsoft_next'; 1242 } 1243 1244 if (options.datepicker) { 1245 datepicker.addClass('active'); 1246 } else { 1247 datepicker.removeClass('active'); 1248 } 1249 1250 if (options.timepicker) { 1251 timepicker.addClass('active'); 1252 } else { 1253 timepicker.removeClass('active'); 1254 } 1255 1256 if (options.value) { 1257 _xdsoft_datetime.setCurrentTime(options.value); 1258 if (input && input.val) { 1259 input.val(_xdsoft_datetime.str); 1260 } 1261 } 1262 1263 if (isNaN(options.dayOfWeekStart)) { 1264 options.dayOfWeekStart = 0; 1265 } else { 1266 options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7; 1267 } 1268 1269 if (!options.timepickerScrollbar) { 1270 timeboxparent.xdsoftScroller(options, 'hide'); 1271 } 1272 1273 if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) { 1274 options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate); 1275 } 1276 1277 if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) { 1278 options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate); 1279 } 1280 1281 if (options.minDateTime && /^\+(.*)$/.test(options.minDateTime)) { 1282 options.minDateTime = _xdsoft_datetime.strToDateTime(options.minDateTime).dateFormat(options.formatDate); 1283 } 1284 1285 if (options.maxDateTime && /^\+(.*)$/.test(options.maxDateTime)) { 1286 options.maxDateTime = _xdsoft_datetime.strToDateTime(options.maxDateTime).dateFormat(options.formatDate); 1287 } 1288 1289 applyButton.toggle(options.showApplyButton); 1290 1291 month_picker 1292 .find('.xdsoft_today_button') 1293 .css('visibility', !options.todayButton ? 'hidden' : 'visible'); 1294 1295 month_picker 1296 .find('.' + options.prev) 1297 .css('visibility', !options.prevButton ? 'hidden' : 'visible'); 1298 1299 month_picker 1300 .find('.' + options.next) 1301 .css('visibility', !options.nextButton ? 'hidden' : 'visible'); 1302 1303 setMask(options); 1304 1305 if (options.validateOnBlur) { 1306 input 1307 .off('blur.xdsoft') 1308 .on('blur.xdsoft', function () { 1309 if (options.allowBlank && (!$(this).val().trim().length || 1310 (typeof options.mask === "string" && $(this).val().trim() === options.mask.replace(/[0-9]/g, '_')))) { 1311 $(this).val(null); 1312 datetimepicker.data('xdsoft_datetime').empty(); 1313 } else { 1314 var d = dateHelper.parseDate($(this).val(), options.format); 1315 if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time 1316 $(this).val(dateHelper.formatDate(d, options.format)); 1317 } else { 1318 var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')), 1319 splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join('')); 1320 1321 // parse the numbers as 0312 => 03:12 1322 if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) { 1323 $(this).val([splittedHours, splittedMinutes].map(function (item) { 1324 return item > 9 ? item : '0' + item; 1325 }).join(':')); 1326 } else { 1327 $(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format)); 1328 } 1329 } 1330 datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); 1331 } 1332 1333 datetimepicker.trigger('changedatetime.xdsoft'); 1334 datetimepicker.trigger('close.xdsoft'); 1335 }); 1336 } 1337 options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1; 1338 1339 datetimepicker 1340 .trigger('xchange.xdsoft') 1341 .trigger('afterOpen.xdsoft'); 1342 }; 1343 1344 datetimepicker 1345 .data('options', options) 1346 .on('touchstart mousedown.xdsoft', function (event) { 1347 event.stopPropagation(); 1348 event.preventDefault(); 1349 yearselect.hide(); 1350 monthselect.hide(); 1351 return false; 1352 }); 1353 1354 //scroll_element = timepicker.find('.xdsoft_time_box'); 1355 timeboxparent.append(timebox); 1356 timeboxparent.xdsoftScroller(options); 1357 1358 datetimepicker.on('afterOpen.xdsoft', function () { 1359 timeboxparent.xdsoftScroller(options); 1360 }); 1361 1362 datetimepicker 1363 .append(datepicker) 1364 .append(timepicker); 1365 1366 if (options.withoutCopyright !== true) { 1367 datetimepicker 1368 .append(xdsoft_copyright); 1369 } 1370 1371 datepicker 1372 .append(month_picker) 1373 .append(calendar) 1374 .append(applyButton); 1375 1376 if (options.insideParent) { 1377 $(input).parent().append(datetimepicker); 1378 } else { 1379 $(options.parentID).append(datetimepicker); 1380 } 1381 1382 XDSoft_datetime = function () { 1383 var _this = this; 1384 _this.now = function (norecursion) { 1385 var d = new Date(), 1386 date, 1387 time; 1388 1389 if (!norecursion && options.defaultDate) { 1390 date = _this.strToDateTime(options.defaultDate); 1391 d.setFullYear(date.getFullYear()); 1392 d.setMonth(date.getMonth()); 1393 d.setDate(date.getDate()); 1394 } 1395 1396 d.setFullYear(d.getFullYear()); 1397 1398 if (!norecursion && options.defaultTime) { 1399 time = _this.strtotime(options.defaultTime); 1400 d.setHours(time.getHours()); 1401 d.setMinutes(time.getMinutes()); 1402 d.setSeconds(time.getSeconds()); 1403 d.setMilliseconds(time.getMilliseconds()); 1404 } 1405 return d; 1406 }; 1407 1408 _this.isValidDate = function (d) { 1409 if (Object.prototype.toString.call(d) !== "[object Date]") { 1410 return false; 1411 } 1412 return !isNaN(d.getTime()); 1413 }; 1414 1415 _this.setCurrentTime = function (dTime, requireValidDate) { 1416 if (typeof dTime === 'string') { 1417 _this.currentTime = _this.strToDateTime(dTime); 1418 } 1419 else if (_this.isValidDate(dTime)) { 1420 _this.currentTime = dTime; 1421 } 1422 else if (!dTime && !requireValidDate && options.allowBlank && !options.inline) { 1423 _this.currentTime = null; 1424 } 1425 else { 1426 _this.currentTime = _this.now(); 1427 } 1428 1429 datetimepicker.trigger('xchange.xdsoft'); 1430 }; 1431 1432 _this.empty = function () { 1433 _this.currentTime = null; 1434 }; 1435 1436 _this.getCurrentTime = function () { 1437 return _this.currentTime; 1438 }; 1439 1440 _this.nextMonth = function () { 1441 1442 if (_this.currentTime === undefined || _this.currentTime === null) { 1443 _this.currentTime = _this.now(); 1444 } 1445 1446 var month = _this.currentTime.getMonth() + 1, 1447 year; 1448 if (month === 12) { 1449 _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1); 1450 month = 0; 1451 } 1452 1453 year = _this.currentTime.getFullYear(); 1454 1455 _this.currentTime.setDate( 1456 Math.min( 1457 new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), 1458 _this.currentTime.getDate() 1459 ) 1460 ); 1461 _this.currentTime.setMonth(month); 1462 1463 if (options.onChangeMonth && typeof options.onChangeMonth === 'function') { 1464 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 1465 } 1466 1467 if (year !== _this.currentTime.getFullYear() && typeof options.onChangeYear === 'function') { 1468 options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 1469 } 1470 1471 datetimepicker.trigger('xchange.xdsoft'); 1472 return month; 1473 }; 1474 1475 _this.prevMonth = function () { 1476 1477 if (_this.currentTime === undefined || _this.currentTime === null) { 1478 _this.currentTime = _this.now(); 1479 } 1480 1481 var month = _this.currentTime.getMonth() - 1; 1482 if (month === -1) { 1483 _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1); 1484 month = 11; 1485 } 1486 _this.currentTime.setDate( 1487 Math.min( 1488 new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), 1489 _this.currentTime.getDate() 1490 ) 1491 ); 1492 _this.currentTime.setMonth(month); 1493 if (options.onChangeMonth && typeof options.onChangeMonth === 'function') { 1494 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 1495 } 1496 datetimepicker.trigger('xchange.xdsoft'); 1497 return month; 1498 }; 1499 1500 _this.getWeekOfYear = function (datetime) { 1501 if (options.onGetWeekOfYear && typeof options.onGetWeekOfYear === 'function') { 1502 var week = options.onGetWeekOfYear.call(datetimepicker, datetime); 1503 if (typeof week !== 'undefined') { 1504 return week; 1505 } 1506 } 1507 var onejan = new Date(datetime.getFullYear(), 0, 1); 1508 1509 //First week of the year is th one with the first Thursday according to ISO8601 1510 if (onejan.getDay() !== 4) { 1511 onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7)); 1512 } 1513 1514 return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7); 1515 }; 1516 1517 _this.strToDateTime = function (sDateTime) { 1518 var tmpDate = [], timeOffset, currentTime; 1519 1520 if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) { 1521 return sDateTime; 1522 } 1523 1524 tmpDate = /^([+-]{1})(.*)$/.exec(sDateTime); 1525 1526 if (tmpDate) { 1527 tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate); 1528 } 1529 1530 if (tmpDate && tmpDate[2]) { 1531 timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000; 1532 currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset); 1533 } else { 1534 currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now(); 1535 } 1536 1537 if (!_this.isValidDate(currentTime)) { 1538 currentTime = _this.now(); 1539 } 1540 1541 return currentTime; 1542 }; 1543 1544 _this.strToDate = function (sDate) { 1545 if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) { 1546 return sDate; 1547 } 1548 1549 var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true); 1550 if (!_this.isValidDate(currentTime)) { 1551 currentTime = _this.now(true); 1552 } 1553 return currentTime; 1554 }; 1555 1556 _this.strtotime = function (sTime) { 1557 if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) { 1558 return sTime; 1559 } 1560 var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true); 1561 if (!_this.isValidDate(currentTime)) { 1562 currentTime = _this.now(true); 1563 } 1564 return currentTime; 1565 }; 1566 1567 _this.str = function () { 1568 var format = options.format; 1569 if (options.yearOffset) { 1570 format = format.replace('Y', _this.currentTime.getFullYear() + options.yearOffset); 1571 format = format.replace('y', String(_this.currentTime.getFullYear() + options.yearOffset).substring(2, 4)); 1572 } 1573 return dateHelper.formatDate(_this.currentTime, format); 1574 }; 1575 _this.currentTime = this.now(); 1576 }; 1577 1578 _xdsoft_datetime = new XDSoft_datetime(); 1579 1580 applyButton.on('touchend click', function (e) {//pathbrite 1581 e.preventDefault(); 1582 datetimepicker.data('changed', true); 1583 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 1584 input.val(_xdsoft_datetime.str()); 1585 datetimepicker.trigger('close.xdsoft'); 1586 }); 1587 month_picker 1588 .find('.xdsoft_today_button') 1589 .on('touchend mousedown.xdsoft', function () { 1590 datetimepicker.data('changed', true); 1591 _xdsoft_datetime.setCurrentTime(0, true); 1592 datetimepicker.trigger('afterOpen.xdsoft'); 1593 }).on('dblclick.xdsoft', function () { 1594 var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate; 1595 currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); 1596 minDate = _xdsoft_datetime.strToDate(options.minDate); 1597 minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); 1598 if (currentDate < minDate) { 1599 return; 1600 } 1601 maxDate = _xdsoft_datetime.strToDate(options.maxDate); 1602 maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()); 1603 if (currentDate > maxDate) { 1604 return; 1605 } 1606 input.val(_xdsoft_datetime.str()); 1607 input.trigger('change'); 1608 datetimepicker.trigger('close.xdsoft'); 1609 }); 1610 month_picker 1611 .find('.xdsoft_prev,.xdsoft_next') 1612 .on('touchend mousedown.xdsoft', function () { 1613 var $this = $(this), 1614 timer = 0, 1615 stop = false; 1616 1617 (function arguments_callee1(v) { 1618 if ($this.hasClass(options.next)) { 1619 _xdsoft_datetime.nextMonth(); 1620 } else if ($this.hasClass(options.prev)) { 1621 _xdsoft_datetime.prevMonth(); 1622 } 1623 if (options.monthChangeSpinner) { 1624 if (!stop) { 1625 timer = setTimeout(arguments_callee1, v || 100); 1626 } 1627 } 1628 }(500)); 1629 1630 $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee2() { 1631 clearTimeout(timer); 1632 stop = true; 1633 $([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft', arguments_callee2); 1634 }); 1635 }); 1636 1637 timepicker 1638 .find('.xdsoft_prev,.xdsoft_next') 1639 .on('touchend mousedown.xdsoft', function () { 1640 var $this = $(this), 1641 timer = 0, 1642 stop = false, 1643 period = 110; 1644 (function arguments_callee4(v) { 1645 var pheight = timeboxparent[0].clientHeight, 1646 height = timebox[0].offsetHeight, 1647 top = Math.abs(parseInt(timebox.css('marginTop'), 10)); 1648 /** 1649 * Fixes a bug which happens if: 1650 * top is < the timeHeightInTimePicker, it will cause the up arrow to stop working 1651 * same for the down arrow if it's not exactly on the pixel 1652 */ 1653 if (top < options.timeHeightInTimePicker) { 1654 top = options.timeHeightInTimePicker; 1655 } else if ($this.hasClass(options.next) && (height - pheight) < top) { 1656 timebox.css('marginTop', '-' + height + 'px'); 1657 } 1658 1659 if ($this.hasClass(options.next) && (height - pheight) > top) { 1660 timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px'); 1661 } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) { 1662 timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px'); 1663 } 1664 /** 1665 * Fixed bug: 1666 * When using css3 transition, it will cause a bug that you cannot scroll the timepicker list. 1667 * The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this 1668 * would cause a bug when you use jquery.css method. 1669 * Let's say: * { transition: all .5s ease; } 1670 * jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button, 1671 * meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the 1672 * next/prev button. 1673 * 1674 * What we should do: 1675 * Replace timebox.css('marginTop') with timebox[0].style.marginTop. 1676 */ 1677 timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]); 1678 period = (period > 10) ? 10 : period - 10; 1679 if (!stop) { 1680 timer = setTimeout(arguments_callee4, v || period); 1681 } 1682 }(500)); 1683 $([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee5() { 1684 clearTimeout(timer); 1685 stop = true; 1686 $([options.ownerDocument.body, options.contentWindow]) 1687 .off('touchend mouseup.xdsoft', arguments_callee5); 1688 }); 1689 }); 1690 1691 xchangeTimer = 0; 1692 // base handler - generating a calendar and timepicker 1693 datetimepicker 1694 .on('xchange.xdsoft', function (event) { 1695 clearTimeout(xchangeTimer); 1696 xchangeTimer = setTimeout(function () { 1697 1698 if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null || isNaN(_xdsoft_datetime.currentTime.getTime())) { 1699 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 1700 } 1701 1702 var table = '', 1703 start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0), 1704 i = 0, 1705 j, 1706 today = _xdsoft_datetime.now(), 1707 maxDate = false, 1708 minDate = false, 1709 minDateTime = false, 1710 maxDateTime = false, 1711 hDate, 1712 day, 1713 d, 1714 y, 1715 m, 1716 w, 1717 classes = [], 1718 customDateSettings, 1719 newRow = true, 1720 time = '', 1721 h, 1722 line_time, 1723 description; 1724 1725 while (start.getDay() !== options.dayOfWeekStart) { 1726 start.setDate(start.getDate() - 1); 1727 } 1728 1729 table += '<table><thead><tr>'; 1730 1731 if (options.weeks) { 1732 table += '<th></th>'; 1733 } 1734 1735 for (j = 0; j < 7; j += 1) { 1736 table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>'; 1737 } 1738 1739 table += '</tr></thead>'; 1740 table += '<tbody>'; 1741 1742 if (options.maxDate !== false) { 1743 maxDate = _xdsoft_datetime.strToDate(options.maxDate); 1744 maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999); 1745 } 1746 1747 if (options.minDate !== false) { 1748 minDate = _xdsoft_datetime.strToDate(options.minDate); 1749 minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); 1750 } 1751 1752 if (options.minDateTime !== false) { 1753 minDateTime = _xdsoft_datetime.strToDate(options.minDateTime); 1754 minDateTime = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), minDateTime.getHours(), minDateTime.getMinutes(), minDateTime.getSeconds()); 1755 } 1756 1757 if (options.maxDateTime !== false) { 1758 maxDateTime = _xdsoft_datetime.strToDate(options.maxDateTime); 1759 maxDateTime = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), maxDateTime.getHours(), maxDateTime.getMinutes(), maxDateTime.getSeconds()); 1760 } 1761 1762 var maxDateTimeDay; 1763 if (maxDateTime !== false) { 1764 maxDateTimeDay = ((maxDateTime.getFullYear() * 12) + maxDateTime.getMonth()) * 31 + maxDateTime.getDate(); 1765 } 1766 1767 while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) { 1768 classes = []; 1769 i += 1; 1770 1771 day = start.getDay(); 1772 d = start.getDate(); 1773 y = start.getFullYear(); 1774 m = start.getMonth(); 1775 w = _xdsoft_datetime.getWeekOfYear(start); 1776 description = ''; 1777 1778 classes.push('xdsoft_date'); 1779 1780 if (options.beforeShowDay && typeof options.beforeShowDay.call === 'function') { 1781 customDateSettings = options.beforeShowDay.call(datetimepicker, start); 1782 } else { 1783 customDateSettings = null; 1784 } 1785 1786 if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){ 1787 if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){ 1788 classes.push('xdsoft_disabled'); 1789 } 1790 } 1791 1792 if(options.allowDates && options.allowDates.length>0){ 1793 if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){ 1794 classes.push('xdsoft_disabled'); 1795 } 1796 } 1797 1798 var currentDay = ((start.getFullYear() * 12) + start.getMonth()) * 31 + start.getDate(); 1799 if ((maxDate !== false && start > maxDate) || (minDateTime !== false && start < minDateTime) || (minDate !== false && start < minDate) || (maxDateTime !== false && currentDay > maxDateTimeDay) || (customDateSettings && customDateSettings[0] === false)) { 1800 classes.push('xdsoft_disabled'); 1801 } 1802 1803 if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { 1804 classes.push('xdsoft_disabled'); 1805 } 1806 1807 if (options.disabledWeekDays.indexOf(day) !== -1) { 1808 classes.push('xdsoft_disabled'); 1809 } 1810 1811 if (input.is('[disabled]')) { 1812 classes.push('xdsoft_disabled'); 1813 } 1814 1815 if (customDateSettings && customDateSettings[1] !== "") { 1816 classes.push(customDateSettings[1]); 1817 } 1818 1819 if (_xdsoft_datetime.currentTime.getMonth() !== m) { 1820 classes.push('xdsoft_other_month'); 1821 } 1822 1823 if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) { 1824 classes.push('xdsoft_current'); 1825 } 1826 1827 if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) { 1828 classes.push('xdsoft_today'); 1829 } 1830 1831 if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { 1832 classes.push('xdsoft_weekend'); 1833 } 1834 1835 if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) { 1836 hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)]; 1837 classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style); 1838 description = hDate.desc === undefined ? '' : hDate.desc; 1839 } 1840 1841 if (options.beforeShowDay && typeof options.beforeShowDay === 'function') { 1842 classes.push(options.beforeShowDay(start)); 1843 } 1844 1845 if (newRow) { 1846 table += '<tr>'; 1847 newRow = false; 1848 if (options.weeks) { 1849 table += '<th>' + w + '</th>'; 1850 } 1851 } 1852 1853 table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' + 1854 '<div>' + d + '</div>' + 1855 '</td>'; 1856 1857 if (start.getDay() === options.dayOfWeekStartPrev) { 1858 table += '</tr>'; 1859 newRow = true; 1860 } 1861 1862 start.setDate(d + 1); 1863 } 1864 table += '</tbody></table>'; 1865 1866 calendar.html(table); 1867 1868 month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]); 1869 month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear() + options.yearOffset); 1870 1871 // generate timebox 1872 time = ''; 1873 h = ''; 1874 m = ''; 1875 1876 var minTimeMinutesOfDay = 0; 1877 if (options.minTime !== false) { 1878 var t = _xdsoft_datetime.strtotime(options.minTime); 1879 minTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes(); 1880 } 1881 var maxTimeMinutesOfDay = 24 * 60; 1882 if (options.maxTime !== false) { 1883 var t = _xdsoft_datetime.strtotime(options.maxTime); 1884 maxTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes(); 1885 } 1886 1887 if (options.minDateTime !== false) { 1888 var t = _xdsoft_datetime.strToDateTime(options.minDateTime); 1889 var currentDayIsMinDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate); 1890 if (currentDayIsMinDateTimeDay) { 1891 var m = 60 * t.getHours() + t.getMinutes(); 1892 if (m > minTimeMinutesOfDay) minTimeMinutesOfDay = m; 1893 } 1894 } 1895 1896 if (options.maxDateTime !== false) { 1897 var t = _xdsoft_datetime.strToDateTime(options.maxDateTime); 1898 var currentDayIsMaxDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate); 1899 if (currentDayIsMaxDateTimeDay) { 1900 var m = 60 * t.getHours() + t.getMinutes(); 1901 if (m < maxTimeMinutesOfDay) maxTimeMinutesOfDay = m; 1902 } 1903 } 1904 1905 line_time = function line_time(h, m) { 1906 var now = _xdsoft_datetime.now(), current_time, 1907 isALlowTimesInit = options.allowTimes && Array.isArray(options.allowTimes) && options.allowTimes.length; 1908 now.setHours(h); 1909 h = parseInt(now.getHours(), 10); 1910 now.setMinutes(m); 1911 m = parseInt(now.getMinutes(), 10); 1912 classes = []; 1913 var currentMinutesOfDay = 60 * h + m; 1914 if (input.is('[disabled]') || (currentMinutesOfDay >= maxTimeMinutesOfDay) || (currentMinutesOfDay < minTimeMinutesOfDay)) { 1915 classes.push('xdsoft_disabled'); 1916 } 1917 1918 current_time = new Date(_xdsoft_datetime.currentTime); 1919 current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10)); 1920 1921 if (!isALlowTimesInit) { 1922 current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step); 1923 } 1924 1925 if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) { 1926 if (options.defaultSelect || datetimepicker.data('changed')) { 1927 classes.push('xdsoft_current'); 1928 } else if (options.initTime) { 1929 classes.push('xdsoft_init_time'); 1930 } 1931 } 1932 if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) { 1933 classes.push('xdsoft_today'); 1934 } 1935 time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>'; 1936 }; 1937 1938 if (!options.allowTimes || !Array.isArray(options.allowTimes) || !options.allowTimes.length) { 1939 for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) { 1940 for (j = 0; j < 60; j += options.step) { 1941 var currentMinutesOfDay = i * 60 + j; 1942 if (currentMinutesOfDay < minTimeMinutesOfDay) continue; 1943 if (currentMinutesOfDay >= maxTimeMinutesOfDay) continue; 1944 h = (i < 10 ? '0' : '') + i; 1945 m = (j < 10 ? '0' : '') + j; 1946 line_time(h, m); 1947 } 1948 } 1949 } else { 1950 for (i = 0; i < options.allowTimes.length; i += 1) { 1951 h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours(); 1952 m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes(); 1953 line_time(h, m); 1954 } 1955 } 1956 1957 timebox.html(time); 1958 1959 opt = ''; 1960 1961 for (i = parseInt(options.yearStart, 10); i <= parseInt(options.yearEnd, 10); i += 1) { 1962 opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + (i + options.yearOffset) + '</div>'; 1963 } 1964 yearselect.children().eq(0) 1965 .html(opt); 1966 1967 for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) { 1968 opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>'; 1969 } 1970 monthselect.children().eq(0).html(opt); 1971 $(datetimepicker) 1972 .trigger('generate.xdsoft'); 1973 }, 10); 1974 event.stopPropagation(); 1975 }) 1976 .on('afterOpen.xdsoft', function () { 1977 if (options.timepicker) { 1978 var classType, pheight, height, top; 1979 if (timebox.find('.xdsoft_current').length) { 1980 classType = '.xdsoft_current'; 1981 } else if (timebox.find('.xdsoft_init_time').length) { 1982 classType = '.xdsoft_init_time'; 1983 } 1984 if (classType) { 1985 pheight = timeboxparent[0].clientHeight; 1986 height = timebox[0].offsetHeight; 1987 top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1; 1988 if ((height - pheight) < top) { 1989 top = height - pheight; 1990 } 1991 timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]); 1992 } else { 1993 timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]); 1994 } 1995 } 1996 }); 1997 1998 timerclick = 0; 1999 calendar 2000 .on('touchend click.xdsoft', 'td', function (xdevent) { 2001 xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap 2002 timerclick += 1; 2003 var $this = $(this), 2004 currentTime = _xdsoft_datetime.currentTime; 2005 2006 if (currentTime === undefined || currentTime === null) { 2007 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 2008 currentTime = _xdsoft_datetime.currentTime; 2009 } 2010 2011 if ($this.hasClass('xdsoft_disabled')) { 2012 return false; 2013 } 2014 2015 currentTime.setDate(1); 2016 currentTime.setFullYear($this.data('year')); 2017 currentTime.setMonth($this.data('month')); 2018 currentTime.setDate($this.data('date')); 2019 2020 datetimepicker.trigger('select.xdsoft', [currentTime]); 2021 2022 input.val(_xdsoft_datetime.str()); 2023 2024 if (options.onSelectDate && typeof options.onSelectDate === 'function') { 2025 options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); 2026 } 2027 2028 datetimepicker.data('changed', true); 2029 datetimepicker.trigger('xchange.xdsoft'); 2030 datetimepicker.trigger('changedatetime.xdsoft'); 2031 if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) { 2032 datetimepicker.trigger('close.xdsoft'); 2033 } 2034 setTimeout(function () { 2035 timerclick = 0; 2036 }, 200); 2037 }); 2038 2039 timebox 2040 .on('touchstart', 'div', function (xdevent) { 2041 this.touchMoved = false; 2042 }) 2043 .on('touchmove', 'div', handleTouchMoved) 2044 .on('touchend click.xdsoft', 'div', function (xdevent) { 2045 if (!this.touchMoved) { 2046 xdevent.stopPropagation(); 2047 var $this = $(this), 2048 currentTime = _xdsoft_datetime.currentTime; 2049 2050 if (currentTime === undefined || currentTime === null) { 2051 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 2052 currentTime = _xdsoft_datetime.currentTime; 2053 } 2054 2055 if ($this.hasClass('xdsoft_disabled')) { 2056 return false; 2057 } 2058 currentTime.setHours($this.data('hour')); 2059 currentTime.setMinutes($this.data('minute')); 2060 datetimepicker.trigger('select.xdsoft', [currentTime]); 2061 2062 datetimepicker.data('input').val(_xdsoft_datetime.str()); 2063 2064 if (options.onSelectTime && typeof options.onSelectTime === 'function') { 2065 options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); 2066 } 2067 datetimepicker.data('changed', true); 2068 datetimepicker.trigger('xchange.xdsoft'); 2069 datetimepicker.trigger('changedatetime.xdsoft'); 2070 if (options.inline !== true && options.closeOnTimeSelect === true) { 2071 datetimepicker.trigger('close.xdsoft'); 2072 } 2073 } 2074 }); 2075 2076 datepicker 2077 .on('mousewheel.xdsoft', function (event) { 2078 if (!options.scrollMonth) { 2079 return true; 2080 } 2081 if (event.deltaY < 0) { 2082 _xdsoft_datetime.nextMonth(); 2083 } else { 2084 _xdsoft_datetime.prevMonth(); 2085 } 2086 return false; 2087 }); 2088 2089 input 2090 .on('mousewheel.xdsoft', function (event) { 2091 if (!options.scrollInput) { 2092 return true; 2093 } 2094 if (!options.datepicker && options.timepicker) { 2095 current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0; 2096 if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) { 2097 current_time_index += event.deltaY; 2098 } 2099 if (timebox.children().eq(current_time_index).length) { 2100 timebox.children().eq(current_time_index).trigger('mousedown'); 2101 } 2102 return false; 2103 } 2104 if (options.datepicker && !options.timepicker) { 2105 datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]); 2106 if (input.val) { 2107 input.val(_xdsoft_datetime.str()); 2108 } 2109 datetimepicker.trigger('changedatetime.xdsoft'); 2110 return false; 2111 } 2112 }); 2113 2114 datetimepicker 2115 .on('changedatetime.xdsoft', function (event) { 2116 if (options.onChangeDateTime && typeof options.onChangeDateTime === 'function') { 2117 var $input = datetimepicker.data('input'); 2118 options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event); 2119 delete options.value; 2120 $input.trigger('change'); 2121 } 2122 }) 2123 .on('generate.xdsoft', function () { 2124 if (options.onGenerate && typeof options.onGenerate === 'function') { 2125 options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 2126 } 2127 if (triggerAfterOpen) { 2128 datetimepicker.trigger('afterOpen.xdsoft'); 2129 triggerAfterOpen = false; 2130 } 2131 }) 2132 .on('click.xdsoft', function (xdevent) { 2133 xdevent.stopPropagation(); 2134 }); 2135 2136 current_time_index = 0; 2137 2138 /** 2139 * Runs the callback for each of the specified node's ancestors. 2140 * 2141 * Return FALSE from the callback to stop ascending. 2142 * 2143 * @param {DOMNode} node 2144 * @param {Function} callback 2145 * @returns {undefined} 2146 */ 2147 forEachAncestorOf = function (node, callback) { 2148 do { 2149 node = node.parentNode; 2150 2151 if (!node || callback(node) === false) { 2152 break; 2153 } 2154 } while (node.nodeName !== 'HTML'); 2155 }; 2156 2157 /** 2158 * Sets the position of the picker. 2159 * 2160 * @returns {undefined} 2161 */ 2162 setPos = function () { 2163 var dateInputOffset, 2164 dateInputElem, 2165 verticalPosition, 2166 left, 2167 position, 2168 datetimepickerElem, 2169 dateInputHasFixedAncestor, 2170 $dateInput, 2171 windowWidth, 2172 verticalAnchorEdge, 2173 datetimepickerCss, 2174 windowHeight, 2175 windowScrollTop; 2176 2177 $dateInput = datetimepicker.data('input'); 2178 dateInputOffset = $dateInput.offset(); 2179 dateInputElem = $dateInput[0]; 2180 2181 verticalAnchorEdge = 'top'; 2182 verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1; 2183 left = dateInputOffset.left; 2184 position = "absolute"; 2185 2186 windowWidth = $(options.contentWindow).width(); 2187 windowHeight = $(options.contentWindow).height(); 2188 windowScrollTop = $(options.contentWindow).scrollTop(); 2189 2190 if ((options.ownerDocument.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) { 2191 var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth; 2192 left = left - diff; 2193 } 2194 2195 if ($dateInput.parent().css('direction') === 'rtl') { 2196 left -= (datetimepicker.outerWidth() - $dateInput.outerWidth()); 2197 } 2198 2199 if (options.fixed) { 2200 verticalPosition -= windowScrollTop; 2201 left -= $(options.contentWindow).scrollLeft(); 2202 position = "fixed"; 2203 } else { 2204 dateInputHasFixedAncestor = false; 2205 2206 forEachAncestorOf(dateInputElem, function (ancestorNode) { 2207 if (ancestorNode === null) { 2208 return false; 2209 } 2210 2211 if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') { 2212 dateInputHasFixedAncestor = true; 2213 return false; 2214 } 2215 }); 2216 2217 if (dateInputHasFixedAncestor && !options.insideParent) { 2218 position = 'fixed'; 2219 2220 //If the picker won't fit entirely within the viewport then display it above the date input. 2221 if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) { 2222 verticalAnchorEdge = 'bottom'; 2223 verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top; 2224 } else { 2225 verticalPosition -= windowScrollTop; 2226 } 2227 } else { 2228 if (verticalPosition + datetimepicker[0].offsetHeight > windowHeight + windowScrollTop) { 2229 verticalPosition = dateInputOffset.top - datetimepicker[0].offsetHeight + 1; 2230 } 2231 } 2232 2233 if (verticalPosition < 0) { 2234 verticalPosition = 0; 2235 } 2236 2237 if (left + dateInputElem.offsetWidth > windowWidth) { 2238 left = windowWidth - dateInputElem.offsetWidth; 2239 } 2240 } 2241 2242 datetimepickerElem = datetimepicker[0]; 2243 2244 forEachAncestorOf(datetimepickerElem, function (ancestorNode) { 2245 var ancestorNodePosition; 2246 2247 ancestorNodePosition = options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position'); 2248 2249 if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) { 2250 left = left - ((windowWidth - ancestorNode.offsetWidth) / 2); 2251 return false; 2252 } 2253 }); 2254 2255 datetimepickerCss = { 2256 position: position, 2257 left: options.insideParent ? dateInputElem.offsetLeft : left, 2258 top: '', //Initialize to prevent previous values interfering with new ones. 2259 bottom: '' //Initialize to prevent previous values interfering with new ones. 2260 }; 2261 2262 if (options.insideParent) { 2263 datetimepickerCss[verticalAnchorEdge] = dateInputElem.offsetTop + dateInputElem.offsetHeight; 2264 } else { 2265 datetimepickerCss[verticalAnchorEdge] = verticalPosition; 2266 } 2267 2268 datetimepicker.css(datetimepickerCss); 2269 }; 2270 2271 datetimepicker 2272 .on('open.xdsoft', function (event) { 2273 var onShow = true; 2274 if (options.onShow && typeof options.onShow === 'function') { 2275 onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); 2276 } 2277 if (onShow !== false) { 2278 datetimepicker.show(); 2279 setPos(); 2280 $(options.contentWindow) 2281 .off('resize.xdsoft', setPos) 2282 .on('resize.xdsoft', setPos); 2283 2284 if (options.closeOnWithoutClick) { 2285 $([options.ownerDocument.body, options.contentWindow]).on('touchstart mousedown.xdsoft', function arguments_callee6() { 2286 datetimepicker.trigger('close.xdsoft'); 2287 $([options.ownerDocument.body, options.contentWindow]).off('touchstart mousedown.xdsoft', arguments_callee6); 2288 }); 2289 } 2290 } 2291 }) 2292 .on('close.xdsoft', function (event) { 2293 var onClose = true; 2294 month_picker 2295 .find('.xdsoft_month,.xdsoft_year') 2296 .find('.xdsoft_select') 2297 .hide(); 2298 if (options.onClose && typeof options.onClose === 'function') { 2299 onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); 2300 } 2301 if (onClose !== false && !options.opened && !options.inline) { 2302 datetimepicker.hide(); 2303 } 2304 event.stopPropagation(); 2305 }) 2306 .on('toggle.xdsoft', function () { 2307 if (datetimepicker.is(':visible')) { 2308 datetimepicker.trigger('close.xdsoft'); 2309 } else { 2310 datetimepicker.trigger('open.xdsoft'); 2311 } 2312 }) 2313 .data('input', input); 2314 2315 timer = 0; 2316 2317 datetimepicker.data('xdsoft_datetime', _xdsoft_datetime); 2318 datetimepicker.setOptions(options); 2319 2320 function getCurrentValue() { 2321 var ct = false, time; 2322 2323 if (options.startDate) { 2324 ct = _xdsoft_datetime.strToDate(options.startDate); 2325 } else { 2326 ct = options.value || ((input && input.val && input.val()) ? input.val() : ''); 2327 if (ct) { 2328 ct = _xdsoft_datetime.strToDateTime(ct); 2329 if (options.yearOffset) { 2330 ct = new Date(ct.getFullYear() - options.yearOffset, ct.getMonth(), ct.getDate(), ct.getHours(), ct.getMinutes(), ct.getSeconds(), ct.getMilliseconds()); 2331 } 2332 } else if (options.defaultDate) { 2333 ct = _xdsoft_datetime.strToDateTime(options.defaultDate); 2334 if (options.defaultTime) { 2335 time = _xdsoft_datetime.strtotime(options.defaultTime); 2336 ct.setHours(time.getHours()); 2337 ct.setMinutes(time.getMinutes()); 2338 } 2339 } 2340 } 2341 2342 if (ct && _xdsoft_datetime.isValidDate(ct)) { 2343 datetimepicker.data('changed', true); 2344 } else { 2345 ct = ''; 2346 } 2347 2348 return ct || 0; 2349 } 2350 2351 function setMask(options) { 2352 2353 var isValidValue = function (mask, value) { 2354 var reg = mask 2355 .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') 2356 .replace(/_/g, '{digit+}') 2357 .replace(/([0-9]{1})/g, '{digit$1}') 2358 .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') 2359 .replace(/\{digit[\+]\}/g, '[0-9_]{1}'); 2360 return (new RegExp(reg)).test(value); 2361 }, 2362 getCaretPos = function (input) { 2363 try { 2364 if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) { 2365 var range = options.ownerDocument.selection.createRange(); 2366 return range.getBookmark().charCodeAt(2) - 2; 2367 } 2368 if (input.setSelectionRange) { 2369 return input.selectionStart; 2370 } 2371 } catch (e) { 2372 return 0; 2373 } 2374 }, 2375 setCaretPos = function (node, pos) { 2376 node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node; 2377 if (!node) { 2378 return false; 2379 } 2380 if (node.createTextRange) { 2381 var textRange = node.createTextRange(); 2382 textRange.collapse(true); 2383 textRange.moveEnd('character', pos); 2384 textRange.moveStart('character', pos); 2385 textRange.select(); 2386 return true; 2387 } 2388 if (node.setSelectionRange) { 2389 node.setSelectionRange(pos, pos); 2390 return true; 2391 } 2392 return false; 2393 }; 2394 2395 if(options.mask) { 2396 input.off('keydown.xdsoft'); 2397 } 2398 2399 if (options.mask === true) { 2400 if (dateHelper.formatMask) { 2401 options.mask = dateHelper.formatMask(options.format) 2402 } else { 2403 options.mask = options.format 2404 .replace(/Y/g, '9999') 2405 .replace(/F/g, '9999') 2406 .replace(/m/g, '19') 2407 .replace(/d/g, '39') 2408 .replace(/H/g, '29') 2409 .replace(/i/g, '59') 2410 .replace(/s/g, '59'); 2411 } 2412 } 2413 2414 if (typeof options.mask === 'string') { 2415 if (!isValidValue(options.mask, input.val())) { 2416 input.val(options.mask.replace(/[0-9]/g, '_')); 2417 setCaretPos(input[0], 0); 2418 } 2419 2420 input.on('paste.xdsoft', function (event) { 2421 // couple options here 2422 // 1. return false - tell them they can't paste 2423 // 2. insert over current characters - minimal validation 2424 // 3. full fledged parsing and validation 2425 // let's go option 2 for now 2426 2427 // fires multiple times for some reason 2428 2429 // https://stackoverflow.com/a/30496488/1366033 2430 var clipboardData = event.clipboardData || event.originalEvent.clipboardData || window.clipboardData, 2431 pastedData = clipboardData.getData('text'), 2432 val = this.value, 2433 pos = this.selectionStart 2434 2435 var valueBeforeCursor = val.slice(0, pos); 2436 var valueAfterPaste = val.slice(pos + pastedData.length); 2437 2438 val = valueBeforeCursor + pastedData + valueAfterPaste; 2439 pos += pastedData.length; 2440 2441 if (isValidValue(options.mask, val)) { 2442 this.value = val; 2443 setCaretPos(this, pos); 2444 } else if (val.trim() === '') { 2445 this.value = options.mask.replace(/[0-9]/g, '_'); 2446 } else { 2447 input.trigger('error_input.xdsoft'); 2448 } 2449 2450 event.preventDefault(); 2451 return false; 2452 }); 2453 2454 input.on('keydown.xdsoft', function (event) { 2455 var val = this.value, 2456 key = event.which, 2457 pos = this.selectionStart, 2458 selEnd = this.selectionEnd, 2459 hasSel = pos !== selEnd, 2460 digit; 2461 2462 // only alow these characters 2463 if (((key >= KEY0 && key <= KEY9) || 2464 (key >= _KEY0 && key <= _KEY9)) || 2465 (key === BACKSPACE || key === DEL)) { 2466 2467 // get char to insert which is new character or placeholder ('_') 2468 digit = (key === BACKSPACE || key === DEL) ? '_' : 2469 String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key); 2470 2471 // we're deleting something, we're not at the start, and have normal cursor, move back one 2472 // if we have a selection length, cursor actually sits behind deletable char, not in front 2473 if (key === BACKSPACE && pos && !hasSel) { 2474 pos -= 1; 2475 } 2476 2477 // don't stop on a separator, continue whatever direction you were going 2478 // value char - keep incrementing position while on separator char and we still have room 2479 // del char - keep decrementing position while on separator char and we still have room 2480 while (true) { 2481 var maskValueAtCurPos = options.mask.slice(pos, pos+1); 2482 var posShorterThanMaskLength = pos < options.mask.length; 2483 var posGreaterThanZero = pos > 0; 2484 var notNumberOrPlaceholder = /[^0-9_]/; 2485 var curPosOnSep = notNumberOrPlaceholder.test(maskValueAtCurPos); 2486 var continueMovingPosition = curPosOnSep && posShorterThanMaskLength && posGreaterThanZero 2487 2488 // if we hit a real char, stay where we are 2489 if (!continueMovingPosition) break; 2490 2491 // hitting backspace in a selection, you can possibly go back any further - go forward 2492 pos += (key === BACKSPACE && !hasSel) ? -1 : 1; 2493 2494 } 2495 2496 if (event.metaKey) { // cmd has been pressed 2497 pos = 0; 2498 hasSel = true; 2499 } 2500 2501 if (hasSel) { 2502 // pos might have moved so re-calc length 2503 var selLength = selEnd - pos 2504 2505 // if we have a selection length we will wipe out entire selection and replace with default template for that range 2506 var defaultBlank = options.mask.replace(/[0-9]/g, '_'); 2507 var defaultBlankSelectionReplacement = defaultBlank.slice(pos, pos+selLength); 2508 var selReplacementRemainder = defaultBlankSelectionReplacement.slice(1) // might be empty 2509 2510 var valueBeforeSel = val.slice(0, pos); 2511 var insertChars = digit + selReplacementRemainder; 2512 var charsAfterSelection = val.slice(pos + selLength); 2513 2514 val = valueBeforeSel + insertChars + charsAfterSelection 2515 2516 } else { 2517 var valueBeforeCursor = val.slice(0, pos); 2518 var insertChar = digit; 2519 var valueAfterNextChar = val.slice(pos + 1); 2520 2521 val = valueBeforeCursor + insertChar + valueAfterNextChar 2522 } 2523 2524 if (val.trim() === '') { 2525 // if empty, set to default 2526 val = defaultBlank 2527 } else { 2528 // if at the last character don't need to do anything 2529 if (pos === options.mask.length) { 2530 event.preventDefault(); 2531 return false; 2532 } 2533 } 2534 2535 // resume cursor location 2536 pos += (key === BACKSPACE) ? 0 : 1; 2537 // don't stop on a separator, continue whatever direction you were going 2538 while (/[^0-9_]/.test(options.mask.slice(pos, pos+1)) && pos < options.mask.length && pos > 0) { 2539 pos += (key === BACKSPACE) ? 0 : 1; 2540 } 2541 2542 if (isValidValue(options.mask, val)) { 2543 this.value = val; 2544 setCaretPos(this, pos); 2545 } else if (val.trim() === '') { 2546 this.value = options.mask.replace(/[0-9]/g, '_'); 2547 } else { 2548 input.trigger('error_input.xdsoft'); 2549 } 2550 } else { 2551 if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) { 2552 return true; 2553 } 2554 } 2555 2556 event.preventDefault(); 2557 return false; 2558 }); 2559 } 2560 } 2561 2562 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 2563 2564 input 2565 .data('xdsoft_datetimepicker', datetimepicker) 2566 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () { 2567 if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) { 2568 return; 2569 } 2570 if (!options.openOnFocus) { 2571 return; 2572 } 2573 clearTimeout(timer); 2574 timer = setTimeout(function () { 2575 if (input.is(':disabled')) { 2576 return; 2577 } 2578 2579 triggerAfterOpen = true; 2580 _xdsoft_datetime.setCurrentTime(getCurrentValue(), true); 2581 if(options.mask) { 2582 setMask(options); 2583 } 2584 datetimepicker.trigger('open.xdsoft'); 2585 }, 100); 2586 }) 2587 .on('keydown.xdsoft', function (event) { 2588 var elementSelector, 2589 key = event.which; 2590 if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) { 2591 elementSelector = $("input:visible,textarea:visible,button:visible,a:visible"); 2592 datetimepicker.trigger('close.xdsoft'); 2593 elementSelector.eq(elementSelector.index(this) + 1).focus(); 2594 return false; 2595 } 2596 if ([TAB].indexOf(key) !== -1) { 2597 datetimepicker.trigger('close.xdsoft'); 2598 return true; 2599 } 2600 }) 2601 .on('blur.xdsoft', function () { 2602 datetimepicker.trigger('close.xdsoft'); 2603 }); 2604 }; 2605 destroyDateTimePicker = function (input) { 2606 var datetimepicker = input.data('xdsoft_datetimepicker'); 2607 if (datetimepicker) { 2608 datetimepicker.data('xdsoft_datetime', null); 2609 datetimepicker.remove(); 2610 input 2611 .data('xdsoft_datetimepicker', null) 2612 .off('.xdsoft'); 2613 $(options.contentWindow).off('resize.xdsoft'); 2614 $([options.contentWindow, options.ownerDocument.body]).off('mousedown.xdsoft touchstart'); 2615 if (input.unmousewheel) { 2616 input.unmousewheel(); 2617 } 2618 } 2619 }; 2620 $(options.ownerDocument) 2621 .off('keydown.xdsoftctrl keyup.xdsoftctrl') 2622 .off('keydown.xdsoftcmd keyup.xdsoftcmd') 2623 .on('keydown.xdsoftctrl', function (e) { 2624 if (e.keyCode === CTRLKEY) { 2625 ctrlDown = true; 2626 } 2627 }) 2628 .on('keyup.xdsoftctrl', function (e) { 2629 if (e.keyCode === CTRLKEY) { 2630 ctrlDown = false; 2631 } 2632 }) 2633 .on('keydown.xdsoftcmd', function (e) { 2634 if (e.keyCode === CMDKEY) { 2635 cmdDown = true; 2636 } 2637 }) 2638 .on('keyup.xdsoftcmd', function (e) { 2639 if (e.keyCode === CMDKEY) { 2640 cmdDown = false; 2641 } 2642 }); 2643 2644 this.each(function () { 2645 var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input; 2646 if (datetimepicker) { 2647 if (typeof opt === 'string') { 2648 switch (opt) { 2649 case 'show': 2650 $(this).select().focus(); 2651 datetimepicker.trigger('open.xdsoft'); 2652 break; 2653 case 'hide': 2654 datetimepicker.trigger('close.xdsoft'); 2655 break; 2656 case 'toggle': 2657 datetimepicker.trigger('toggle.xdsoft'); 2658 break; 2659 case 'destroy': 2660 destroyDateTimePicker($(this)); 2661 break; 2662 case 'reset': 2663 this.value = this.defaultValue; 2664 if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) { 2665 datetimepicker.data('changed', false); 2666 } 2667 datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value); 2668 break; 2669 case 'validate': 2670 $input = datetimepicker.data('input'); 2671 $input.trigger('blur.xdsoft'); 2672 break; 2673 default: 2674 if (datetimepicker[opt] && typeof datetimepicker[opt] === 'function') { 2675 result = datetimepicker[opt](opt2); 2676 } 2677 } 2678 } else { 2679 datetimepicker 2680 .setOptions(opt); 2681 } 2682 return 0; 2683 } 2684 if (typeof opt
vendor: 758 bytes, lines 2684-2718
2684 !== 'string') { 2685 if (!options.lazyInit || options.open || options.inline) { 2686 createDateTimePicker($(this)); 2687 } else { 2688 lazyInit($(this)); 2689 } 2690 } 2691 }); 2692 2693 return result; 2694 }; 2695 2696 $.fn.datetimepicker.defaults = default_options; 2697 2698 function HighlightedDate(date, desc, style) { 2699 "use strict"; 2700 this.date = date; 2701 this.desc = desc; 2702 this.style = style; 2703 } 2704}; 2705;(function (factory) { 2706 if ( typeof define === 'function' && define.amd ) { 2707 // AMD. Register as an anonymous module. 2708 define(['jquery', 'jquery-mousewheel'], factory); 2709 } else if (typeof exports === 'object') { 2710 // Node/CommonJS style for Browserify 2711 module.exports = factory(require('jquery'));; 2712 } else { 2713 // Browser globals 2714 factory(jQuery); 2715 } 2716}(datetimepickerFactory)); 2717 2718
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.