mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
3 lines
44 KiB
JavaScript
3 lines
44 KiB
JavaScript
|
!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:["
|
|||
|
|
|||
|
for(c+="</tr></thead>",c+="<tbody>",_.maxDate!==!1&&(k=P.strToDate(_.maxDate),k=new Date(k.getFullYear(),k.getMonth(),k.getDate(),23,59,59,999)),_.minDate!==!1&&(y=P.strToDate(_.minDate),y=new Date(y.getFullYear(),y.getMonth(),y.getDate()));g<P.currentTime.countDaysInMonth()||h.getDay()!==_.dayOfWeekStart||P.currentTime.getMonth()===h.getMonth();)x=[],g+=1,n=h.getDay(),i=h.getDate(),s=h.getFullYear(),d=h.getMonth(),u=P.getWeekOfYear(h),m="",x.push("xdsoft_date"),l=_.beforeShowDay&&e.isFunction(_.beforeShowDay.call)?_.beforeShowDay.call(J,h):null,k!==!1&&h>k||y!==!1&&y>h||l&&l[0]===!1?x.push("xdsoft_disabled"):-1!==_.disabledDates.indexOf(h.dateFormat(_.formatDate))?x.push("xdsoft_disabled"):-1!==_.disabledWeekDays.indexOf(n)&&x.push("xdsoft_disabled"),l&&""!==l[1]&&x.push(l[1]),P.currentTime.getMonth()!==d&&x.push("xdsoft_other_month"),(_.defaultSelect||J.data("changed"))&&P.currentTime.dateFormat(_.formatDate)===h.dateFormat(_.formatDate)&&x.push("xdsoft_current"),p.dateFormat(_.formatDate)===h.dateFormat(_.formatDate)&&x.push("xdsoft_today"),(0===h.getDay()||6===h.getDay()||-1!==_.weekends.indexOf(h.dateFormat(_.formatDate)))&&x.push("xdsoft_weekend"),void 0!==_.highlightedDates[h.dateFormat(_.formatDate)]&&(a=_.highlightedDates[h.dateFormat(_.formatDate)],x.push(void 0===a.style?"xdsoft_highlighted_default":a.style),m=void 0===a.desc?"":a.desc),_.beforeShowDay&&e.isFunction(_.beforeShowDay)&&x.push(_.beforeShowDay(h)),b&&(c+="<tr>",b=!1,_.weeks&&(c+="<th>"+u+"</th>")),c+='<td data-date="'+i+'" data-month="'+d+'" data-year="'+s+'" class="xdsoft_date xdsoft_day_of_week'+h.getDay()+" "+x.join(" ")+'" title="'+m+'"><div>'+i+"</div></td>",h.getDay()===_.dayOfWeekStartPrev&&(c+="</tr>",b=!0),h.setDate(i+1);if(c+="</tbody></table>",H.html(c),N.find(".xdsoft_label span").eq(0).text(_.i18n[o].months[P.currentTime.getMonth()]),N.find(".xdsoft_label span").eq(1).text(P.currentTime.getFullYear()),v="",T="",d="",f=function(e,t){var a,r,o=P.now();o.setHours(e),e=parseInt(o.getHours(),10),o.setMinutes(t),t=parseInt(o.getMinutes(),10),a=new Date(P.currentTime),a.setHours(e),a.setMinutes(t),x=[],(_.minDateTime!==!1&&_.minDateTime>a||_.maxTime!==!1&&P.strtotime(_.maxTime).getTime()<o.getTime()||_.minTime!==!1&&P.strtotime(_.minTime).getTime()>o.getTime())&&x.push("xdsoft_disabled"),(_.minDateTime!==!1&&_.minDateTime>a||_.disabledMinTime!==!1&&o.getTime()>P.strtotime(_.disabledMinTime).getTime()&&_.disabledMaxTime!==!1&&o.getTime()<P.strtotime(_.disabledMaxTime).getTime())&&x.push("xdsoft_disabled"),r=new Date(P.currentTime),r.setHours(parseInt(P.currentTime.getHours(),10)),r.setMinutes(Math[_.roundTime](P.currentTime.getMinutes()/_.step)*_.step),(_.initTime||_.defaultSelect||J.data("changed"))&&r.getHours()===parseInt(e,10)&&(_.step>59||r.getMinutes()===parseInt(t,10))&&(_.defaultSelect||J.data("changed")?x.push("xdsoft_current"):_.initTime&&x.push("xdsoft_init_time")),parseInt(p.getHours(),10)===parseInt(e,10)&&parseInt(p.getMinutes(),10)===parseInt(t,10)&&x.push("xdsoft_today"),v+='<div class="xdsoft_time '+x.join(" ")+'" data-hour="'+e+'" data-minute="'+t+'">'+o.dateFormat(_.formatTime)+"</div>"},_.allowTimes&&e.isArray(_.allowTimes)&&_.allowTimes.length)for(g=0;g<_.allowTimes.length;g+=1)T=P.strtotime(_.allowTimes[g]).getHours(),d=P.strtotime(_.allowTimes[g]).getMinutes(),f(T,d);else for(g=0,t=0;g<(_.hours12?12:24);g+=1)for(t=0;60>t;t+=_.step)T=(10>g?"0":"")+g,d=(10>t?"0":"")+t,f(T,d);for(L.html(v),r="",g=0,g=parseInt(_.yearStart,10)+_.yearOffset;g<=parseInt(_.yearEnd,10)+_.yearOffset;g+=1)r+='<div class="xdsoft_option '+(P.currentTime.getFullYear()===g?"xdsoft_current":"")+'" data-value="'+g+'">'+g+"</div>";for(E.children().eq(0).html(r),g=parseInt(_.monthStart,10),r="";g<=parseInt(_.monthEnd,10);g+=1)r+='<div class="xdsoft_option '+(P.currentTime.getMonth()===g?"xdsoft_current":"")+'" data-value="'+g+'">'+_.i18n[o].months[g]+"</div>";B.children().eq(0).html(r),e(J).trigger("generate.xdsoft")},10),t.stopPropagation()}).on("afterOpen.xdsoft",function(){if(_.timepicker){var e,t,a,r;L.find(".xdsoft_current").length?e=".xdsoft_curren
|