jquery.datetimepicker.js 33 KB

12345678910
  1. /**
  2. * @preserve jQuery DateTimePicker plugin v2.1.9
  3. * @homepage http://xdsoft.net/jqplugins/datetimepicker/
  4. * (c) 2014, Chupurnov Valeriy.
  5. *//*
  6. jQuery DateTimePicker plugin v2.1.9
  7. @homepage http://xdsoft.net/jqplugins/datetimepicker/
  8. (c) 2014, Chupurnov Valeriy.
  9. */
  10. (function(b){var e={i18n:{ru:{months:"\u042f\u043d\u0432\u0430\u0440\u044c \u0424\u0435\u0432\u0440\u0430\u043b\u044c \u041c\u0430\u0440\u0442 \u0410\u043f\u0440\u0435\u043b\u044c \u041c\u0430\u0439 \u0418\u044e\u043d\u044c \u0418\u044e\u043b\u044c \u0410\u0432\u0433\u0443\u0441\u0442 \u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c \u041e\u043a\u0442\u044f\u0431\u0440\u044c \u041d\u043e\u044f\u0431\u0440\u044c \u0414\u0435\u043a\u0430\u0431\u0440\u044c".split(" "),dayOfWeek:"\u0412\u0441\u043a \u041f\u043d \u0412\u0442 \u0421\u0440 \u0427\u0442 \u041f\u0442 \u0421\u0431".split(" ")},en:{months:"January February March April May June July August September October November December".split(" "),dayOfWeek:"Sun Mon Tue Wed Thu Fri Sat".split(" ")},de:{months:"Januar Februar M\u00e4rz April Mai Juni Juli August September Oktober November Dezember".split(" "),dayOfWeek:"So Mo Di Mi Do Fr Sa".split(" ")},nl:{months:"januari februari maart april mei juni juli augustus september oktober november december".split(" "),dayOfWeek:"zo ma di wo do vr za".split(" ")},tr:{months:"Ocak \u015eubat Mart Nisan May\u0131s Haziran Temmuz A\u011fustos Eyl\u00fcl Ekim Kas\u0131m Aral\u0131k".split(" "),dayOfWeek:"Paz Pts Sal \u00c7ar Per Cum Cts".split(" ")},fr:{months:"Janvier F\u00e9vrier Mars Avril Mai Juin Juillet Ao\u00fbt Septembre Octobre Novembre D\u00e9cembre".split(" "),dayOfWeek:"Dim Lun Mar Mer Jeu Ven Sam".split(" ")},es:{months:"Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre".split(" "),dayOfWeek:"Dom Lun Mar Mi\u00e9 Jue Vie S\u00e1b".split(" ")},th:{months:"\u0e21\u0e01\u0e23\u0e32\u0e04\u0e21 \u0e01\u0e38\u0e21\u0e20\u0e32\u0e1e\u0e31\u0e19\u0e18\u0e4c \u0e21\u0e35\u0e19\u0e32\u0e04\u0e21 \u0e40\u0e21\u0e29\u0e32\u0e22\u0e19 \u0e1e\u0e24\u0e29\u0e20\u0e32\u0e04\u0e21 \u0e21\u0e34\u0e16\u0e38\u0e19\u0e32\u0e22\u0e19 \u0e01\u0e23\u0e01\u0e0e\u0e32\u0e04\u0e21 \u0e2a\u0e34\u0e07\u0e2b\u0e32\u0e04\u0e21 \u0e01\u0e31\u0e19\u0e22\u0e32\u0e22\u0e19 \u0e15\u0e38\u0e25\u0e32\u0e04\u0e21 \u0e1e\u0e24\u0e28\u0e08\u0e34\u0e01\u0e32\u0e22\u0e19 \u0e18\u0e31\u0e19\u0e27\u0e32\u0e04\u0e21".split(" "),dayOfWeek:"\u0e2d\u0e32. \u0e08. \u0e2d. \u0e1e. \u0e1e\u0e24. \u0e28. \u0e2a.".split(" ")},pl:{months:"stycze\u0144 luty marzec kwiecie\u0144 maj czerwiec lipiec sierpie\u0144 wrzesie\u0144 pa\u017adziernik listopad grudzie\u0144".split(" "),dayOfWeek:"nd pn wt \u015br cz pt sb".split(" ")},pt:{months:"Janeiro Fevereiro Mar\u00e7o Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro".split(" "),dayOfWeek:"Dom Seg Ter Qua Qui Sex Sab".split(" ")},ch:{months:"\u4e00\u6708 \u4e8c\u6708 \u4e09\u6708 \u56db\u6708 \u4e94\u6708 \u516d\u6708 \u4e03\u6708 \u516b\u6708 \u4e5d\u6708 \u5341\u6708 \u5341\u4e00\u6708 \u5341\u4e8c\u6708".split(" "),dayOfWeek:"\u65e5\u4e00\u4e8c\u4e09\u56db\u4e94\u516d".split("")},se:{months:"Januari Februari Mars April Maj Juni Juli Augusti September Oktober November December".split(" "),dayOfWeek:"S\u00f6n M\u00e5n Tis Ons Tor Fre L\u00f6r".split(" ")},kr:{months:"1\uc6d4 2\uc6d4 3\uc6d4 4\uc6d4 5\uc6d4 6\uc6d4 7\uc6d4 8\uc6d4 9\uc6d4 10\uc6d4 11\uc6d4 12\uc6d4".split(" "),dayOfWeek:"\uc77c\uc6d4\ud654\uc218\ubaa9\uae08\ud1a0".split("")},it:{months:"Gennaio Febbraio Marzo Aprile Maggio Giugno Luglio Agosto Settembre Ottobre Novembre Dicembre".split(" "),dayOfWeek:"Dom Lun Mar Mer Gio Ven Sab".split(" ")}},value:"",lang:"en",format:"Y/m/d H:i",formatTime:"H:i",formatDate:"Y/m/d",step:60,closeOnDateSelect:0,closeOnWithoutClick:!0,timepicker:!0,datepicker:!0,minDate:!1,maxDate:!1,minTime:!1,maxTime:!1,allowTimes:[],opened:!1,inline:!1,onSelectDate:function(){},onSelectTime:function(){},onChangeMonth:function(){},onChangeDateTime:function(){},onShow:function(){},onClose:function(){},onGenerate:function(){},withoutCopyright:!0,inverseButton:!1,hours12:!1,next:"xdsoft_next",prev:"xdsoft_prev",dayOfWeekStart:0,timeHeightInTimePicker:25,timepickerScrollbar:!0,todayButton:!0,defaultSelect:!0,scrollMonth:!0,scrollTime:!0,scrollInput:!0,mask:!1,validateOnBlur:!0,allowBlank:!1,yearStart:1950,yearEnd:2050,style:"",id:"",roundTime:"round",className:"",weekends:[],yearOffset:0};Array.prototype.indexOf||(Array.prototype.indexOf=function(b,e){for(var a=e||0,r=this.length;a<r;a++)if(this[a]===b)return a;return-1});b.fn.xdsoftScroller=function(e){return this.each(function(){var k=b(this);if(!b(this).hasClass("xdsoft_scroller_box")){var a=function(a){var b={x:0,y:0};if("touchstart"==a.type||"touchmove"==a.type||"touchend"==a.type||"touchcancel"==a.type)a=a.originalEvent.touches[0]||a.originalEvent.changedTouches[0],b.x=a.pageX,b.y=a.pageY;else if("mousedown"==a.type||"mouseup"==a.type||"mousemove"==a.type||"mouseover"==a.type||"mouseout"==a.type||"mouseenter"==a.type||"mouseleave"==a.type)b.x=a.pageX,b.y=a.pageY;return b},r=0,d=k.children().eq(0),c=k[0].clientHeight,n=d[0].offsetHeight,w=b('\x3cdiv class\x3d"xdsoft_scrollbar"\x3e\x3c/div\x3e'),m=b('\x3cdiv class\x3d"xdsoft_scroller"\x3e\x3c/div\x3e'),B=100,p=!1;w.append(m);k.addClass("xdsoft_scroller_box").append(w);m.on("mousedown.xdsoft_scroller",function(a){c||k.trigger("resize_scroll.xdsoft_scroller",[e]);var d=a.pageY,n=parseInt(m.css("margin-top")),p=w[0].offsetHeight;b(document.body).addClass("xdsoft_noselect");b([document.body,window]).on("mouseup.xdsoft_scroller",function z(){b([document.body,window]).off("mouseup.xdsoft_scroller",z).off("mousemove.xdsoft_scroller",r).removeClass("xdsoft_noselect")});b(document.body).on("mousemove.xdsoft_scroller",r=function(a){a=a.pageY-d+n;0>a&&(a=0);a+m[0].offsetHeight>p&&(a=p-m[0].offsetHeight);k.trigger("scroll_element.xdsoft_scroller",[B?a/B:0])})});k.on("scroll_element.xdsoft_scroller",function(a,b){c||k.trigger("resize_scroll.xdsoft_scroller",[b,!0]);b=1<b?1:0>b||isNaN(b)?0:b;m.css("margin-top",B*b);d.css("marginTop",-parseInt((n-c)*b))}).on("resize_scroll.xdsoft_scroller",function(a,b,e){c=k[0].clientHeight;n=d[0].offsetHeight;a=c/n;var g=a*w[0].offsetHeight;1<a?m.hide():(m.show(),m.css("height",parseInt(10<g?g:10)),B=w[0].offsetHeight-m[0].offsetHeight,!0!==e&&k.trigger("scroll_element.xdsoft_scroller",[b?b:Math.abs(parseInt(d.css("marginTop")))/(n-c)]))});k.mousewheel&&k.mousewheel(function(a,b,e,m){e=Math.abs(parseInt(d.css("marginTop")));k.trigger("scroll_element.xdsoft_scroller",[(e-20*b)/(n-c)]);a.stopPropagation();return!1});k.on("touchstart",function(b){p=a(b)});k.on("touchmove",function(b){if(p){var e=a(b),m=Math.abs(parseInt(d.css("marginTop")));k.trigger("scroll_element.xdsoft_scroller",[(m-(e.y-p.y))/(n-c)]);b.stopPropagation();b.preventDefault()}});k.on("touchend touchcancel",function(a){p=!1})}k.trigger("resize_scroll.xdsoft_scroller",[e])})};b.fn.datetimepicker=function(g){var k=!1,a=b.isPlainObject(g)||!g?b.extend(!0,{},e,g):b.extend({},e),r=function(d){var c=b("\x3cdiv "+(a.id?'id\x3d"'+a.id+'"':"")+" "+(a.style?'style\x3d"'+a.style+'"':"")+' class\x3d"xdsoft_datetimepicker xdsoft_noselect '+a.className+'"\x3e\x3c/div\x3e'),e=b('\x3cdiv class\x3d"xdsoft_copyright"\x3e\x3ca target\x3d"_blank" href\x3d"http://xdsoft.net/jqplugins/datetimepicker/"\x3exdsoft.net\x3c/a\x3e\x3c/div\x3e'),g=b('\x3cdiv class\x3d"xdsoft_datepicker active"\x3e\x3c/div\x3e'),m=b('\x3cdiv class\x3d"xdsoft_mounthpicker"\x3e\x3cbutton type\x3d"button" class\x3d"xdsoft_prev"\x3e\x3c/button\x3e\x3cbutton type\x3d"button" class\x3d"xdsoft_today_button"\x3e\x3c/button\x3e\x3cdiv class\x3d"xdsoft_label xdsoft_month"\x3e\x3cspan\x3e\x3c/span\x3e\x3c/div\x3e\x3cdiv class\x3d"xdsoft_label xdsoft_year"\x3e\x3cspan\x3e\x3c/span\x3e\x3c/div\x3e\x3cbutton type\x3d"button" class\x3d"xdsoft_next"\x3e\x3c/button\x3e\x3c/div\x3e'),r=b('\x3cdiv class\x3d"xdsoft_calendar"\x3e\x3c/div\x3e'),p=b('\x3cdiv class\x3d"xdsoft_timepicker active"\x3e\x3cbutton type\x3d"button" class\x3d"xdsoft_prev"\x3e\x3c/button\x3e\x3cdiv class\x3d"xdsoft_time_box"\x3e\x3c/div\x3e\x3cbutton type\x3d"button" class\x3d"xdsoft_next"\x3e\x3c/button\x3e\x3c/div\x3e'),v=p.find(".xdsoft_time_box").eq(0),q=b('\x3cdiv class\x3d"xdsoft_time_variant"\x3e\x3c/div\x3e'),H=b('\x3cdiv class\x3d"xdsoft_scrollbar"\x3e\x3c/div\x3e');b('\x3cdiv class\x3d"xdsoft_scroller"\x3e\x3c/div\x3e');var C=b('\x3cdiv class\x3d"xdsoft_select xdsoft_monthselect"\x3e\x3cdiv\x3e\x3c/div\x3e\x3c/div\x3e'),D=b('\x3cdiv class\x3d"xdsoft_select xdsoft_yearselect"\x3e\x3cdiv\x3e\x3c/div\x3e\x3c/div\x3e');m.find(".xdsoft_month span").after(C);m.find(".xdsoft_year span").after(D);m.find(".xdsoft_month,.xdsoft_year").on("mousedown.xdsoft",function(a){m.find(".xdsoft_select").hide();var c=b(this).find(".xdsoft_select").eq(0),d=0,e=0;f.currentTime&&(d=f.currentTime[b(this).hasClass("xdsoft_month")?"getMonth":"getFullYear"]());c.show();for(var A=c.find("div.xdsoft_option"),y=0;y<A.length&&A.eq(y).data("value")!=d;y++)e+=A[0].offsetHeight;c.xdsoftScroller(e/(c.children()[0].offsetHeight-c[0].clientHeight));a.stopPropagation();return!1});m.find(".xdsoft_select").xdsoftScroller().on("mousedown.xdsoft",function(a){a.stopPropagation();a.preventDefault()}).on("mousedown.xdsoft",".xdsoft_option",function(l){if(f&&f.currentTime)f.currentTime[b(this).parent().parent().hasClass("xdsoft_monthselect")?"setMonth":"setFullYear"](b(this).data("value"));b(this).parent().parent().hide();c.trigger("xchange.xdsoft");a.onChangeMonth&&a.onChangeMonth.call&&a.onChangeMonth.call(c,f.currentTime,c.data("input"))});c.setOptions=function(l){a=b.extend(!0,{},a,l);!a.open&&!a.opened||a.inline||d.trigger("open.xdsoft");a.inline&&(c.addClass("xdsoft_inline"),d.after(c).hide(),c.trigger("afterOpen.xdsoft"));a.inverseButton&&(a.next="xdsoft_prev",a.prev="xdsoft_next");a.datepicker?g.addClass("active"):g.removeClass("active");a.timepicker?p.addClass("active"):p.removeClass("active");a.value&&(d&&d.val&&d.val(a.value),f.setCurrentTime(a.value));isNaN(a.dayOfWeekStart)||0>parseInt(a.dayOfWeekStart)||6<parseInt(a.dayOfWeekStart)?a.dayOfWeekStart=0:a.dayOfWeekStart=parseInt(a.dayOfWeekStart);a.timepickerScrollbar||H.hide();l=[];var h;a.minDate&&(l=/^-(.*)$/.exec(a.minDate))&&(l=Date.parseDate(l[1],a.formatDate))&&(h=l.getTime()+-6E4*l.getTimezoneOffset(),a.minDate=(new Date(f.now().getTime()-h)).dateFormat(a.formatDate));a.maxDate&&(l=/^\+(.*)$/.exec(a.maxDate))&&(l=Date.parseDate(l[1],a.formatDate))&&(h=l.getTime()+-6E4*l.getTimezoneOffset(),a.maxDate=(new Date(f.now().getTime()+h)).dateFormat(a.formatDate));m.find(".xdsoft_today_button").css("visibility",a.todayButton?"visible":"hidden");if(a.mask){var e=function(a,b){var c=a.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,"\\$1").replace(/_/g,"{digit+}").replace(/([0-9]{1})/g,"{digit$1}").replace(/\{digit([0-9]{1})\}/g,"[0-$1_]{1}").replace(/\{digit[\+]\}/g,"[0-9_]{1}");return RegExp(c).test(b)};d.off("keydown.xdsoft");switch(!0){case !0===a.mask:a.mask=a.format.replace(/Y/g,"9999").replace(/F/g,"9999").replace(/m/g,"19").replace(/d/g,"39").replace(/H/g,"29").replace(/i/g,"59").replace(/s/g,"59");case "string"==b.type(a.mask):e(a.mask,d.val())||d.val(a.mask.replace(/[0-9]/g,"_")),d.on("keydown.xdsoft",function(c){var l=this.value,h=c.which;switch(!0){case 48<=h&&57>=h||96<=h&&105>=h||8==h||46==h:var f;a:{try{if(document.selection&&document.selection.createRange){f=document.selection.createRange().getBookmark().charCodeAt(2)-2;break a}else if(this.setSelectionRange){f=this.selectionStart;break a}}catch(m){f=0;break a}f=void 0}var g=8!=h&&46!=h?String.fromCharCode(96<=h&&105>=h?h-48:h):"_";8!=h&&46!=h||!f||(f--,g="_");for(;/[^0-9_]/.test(a.mask.substr(f,1))&&f<a.mask.length&&0<f;)f+=8==h||46==h?-1:1;l=l.substr(0,f)+g+l.substr(f+1);if(""==b.trim(l))l=a.mask.replace(/[0-9]/g,"_");else if(f==a.mask.length)break;for(f+=8==h||46==h?0:1;/[^0-9_]/.test(a.mask.substr(f,1))&&f<a.mask.length&&0<f;)f+=8==h||46==h?-1:1;if(e(a.mask,l)){if(this.value=l,l=this,l="string"==typeof l||l instanceof String?document.getElementById(l):l)l.createTextRange?(l=l.createTextRange(),l.collapse(!0),l.moveEnd(f),l.moveStart(f),l.select()):l.setSelectionRange&&l.setSelectionRange(f,f)}else""==b.trim(l)?this.value=a.mask.replace(/[0-9]/g,"_"):d.trigger("error_input.xdsoft");break;case !!~[65,67,86,90,89].indexOf(h)&&k:case !!~[27,38,40,37,39,116,17,9,13].indexOf(h):return!0}c.preventDefault();return!1})}}if(a.validateOnBlur)d.off("blur.xdsoft").on("blur.xdsoft",function(){a.allowBlank&&!b.trim(b(this).val()).length?(b(this).val(null),c.data("xdsoft_datetime").empty()):(Date.parseDate(b(this).val(),a.format)||b(this).val(f.now().dateFormat(a.format)),c.data("xdsoft_datetime").setCurrentTime(b(this).val()));c.trigger("changedatetime.xdsoft")});a.dayOfWeekStartPrev=0==a.dayOfWeekStart?6:a.dayOfWeekStart-1;c.trigger("xchange.xdsoft")};c.data("options",a).on("mousedown.xdsoft",function(a){a.stopPropagation();a.preventDefault();D.hide();C.hide();return!1});var z=p.find(".xdsoft_time_box");z.append(q);z.xdsoftScroller();c.on("afterOpen.xdsoft",function(){z.xdsoftScroller()});c.append(g).append(p);!0!==a.withoutCopyright&&c.append(e);g.append(m).append(r);b("body").append(c);var f=new function(){var b=this;b.now=function(){var b=new Date;a.yearOffset&&b.setFullYear(b.getFullYear()+a.yearOffset);return b};b.currentTime=this.now();b.isValidDate=function(a){return"[object Date]"!==Object.prototype.toString.call(a)?!1:!isNaN(a.getTime())};b.setCurrentTime=function(a){b.currentTime="string"==typeof a?b.strtodatetime(a):b.isValidDate(a)?a:b.now();c.trigger("xchange.xdsoft")};b.empty=function(){b.currentTime=null};b.getCurrentTime=function(a){return b.currentTime};b.nextMonth=function(){var h=b.currentTime.getMonth()+1;12==h&&(b.currentTime.setFullYear(b.currentTime.getFullYear()+1),h=0);b.currentTime.setDate(Math.min(Date.daysInMonth[h],b.currentTime.getDate()));b.currentTime.setMonth(h);a.onChangeMonth&&a.onChangeMonth.call&&a.onChangeMonth.call(c,f.currentTime,c.data("input"));c.trigger("xchange.xdsoft");return h};b.prevMonth=function(){var h=b.currentTime.getMonth()-1;-1==h&&(b.currentTime.setFullYear(b.currentTime.getFullYear()-1),h=11);b.currentTime.setDate(Math.min(Date.daysInMonth[h],b.currentTime.getDate()));b.currentTime.setMonth(h);a.onChangeMonth&&a.onChangeMonth.call&&a.onChangeMonth.call(c,f.currentTime,c.data("input"));c.trigger("xchange.xdsoft");return h};b.strtodatetime=function(c){c=c?Date.parseDate(c,a.format):b.now();b.isValidDate(c)||(c=b.now());return c};b.strtodate=function(c){c=c?Date.parseDate(c,a.formatDate):b.now();b.isValidDate(c)||(c=b.now());return c};b.strtotime=function(c){c=c?Date.parseDate(c,a.formatTime):b.now();b.isValidDate(c)||(c=b.now());return c};b.str=function(){return b.currentTime.dateFormat(a.format)}};m.find(".xdsoft_today_button").on("mousedown.xdsoft",function(){c.data("changed",!0);f.setCurrentTime(0);c.trigger("afterOpen.xdsoft")}).on("dblclick.xdsoft",function(){d.val(f.str());c.trigger("close.xdsoft")});m.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var c=b(this),h=0,e=!1;(function A(b){f.currentTime.getMonth();c.hasClass(a.next)?f.nextMonth():c.hasClass(a.prev)&&f.prevMonth();!e&&(h=setTimeout(A,b?b:100))})(500);b([document.body,window]).on("mouseup.xdsoft",function y(){clearTimeout(h);e=!0;b([document.body,window]).off("mouseup.xdsoft",y)})});p.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var c=b(this),h=0,f=!1,e=110;(function y(b){var d=v[0].clientHeight,m=q[0].offsetHeight,g=Math.abs(parseInt(q.css("marginTop")));c.hasClass(a.next)&&m-d-a.timeHeightInTimePicker>=g?q.css("marginTop","-"+(g+a.timeHeightInTimePicker)+"px"):c.hasClass(a.prev)&&0<=g-a.timeHeightInTimePicker&&q.css("marginTop","-"+(g-a.timeHeightInTimePicker)+"px");v.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(q.css("marginTop"))/(m-d))]);e=10<e?10:e-10;!f&&(h=setTimeout(y,b?b:e))})(500);b([document.body,window]).on("mouseup.xdsoft",function J(){clearTimeout(h);f=!0;b([document.body,window]).off("mouseup.xdsoft",J)})});c.on("xchange.xdsoft",function(e){for(var h="",d=new Date(f.currentTime.getFullYear(),f.currentTime.getMonth(),1,12,0,0),g=0,k=f.now();d.getDay()!=a.dayOfWeekStart;)d.setDate(d.getDate()-1);for(var h=h+"\x3ctable\x3e\x3cthead\x3e\x3ctr\x3e",n=0;7>n;n++)h+="\x3cth\x3e"+a.i18n[a.lang].dayOfWeek[6<n+a.dayOfWeekStart?0:n+a.dayOfWeekStart]+"\x3c/th\x3e";var h=h+"\x3c/tr\x3e\x3c/thead\x3e\x3ctbody\x3e\x3ctr\x3e",p=n=!1;!1!==a.maxDate&&(n=f.strtodate(a.maxDate),n=new Date(n.getFullYear(),n.getMonth(),n.getDate(),23,59,59,999));!1!==a.minDate&&(p=f.strtodate(a.minDate),p=new Date(p.getFullYear(),p.getMonth(),p.getDate()));for(var w,v,t,u=[];g<f.currentTime.getDaysInMonth()||d.getDay()!=a.dayOfWeekStart||f.currentTime.getMonth()==d.getMonth();)u=[],g++,w=d.getDate(),v=d.getFullYear(),t=d.getMonth(),u.push("xdsoft_date"),(!1!==n&&d>n||!1!==p&&d<p)&&u.push("xdsoft_disabled"),f.currentTime.getMonth()!=t&&u.push("xdsoft_other_month"),(a.defaultSelect||c.data("changed"))&&f.currentTime.dateFormat("d.m.Y")==d.dateFormat("d.m.Y")&&u.push("xdsoft_current"),k.dateFormat("d.m.Y")==d.dateFormat("d.m.Y")&&u.push("xdsoft_today"),(0==d.getDay()||6==d.getDay()||~a.weekends.indexOf(d.dateFormat("d.m.Y")))&&u.push("xdsoft_weekend"),h+='\x3ctd data-date\x3d"'+w+'" data-month\x3d"'+t+'" data-year\x3d"'+v+'" class\x3d"xdsoft_date xdsoft_day_of_week'+d.getDay()+" "+u.join(" ")+'"\x3e\x3cdiv\x3e'+w+"\x3c/div\x3e\x3c/td\x3e",d.getDay()==a.dayOfWeekStartPrev&&(h+="\x3c/tr\x3e"),d.setDate(w+1);r.html(h+"\x3c/tbody\x3e\x3c/table\x3e");m.find(".xdsoft_label span").eq(0).text(a.i18n[a.lang].months[f.currentTime.getMonth()]);m.find(".xdsoft_label span").eq(1).text(f.currentTime.getFullYear());var x="";t=h="";d=function(b,d){var h=f.now();h.setHours(b);b=parseInt(h.getHours());h.setMinutes(d);d=parseInt(h.getMinutes());u=[];(!1!==a.maxTime&&f.strtotime(a.maxTime).getTime()<h.getTime()||!1!==a.minTime&&f.strtotime(a.minTime).getTime()>h.getTime())&&u.push("xdsoft_disabled");(a.defaultSelect||c.data("changed"))&&parseInt(f.currentTime.getHours())==parseInt(b)&&(59<a.step||Math[a.roundTime](f.currentTime.getMinutes()/a.step)*a.step==parseInt(d))&&u.push("xdsoft_current");parseInt(k.getHours())==parseInt(b)&&parseInt(k.getMinutes())==parseInt(d)&&u.push("xdsoft_today");x+='\x3cdiv class\x3d"xdsoft_time '+u.join(" ")+'" data-hour\x3d"'+b+'" data-minute\x3d"'+d+'"\x3e'+h.dateFormat(a.formatTime)+"\x3c/div\x3e"};if(a.allowTimes&&b.isArray(a.allowTimes)&&a.allowTimes.length)for(g=0;g<a.allowTimes.length;g++)h=f.strtotime(a.allowTimes[g]).getHours(),t=f.strtotime(a.allowTimes[g]).getMinutes(),d(h,t);else for(n=g=0;g<(a.hours12?12:24);g++)for(n=0;60>n;n+=a.step)h=(10>g?"0":"")+g,t=(10>n?"0":"")+n,d(h,t);q.html(x);t="";g=0;for(g=parseInt(a.yearStart,10)+a.yearOffset;g<=parseInt(a.yearEnd,10)+a.yearOffset;g++)t+='\x3cdiv class\x3d"xdsoft_option '+(f.currentTime.getFullYear()==g?"xdsoft_current":"")+'" data-value\x3d"'+g+'"\x3e'+g+"\x3c/div\x3e";D.children().eq(0).html(t);g=0;for(t="";11>=g;g++)t+='\x3cdiv class\x3d"xdsoft_option '+(f.currentTime.getMonth()==g?"xdsoft_current":"")+'" data-value\x3d"'+g+'"\x3e'+a.i18n[a.lang].months[g]+"\x3c/div\x3e";C.children().eq(0).html(t);b(this).trigger("generate.xdsoft");e.stopPropagation()}).on("afterOpen.xdsoft",function(){if(a.timepicker&&q.find(".xdsoft_current").length){var b=v[0].clientHeight,c=q[0].offsetHeight,d=q.find(".xdsoft_current").index()*a.timeHeightInTimePicker+1;c-b<d&&(d=c-b);q.css("marginTop","-"+parseInt(d)+"px");v.trigger("scroll_element.xdsoft_scroller",[parseInt(d)/(c-b)])}});var E=0;r.on("click.xdsoft","td",function(){E++;var e=b(this),h=f.currentTime;if(e.hasClass("xdsoft_disabled"))return!1;h.setFullYear(e.data("year"));h.setMonth(e.data("month"));h.setDate(e.data("date"));c.trigger("select.xdsoft",[h]);d.val(f.str());(1<E||!0===a.closeOnDateSelect||0===a.closeOnDateSelect&&!a.timepicker)&&!a.inline&&c.trigger("close.xdsoft");a.onSelectDate&&a.onSelectDate.call&&a.onSelectDate.call(c,f.currentTime,c.data("input"));c.data("changed",!0);c.trigger("xchange.xdsoft");c.trigger("changedatetime.xdsoft");setTimeout(function(){E=0},200)});q.on("click.xdsoft","div",function(){var d=b(this),h=f.currentTime;if(d.hasClass("xdsoft_disabled"))return!1;h.setHours(d.data("hour"));h.setMinutes(d.data("minute"));c.trigger("select.xdsoft",[h]);c.data("input").val(f.str());!a.inline&&c.trigger("close.xdsoft");a.onSelectTime&&a.onSelectTime.call&&a.onSelectTime.call(c,f.currentTime,c.data("input"));c.data("changed",!0);c.trigger("xchange.xdsoft");c.trigger("changedatetime.xdsoft")});c.mousewheel&&g.mousewheel(function(b,c,d,e){if(!a.scrollMonth)return!0;0>c?f.nextMonth():f.prevMonth();return!1});c.mousewheel&&v.unmousewheel().mousewheel(function(b,c,d,e){if(!a.scrollTime)return!0;d=v[0].clientHeight;e=q[0].offsetHeight;var f=Math.abs(parseInt(q.css("marginTop"))),g=!0;0>c&&e-d-a.timeHeightInTimePicker>=f?(q.css("marginTop","-"+(f+a.timeHeightInTimePicker)+"px"),g=!1):0<c&&0<=f-a.timeHeightInTimePicker&&(q.css("marginTop","-"+(f-a.timeHeightInTimePicker)+"px"),g=!1);v.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(q.css("marginTop"))/(e-d))]);b.stopPropagation();return g});c.on("changedatetime.xdsoft",function(){a.onChangeDateTime&&a.onChangeDateTime.call&&a.onChangeDateTime.call(c,f.currentTime,c.data("input"))}).on("generate.xdsoft",function(){a.onGenerate&&a.onGenerate.call&&a.onGenerate.call(c,f.currentTime,c.data("input"))});var x=0;d.mousewheel&&d.mousewheel(function(b,e,n,m){if(!a.scrollInput)return!0;if(!a.datepicker&&a.timepicker)return x=q.find(".xdsoft_current").length?q.find(".xdsoft_current").eq(0).index():0,0<=x+e&&x+e<q.children().length&&(x+=e),q.children().eq(x).length&&q.children().eq(x).trigger("mousedown"),!1;if(a.datepicker&&!a.timepicker)return g.trigger(b,[e,n,m]),d.val&&d.val(f.str()),c.trigger("changedatetime.xdsoft"),!1});var F=function(){var a=c.data("input").offset(),d=a.top+c.data("input")[0].offsetHeight-1,e=a.left;d+c[0].offsetHeight>b(window).height()+b(window).scrollTop()&&(d=a.top-c[0].offsetHeight+1);e+c[0].offsetWidth>b(window).width()&&(e=a.left-c[0].offsetWidth+c.data("input")[0].offsetWidth);c.css({left:e,top:d})};c.on("open.xdsoft",function(){var d=!0;a.onShow&&a.onShow.call&&(d=a.onShow.call(c,f.currentTime,c.data("input")));if(!1!==d&&(c.show(),c.trigger("afterOpen.xdsoft"),F(),b(window).off("resize.xdsoft",F).on("resize.xdsoft",F),a.closeOnWithoutClick))b([document.body,window]).on("mousedown.xdsoft",function I(){c.trigger("close.xdsoft");b([document.body,window]).off("mousedown.xdsoft",I)})}).on("close.xdsoft",function(b){var d=!0;a.onClose&&a.onClose.call&&(d=a.onClose.call(c,f.currentTime,c.data("input")));!1===d||a.opened||a.inline||c.hide();b.stopPropagation()}).data("input",d);var G=0;c.data("xdsoft_datetime",f);c.setOptions(a);(e=a.value?a.value:d&&d.val&&d.val()?d.val():"")&&f.isValidDate(e=Date.parseDate(e,a.format))?c.data("changed",!0):e="";f.setCurrentTime(e?e:0);c.trigger("afterOpen.xdsoft");d.data("xdsoft_datetimepicker",c).on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function(a){d.is(":disabled")||d.is(":hidden")||!d.is(":visible")||(clearTimeout(G),G=setTimeout(function(){d.is(":disabled")||d.is(":hidden")||!d.is(":visible")||(f.setCurrentTime(d&&d.val&&d.val()?d.val():0),c.trigger("open.xdsoft"))},100))}).on("keydown.xdsoft",function(a){a=a.which;switch(!0){case !!~[13].indexOf(a):return a=b("input:visible,textarea:visible"),c.trigger("close.xdsoft"),a.eq(a.index(this)+1).focus(),!1;case !!~[9].indexOf(a):return c.trigger("close.xdsoft"),!0}})};b(document).off("keydown.xdsoftctrl keyup.xdsoftctrl").on("keydown.xdsoftctrl",function(a){17==a.keyCode&&(k=!0)}).on("keyup.xdsoftctrl",function(a){17==a.keyCode&&(k=!1)});return this.each(function(){var d;if(d=b(this).data("xdsoft_datetimepicker")){if("string"===b.type(g))switch(g){case "show":b(this).select().focus();d.trigger("open.xdsoft");break;case "hide":d.trigger("close.xdsoft");break;case "destroy":d=b(this);var c=d.data("xdsoft_datetimepicker");c&&(c.data("xdsoft_datetime",null),c.remove(),d.data("xdsoft_datetimepicker",null).off("open.xdsoft focusin.xdsoft focusout.xdsoft mousedown.xdsoft blur.xdsoft keydown.xdsoft"),b(window).off("resize.xdsoft"),b([window,document.body]).off("mousedown.xdsoft"),d.unmousewheel&&d.unmousewheel());break;case "reset":(this.value=this.defaultValue)&&d.data("xdsoft_datetime").isValidDate(Date.parseDate(this.value,a.format))||d.data("changed",!1),d.data("xdsoft_datetime").setCurrentTime(this.value)}else d.setOptions(g);return 0}"string"!==b.type(g)&&r(b(this))})}})(jQuery);Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){null==Date.formatFunctions[b]&&Date.createNewFormat(b);return this[Date.formatFunctions[b]]()};Date.createNewFormat=function(b){var e="format"+Date.formatFunctions.count++;Date.formatFunctions[b]=e;for(var e="Date.prototype."+e+" \x3d function() {return ",g=!1,k,a=0;a<b.length;++a)k=b.charAt(a),g||"\\"!=k?g?(g=!1,e+="'"+String.escape(k)+"' + "):e+=Date.getFormatCode(k):g=!0;eval(e.substring(0,e.length-3)+";}")};Date.getFormatCode=function(b){switch(b){case "d":return"String.leftPad(this.getDate(), 2, '0') + ";case "D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case "j":return"this.getDate() + ";case "l":return"Date.dayNames[this.getDay()] + ";case "S":return"this.getSuffix() + ";case "w":return"this.getDay() + ";case "z":return"this.getDayOfYear() + ";case "W":return"this.getWeekOfYear() + ";case "F":return"Date.monthNames[this.getMonth()] + ";case "m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case "M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case "n":return"(this.getMonth() + 1) + ";case "t":return"this.getDaysInMonth() + ";case "L":return"(this.isLeapYear() ? 1 : 0) + ";case "Y":return"this.getFullYear() + ";case "y":return"('' + this.getFullYear()).substring(2, 4) + ";case "a":return"(this.getHours() \x3c 12 ? 'am' : 'pm') + ";case "A":return"(this.getHours() \x3c 12 ? 'AM' : 'PM') + ";case "g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case "G":return"this.getHours() + ";case "h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case "H":return"String.leftPad(this.getHours(), 2, '0') + ";case "i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case "s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case "O":return"this.getGMTOffset() + ";case "T":return"this.getTimezone() + ";case "Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(b)+"' + "}};Date.parseDate=function(b,e){null==Date.parseFunctions[e]&&Date.createParser(e);return Date[Date.parseFunctions[e]](b)};Date.createParser=function(b){var e="parse"+Date.parseFunctions.count++,g=Date.parseRegexes.length,k=1;Date.parseFunctions[b]=e;for(var e="Date."+e+" \x3d function(input) {\nvar y \x3d -1, m \x3d -1, d \x3d -1, h \x3d -1, i \x3d -1, s \x3d -1;\nvar d \x3d new Date();\ny \x3d d.getFullYear();\nm \x3d d.getMonth();\nd \x3d d.getDate();\nvar results \x3d input.match(Date.parseRegexes["+g+"]);\nif (results \x26\x26 results.length \x3e 0) {",a="",r=!1,d,c=0;c<b.length;++c)d=b.charAt(c),r||"\\"!=d?r?(r=!1,a+=String.escape(d)):(obj=Date.formatCodeToRegex(d,k),k+=obj.g,a+=obj.s,obj.g&&obj.c&&(e+=obj.c)):r=!0;Date.parseRegexes[g]=new RegExp("^"+a+"$");eval(e+"if (y \x3e 0 \x26\x26 m \x3e\x3d 0 \x26\x26 d \x3e 0 \x26\x26 h \x3e\x3d 0 \x26\x26 i \x3e\x3d 0 \x26\x26 s \x3e\x3d 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y \x3e 0 \x26\x26 m \x3e\x3d 0 \x26\x26 d \x3e 0 \x26\x26 h \x3e\x3d 0 \x26\x26 i \x3e\x3d 0)\n{return new Date(y, m, d, h, i);}\nelse if (y \x3e 0 \x26\x26 m \x3e\x3d 0 \x26\x26 d \x3e 0 \x26\x26 h \x3e\x3d 0)\n{return new Date(y, m, d, h);}\nelse if (y \x3e 0 \x26\x26 m \x3e\x3d 0 \x26\x26 d \x3e 0)\n{return new Date(y, m, d);}\nelse if (y \x3e 0 \x26\x26 m \x3e\x3d 0)\n{return new Date(y, m);}\nelse if (y \x3e 0)\n{return new Date(y);}\n}return null;}")};Date.formatCodeToRegex=function(b,e){switch(b){case "D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case "j":case "d":return{g:1,c:"d \x3d parseInt(results["+e+"], 10);\n",s:"(\\d{1,2})"};case "l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case "S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case "w":return{g:0,c:null,s:"\\d"};case "z":return{g:0,c:null,s:"(?:\\d{1,3})"};case "W":return{g:0,c:null,s:"(?:\\d{2})"};case "F":return{g:1,c:"m \x3d parseInt(Date.monthNumbers[results["+e+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case "M":return{g:1,c:"m \x3d parseInt(Date.monthNumbers[results["+e+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case "n":case "m":return{g:1,c:"m \x3d parseInt(results["+e+"], 10) - 1;\n",s:"(\\d{1,2})"};case "t":return{g:0,c:null,s:"\\d{1,2}"};case "L":return{g:0,c:null,s:"(?:1|0)"};case "Y":return{g:1,c:"y \x3d parseInt(results["+e+"], 10);\n",s:"(\\d{4})"};case "y":return{g:1,c:"var ty \x3d parseInt(results["+e+"], 10);\ny \x3d ty \x3e Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case "a":return{g:1,c:"if (results["+e+"] \x3d\x3d 'am') {\nif (h \x3d\x3d 12) { h \x3d 0; }\n} else { if (h \x3c 12) { h +\x3d 12; }}",s:"(am|pm)"};case "A":return{g:1,c:"if (results["+e+"] \x3d\x3d 'AM') {\nif (h \x3d\x3d 12) { h \x3d 0; }\n} else { if (h \x3c 12) { h +\x3d 12; }}",s:"(AM|PM)"};case "g":case "G":case "h":case "H":return{g:1,c:"h \x3d parseInt(results["+e+"], 10);\n",s:"(\\d{1,2})"};case "i":return{g:1,c:"i \x3d parseInt(results["+e+"], 10);\n",s:"(\\d{2})"};case "s":return{g:1,c:"s \x3d parseInt(results["+e+"], 10);\n",s:"(\\d{2})"};case "O":return{g:0,c:null,s:"[+-]\\d{4}"};case "T":return{g:0,c:null,s:"[A-Z]{3}"};case "Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)}}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3")};Date.prototype.getGMTOffset=function(){return(0<this.getTimezoneOffset()?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0")};Date.prototype.getDayOfYear=function(){var b=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var e=0;e<this.getMonth();++e)b+=Date.daysInMonth[e];return b+this.getDate()-1};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay()),e=7-(new Date(this.getFullYear(),0,1)).getDay()+4;document.write(e);return String.leftPad((b-e)/7+1,2,"0")};Date.prototype.isLeapYear=function(){var b=this.getFullYear();return 0==(b&3)&&(b%100||0==b%400&&b)};Date.prototype.getFirstDayOfMonth=function(){var b=(this.getDay()-(this.getDate()-1))%7;return 0>b?b+7:b};Date.prototype.getLastDayOfMonth=function(){var b=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return 0>b?b+7:b};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()]};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};String.escape=function(b){return b.replace(/('|\\)/g,"\\$1")};String.leftPad=function(b,e,g){b=new String(b);for(null==g&&(g=" ");b.length<e;)b=g+b;return b};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames="January February March April May June July August September October November December".split(" ");Date.dayNames="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ");Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"};(function(b){"function"===typeof define&&define.amd?define(["jquery"],b):"object"===typeof exports?module.exports=b:b(jQuery)})(function(b){function e(c){var d=c||window.event,e=[].slice.call(arguments,1),g=0,k=0,p=0;c=b.event.fix(d);c.type="mousewheel";d.wheelDelta&&(g=d.wheelDelta);d.detail&&(g=-1*d.detail);d.deltaY&&(g=p=-1*d.deltaY);d.deltaX&&(k=d.deltaX,g=-1*k);void 0!==d.wheelDeltaY&&(p=d.wheelDeltaY);void 0!==d.wheelDeltaX&&(k=-1*d.wheelDeltaX);d=Math.abs(g);if(!a||d<a)a=d;d=Math.max(Math.abs(p),Math.abs(k));if(!r||d<r)r=d;d=0<g?"floor":"ceil";g=Math[d](g/a);k=Math[d](k/r);p=Math[d](p/r);e.unshift(c,g,k,p);return(b.event.dispatch||b.event.handle).apply(this,e)}var g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],k="onwheel"in document||9<=document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],a,r;if(b.event.fixHooks)for(var d=g.length;d;)b.event.fixHooks[g[--d]]=b.event.mouseHooks;b.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=k.length;a;)this.addEventListener(k[--a],e,!1);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=k.length;a;)this.removeEventListener(k[--a],e,!1);else this.onmousewheel=null}};b.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});