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