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