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