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