1/** 2 * @preserve jQuery DateTimePicker plugin v2.4.5 3 * @homepage http://xdsoft.net/jqplugins/datetimepicker/ 4 * (c) 2014, Chupurnov Valeriy. 5 */ 6/*global document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/ 7(function ($) { 8 'use strict'; 9 var default_options = { 10 i18n: { 11 ar: { // Arabic 12 months: [ 13 "ÙÙØ§Ùر", "ÙØ¨Ø±Ø§Ùر", "٠ارس", "أبرÙÙ", "٠اÙÙ", "ÙÙÙÙÙ", "ÙÙÙÙÙ", "أغسطس", "سبت٠بر", "Ø£ÙØªÙبر", "ÙÙÙ٠بر", "Ø¯ÙØ³Ù بر" 14 ], 15 dayOfWeek: [ 16 "Ù", "Ø«", "ع", "Ø®", "ج", "س", "Ø" 17 ] 18 }, 19 ro: { // Romanian 20 months: [ 21 "ianuarie", "februarie", "martie", "aprilie", "mai", "iunie", "iulie", "august", "septembrie", "octombrie", "noiembrie", "decembrie" 22 ], 23 dayOfWeek: [ 24 "l", "ma", "mi", "j", "v", "s", "d" 25 ] 26 }, 27 id: { // Indonesian 28 months: [ 29 "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" 30 ], 31 dayOfWeek: [ 32 "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab" 33 ] 34 }, 35 is: { // Icelandic 36 months: [ 37 "Janúar", "Febrúar", "Mars", "AprÃl", "MaÃ", "JúnÃ", "JúlÃ", "Ãgúst", "September", "Október", "Nóvember", "Desember" 38 ], 39 dayOfWeek: [ 40 "Sun", "Mán", "Ãrið", "Mið", "Fim", "Fös", "Lau" 41 ] 42 }, 43 bg: { // Bulgarian 44 months: [ 45 "ЯнÑаÑи", "ФевÑÑаÑи", "ÐаÑÑ", "ÐпÑил", "Ðай", "Юни", "Юли", "ÐвгÑÑÑ", "СепÑемвÑи", "ÐкÑомвÑи", "ÐоемвÑи", "ÐекемвÑи" 46 ], 47 dayOfWeek: [ 48 "Ðд", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб" 49 ] 50 }, 51 fa: { // Persian/Farsi 52 months: [ 53 'ÙØ±ÙردÛÙ', 'Ø§Ø±Ø¯ÛØ¨Ùشت', 'خرداد', 'ØªÛØ±', '٠رداد', 'Ø´ÙØ±ÛÙØ±', 'Ù ÙØ±', 'آباÙ', 'آذر', 'دÛ', 'بÙÙ Ù', 'اسÙÙØ¯' 54 ], 55 dayOfWeek: [ 56 'ÛÚ©Ø´ÙØ¨Ù', 'Ø¯ÙØ´ÙبÙ', 'Ø³Ù Ø´ÙØ¨Ù', 'ÚÙØ§Ø±Ø´ÙبÙ', 'Ù¾ÙØ¬Ø´ÙبÙ', 'ج٠عÙ', 'Ø´ÙØ¨Ù' 57 ] 58 }, 59 ru: { // Russian 60 months: [ 61 'ЯнваÑÑ', 'ФевÑалÑ', 'ÐаÑÑ', 'ÐпÑелÑ', 'Ðай', 'ÐÑнÑ', 'ÐÑлÑ', 'ÐвгÑÑÑ', 'СенÑÑбÑÑ', 'ÐкÑÑбÑÑ', 'ÐоÑбÑÑ', 'ÐекабÑÑ' 62 ], 63 dayOfWeek: [ 64 "ÐÑк", "Ðн", "ÐÑ", "СÑ", "ЧÑ", "ÐÑ", "Сб" 65 ] 66 }, 67 uk: { // Ukrainian 68 months: [ 69 'СÑÑенÑ', 'ÐÑÑий', 'ÐеÑезенÑ', 'ÐвÑÑенÑ', 'ТÑавенÑ', 'ЧеÑвенÑ', 'ÐипенÑ', 'СеÑпенÑ', 'ÐеÑеÑенÑ', 'ÐовÑенÑ', 'ÐиÑÑопад', 'ÐÑÑденÑ' 70 ], 71 dayOfWeek: [ 72 "Ðдл", "Ðнд", "ÐÑÑ", "СÑд", "ЧÑв", "ÐÑн", "СбÑ" 73 ] 74 }, 75 en: { // English 76 months: [ 77 "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
77November", "December" 78 ], 79 dayOfWeek: [ 80 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 81 ] 82 }, 83 el: { // Îλληνικά 84 months: [ 85 "ÎÎ±Î½Î¿Ï Î¬ÏιοÏ", "ΦεβÏÎ¿Ï Î¬ÏιοÏ", "ÎάÏÏιοÏ", "ÎÏÏίλιοÏ", "ÎάιοÏ", "ÎοÏνιοÏ", "ÎοÏλιοÏ", "ÎÏÎ³Î¿Ï ÏÏοÏ", "ΣεÏÏÎμβÏιοÏ", "ÎκÏÏβÏιοÏ", "ÎοÎμβÏιοÏ", "ÎεκÎμβÏιοÏ" 86 ], 87 dayOfWeek: [ 88 "ÎÏ Ï", "ÎÎµÏ ", "ΤÏι", "ΤεÏ", "Πεμ", "ΠαÏ", "Σαβ" 89 ] 90 }, 91 de: { // German 92 months: [ 93 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' 94 ], 95 dayOfWeek: [ 96 "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa" 97 ] 98 }, 99 nl: { // Dutch 100 months: [ 101 "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december" 102 ], 103 dayOfWeek: [ 104 "zo", "ma", "di", "wo", "do", "vr", "za" 105 ] 106 }, 107 tr: { // Turkish 108 months: [ 109 "Ocak", "Åubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "AÄustos", "Eylül", "Ekim", "Kasım", "Aralık" 110 ], 111 dayOfWeek: [ 112 "Paz", "Pts", "Sal", "Ãar", "Per", "Cum", "Cts" 113 ] 114 }, 115 fr: { //French 116 months: [ 117 "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" 118 ], 119 dayOfWeek: [ 120 "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" 121 ] 122 }, 123 es: { // Spanish 124 months: [ 125 "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" 126 ], 127 dayOfWeek: [ 128 "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" 129 ] 130 }, 131 th: { // Thai 132 months: [ 133 'มà¸à¸£à¸²à¸à¸¡', 'à¸à¸¸à¸¡à¸ าà¸à¸±à¸à¸à¹', 'มีà¸à¸²à¸à¸¡', 'à¹à¸¡à¸©à¸²à¸¢à¸', 'à¸à¸¤à¸©à¸ าà¸à¸¡', 'มิà¸à¸¸à¸à¸²à¸¢à¸', 'à¸à¸£à¸à¸à¸²à¸à¸¡', 'สิà¸à¸«à¸²à¸à¸¡', 'à¸à¸±à¸à¸¢à¸²à¸¢à¸', 'à¸à¸¸à¸¥à¸²à¸à¸¡', 'à¸à¸¤à¸¨à¸à¸´à¸à¸²à¸¢à¸', 'à¸à¸±à¸à¸§à¸²à¸à¸¡' 134 ], 135 dayOfWeek: [ 136 'à¸à¸².', 'à¸.', 'à¸.', 'à¸.', 'à¸à¸¤.', 'ศ.', 'ส.' 137 ] 138 }, 139 pl: { // Polish 140 months: [ 141 "styczeÅ", "luty", "marzec", "kwiecieÅ", "maj", "czerwiec", "lipiec", "sierpieÅ", "wrzesieÅ", "październik", "listopad", "grudzieÅ" 142 ], 143 dayOfWeek: [ 144 "nd", "pn", "wt", "År", "cz", "pt", "sb" 145 ] 146 }, 147 pt: { // Portuguese 148 months: [ 149 "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" 150 ], 151 dayOfWeek: [ 152 "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab" 153 ] 154 }, 155 ch: { // Simplified Chinese 156 months: [ 157 "䏿", "äºæ", "䏿", "åæ", "äºæ", "å æ", "䏿", "å «æ", "乿", "åæ", "å䏿", "åäºæ" 158 ], 159 dayOfWeek: [ 160 "æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å " 161 ] 162 }, 163 se: { // Swedish 164 months: [ 165 "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" 166 ], 167 dayOfWeek: [ 168 "Sön", "MÃ¥n", "Tis", "Ons", "Tor", "Fre", "Lör" 169 ] 170 }, 171 kr: { // Korean 172 months: [ 173 "1ì", "2ì", "3ì", "4ì", "5ì", "6ì", "7ì", "8ì", "9ì", "10ì", "11ì", "12ì" 174 ], 175 dayOfWeek: [ 176 "ì¼", "ì", "í", "ì", "목", "ê¸", "í " 177 ] 178 }, 179 it: { // Italian 180 months: [ 181 "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" 182 ], 183 dayOfWeek: [ 184 "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab" 185 ] 186 }, 187 da: { // Dansk 188 months: [ 189 "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December" 190 ], 191 dayOfWeek: [ 192 "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" 193 ] 194 }, 195 no: { // Norwegian 196 months: [ 197 "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember" 198 ], 199 dayOfWeek: [ 200 "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" 201 ] 202 }, 203 nb: { // Norwegian BokmÃ¥l 204 months: [ 205 "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "
205November", "Desember" 206 ], 207 dayOfWeek: [ 208 "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" 209 ] 210 }, 211 ja: { // Japanese 212 months: [ 213 "1æ", "2æ", "3æ", "4æ", "5æ", "6æ", "7æ", "8æ", "9æ", "10æ", "11æ", "12æ" 214 ], 215 dayOfWeek: [ 216 "æ¥", "æ", "ç«", "æ°´", "æ¨", "é", "å" 217 ] 218 }, 219 vi: { // Vietnamese 220 months: [ 221 "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" 222 ], 223 dayOfWeek: [ 224 "CN", "T2", "T3", "T4", "T5", "T6", "T7" 225 ] 226 }, 227 sl: { // SlovenÅ¡Äina 228 months: [ 229 "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December" 230 ], 231 dayOfWeek: [ 232 "Ned", "Pon", "Tor", "Sre", "Äet", "Pet", "Sob" 233 ] 234 }, 235 cs: { // ÄeÅ¡tina 236 months: [ 237 "Leden", "Ãnor", "BÅezen", "Duben", "KvÄten", "Äerven", "Äervenec", "Srpen", "ZáÅÃ", "ÅÃjen", "Listopad", "Prosinec" 238 ], 239 dayOfWeek: [ 240 "Ne", "Po", "Ãt", "St", "Ät", "Pá", "So" 241 ] 242 }, 243 hu: { // Hungarian 244 months: [ 245 "Január", "Február", "Március", "Ãprilis", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" 246 ], 247 dayOfWeek: [ 248 "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo" 249 ] 250 }, 251 az: { //Azerbaijanian (Azeri) 252 months: [ 253 "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr" 254 ], 255 dayOfWeek: [ 256 "B", "Be", "Ãa", "Ã", "Ca", "C", "Å" 257 ] 258 }, 259 bs: { //Bosanski 260 months: [ 261 "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" 262 ], 263 dayOfWeek: [ 264 "Ned", "Pon", "Uto", "Sri", "Äet", "Pet", "Sub" 265 ] 266 }, 267 ca: { //Català 268 months: [ 269 "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre" 270 ], 271 dayOfWeek: [ 272 "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds" 273 ] 274 }, 275 'en-GB': { //English (British) 276 months: [ 277 "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
277November", "December" 278 ], 279 dayOfWeek: [ 280 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 281 ] 282 }, 283 et: { //"Eesti" 284 months: [ 285 "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember" 286 ], 287 dayOfWeek: [ 288 "P", "E", "T", "K", "N", "R", "L" 289 ] 290 }, 291 eu: { //Euskara 292 months: [ 293 "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua" 294 ], 295 dayOfWeek: [ 296 "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La." 297 ] 298 }, 299 fi: { //Finnish (Suomi) 300 months: [ 301 "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu" 302 ], 303 dayOfWeek: [ 304 "Su", "Ma", "Ti", "Ke", "To", "Pe", "La" 305 ] 306 }, 307 gl: { //Galego 308 months: [ 309 "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec" 310 ], 311 dayOfWeek: [ 312 "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab" 313 ] 314 }, 315 hr: { //Hrvatski 316 months: [ 317 "SijeÄanj", "VeljaÄa", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac" 318 ], 319 dayOfWeek: [ 320 "Ned", "Pon", "Uto", "Sri", "Äet", "Pet", "Sub" 321 ] 322 }, 323 ko: { //Korean (íêµì´) 324 months: [ 325 "1ì", "2ì", "3ì", "4ì", "5ì", "6ì", "7ì", "8ì", "9ì", "10ì", "11ì", "12ì" 326 ], 327 dayOfWeek: [ 328 "ì¼", "ì", "í", "ì", "목", "ê¸", "í " 329 ] 330 }, 331 lt: { //Lithuanian (lietuvių) 332 months: [ 333 "Sausio", "Vasario", "Kovo", "Balandžio", "GegužÄs", "Birželio", "Liepos", "RugpjÅ«Äio", "RugsÄjo", "Spalio", "LapkriÄio", "Gruodžio" 334 ], 335 dayOfWeek: [ 336 "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Å eÅ¡" 337 ] 338 }, 339 lv: { //Latvian (LatvieÅ¡u) 340 months: [ 341 "JanvÄris", "FebruÄris", "Marts", "AprÄ«lis ", "Maijs", "JÅ«nijs", "JÅ«lijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris" 342 ], 343 dayOfWeek: [ 344 "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St" 345 ] 346 }, 347 mk: { //Macedonian (ÐакедонÑки) 348 months: [ 349 "ÑанÑаÑи", "ÑевÑÑаÑи", "маÑÑ", "апÑил", "маÑ", "ÑÑни", "ÑÑли", "авгÑÑÑ", "ÑепÑемвÑи", "окÑомвÑи", "ноемвÑи", "декемвÑи" 350 ], 351 dayOfWeek: [ 352 "нед", "пон", "вÑо", "ÑÑе", "ÑеÑ", "пеÑ", "Ñаб" 353 ] 354 }, 355 mn: { //Mongolian (Ðонгол) 356 months: [ 357 "1-Ñ ÑаÑ", "2-Ñ ÑаÑ", "3-Ñ ÑаÑ", "4-Ñ ÑаÑ", "5-Ñ ÑаÑ", "6-Ñ ÑаÑ", "7-Ñ ÑаÑ", "8-Ñ ÑаÑ", "9-Ñ ÑаÑ", "10-Ñ ÑаÑ", "11-Ñ ÑаÑ", "12-Ñ ÑаÑ" 358 ], 359 dayOfWeek: [ 360 "Ðав", "ÐÑг", "ÐÑ Ð°", "ÐÒ¯Ñ", "ÐÑн", "ÐÑм", "ÐÑм" 361 ] 362 }, 363 'pt-BR': { //Português(Brasil) 364 months: [ 365 "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" 366 ], 367 dayOfWeek: [ 368 "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb" 369 ] 370 }, 371 sk: { //SlovenÄina 372 months: [ 373 "Január", "Február", "Marec", "AprÃl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December" 374 ], 375 dayOfWeek: [ 376 "Ne", "Po", "Ut", "St", "Å t", "Pi", "So" 377 ] 378 }, 379 sq: { //Albanian (Shqip) 380 months: [ 381 "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
381November", "December" 382 ], 383 dayOfWeek: [ 384 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 385 ] 386 }, 387 'sr-YU': { //Serbian (Srpski) 388 months: [ 389 "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" 390 ], 391 dayOfWeek: [ 392 "Ned", "Pon", "Uto", "Sre", "Äet", "Pet", "Sub" 393 ] 394 }, 395 sr: { //Serbian Cyrillic (СÑпÑки) 396 months: [ 397 "ÑанÑаÑ", "ÑебÑÑаÑ", "маÑÑ", "апÑил", "маÑ", "ÑÑн", "ÑÑл", "авгÑÑÑ", "ÑепÑембаÑ", "окÑобаÑ", "новембаÑ", "деÑембаÑ" 398 ], 399 dayOfWeek: [ 400 "нед", "пон", "ÑÑо", "ÑÑе", "ÑеÑ", "пеÑ", "ÑÑб" 401 ] 402 }, 403 sv: { //Svenska 404 months: [ 405 "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" 406 ], 407 dayOfWeek: [ 408 "Sön", "MÃ¥n", "Tis", "Ons", "Tor", "Fre", "Lör" 409 ] 410 }, 411 'zh-TW': { //Traditional Chinese (ç¹é«ä¸æ) 412 months: [ 413 "䏿", "äºæ", "䏿", "åæ", "äºæ", "å æ", "䏿", "å «æ", "乿", "åæ", "å䏿", "åäºæ" 414 ], 415 dayOfWeek: [ 416 "æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å " 417 ] 418 }, 419 zh: { //Simplified Chinese (ç®ä½ä¸æ) 420 months: [ 421 "䏿", "äºæ", "䏿", "åæ", "äºæ", "å æ", "䏿", "å «æ", "乿", "åæ", "å䏿", "åäºæ" 422 ], 423 dayOfWeek: [ 424 "æ¥", "ä¸", "äº", "ä¸", "å", "äº", "å " 425 ] 426 }, 427 he: { //Hebrew (×¢×ר×ת) 428 months: [ 429 '×× ××ר', 'פ×ר××ר', '×רץ', '×פר××', '×××', '××× ×', '××××', '××××ס×', 'ספ×××ר', '×××§×××ר', '× ××××ר', '×צ××ר' 430 ], 431 dayOfWeek: [ 432 '×\'', '×\'', '×\'', '×\'', '×\'', '×\'', 'ש×ת' 433 ] 434 }, 435 hy: { // Armenian 436 months: [ 437 "ÕÕ¸ÖÕ¶Õ¾Õ¡Ö", "ÕÕ¥Õ¿ÖÕ¾Õ¡Ö", "ÕÕ¡ÖÕ¿", "Ô±ÕºÖÕ«Õ¬", "ÕÕ¡ÕµÕ«Õ½", "ÕÕ¸ÖÕ¶Õ«Õ½", "ÕÕ¸ÖÕ¬Õ«Õ½", "ÕÕ£Õ¸Õ½Õ¿Õ¸Õ½", "ÕÕ¥ÕºÕ¿Õ¥Õ´Õ¢Õ¥Ö", "ÕÕ¸Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö", "ÕÕ¸ÕµÕ¥Õ´Õ¢Õ¥Ö", "Ô´Õ¥Õ¯Õ¿Õ¥Õ´Õ¢Õ¥Ö" 438 ], 439 dayOfWeek: [ 440 "Ô¿Õ«", "ÔµÖÕ¯", "ÔµÖÖ", "ÕÕ¸Ö", "ÕÕ¶Õ£", "ÕÖÖÕ¢", "ÕÕ¢Õ©" 441 ] 442 }, 443 kg: { // Kyrgyz 444 months: [ 445 'Ò®ÑÑүн айÑ', 'ÐиÑдин айÑ', 'Ðалган ÐÑÑан', 'ЧÑн ÐÑÑан', 'ÐÑгÑ', 'ÐÑлжа', 'Теке', 'ÐÐ°Ñ Ðона', 'ÐÑк Ðона', 'ТогÑздÑн айÑ', 'ÐеÑинин айÑ', 'ÐеÑÑин айÑ' 446 ], 447 dayOfWeek: [ 448 "Ðек", "Ðүй", "Шей", "ШаÑ", "Ðей", "ÐÑм", "ÐÑе" 449 ] 450 } 451 }, 452 value: '', 453 lang: datetime.lang !== undefined ? datetime.lang : 'en', 454 rtl: datetime.rtl !== undefined ? ( datetime.rtl === '1' ) : false, 455 456 format: 'Y/m/d H:i', 457 formatTime: 'H:i', 458 formatDate: 'Y/m/d', 459 460 startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05', 461 step: 60, 462 monthChangeSpinner: true, 463 464 closeOnDateSelect: false, 465 closeOnTimeSelect: true, 466 closeOnWithoutClick: true, 467 closeOnInputClick: true, 468 469 timepicker: true, 470 datepicker: true, 471 weeks: false, 472 473 defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i') 474 defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05') 475 476 minDate: false, 477 maxDate: false, 478 minTime: false, 479 maxTime: false, 480 disabledMinTime: false, 481 disabledMaxTime: false, 482 483 allowTimes: [], 484 opened: false, 485 initTime: true, 486 inline: false, 487 theme: '', 488 489 onSelectDate: function () {}, 490 onSelectTime: function () {}, 491 onChangeMonth: function () {}, 492 onChangeYear: function () {}, 493 onChangeDateTime: function () {}, 494 onShow: function () {}, 495 onClose: function () {}, 496 onGenerate: function () {}, 497 498 withoutCopyright: true, 499 inverseButton: false, 500 hours12: false, 501 next: 'xdsoft_next', 502 prev : 'xdsoft_prev', 503 dayOfWeekStart: 0, 504 parentID: 'body', 505 timeHeightInTimePicker: 25, 506 timepickerScrollbar: true, 507 todayButton: true, 508 prevButton: true, 509 nextButton: true, 510 defaultSelect: true, 511 512 scrollMonth: true, 513 scrollTime: true, 514 scrollInput: true, 515 516 lazyInit: false, 517 mask: false, 518 validateOnBlur: true, 519 allowBlank: true, 520 yearStart: 1950, 521 yearEnd: 2050, 522 monthStart: 0, 523 monthEnd: 11, 524 style: '', 525 id: '', 526 fixed: false, 527 roundTime: 'round', // ceil, floor 528 className: '', 529 weekends: [], 530 highlightedDates: [], 531 highlightedPeriods: [], 532 disabledDates : [], 533 disabledWeekDays: [], 534 yearOffset: 0, 535 beforeShowDay: null, 536 537 enterLikeTab: true,
vendor: 5,620 bytes, lines 538-706
538 showApplyButton: false 539 }; 540 if( default_options.i18n[default_options.lang] === undefined ) { 541 default_options['lang'] = 'en'; 542 } 543 // fix for ie8 544 if (!window.getComputedStyle) { 545 window.getComputedStyle = function (el, pseudo) { 546 this.el = el; 547 this.getPropertyValue = function (prop) { 548 var re = /(\-([a-z]){1})/g; 549 if (prop === 'float') { 550 prop = 'styleFloat'; 551 } 552 if (re.test(prop)) { 553 prop = prop.replace(re, function (a, b, c) { 554 return c.toUpperCase(); 555 }); 556 } 557 return el.currentStyle[prop] || null; 558 }; 559 return this; 560 }; 561 } 562 if (!Array.prototype.indexOf) { 563 Array.prototype.indexOf = function (obj, start) { 564 var i, j; 565 for (i = (start || 0), j = this.length; i < j; i += 1) { 566 if (this[i] === obj) { return i; } 567 } 568 return -1; 569 }; 570 } 571 Date.prototype.countDaysInMonth = function () { 572 return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate(); 573 }; 574 $.fn.xdsoftScroller = function (percent) { 575 return this.each(function () { 576 var timeboxparent = $(this), 577 pointerEventToXY = function (e) { 578 var out = {x: 0, y: 0}, 579 touch; 580 if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') { 581 touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; 582 out.x = touch.clientX; 583 out.y = touch.clientY; 584 } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') { 585 out.x = e.clientX; 586 out.y = e.clientY; 587 } 588 return out; 589 }, 590 move = 0, 591 timebox, 592 parentHeight, 593 height, 594 scrollbar, 595 scroller, 596 maximumOffset = 100, 597 start = false, 598 startY = 0, 599 startTop = 0, 600 h1 = 0, 601 touchStart = false, 602 startTopScroll = 0, 603 calcOffset = function () {}; 604 if (percent === 'hide') { 605 timeboxparent.find('.xdsoft_scrollbar').hide(); 606 return; 607 } 608 if (!$(this).hasClass('xdsoft_scroller_box')) { 609 timebox = timeboxparent.children().eq(0); 610 parentHeight = timeboxparent[0].clientHeight; 611 height = timebox[0].offsetHeight; 612 scrollbar = $('<div class="xdsoft_scrollbar"></div>'); 613 scroller = $('<div class="xdsoft_scroller"></div>'); 614 scrollbar.append(scroller); 615 616 timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar); 617 calcOffset = function calcOffset(event) { 618 var offset = pointerEventToXY(event).y - startY + startTopScroll; 619 if (offset < 0) { 620 offset = 0; 621 } 622 if (offset + scroller[0].offsetHeight > h1) { 623 offset = h1 - scroller[0].offsetHeight; 624 } 625 timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]); 626 }; 627 628 scroller 629 .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) { 630 if (!parentHeight) { 631 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); 632 } 633 634 startY = pointerEventToXY(event).y; 635 startTopScroll = parseInt(scroller.css('margin-top'), 10); 636 h1 = scrollbar[0].offsetHeight; 637 638 if (event.type === 'mousedown') { 639 if (document) { 640 $(document.body).addClass('xdsoft_noselect'); 641 } 642 $([document.body, window]).on('mouseup.xdsoft_scroller', function arguments_callee() { 643 $([document.body, window]).off('mouseup.xdsoft_scroller', arguments_callee) 644 .off('mousemove.xdsoft_scroller', calcOffset) 645 .removeClass('xdsoft_noselect'); 646 }); 647 $(document.body).on('mousemove.xdsoft_scroller', calcOffset); 648 } else { 649 touchStart = true; 650 event.stopPropagation(); 651 event.preventDefault(); 652 } 653 }) 654 .on('touchmove', function (event) { 655 if (touchStart) { 656 event.preventDefault(); 657 calcOffset(event); 658 } 659 }) 660 .on('touchend touchcancel', function (event) { 661 touchStart = false; 662 startTopScroll = 0; 663 }); 664 665 timeboxparent 666 .on('scroll_element.xdsoft_scroller', function (event, percentage) { 667 if (!parentHeight) { 668 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]); 669 } 670 percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage; 671 672 scroller.css('margin-top', maximumOffset * percentage); 673 674 setTimeout(function () { 675 timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10)); 676 }, 10); 677 }) 678 .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) { 679 var percent, sh; 680 parentHeight = timeboxparent[0].clientHeight; 681 height = timebox[0].offsetHeight; 682 percent = parentHeight / height; 683 sh = percent * scrollbar[0].offsetHeight; 684 if (percent > 1) { 685 scroller.hide(); 686 } else { 687 scroller.show(); 688 scroller.css('height', parseInt(sh > 10 ? sh : 10, 10)); 689 maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight; 690 if (noTriggerScroll !== true) { 691 timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]); 692 } 693 } 694 }); 695 696 timeboxparent.on('mousewheel', function (event) { 697 var top = Math.abs(parseInt(timebox.css('marginTop'), 10)); 698 699 top = top - (event.deltaY * 20); 700 if (top < 0) { 701 top = 0; 702 } 703 704 timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]); 705 event.stopPropagation(); 706 return false;
vendor: 34,237 bytes, lines 707-1698
707 }); 708 709 timeboxparent.on('touchstart', function (event) { 710 start = pointerEventToXY(event); 711 startTop = Math.abs(parseInt(timebox.css('marginTop'), 10)); 712 }); 713 714 timeboxparent.on('touchmove', function (event) { 715 if (start) { 716 event.preventDefault(); 717 var coord = pointerEventToXY(event); 718 timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]); 719 } 720 }); 721 722 timeboxparent.on('touchend touchcancel', function (event) { 723 start = false; 724 startTop = 0; 725 }); 726 } 727 timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); 728 }); 729 }; 730 731 $.fn.datetimepicker = function (opt) { 732 var KEY0 = 48, 733 KEY9 = 57, 734 _KEY0 = 96, 735 _KEY9 = 105, 736 CTRLKEY = 17, 737 DEL = 46, 738 ENTER = 13, 739 ESC = 27, 740 BACKSPACE = 8, 741 ARROWLEFT = 37, 742 ARROWUP = 38, 743 ARROWRIGHT = 39, 744 ARROWDOWN = 40, 745 TAB = 9, 746 F5 = 116, 747 AKEY = 65, 748 CKEY = 67, 749 VKEY = 86, 750 ZKEY = 90, 751 YKEY = 89, 752 ctrlDown = false, 753 options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options), 754 755 lazyInitTimer = 0, 756 createDateTimePicker, 757 destroyDateTimePicker, 758 759 lazyInit = function (input) { 760 input 761 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function initOnActionCallback(event) { 762 if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) { 763 return; 764 } 765 clearTimeout(lazyInitTimer); 766 lazyInitTimer = setTimeout(function () { 767 768 if (!input.data('xdsoft_datetimepicker')) { 769 createDateTimePicker(input); 770 } 771 input 772 .off('open.xdsoft focusin.xdsoft mousedown.xdsoft', initOnActionCallback) 773 .trigger('open.xdsoft'); 774 }, 100); 775 }); 776 }; 777 778 createDateTimePicker = function (input) { 779 var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'), 780 xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'), 781 datepicker = $('<div class="xdsoft_datepicker active"></div>'), 782 mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' + 783 '<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' + 784 '<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' + 785 '<button type="button" class="xdsoft_next"></button></div>'), 786 calendar = $('<div class="xdsoft_calendar"></div>'), 787 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>'), 788 timeboxparent = timepicker.find('.xdsoft_time_box').eq(0), 789 timebox = $('<div class="xdsoft_time_variant"></div>'), 790 applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'), 791 /*scrollbar = $('<div class="xdsoft_scrollbar"></div>'), 792 scroller = $('<div class="xdsoft_scroller"></div>'),*/ 793 monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'), 794 yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'), 795 triggerAfterOpen = false, 796 XDSoft_datetime, 797 //scroll_element, 798 xchangeTimer, 799 timerclick, 800 current_time_index, 801 setPos, 802 timer = 0, 803 timer1 = 0, 804 _xdsoft_datetime; 805 806 if (options.id) { 807 datetimepicker.attr('id', options.id); 808 } 809 if (options.style) { 810 datetimepicker.attr('style', options.style); 811 } 812 if (options.weeks) { 813 datetimepicker.addClass('xdsoft_showweeks'); 814 } 815 if (options.rtl) { 816 datetimepicker.addClass('xdsoft_rtl'); 817 } 818 819 datetimepicker.addClass('xdsoft_' + options.theme); 820 datetimepicker.addClass(options.className); 821 822 mounth_picker 823 .find('.xdsoft_month span') 824 .after(monthselect); 825 mounth_picker 826 .find('.xdsoft_year span') 827 .after(yearselect); 828 829 mounth_picker 830 .find('.xdsoft_month,.xdsoft_year') 831 .on('mousedown.xdsoft', function (event) { 832 var select = $(this).find('.xdsoft_select').eq(0), 833 val = 0, 834 top = 0, 835 visible = select.is(':visible'), 836 items, 837 i; 838 839 mounth_picker 840 .find('.xdsoft_select') 841 .hide(); 842 if (_xdsoft_datetime.currentTime) { 843 val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear'](); 844 } 845 846 select[visible ? 'hide' : 'show'](); 847 for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) { 848 if (items.eq(i).data('value') === val) { 849 break; 850 } else { 851 top += items[0].offsetHeight; 852 } 853 } 854 855 select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight))); 856 event.stopPropagation(); 857 return false; 858 }); 859 860 mounth_picker 861 .find('.xdsoft_select') 862 .xdsoftScroller() 863 .on('mousedown.xdsoft', function (event) { 864 event.stopPropagation(); 865 event.preventDefault(); 866 }) 867 .on('mousedown.xdsoft', '.xdsoft_option', function (event) { 868 869 if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { 870 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 871 } 872 873 var year = _xdsoft_datetime.currentTime.getFullYear(); 874 if (_xdsoft_datetime && _xdsoft_datetime.currentTime) { 875 _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value')); 876 } 877 878 $(this).parent().parent().hide(); 879 880 datetimepicker.trigger('xchange.xdsoft'); 881 if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { 882 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 883 } 884 885 if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { 886 options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 887 } 888 }); 889 890 datetimepicker.setOptions = function (_options) { 891 var highlightedDates = {}, 892 getCaretPos = function (input) { 893 try { 894 if (document.selection && document.selection.createRange) { 895 var range = document.selection.createRange(); 896 return range.getBookmark().charCodeAt(2) - 2; 897 } 898 if (input.setSelectionRange) { 899 return input.selectionStart; 900 } 901 } catch (e) { 902 return 0; 903 } 904 }, 905 setCaretPos = function (node, pos) { 906 node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node; 907 if (!node) { 908 return false; 909 } 910 if (node.createTextRange) { 911 var textRange = node.createTextRange(); 912 textRange.collapse(true); 913 textRange.moveEnd('character', pos); 914 textRange.moveStart('character', pos); 915 textRange.select(); 916 return true; 917 } 918 if (node.setSelectionRange) { 919 node.setSelectionRange(pos, pos); 920 return true; 921 } 922 return false; 923 }, 924 isValidValue = function (mask, value) { 925 var reg = mask 926 .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') 927 .replace(/_/g, '{digit+}') 928 .replace(/([0-9]{1})/g, '{digit$1}') 929 .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') 930 .replace(/\{digit[\+]\}/g, '[0-9_]{1}'); 931 return (new RegExp(reg)).test(value); 932 }; 933 options = $.extend(true, {}, options, _options); 934 935 if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) { 936 options.allowTimes = $.extend(true, [], _options.allowTimes); 937 } 938 939 if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) { 940 options.weekends = $.extend(true, [], _options.weekends); 941 } 942 943 if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) { 944 $.each(_options.highlightedDates, function (index, value) { 945 var splitData = $.map(value.split(','), $.trim), 946 exDesc, 947 hDate = new HighlightedDate(Date.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style 948 keyDate = hDate.date.dateFormat(options.formatDate); 949 if (highlightedDates[keyDate] !== undefined) { 950 exDesc = highlightedDates[keyDate].desc; 951 if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { 952 highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; 953 } 954 } else { 955 highlightedDates[keyDate] = hDate; 956 } 957 }); 958 959 options.highlightedDates = $.extend(true, [], highlightedDates); 960 } 961 962 if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) { 963 highlightedDates = $.extend(true, [], options.highlightedDates); 964 $.each(_options.highlightedPeriods, function (index, value) { 965 var dateTest, // start date 966 dateEnd, 967 desc, 968 hDate, 969 keyDate, 970 exDesc, 971 style; 972 if ($.isArray(value)) { 973 dateTest = value[0]; 974 dateEnd = value[1]; 975 desc = value[2]; 976 style = value[3]; 977 } 978 else { 979 var splitData = $.map(value.split(','), $.trim); 980 dateTest = Date.parseDate(splitData[0], options.formatDate); 981 dateEnd = Date.parseDate(splitData[1], options.formatDate); 982 desc = splitData[2]; 983 style = splitData[3]; 984 } 985 986 while (dateTest <= dateEnd) { 987 hDate = new HighlightedDate(dateTest, desc, style); 988 keyDate = dateTest.dateFormat(options.formatDate); 989 dateTest.setDate(dateTest.getDate() + 1); 990 if (highlightedDates[keyDate] !== undefined) { 991 exDesc = highlightedDates[keyDate].desc; 992 if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { 993 highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; 994 } 995 } else { 996 highlightedDates[keyDate] = hDate; 997 } 998 } 999 }); 1000 1001 options.highlightedDates = $.extend(true, [], highlightedDates); 1002 } 1003 1004 if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) { 1005 options.disabledDates = $.extend(true, [], _options.disabledDates); 1006 } 1007 1008 if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) { 1009 options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays); 1010 } 1011 1012 if ((options.open || options.opened) && (!options.inline)) { 1013 input.trigger('open.xdsoft'); 1014 } 1015 1016 if (options.inline) { 1017 triggerAfterOpen = true; 1018 datetimepicker.addClass('xdsoft_inline'); 1019 input.after(datetimepicker).hide(); 1020 } 1021 1022 if (options.inverseButton) { 1023 options.next = 'xdsoft_prev'; 1024 options.prev = 'xdsoft_next'; 1025 } 1026 1027 if (options.datepicker) { 1028 datepicker.addClass('active'); 1029 } else { 1030 datepicker.removeClass('active'); 1031 } 1032 1033 if (options.timepicker) { 1034 timepicker.addClass('active'); 1035 } else { 1036 timepicker.removeClass('active'); 1037 } 1038 1039 if (options.value) { 1040 _xdsoft_datetime.setCurrentTime(options.value); 1041 if (input && input.val) { 1042 input.val(_xdsoft_datetime.str); 1043 } 1044 } 1045 1046 if (isNaN(options.dayOfWeekStart)) { 1047 options.dayOfWeekStart = 0; 1048 } else { 1049 options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7; 1050 } 1051 1052 if (!options.timepickerScrollbar) { 1053 timeboxparent.xdsoftScroller('hide'); 1054 } 1055 1056 if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) { 1057 options.minDate = _xdsoft_datetime.strToDateTime(options.minDate).dateFormat(options.formatDate); 1058 } 1059 1060 if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) { 1061 options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat(options.formatDate); 1062 } 1063 1064 applyButton.toggle(options.showApplyButton); 1065 1066 mounth_picker 1067 .find('.xdsoft_today_button') 1068 .css('visibility', !options.todayButton ? 'hidden' : 'visible'); 1069 1070 mounth_picker 1071 .find('.' + options.prev) 1072 .css('visibility', !options.prevButton ? 'hidden' : 'visible'); 1073 1074 mounth_picker 1075 .find('.' + options.next) 1076 .css('visibility', !options.nextButton ? 'hidden' : 'visible'); 1077 1078 if (options.mask) { 1079 input.off('keydown.xdsoft'); 1080 1081 if (options.mask === true) { 1082 options.mask = options.format 1083 .replace(/Y/g, '9999') 1084 .replace(/F/g, '9999') 1085 .replace(/m/g, '19') 1086 .replace(/d/g, '39') 1087 .replace(/H/g, '29') 1088 .replace(/i/g, '59') 1089 .replace(/s/g, '59'); 1090 } 1091 1092 if ($.type(options.mask) === 'string') { 1093 if (!isValidValue(options.mask, input.val())) { 1094 input.val(options.mask.replace(/[0-9]/g, '_')); 1095 } 1096 1097 input.on('keydown.xdsoft', function (event) { 1098 var val = this.value, 1099 key = event.which, 1100 pos, 1101 digit; 1102 1103 if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) { 1104 pos = getCaretPos(this); 1105 digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_'; 1106 1107 if ((key === BACKSPACE || key === DEL) && pos) { 1108 pos -= 1; 1109 digit = '_'; 1110 } 1111 1112 while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { 1113 pos += (key === BACKSPACE || key === DEL) ? -1 : 1; 1114 } 1115 1116 val = val.substr(0, pos) + digit + val.substr(pos + 1); 1117 if ($.trim(val) === '') { 1118 val = options.mask.replace(/[0-9]/g, '_'); 1119 } else { 1120 if (pos === options.mask.length) { 1121 event.preventDefault(); 1122 return false; 1123 } 1124 } 1125 1126 pos += (key === BACKSPACE || key === DEL) ? 0 : 1; 1127 while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { 1128 pos += (key === BACKSPACE || key === DEL) ? -1 : 1; 1129 } 1130 1131 if (isValidValue(options.mask, val)) { 1132 this.value = val; 1133 setCaretPos(this, pos); 1134 } else if ($.trim(val) === '') { 1135 this.value = options.mask.replace(/[0-9]/g, '_'); 1136 } else { 1137 input.trigger('error_input.xdsoft'); 1138 } 1139 } else { 1140 if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) { 1141 return true; 1142 } 1143 } 1144 1145 event.preventDefault(); 1146 return false; 1147 }); 1148 } 1149 } 1150 if (options.validateOnBlur) { 1151 input 1152 .off('blur.xdsoft') 1153 .on('blur.xdsoft', function () { 1154 if (options.allowBlank && !$.trim($(this).val()).length) { 1155 $(this).val(null); 1156 datetimepicker.data('xdsoft_datetime').empty(); 1157 } else if (!Date.parseDate($(this).val(), options.format)) { 1158 var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')), 1159 splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join('')); 1160 1161 // parse the numbers as 0312 => 03:12 1162 if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) { 1163 $(this).val([splittedHours, splittedMinutes].map(function (item) { 1164 return item > 9 ? item : '0' + item; 1165 }).join(':')); 1166 } else { 1167 $(this).val((_xdsoft_datetime.now()).dateFormat(options.format)); 1168 } 1169 1170 datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); 1171 } else { 1172 datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); 1173 } 1174 1175 datetimepicker.trigger('changedatetime.xdsoft'); 1176 }); 1177 } 1178 options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1; 1179 1180 datetimepicker 1181 .trigger('xchange.xdsoft') 1182 .trigger('afterOpen.xdsoft'); 1183 }; 1184 1185 datetimepicker 1186 .data('options', options) 1187 .on('mousedown.xdsoft', function (event) { 1188 event.stopPropagation(); 1189 event.preventDefault(); 1190 yearselect.hide(); 1191 monthselect.hide(); 1192 return false; 1193 }); 1194 1195 //scroll_element = timepicker.find('.xdsoft_time_box'); 1196 timeboxparent.append(timebox); 1197 timeboxparent.xdsoftScroller(); 1198 1199 datetimepicker.on('afterOpen.xdsoft', function () { 1200 timeboxparent.xdsoftScroller(); 1201 }); 1202 1203 datetimepicker 1204 .append(datepicker) 1205 .append(timepicker); 1206 1207 if (options.withoutCopyright !== true) { 1208 datetimepicker 1209 .append(xdsoft_copyright); 1210 } 1211 1212 datepicker 1213 .append(mounth_picker) 1214 .append(calendar) 1215 .append(applyButton); 1216 1217 $(options.parentID) 1218 .append(datetimepicker); 1219 1220 XDSoft_datetime = function () { 1221 var _this = this; 1222 _this.now = function (norecursion) { 1223 var d = new Date(), 1224 date, 1225 time; 1226 1227 if (!norecursion && options.defaultDate) { 1228 date = _this.strToDateTime(options.defaultDate); 1229 d.setFullYear(date.getFullYear()); 1230 d.setMonth(date.getMonth()); 1231 d.setDate(date.getDate()); 1232 } 1233 1234 if (options.yearOffset) { 1235 d.setFullYear(d.getFullYear() + options.yearOffset); 1236 } 1237 1238 if (!norecursion && options.defaultTime) { 1239 time = _this.strtotime(options.defaultTime); 1240 d.setHours(time.getHours()); 1241 d.setMinutes(time.getMinutes()); 1242 } 1243 return d; 1244 }; 1245 1246 _this.isValidDate = function (d) { 1247 if (Object.prototype.toString.call(d) !== "[object Date]") { 1248 return false; 1249 } 1250 return !isNaN(d.getTime()); 1251 }; 1252 1253 _this.setCurrentTime = function (dTime) { 1254 _this.currentTime = (typeof dTime === 'string') ? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime : _this.now(); 1255 datetimepicker.trigger('xchange.xdsoft'); 1256 }; 1257 1258 _this.empty = function () { 1259 _this.currentTime = null; 1260 }; 1261 1262 _this.getCurrentTime = function (dTime) { 1263 return _this.currentTime; 1264 }; 1265 1266 _this.nextMonth = function () { 1267 1268 if (_this.currentTime === undefined || _this.currentTime === null) { 1269 _this.currentTime = _this.now(); 1270 } 1271 1272 var month = _this.currentTime.getMonth() + 1, 1273 year; 1274 if (month === 12) { 1275 _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1); 1276 month = 0; 1277 } 1278 1279 year = _this.currentTime.getFullYear(); 1280 1281 _this.currentTime.setDate( 1282 Math.min( 1283 new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), 1284 _this.currentTime.getDate() 1285 ) 1286 ); 1287 _this.currentTime.setMonth(month); 1288 1289 if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { 1290 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 1291 } 1292 1293 if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { 1294 options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 1295 } 1296 1297 datetimepicker.trigger('xchange.xdsoft'); 1298 return month; 1299 }; 1300 1301 _this.prevMonth = function () { 1302 1303 if (_this.currentTime === undefined || _this.currentTime === null) { 1304 _this.currentTime = _this.now(); 1305 } 1306 1307 var month = _this.currentTime.getMonth() - 1; 1308 if (month === -1) { 1309 _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1); 1310 month = 11; 1311 } 1312 _this.currentTime.setDate( 1313 Math.min( 1314 new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), 1315 _this.currentTime.getDate() 1316 ) 1317 ); 1318 _this.currentTime.setMonth(month); 1319 if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { 1320 options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 1321 } 1322 datetimepicker.trigger('xchange.xdsoft'); 1323 return month; 1324 }; 1325 1326 _this.getWeekOfYear = function (datetime) { 1327 var onejan = new Date(datetime.getFullYear(), 0, 1); 1328 return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7); 1329 }; 1330 1331 _this.strToDateTime = function (sDateTime) { 1332 var tmpDate = [], timeOffset, currentTime; 1333 1334 if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) { 1335 return sDateTime; 1336 } 1337 1338 tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime); 1339 if (tmpDate) { 1340 tmpDate[2] = Date.parseDate(tmpDate[2], options.formatDate); 1341 } 1342 if (tmpDate && tmpDate[2]) { 1343 timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000; 1344 currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset); 1345 } else { 1346 currentTime = sDateTime ? Date.parseDate(sDateTime, options.format) : _this.now(); 1347 } 1348 1349 if (!_this.isValidDate(currentTime)) { 1350 currentTime = _this.now(); 1351 } 1352 1353 return currentTime; 1354 }; 1355 1356 _this.strToDate = function (sDate) { 1357 if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) { 1358 return sDate; 1359 } 1360 1361 var currentTime = sDate ? Date.parseDate(sDate, options.formatDate) : _this.now(true); 1362 if (!_this.isValidDate(currentTime)) { 1363 currentTime = _this.now(true); 1364 } 1365 return currentTime; 1366 }; 1367 1368 _this.strtotime = function (sTime) { 1369 if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) { 1370 return sTime; 1371 } 1372 var currentTime = sTime ? Date.parseDate(sTime, options.formatTime) : _this.now(true); 1373 if (!_this.isValidDate(currentTime)) { 1374 currentTime = _this.now(true); 1375 } 1376 return currentTime; 1377 }; 1378 1379 _this.str = function () { 1380 return _this.currentTime.dateFormat(options.format); 1381 }; 1382 _this.currentTime = this.now(); 1383 }; 1384 1385 _xdsoft_datetime = new XDSoft_datetime(); 1386 1387 applyButton.on('click', function (e) {//pathbrite 1388 e.preventDefault(); 1389 datetimepicker.data('changed', true); 1390 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 1391 input.val(_xdsoft_datetime.str()); 1392 datetimepicker.trigger('close.xdsoft'); 1393 }); 1394 mounth_picker 1395 .find('.xdsoft_today_button') 1396 .on('mousedown.xdsoft', function () { 1397 datetimepicker.data('changed', true); 1398 _xdsoft_datetime.setCurrentTime(0); 1399 datetimepicker.trigger('afterOpen.xdsoft'); 1400 }).on('dblclick.xdsoft', function () { 1401 var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate; 1402 currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); 1403 minDate = _xdsoft_datetime.strToDate(options.minDate); 1404 minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); 1405 if (currentDate < minDate) { 1406 return; 1407 } 1408 maxDate = _xdsoft_datetime.strToDate(options.maxDate); 1409 maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()); 1410 if (currentDate > maxDate) { 1411 return; 1412 } 1413 input.val(_xdsoft_datetime.str()); 1414 input.trigger('change'); 1415 datetimepicker.trigger('close.xdsoft'); 1416 }); 1417 mounth_picker 1418 .find('.xdsoft_prev,.xdsoft_next') 1419 .on('mousedown.xdsoft', function () { 1420 var $this = $(this), 1421 timer = 0, 1422 stop = false; 1423 1424 (function arguments_callee1(v) { 1425 if ($this.hasClass(options.next)) { 1426 _xdsoft_datetime.nextMonth(); 1427 } else if ($this.hasClass(options.prev)) { 1428 _xdsoft_datetime.prevMonth(); 1429 } 1430 if (options.monthChangeSpinner) { 1431 if (!stop) { 1432 timer = setTimeout(arguments_callee1, v || 100); 1433 } 1434 } 1435 }(500)); 1436 1437 $([document.body, window]).on('mouseup.xdsoft', function arguments_callee2() { 1438 clearTimeout(timer); 1439 stop = true; 1440 $([document.body, window]).off('mouseup.xdsoft', arguments_callee2); 1441 }); 1442 }); 1443 1444 timepicker 1445 .find('.xdsoft_prev,.xdsoft_next') 1446 .on('mousedown.xdsoft', function () { 1447 var $this = $(this), 1448 timer = 0, 1449 stop = false, 1450 period = 110; 1451 (function arguments_callee4(v) { 1452 var pheight = timeboxparent[0].clientHeight, 1453 height = timebox[0].offsetHeight, 1454 top = Math.abs(parseInt(timebox.css('marginTop'), 10)); 1455 if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) { 1456 timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px'); 1457 } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) { 1458 timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px'); 1459 } 1460 timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox.css('marginTop'), 10) / (height - pheight))]); 1461 period = (period > 10) ? 10 : period - 10; 1462 if (!stop) { 1463 timer = setTimeout(arguments_callee4, v || period); 1464 } 1465 }(500)); 1466 $([document.body, window]).on('mouseup.xdsoft', function arguments_callee5() { 1467 clearTimeout(timer); 1468 stop = true; 1469 $([document.body, window]) 1470 .off('mouseup.xdsoft', arguments_callee5); 1471 }); 1472 }); 1473 1474 xchangeTimer = 0; 1475 // base handler - generating a calendar and timepicker 1476 datetimepicker 1477 .on('xchange.xdsoft', function (event) { 1478 clearTimeout(xchangeTimer); 1479 xchangeTimer = setTimeout(function () { 1480 1481 if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { 1482 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 1483 } 1484 1485 var table = '', 1486 start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0), 1487 i = 0, 1488 j, 1489 today = _xdsoft_datetime.now(), 1490 maxDate = false, 1491 minDate = false, 1492 hDate, 1493 day, 1494 d, 1495 y, 1496 m, 1497 w, 1498 classes = [], 1499 customDateSettings, 1500 newRow = true, 1501 time = '', 1502 h = '', 1503 line_time, 1504 description; 1505 1506 while (start.getDay() !== options.dayOfWeekStart) { 1507 start.setDate(start.getDate() - 1); 1508 } 1509 1510 table += '<table><thead><tr>'; 1511 1512 if (options.weeks) { 1513 table += '<th></th>'; 1514 } 1515 1516 for (j = 0; j < 7; j += 1) { 1517 table += '<th>' + options.i18n[options.lang].dayOfWeek[(j + options.dayOfWeekStart) % 7] + '</th>'; 1518 } 1519 1520 table += '</tr></thead>'; 1521 table += '<tbody>'; 1522 1523 if (options.maxDate !== false) { 1524 maxDate = _xdsoft_datetime.strToDate(options.maxDate); 1525 maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999); 1526 } 1527 1528 if (options.minDate !== false) { 1529 minDate = _xdsoft_datetime.strToDate(options.minDate); 1530 minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); 1531 } 1532 1533 while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) { 1534 classes = []; 1535 i += 1; 1536 1537 day = start.getDay(); 1538 d = start.getDate(); 1539 y = start.getFullYear(); 1540 m = start.getMonth(); 1541 w = _xdsoft_datetime.getWeekOfYear(start); 1542 description = ''; 1543 1544 classes.push('xdsoft_date'); 1545 1546 if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) { 1547 customDateSettings = options.beforeShowDay.call(datetimepicker, start); 1548 } else { 1549 customDateSettings = null; 1550 } 1551 1552 if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) { 1553 classes.push('xdsoft_disabled'); 1554 } else if (options.disabledDates.indexOf(start.dateFormat(options.formatDate)) !== -1) { 1555 classes.push('xdsoft_disabled'); 1556 } else if (options.disabledWeekDays.indexOf(day) !== -1) { 1557 classes.push('xdsoft_disabled'); 1558 } 1559 1560 if (customDateSettings && customDateSettings[1] !== "") { 1561 classes.push(customDateSettings[1]); 1562 } 1563 1564 if (_xdsoft_datetime.currentTime.getMonth() !== m) { 1565 classes.push('xdsoft_other_month'); 1566 } 1567 1568 if ((options.defaultSelect || datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) { 1569 classes.push('xdsoft_current'); 1570 } 1571 1572 if (today.dateFormat(options.formatDate) === start.dateFormat(options.formatDate)) { 1573 classes.push('xdsoft_today'); 1574 } 1575 1576 if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(start.dateFormat(options.formatDate)) !== -1) { 1577 classes.push('xdsoft_weekend'); 1578 } 1579 1580 if (options.highlightedDates[start.dateFormat(options.formatDate)] !== undefined) { 1581 hDate = options.highlightedDates[start.dateFormat(options.formatDate)]; 1582 classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style); 1583 description = hDate.desc === undefined ? '' : hDate.desc; 1584 } 1585 1586 if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) { 1587 classes.push(options.beforeShowDay(start)); 1588 } 1589 1590 if (newRow) { 1591 table += '<tr>'; 1592 newRow = false; 1593 if (options.weeks) { 1594 table += '<th>' + w + '</th>'; 1595 } 1596 } 1597 1598 table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' + 1599 '<div>' + d + '</div>' + 1600 '</td>'; 1601 1602 if (start.getDay() === options.dayOfWeekStartPrev) { 1603 table += '</tr>'; 1604 newRow = true; 1605 } 1606 1607 start.setDate(d + 1); 1608 } 1609 table += '</tbody></table>'; 1610 1611 calendar.html(table); 1612 1613 mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[options.lang].months[_xdsoft_datetime.currentTime.getMonth()]); 1614 mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear()); 1615 1616 // generate timebox 1617 time = ''; 1618 h = ''; 1619 m = ''; 1620 line_time = function line_time(h, m) { 1621 var now = _xdsoft_datetime.now(), optionDateTime, current_time; 1622 now.setHours(h); 1623 h = parseInt(now.getHours(), 10); 1624 now.setMinutes(m); 1625 m = parseInt(now.getMinutes(), 10); 1626 optionDateTime = new Date(_xdsoft_datetime.currentTime); 1627 optionDateTime.setHours(h); 1628 optionDateTime.setMinutes(m); 1629 classes = []; 1630 if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) { 1631 classes.push('xdsoft_disabled'); 1632 } 1633 if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) { 1634 classes.push('xdsoft_disabled'); 1635 } 1636 1637 current_time = new Date(_xdsoft_datetime.currentTime); 1638 current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10)); 1639 current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step); 1640 1641 if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && (options.step > 59 || current_time.getMinutes() === parseInt(m, 10))) { 1642 if (options.defaultSelect || datetimepicker.data('changed')) { 1643 classes.push('xdsoft_current'); 1644 } else if (options.initTime) { 1645 classes.push('xdsoft_init_time'); 1646 } 1647 } 1648 if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) { 1649 classes.push('xdsoft_today'); 1650 } 1651 time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + now.dateFormat(options.formatTime) + '</div>'; 1652 }; 1653 1654 if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) { 1655 for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) { 1656 for (j = 0; j < 60; j += options.step) { 1657 h = (i < 10 ? '0' : '') + i; 1658 m = (j < 10 ? '0' : '') + j; 1659 line_time(h, m); 1660 } 1661 } 1662 } else { 1663 for (i = 0; i < options.allowTimes.length; i += 1) { 1664 h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours(); 1665 m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes(); 1666 line_time(h, m); 1667 } 1668 } 1669 1670 timebox.html(time); 1671 1672 opt = ''; 1673 i = 0; 1674 1675 for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) { 1676 opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>'; 1677 } 1678 yearselect.children().eq(0) 1679 .html(opt); 1680 1681 for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) { 1682 opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[options.lang].months[i] + '</div>'; 1683 } 1684 monthselect.children().eq(0).html(opt); 1685 $(datetimepicker) 1686 .trigger('generate.xdsoft'); 1687 }, 10); 1688 event.stopPropagation(); 1689 }) 1690 .on('afterOpen.xdsoft', function () { 1691 if (options.timepicker) { 1692 var classType, pheight, height, top; 1693 if (timebox.find('.xdsoft_current').length) { 1694 classType = '.xdsoft_current'; 1695 } else if (timebox.find('.xdsoft_init_time').length) { 1696 classType = '.xdsoft_init_time'; 1697 } 1698 if (classType) {
vendor: 1,383 bytes, lines 1699-1737
1699 pheight = timeboxparent[0].clientHeight; 1700 height = timebox[0].offsetHeight; 1701 top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1; 1702 if ((height - pheight) < top) { 1703 top = height - pheight; 1704 } 1705 timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]); 1706 } else { 1707 timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]); 1708 } 1709 } 1710 }); 1711 1712 timerclick = 0; 1713 calendar 1714 .on('click.xdsoft', 'td', function (xdevent) { 1715 xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap 1716 timerclick += 1; 1717 var $this = $(this), 1718 currentTime = _xdsoft_datetime.currentTime; 1719 1720 if (currentTime === undefined || currentTime === null) { 1721 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 1722 currentTime = _xdsoft_datetime.currentTime; 1723 } 1724 1725 if ($this.hasClass('xdsoft_disabled')) { 1726 return false; 1727 } 1728 1729 currentTime.setDate(1); 1730 currentTime.setFullYear($this.data('year')); 1731 currentTime.setMonth($this.data('month')); 1732 currentTime.setDate($this.data('date')); 1733 1734 datetimepicker.trigger('select.xdsoft', [currentTime]); 1735 1736 input.val(_xdsoft_datetime.str()); 1737 if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !
1737options.timepicker))) && !options.inline) { 1738 datetimepicker.trigger('close.xdsoft'); 1739 } 1740 1741 if (options.onSelectDate && $.isFunction(options.onSelectDate)) { 1742 options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); 1743 } 1744 1745 datetimepicker.data('changed', true); 1746 datetimepicker.trigger('xchange.xdsoft'); 1747 datetimepicker.trigger('changedatetime.xdsoft'); 1748 setTimeout(function () { 1749 timerclick = 0; 1750 }, 200); 1751 }); 1752 1753 timebox 1754 .on('click.xdsoft', 'div', function (xdevent) { 1755 xdevent.stopPropagation(); 1756 var $this = $(this), 1757 currentTime = _xdsoft_datetime.currentTime; 1758 1759 if (currentTime === undefined || currentTime === null) { 1760 _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); 1761 currentTime = _xdsoft_datetime.currentTime; 1762 } 1763 1764 if ($this.hasClass('xdsoft_disabled')) { 1765 return false; 1766 } 1767 currentTime.setHours($this.data('hour')); 1768 currentTime.setMinutes($this.data('minute')); 1769 datetimepicker.trigger('select.xdsoft', [currentTime]); 1770 1771 datetimepicker.data('input').val(_xdsoft_datetime.str()); 1772 1773 if (options.inline !== true && options.closeOnTimeSelect === true) { 1774 datetimepicker.trigger('close.xdsoft'); 1775 } 1776 1777 if (options.onSelectTime && $.isFunction(options.onSelectTime)) { 1778 options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); 1779 } 1780 datetimepicker.data('changed', true); 1781 datetimepicker.trigger('xchange.xdsoft'); 1782 datetimepicker.trigger('changedatetime.xdsoft'); 1783 }); 1784 1785 1786 datepicker 1787 .on('mousewheel.xdsoft', function (event) { 1788 if (!options.scrollMonth) { 1789 return true; 1790 } 1791 if (event.deltaY < 0) { 1792 _xdsoft_datetime.nextMonth(); 1793 } else { 1794 _xdsoft_datetime.prevMonth(); 1795 } 1796 return false; 1797 }); 1798 1799 input 1800 .on('mousewheel.xdsoft', function (event) { 1801 if (!options.scrollInput) { 1802 return true; 1803 } 1804 if (!options.datepicker && options.timepicker) { 1805 current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0; 1806 if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) { 1807 current_time_index += event.deltaY; 1808 } 1809 if (timebox.children().eq(current_time_index).length) { 1810 timebox.children().eq(current_time_index).trigger('mousedown'); 1811 } 1812 return false; 1813 } 1814 if (options.datepicker && !options.timepicker) { 1815 datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]); 1816 if (input.val) { 1817 input.val(_xdsoft_datetime.str()); 1818 } 1819 datetimepicker.trigger('changedatetime.xdsoft'); 1820 return false; 1821 } 1822 }); 1823 1824 datetimepicker 1825 .on('changedatetime.xdsoft', function (event) { 1826 if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) { 1827 var $input = datetimepicker.data('input'); 1828 options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event); 1829 delete options.value; 1830 $input.trigger('change'); 1831 } 1832 }) 1833 .on('generate.xdsoft', function () { 1834 if (options.onGenerate && $.isFunction(options.onGenerate)) { 1835 options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); 1836 } 1837 if (triggerAfterOpen) { 1838 datetimepicker.trigger('afterOpen.xdsoft'); 1839 triggerAfterOpen = false; 1840 } 1841 }) 1842 .on('click.xdsoft', function (xdevent) { 1843 xdevent.stopPropagation(); 1844 }); 1845 1846 current_time_index = 0; 1847 1848 setPos = function () { 1849 var offset = datetimepicker.data('input').offset(), top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, position = "absolute", node; 1850 if (datetimepicker.data('input').parent().css('direction') == 'rtl') 1851 left -= (datetimepicker.outerWidth() - datetimepicker.data('input').outerWidth()); 1852 if (options.fixed) { 1853 top -= $(window).scrollTop(); 1854 left -= $(window).scrollLeft(); 1855 position = "fixed"; 1856 } else { 1857 if (top + datetimepicker[0].offsetHeight > $(window).height() + $(window).scrollTop()) { 1858 top = offset.top - datetimepicker[0].offsetHeight + 1; 1859 } 1860 if (top < 0) { 1861 top = 0; 1862 } 1863 if (left + datetimepicker[0].offsetWidth > $(window).width()) { 1864 left = $(window).width() - datetimepicker[0].offsetWidth; 1865 } 1866 } 1867 1868 node = datetimepicker[0]; 1869 do { 1870 node = node.parentNode; 1871 if (window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) { 1872 left = left - (($(window).width() - node.offsetWidth) / 2); 1873 break; 1874 } 1875 } while (node.nodeName !== 'HTML'); 1876 datetimepicker.css({ 1877 left: left, 1878 top: top, 1879 position: position 1880 }); 1881 }; 1882 datetimepicker 1883 .on('open.xdsoft', function (event) { 1884 var onShow = true; 1885 if (options.onShow && $.isFunction(options.onShow)) {
1886 onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); 1887 } 1888 if (onShow !== false) { 1889 datetimepicker.show(); 1890 setPos(); 1891 $(window) 1892 .off('resize.xdsoft', setPos) 1893 .on('resize.xdsoft', setPos); 1894 1895 if (options.closeOnWithoutClick) { 1896 $([document.body, window]).on('mousedown.xdsoft', function arguments_callee6() { 1897 datetimepicker.trigger('close.xdsoft'); 1898 $([document.body, window]).off('mousedown.xdsoft', arguments_callee6); 1899 }); 1900 } 1901 } 1902 }) 1903 .on('close.xdsoft', function (event) { 1904 var onClose = true; 1905 mounth_picker 1906 .find('.xdsoft_month,.xdsoft_year') 1907 .find('.xdsoft_select') 1908 .hide(); 1909 if (options.onClose && $.isFunction(options.onClose)) { 1910 onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); 1911 } 1912 if (onClose !== false && !options.opened && !options.inline) { 1913 datetimepicker.hide(); 1914 } 1915 event.stopPropagation(); 1916 }) 1917 .on('toggle.xdsoft', function (event) { 1918 if (datetimepicker.is(':visible')) { 1919 datetimepicker.trigger('close.xdsoft'); 1920 } else { 1921 datetimepicker.trigger('open.xdsoft'); 1922 } 1923 }) 1924 .data('input', input); 1925 1926 timer = 0; 1927 timer1 = 0; 1928 1929 datetimepicker.data('xdsoft_datetime', _xdsoft_datetime); 1930 datetimepicker.setOptions(options); 1931 1932 function getCurrentValue() { 1933 var ct = false, time; 1934 1935 if (options.startDate) { 1936 ct = _xdsoft_datetime.strToDate(options.startDate); 1937 } else { 1938 ct = options.value || ((input && input.val && input.val()) ? input.val() : ''); 1939 if (ct) { 1940 ct = _xdsoft_datetime.strToDateTime(ct); 1941 } else if (options.defaultDate) { 1942 ct = _xdsoft_datetime.strToDateTime(options.defaultDate); 1943 if (options.defaultTime) { 1944 time = _xdsoft_datetime.strtotime(options.defaultTime); 1945 ct.setHours(time.getHours()); 1946 ct.setMinutes(time.getMinutes()); 1947 } 1948 } 1949 } 1950 1951 if (ct && _xdsoft_datetime.isValidDate(ct)) { 1952 datetimepicker.data('changed', true); 1953 } else { 1954 ct = ''; 1955 } 1956 1957 return ct || 0; 1958 } 1959 1960 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 1961 1962 input 1963 .data('xdsoft_datetimepicker', datetimepicker) 1964 .on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function (event) { 1965 if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) { 1966 return; 1967 } 1968 clearTimeout(timer); 1969 timer = setTimeout(function () { 1970 if (input.is(':disabled')) { 1971 return; 1972 } 1973 1974 triggerAfterOpen = true; 1975 _xdsoft_datetime.setCurrentTime(getCurrentValue()); 1976 1977 datetimepicker.trigger('open.xdsoft'); 1978 }, 100); 1979 }) 1980 .on('keydown.xdsoft', function (event) { 1981 var val = this.value, elementSelector, 1982 key = event.which; 1983 if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) { 1984 elementSelector = $("input:visible,textarea:visible"); 1985 datetimepicker.trigger('close.xdsoft'); 1986 elementSelector.eq(elementSelector.index(this) + 1).focus(); 1987 return false; 1988 } 1989 if ([TAB].indexOf(key) !== -1) { 1990 datetimepicker.trigger('close.xdsoft'); 1991 return true; 1992 } 1993 }); 1994 }; 1995 destroyDateTimePicker = function (input) { 1996 var datetimepicker = input.data('xdsoft_datetimepicker'); 1997 if (datetimepicker) { 1998 datetimepicker.data('xdsoft_datetime', null); 1999 datetimepicker.remove(); 2000 input 2001 .data('xdsoft_datetimepicker', null) 2002 .off('.xdsoft'); 2003 $(window).off('resize.xdsoft'); 2004 $([window, document.body]).off('mousedown.xdsoft'); 2005 if (input.unmousewheel) { 2006 input.unmousewheel(); 2007 } 2008 } 2009 }; 2010 $(document) 2011 .off('keydown.xdsoftctrl keyup.xdsoftctrl') 2012 .on('keydown.xdsoftctrl', function (e) { 2013 if (e.keyCode === CTRLKEY) { 2014 ctrlDown = true; 2015 } 2016 }) 2017 .on('keyup.xdsoftctrl', function (e) { 2018 if (e.keyCode === CTRLKEY) { 2019 ctrlDown = false; 2020 } 2021 }); 2022 return this.each(function () { 2023 var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input; 2024 if (datetimepicker) { 2025 if ($.type(opt) === 'string') { 2026 switch (opt) { 2027 case 'show': 2028 $(this).select().focus(); 2029 datetimepicker.trigger('open.xdsoft'); 2030 break; 2031 case 'hide': 2032 datetimepicker.trigger('close.xdsoft'); 2033 break; 2034 case 'toggle': 2035 datetimepicker.trigger('toggle.xdsoft'); 2036 break; 2037 case 'destroy': 2038 destroyDateTimePicker($(this)); 2039 break; 2040 case 'reset': 2041 this.value = this.defaultValue; 2042 if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(Date.parseDate(this.value, options.format))) { 2043 datetimepicker.data('changed', false); 2044 } 2045 datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value); 2046 break; 2047 case 'validate': 2048 $input = datetimepicker.data('input'); 2049 $input.trigger('blur.xdsoft'); 2050 break; 2051 } 2052 } else { 2053 datetimepicker 2054 .setOptions(opt); 2055 } 2056 return 0; 2057 } 2058 if ($.type(opt) !== 'string') { 2059 if (!options.lazyInit || options.open || options.inline) { 2060 createDateTimePicker($(this)); 2061 } else { 2062 lazyInit($(this)); 2063 } 2064 } 2065 }); 2066 }; 2067 $.fn.datetimepicker.defaults = default_options; 2068}(jQuery)); 2069 2070function HighlightedDate(date, desc, style) { 2071 "use strict"; 2072 this.date = date; 2073 this.desc = desc; 2074 this.style = style; 2075} 2076 2077(function () { 2078 2079/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh) 2080 * Licensed under the MIT License (LICENSE.txt). 2081 * 2082 * Version: 3.1.12 2083 * 2084 * Requires: jQuery 1.2.2+ 2085 */ 2086!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1
vendor: 2,754 bytes, lines 2086-2094
2086),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}); 2087 2088// Parse and Format Library 2089//http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/ 2090/* 2091 * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org> 2092 * 2093 * This program is free software; you can redistribute it and/or modify it 2094 * under the terms of the GNU Lesser General Public License as published by the
2095 * Free Software Foundation, version 2.1. 2096 * 2097 * This program is distributed in the hope that it will be useful, but WITHOUT 2098 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 2099 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 2100 * details. 2101 */ 2102// Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var codePrefix="Date.prototype."+funcName+" = function() {return ";var code="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;code+="'"+String.escape(ch)+"' + ";}else{code+=Date.getFormatCode(ch);}}}if(code.length==0){code="\"\"";}else{code=code.substring(0,code.length-3);}eval(codePrefix+code+";}");};Date.getFormatCode=function(a){switch(a){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(a)+"' + ";}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;regex+=String.escape(ch);}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}}code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$",'i');eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){case"D":return{g:0,c:null,
2102s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+a+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+a+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0");};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)));};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a;};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a;};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1");};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"}; 2103// Date.monthNames = [datetime.January, datetime.February, datetime.March, datetime.April, datetime.May, datetime.June, datetime.July, datetime.August, datetime.September, datetime.October, datetime.November, datetime.December]; 2104// Date.dayNames = [datetime.Sunday, datetime.Monday, datetime.Tuesday, datetime.Wednesday, datetime.Thursday, datetime.Friday, datetime.Saturday]; 2105// }()); 2106 2107Date.parseFunctions = { 2108 count: 0 2109}; 2110Date.parseRegexes = []; 2111Date.formatFunctions = { 2112 count: 0 2113}; 2114Date.prototype.dateFormat = function(b) { 2115 if (b == "unixtime") { 2116 return parseInt(this.getTime() / 1000); 2117 } 2118 if (Date.formatFunctions[b] == null) { 2119 Date.createNewFormat(b); 2120 } 2121 var a = Date.formatFunctions[b]; 2122 return this[a](); 2123}; 2124Date.createNewFormat = function(format) { 2125 var funcName = "format" + Date.formatFunctions.count++; 2126 Date.formatFunctions[format] = funcName; 2127 var codePrefix = "Date.prototype." + funcName + " = function() {return "; 2128 var code = ""; 2129 var special = false;
2130 var ch = ""; 2131 for (var i = 0; i < format.length; ++i) { 2132 ch = format.charAt(i); 2133 if (!special && ch == "\\") { 2134 special = true; 2135 } else { 2136 if (special) { 2137 special = false; 2138 code += "'" + String.escape(ch) + "' + "; 2139 } else { 2140 code += Date.getFormatCode(ch); 2141 } 2142 } 2143 } 2144 if (code.length == 0) { 2145 code = "\"\""; 2146 } else { 2147 code = code.substring(0, code.length - 3); 2148 } 2149 eval(codePrefix + code + ";}"); 2150}; 2151Date.getFormatCode = function(a) { 2152 switch (a) { 2153 case "d": 2154 return "String.leftPad(this.getDate(), 2, '0') + "; 2155 case "D": 2156 return "Date.dayNames[this.getDay()].substring(0, 3) + "; 2157 case "j": 2158 return "this.getDate() + "; 2159 case "l": 2160 return "Date.dayNames[this.getDay()] + "; 2161 case "S": 2162 return "this.getSuffix() + "; 2163 case "w": 2164 return "this.getDay() + "; 2165 case "z": 2166 return "this.getDayOfYear() + "; 2167 case "W": 2168 return "this.getWeekOfYear() + "; 2169 case "F": 2170 return "Date.monthNames[this.getMonth()] + "; 2171 case "m": 2172 return "String.leftPad(this.getMonth() + 1, 2, '0') + "; 2173 case "M": 2174 return "Date.monthNames[this.getMonth()].substring(0, 3) + "; 2175 case "n": 2176 return "(this.getMonth() + 1) + "; 2177 case "t": 2178 return "this.getDaysInMonth() + "; 2179 case "L": 2180 return "(this.isLeapYear() ? 1 : 0) + "; 2181 case "Y": 2182 return "this.getFullYear() + "; 2183 case "y": 2184 return "('' + this.getFullYear()).substring(2, 4) + "; 2185 case "a": 2186 return "(this.getHours() < 12 ? 'am' : 'pm') + "; 2187 case "A": 2188 return "(this.getHours() < 12 ? 'AM' : 'PM') + "; 2189 case "g": 2190 return "((this.getHours() %12) ? this.getHours() % 12 : 12) + "; 2191 case "G": 2192 return "this.getHours() + "; 2193 case "h": 2194 return "String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + "; 2195 case "H": 2196 return "String.leftPad(this.getHours(), 2, '0') + "; 2197 case "i": 2198 return "String.leftPad(this.getMinutes(), 2, '0') + "; 2199 case "s": 2200 return "String.leftPad(this.getSeconds(), 2, '0') + "; 2201 case "O": 2202 return "this.getGMTOffset() + "; 2203 case "T": 2204 return "this.getTimezone() + "; 2205 case "Z": 2206 return "(this.getTimezoneOffset() * -60) + "; 2207 default: 2208 return "'" + String.escape(a) + "' + "; 2209 } 2210}; 2211Date.parseDate = function(a, c) { 2212 if (c == "unixtime") { 2213 return new Date(!isNaN(parseInt(a)) ? parseInt(a) * 1000 : 0); 2214 } 2215 if (Date.parseFunctions[c] == null) { 2216 Date.createParser(c); 2217 } 2218 var b = Date.parseFunctions[c]; 2219 return Date[b](a); 2220}; 2221Date.createParser = function(format) { 2222 var funcName = "parse" + Date.parseFunctions.count++; 2223 var regexNum = Date.parseRegexes.length; 2224 var currentGroup = 1; 2225 Date.parseFunctions[format] = funcName; 2226 var code = "Date." + funcName + " = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes[" + regexNum + "]);\nif (results && results.length > 0) {"; 2227 var regex = ""; 2228 var special = false;
2229 var ch = ""; 2230 for (var i = 0; i < format.length; ++i) { 2231 ch = format.charAt(i); 2232 if (!special && ch == "\\") { 2233 special = true; 2234 } else { 2235 if (special) { 2236 special = false; 2237 regex += String.escape(ch); 2238 } else { 2239 obj = Date.formatCodeToRegex(ch, currentGroup); 2240 currentGroup += obj.g; 2241 regex += obj.s; 2242 if (obj.g && obj.c) { 2243 code += obj.c; 2244 } 2245 } 2246 } 2247 } 2248 code += "if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}"; 2249 code += "if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}"; 2250 Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$", 'i'); 2251 eval(code); 2252}; 2253Date.formatCodeToRegex = function(b, a) { 2254 switch (b) { 2255 case "D": 2256 return { 2257 g: 0, 2258 c: null, 2259 s: "(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)" 2260 }; 2261 case "j": 2262 case "d": 2263 return { 2264 g: 1, 2265 c: "d = parseInt(results[" + a + "], 10);\n", 2266 s: "(\\d{1,2})" 2267 }; 2268 case "l": 2269 return { 2270 g: 0, 2271 c: null, 2272 s: "(?:" + Date.dayNames.join("|") + ")" 2273 }; 2274 case "S": 2275 return { 2276 g: 0, 2277 c: null, 2278 s: "(?:st|nd|rd|th)" 2279 }; 2280 case "w": 2281 return { 2282 g: 0, 2283 c: null, 2284 s: "\\d" 2285 }; 2286 case "z": 2287 return { 2288 g: 1, 2289 c: "z = parseInt(results[" + a + "], 10);\n", 2290 s: "(\\d{1,3})" 2291 }; 2292 case "W": 2293 return { 2294 g: 0, 2295 c: null, 2296 s: "(?:\\d{2})" 2297 }; 2298 case "F": 2299 return { 2300 g: 1, 2301 c: "m = parseInt(Date.monthNumbers[results[" + a + "].substring(0, 3)], 10);\n", 2302 s: "(" + Date.monthNames.join("|") + ")" 2303 }; 2304 case "M": 2305 return { 2306 g: 1, 2307 c: "m = parseInt(Date.monthNumbers[results[" + a + "]], 10);\n", 2308 s: "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)" 2309 }; 2310 case "n": 2311 case "m": 2312 return { 2313 g: 1, 2314 c: "m = parseInt(results[" + a + "], 10) - 1;\n", 2315 s: "(\\d{1,2})" 2316 }; 2317 case "t": 2318 return { 2319 g: 0, 2320 c: null, 2321 s: "\\d{1,2}" 2322 }; 2323 case "L": 2324 return { 2325 g: 0, 2326 c: null, 2327 s: "(?:1|0)" 2328 }; 2329 case "Y": 2330 return { 2331 g: 1, 2332 c: "y = parseInt(results[" + a + "], 10);\n", 2333 s: "(\\d{4})" 2334 }; 2335 case "y": 2336 return { 2337 g: 1, 2338 c: "var ty = parseInt(results[" + a + "], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", 2339 s: "(\\d{1,2})" 2340 }; 2341 case "a": 2342 return { 2343 g: 1, 2344 c: "if (results[" + a + "] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}", 2345 s: "(am|pm)" 2346 }; 2347 case "A": 2348 return { 2349 g: 1, 2350 c: "if (results[" + a + "] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}", 2351 s: "(AM|PM)" 2352 }; 2353 case "g": 2354 case "G": 2355 case "h": 2356 case "H": 2357 return { 2358 g: 1, 2359 c: "h = parseInt(results[" + a + "], 10);\n", 2360 s: "(\\d{1,2})" 2361 }; 2362 case "i": 2363 return { 2364 g: 1, 2365 c: "i = parseInt(results[" + a + "], 10);\n", 2366 s: "(\\d{2})" 2367 }; 2368 case "s": 2369 return { 2370 g: 1, 2371 c: "s = parseInt(results[" + a + "], 10);\n", 2372 s: "(\\d{2})" 2373 }; 2374 case "O": 2375 return { 2376 g: 0, 2377 c: null, 2378 s: "[+-]\\d{4}" 2379 }; 2380 case "T": 2381 return { 2382 g: 0, 2383 c: null, 2384 s: "[A-Z]{3}" 2385 }; 2386 case "Z": 2387 return { 2388 g: 0, 2389 c: null, 2390 s: "[+-]\\d{1,5}" 2391 }; 2392 default: 2393 return { 2394 g: 0, 2395 c: null, 2396 s: String.escape(b) 2397 }; 2398 } 2399}; 2400Date.prototype.getTimezone = function() { 2401 return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/, "$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3"); 2402}; 2403Date.prototype.getGMTOffset = function() { 2404 return (this.getTimezoneOffset() > 0 ? "-" : "+") + String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset()) / 60), 2, "0") + String.leftPad(Math.abs(this.getTimezoneOffset()) % 60, 2, "0"); 2405}; 2406Date.prototype.getDayOfYear = function() { 2407 var a = 0; 2408 Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; 2409 for (var b = 0; b < this.getMonth(); ++b) { 2410 a += Date.daysInMonth[b]; 2411 } 2412 return a + this.getDate(); 2413}; 2414Date.prototype.getWeekOfYear = function() { 2415 var b = this.getDayOfYear() + (4 - this.getDay()); 2416 var a = new Date(this.getFullYear(), 0, 1); 2417 var c = (7 - a.getDay() + 4); 2418 return String.leftPad(Math.ceil((b - c) / 7) + 1, 2, "0"); 2419}; 2420Date.prototype.isLeapYear = function() { 2421 var a = this.getFullYear(); 2422 return ((a & 3) == 0 && (a % 100 || (a % 400 == 0 && a))); 2423}; 2424Date.prototype.getFirstDayOfMonth = function() { 2425 var a = (this.getDay() - (this.getDate() - 1)) % 7; 2426 return (a < 0) ? (a + 7) : a; 2427}; 2428Date.prototype.getLastDayOfMonth = function() { 2429 var a = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7; 2430 return (a < 0) ? (a + 7) : a; 2431}; 2432Date.prototype.getDaysInMonth = function() { 2433 Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; 2434 return Date.daysInMonth[this.getMonth()]; 2435}; 2436Date.prototype.getSuffix = function() { 2437 switch (this.getDate()) { 2438 case 1: 2439 case 21: 2440 case 31: 2441 return "st"; 2442 case 2: 2443 case 22: 2444 return "nd"; 2445 case 3: 2446 case 23: 2447 return "rd"; 2448 default: 2449 return "th"; 2450 } 2451}; 2452String.escape = function(a) { 2453 return a.replace(/('|\\)/g, "\\$1"); 2454}; 2455String.leftPad = function(d, b, c) { 2456 var a = new String(d); 2457 if (c == null) { 2458 c = " "; 2459 } 2460 while (a.length < b) { 2461 a = c + a; 2462 } 2463 return a; 2464}; 2465Date.daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 2466Date.monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
2466November", "December"]; 2467Date.dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; 2468Date.y2kYear = 50; 2469Date.monthNumbers = { 2470 Jan: 0, 2471 Feb: 1, 2472 Mar: 2, 2473 Apr: 3, 2474 May: 4, 2475 Jun: 5, 2476 Jul: 6, 2477 Aug: 7, 2478 Sep: 8, 2479 Oct: 9, 2480 Nov: 10, 2481 Dec: 11 2482}; 2483Date.patterns = { 2484 ISO8601LongPattern: "Y-m-d H:i:s", 2485 ISO8601ShortPattern: "Y-m-d", 2486 ShortDatePattern: "n/j/Y", 2487 LongDatePattern: "l, F d, Y", 2488 FullDateTimePattern: "l, F d, Y g:i:s A", 2489 MonthDayPattern: "F d", 2490 ShortTimePattern: "g:i A", 2491 LongTimePattern: "g:i:s A", 2492 SortableDateTimePattern: "Y-m-d\\TH:i:s", 2493 UniversalSortableDateTimePattern: "Y-m-d H:i:sO", 2494 YearMonthPattern: "F, Y" 2495}; 2496Date.monthNames = [datetime.January, datetime.February, datetime.March, datetime.April, datetime.May, datetime.June, datetime.July, datetime.August, datetime.September, datetime.October, datetime.November, datetime.December]; 2497Date.dayNames = [datetime.Sunday, datetime.Monday, datetime.Tuesday, datetime.Wednesday, datetime.Thursday, datetime.Friday, datetime.Saturday]; 2498Date.monthNumbers[datetime.January.substring(0,3)] = Date.monthNumbers[datetime.January.substring(0,3).toLowerCase()] = 0; 2499Date.monthNumbers[datetime.February.substring(0,3)] = Date.monthNumbers[datetime.February.substring(0,3).toLowerCase()] = 1; 2500Date.monthNumbers[datetime.March.substring(0,3)] = Date.monthNumbers[datetime.March.substring(0,3).toLowerCase()] = 2; 2501Date.monthNumbers[datetime.April.substring(0,3)] = Date.monthNumbers[datetime.April.substring(0,3).toLowerCase()] = 3; 2502Date.monthNumbers[datetime.May.substring(0,3)] = Date.monthNumbers[datetime.May.substring(0,3).toLowerCase()] = 4; 2503Date.monthNumbers[datetime.June.substring(0,3)] = Date.monthNumbers[datetime.June.substring(0,3).toLowerCase()] = 5; 2504Date.monthNumbers[datetime.July.substring(0,3)] = Date.monthNumbers[datetime.July.substring(0,3).toLowerCase()] = 6; 2505Date.monthNumbers[datetime.August.substring(0,3)] = Date.monthNumbers[datetime.August.substring(0,3).toLowerCase()] = 7; 2506Date.monthNumbers[datetime.September.substring(0,3)] = Date.monthNumbers[datetime.September.substring(0,3).toLowerCase()] = 8; 2507Date.monthNumbers[datetime.October.substring(0,3)] = Date.monthNumbers[datetime.October.substring(0,3).toLowerCase()] = 9; 2508Date.monthNumbers[datetime.November.substring(0,3)] = Date.monthNumbers[datetime.November.substring(0,3).toLowerCase()] = 10; 2509Date.monthNumbers[datetime.December.substring(0,3)] = Date.monthNumbers[datetime.December.substring(0,3).toLowerCase()] = 11; 2510}());
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.