datetimepicker/build/jquery.datetimepicker.min.js

3 lines
45 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:["
}(500),e([document.body,window]).on("touchend mouseup.xdsoft",function n(){clearTimeout(a),o=!0,e([document.body,window]).off("touchend mouseup.xdsoft",n)})}),I.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=L[0].clientHeight,s=R[0].offsetHeight,d=Math.abs(parseInt(R.css("marginTop"),10));t.hasClass(C.next)&&s-i-C.timeHeightInTimePicker>=d?R.css("marginTop","-"+(d+C.timeHeightInTimePicker)+"px"):t.hasClass(C.prev)&&d-C.timeHeightInTimePicker>=0&&R.css("marginTop","-"+(d-C.timeHeightInTimePicker)+"px"),L.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(R.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)})}),d=0,J.on("xchange.xdsoft",function(t){clearTimeout(d),d=setTimeout(function(){(void 0===j.currentTime||null===j.currentTime)&&(j.currentTime=j.now());for(var t,a,i,s,d,u,l,f,c,m,h="",g=new Date(j.currentTime.getFullYear(),j.currentTime.getMonth(),1,12,0,0),p=0,y=j.now(),k=!1,b=!1,x=[],v=!0,D="",T="";g.getDay()!==C.dayOfWeekStart;)g.setDate(g.getDate()-1);for(h+="<table><thead><tr>",C.weeks&&(h+="<th></th>"),t=0;7>t;t+=1)h+="<th>"+C.i18n[n].dayOfWeekShort[(t+C.dayOfWeekStart)%7]+"</th>";for(h+="</tr></thead>",h+="<tbody>",C.maxDate!==!1&&(k=j.strToDate(C.maxDate),k=new Date(k.getFullYear(),k.getMonth(),k.getDate(),23,59,59,999)),C.minDate!==!1&&(b=j.strToDate(C.minDate),b=new Date(b.getFullYear(),b.getMonth(),b.getDate()));p<j.currentTime.countDaysInMonth()||g.getDay()!==C.dayOfWeekStart||j.currentTime.getMonth()===g.getMonth();)x=[],p+=1,i=g.getDay(),s=g.getDate(),d=g.getFullYear(),u=g.getMonth(),l=j.getWeekOfYear(g),m="",x.push("xdsoft_date"),f=C.beforeShowDay&&e.isFunction(C.beforeShowDay.call)?C.beforeShowDay.call(J,g):null,C.allowDateRe&&"[object RegExp]"===Object.prototype.toString.call(C.allowDateRe)?C.allowDateRe.test(g.dateFormat(C.formatDate))||x.push("xdsoft_disabled"):C.allowDates&&C.allowDates.length>0?-1===C.allowDates.indexOf(g.dateFormat(C.formatDate))&&x.push("xdsoft_disabled"):k!==!1&&g>k||b!==!1&&b>g||f&&f[0]===!1?x.push("xdsoft_disabled"):-1!==C.disabledDates.indexOf(o.formatDate(g,C.formatDate))?x.push("xdsoft_disabled"):-1!==C.disabledWeekDays.indexOf(i)&&x.push("xdsoft_disabled"),f&&""!==f[1]&&x.push(f[1]),j.currentTime.getMonth()!==u&&x.push("xdsoft_other_month"),(C.defaultSelect||J.data("changed"))&&o.formatDate(j.currentTime,C.formatDate)===o.formatDate(g,C.formatDate)&&x.push("xdsoft_current"),o.formatDate(y,C.formatDate)===o.formatDate(g,C.formatDate)&&x.push("xdsoft_today"),(0===g.getDay()||6===g.getDay()||-1!==C.weekends.indexOf(o.formatDate(g,C.formatDate)))&&x.push("xdsoft_weekend"),void 0!==C.highlightedDates[o.formatDate(g,C.formatDate)]&&(a=C.highlightedDates[o.formatDate(g,C.formatDate)],x.push(void 0===a.style?"xdsoft_highlighted_default":a.style),m=void 0===a.desc?"":a.desc),C.beforeShowDay&&e.isFunction(C.beforeShowDay)&&x.push(C.beforeShowDay(g)),v&&(h+="<tr>",v=!1,C.weeks&&(h+="<th>"+l+"</th>")),h+='<td data-date="'+s+'" data-month="'+u+'" data-year="'+d+'" class="xdsoft_date xdsoft_day_of_week'+g.getDay()+" "+x.join(" ")+'" title="'+m+'"><div>'+s+"</div></td>",g.getDay()===C.dayOfWeekStartPrev&&(h+="</tr>",v=!0),g.setDate(s+1);if(h+="</tbody></table>",N.html(h),z.find(".xdsoft_label span").eq(0).text(C.i18n[n].months[j.currentTime.getMonth()]),z.find(".xdsoft_label span").eq(1).text(j.currentTime.getFullYear()),D="",T="",u="",c=function(t,a){var r,n,i=j.now(),s=C.allowTimes&&e.isArray(C.allowTimes)&&C.allowTimes.length;i.setHours(t),t=parseInt(i.getHours(),10),i.setMinutes(a),a=parseInt(i.getMinutes(),10),r=new Date(j.currentTime),r.setHours(t),r.setMinutes(a),x=[],(C.minDateTime!==!1&&C.minDateTime>r||C.maxTime!==!1&&j.strtotime(C.maxTime).getTime()<i.getTime()||C.minTime!==!1&&j.strtotime(C.minTime).getTime()>i.getTime())&&x.push("xdsoft_disabled"),(C.minDateTime!==!1&&C.minDateTime>r||C.disabledMinTime!==!1&&i.getT