datetimepicker/build/jquery.datetimepicker.min.js

2 lines
46 KiB
JavaScript
Raw Normal View History

!function(e){"function"==typeof define&&define.amd?define(["jquery","jquery-mousewheel"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){"use strict";function t(e,t,a){this.date=e,this.desc=t,this.style=a}var a={i18n:{ar:{months:["كانون الثاني","شباط","آذار","نيسان","مايو","حزيران","تموز","آب","أيلول","تشرين الأول","تشرين الثاني","كانون الأول"],dayOfWeekShort:["ن","ث","ع","خ","ج","س","ح"],dayOfWeek:["الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت","الأحد"]},ro:{months:["Ianuarie","Februarie","Martie","Aprilie","Mai","Iunie","Iulie","August","Septembrie","Octombrie","Noiembrie","Decembrie"],dayOfWeekShort:["Du","Lu","Ma","Mi","Jo","Vi","Sâ"],dayOfWeek:["Duminică","Luni","Marţi","Miercuri","Joi","Vineri","Sâmbătă"]},id:{months:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],dayOfWeekShort:["Min","Sen","Sel","Rab","Kam","Jum","Sab"],dayOfWeek:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"]},is:{months:["Janúar","Febrúar","Mars","Apríl","Maí","Júní","Júlí","Ágúst","September","Október","Nóvember","Desember"],dayOfWeekShort:["Sun","Mán","Þrið","Mið","Fim","Fös","Lau"],dayOfWeek:["Sunnudagur","Mánudagur","Þriðjudagur","Miðvikudagur","Fimmtudagur","Föstudagur","Laugardagur"]},bg:{months:["Януари","Февруари","Март","Април","Май","Юни","Юли","Август","Септември","Октомври","Ноември","Декември"],dayOfWeekShort:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],dayOfWeek:["Неделя","Понеделник","Вторник","Сряда","Четвъртък","Петък","Събота"]},fa:{months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],dayOfWeekShort:["یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],dayOfWeek:["یک‌شنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنج‌شنبه","جمعه","شنبه","یک‌شنبه"]},ru:{months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],dayOfWeekShort:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],dayOfWeek:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"]},uk:{months:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"],dayOfWeekShort:["Ндл","Пнд","Втр","Срд","Чтв","Птн","Сбт"],dayOfWeek:["Неділя","Понеділок","Вівторок","Середа","Четвер","П'ятниця","Субота"]},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeekShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},el:{months:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"],dayOfWeekShort:["Κυρ","Δευ","Τρι","Τετ","Πεμ","Παρ","Σαβ"],dayOfWeek:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"]},de:{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],dayOfWeekShort:["So","Mo","Di","Mi","Do","Fr","Sa"],dayOfWeek:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},nl:{months:["
o>t||(a.val(J.str()),a.trigger("change"),Y.trigger("close.xdsoft")))}),I.find(".xdsoft_prev,.xdsoft_next").on("touchend mousedown.xdsoft",function(){var t=e(this),a=0,o=!1;!function r(e){t.hasClass(F.next)?J.nextMonth():t.hasClass(F.prev)&&J.prevMonth(),F.monthChangeSpinner&&(o||(a=setTimeout(r,e||100)))}(500),e([document.body,window]).on("touchend mouseup.xdsoft",function n(){clearTimeout(a),o=!0,e([document.body,window]).off("touchend mouseup.xdsoft",n)})}),R.find(".xdsoft_prev,.xdsoft_next").on("touchend mousedown.xdsoft",function(){var t=e(this),a=0,o=!1,r=110;!function n(e){var i=V[0].clientHeight,s=E[0].offsetHeight,d=Math.abs(parseInt(E.css("marginTop"),10));t.hasClass(F.next)&&s-i-F.timeHeightInTimePicker>=d?E.css("marginTop","-"+(d+F.timeHeightInTimePicker)+"px"):t.hasClass(F.prev)&&d-F.timeHeightInTimePicker>=0&&E.css("marginTop","-"+(d-F.timeHeightInTimePicker)+"px"),V.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(E.css("marginTop"),10)/(s-i))]),r=r>10?10:r-10,o||(a=setTimeout(n,e||r))}(500),e([document.body,window]).on("touchend mouseup.xdsoft",function i(){clearTimeout(a),o=!0,e([document.body,window]).off("touchend mouseup.xdsoft",i)})}),u=0,Y.on("xchange.xdsoft",function(t){clearTimeout(u),u=setTimeout(function(){(void 0===J.currentTime||null===J.currentTime)&&(J.currentTime=J.now());for(var t,i,s,d,u,l,f,c,m,h,g="",p=new Date(J.currentTime.getFullYear(),J.currentTime.getMonth(),1,12,0,0),y=0,k=J.now(),b=!1,x=!1,v=[],D=!0,T="",S="";p.getDay()!==F.dayOfWeekStart;)p.setDate(p.getDate()-1);for(g+="<table><thead><tr>",F.weeks&&(g+="<th></th>"),t=0;7>t;t+=1)g+="<th>"+F.i18n[n].dayOfWeekShort[(t+F.dayOfWeekStart)%7]+"</th>";for(g+="</tr></thead>",g+="<tbody>",F.maxDate!==!1&&(b=J.strToDate(F.maxDate),b=new Date(b.getFullYear(),b.getMonth(),b.getDate(),23,59,59,999)),F.minDate!==!1&&(x=J.strToDate(F.minDate),x=new Date(x.getFullYear(),x.getMonth(),x.getDate()));y<J.currentTime.countDaysInMonth()||p.getDay()!==F.dayOfWeekStart||J.currentTime.getMonth()===p.getMonth();)v=[],y+=1,s=p.getDay(),d=p.getDate(),u=p.getFullYear(),l=p.getMonth(),f=J.getWeekOfYear(p),h="",v.push("xdsoft_date"),c=F.beforeShowDay&&e.isFunction(F.beforeShowDay.call)?F.beforeShowDay.call(Y,p):null,F.allowDateRe&&"[object RegExp]"===Object.prototype.toString.call(F.allowDateRe)?F.allowDateRe.test(o.formatDate(p,F.formatDate))||v.push("xdsoft_disabled"):F.allowDates&&F.allowDates.length>0?-1===F.allowDates.indexOf(o.formatDate(p,F.formatDate))&&v.push("xdsoft_disabled"):b!==!1&&p>b||x!==!1&&x>p||c&&c[0]===!1?v.push("xdsoft_disabled"):-1!==F.disabledDates.indexOf(o.formatDate(p,F.formatDate))?v.push("xdsoft_disabled"):-1!==F.disabledWeekDays.indexOf(s)?v.push("xdsoft_disabled"):a.is("[readonly]")&&v.push("xdsoft_disabled"),c&&""!==c[1]&&v.push(c[1]),J.currentTime.getMonth()!==l&&v.push("xdsoft_other_month"),(F.defaultSelect||Y.data("changed"))&&o.formatDate(J.currentTime,F.formatDate)===o.formatDate(p,F.formatDate)&&v.push("xdsoft_current"),o.formatDate(k,F.formatDate)===o.formatDate(p,F.formatDate)&&v.push("xdsoft_today"),(0===p.getDay()||6===p.getDay()||-1!==F.weekends.indexOf(o.formatDate(p,F.formatDate)))&&v.push("xdsoft_weekend"),void 0!==F.highlightedDates[o.formatDate(p,F.formatDate)]&&(i=F.highlightedDates[o.formatDate(p,F.formatDate)],v.push(void 0===i.style?"xdsoft_highlighted_default":i.style),h=void 0===i.desc?"":i.desc),F.beforeShowDay&&e.isFunction(F.beforeShowDay)&&v.push(F.beforeShowDay(p)),D&&(g+="<tr>",D=!1,F.weeks&&(g+="<th>"+f+"</th>")),g+='<td data-date="'+d+'" data-month="'+l+'" data-year="'+u+'" class="xdsoft_date xdsoft_day_of_week'+p.getDay()+" "+v.join(" ")+'" title="'+h+'"><div>'+d+"</div></td>",p.getDay()===F.dayOfWeekStartPrev&&(g+="</tr>",D=!0),p.setDate(d+1);if(g+="</tbody></table>",L.html(g),I.find(".xdsoft_label span").eq(0).text(F.i18n[n].months[J.currentTime.getMonth()]),I.find(".xdsoft_label span").eq(1).text(J.currentTime.getFullYear()),T="",S="",l="",m=function(t,r){var n,i,s=J.now(),d=F.allowTimes&&e.isArray(F.allowTimes)&&F.allowTimes.length;s.setHours(t),t=parseInt(s.getHours(),10),s.setMinut