31 lines
43 KiB
JavaScript
31 lines
43 KiB
JavaScript
/*!
|
|
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2016
|
|
* @version 1.3.4
|
|
*
|
|
* Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
|
|
* @see http://php.net/manual/en/function.date.php
|
|
*
|
|
* For more JQuery plugins visit http://plugins.krajee.com
|
|
* For more Yii related demos visit http://demos.krajee.com
|
|
*/
|
|
var DateFormatter;!function(){"use strict";var t,e,n,r,a;t=function(t,e){return"string"==typeof t&&"string"==typeof e&&t.toLowerCase()===e.toLowerCase()},e=function(t,n,r){var a=r||"0",u=t.toString();return u.length<n?e(a+u,n):u},n=function(t){var e,r;for(t=t||{},e=1;e<arguments.length;e++)if(r=arguments[e])for(var a in r)r.hasOwnProperty(a)&&("object"==typeof r[a]?n(t[a],r[a]):t[a]=r[a]);return t},r=function(t,e){for(var n=0;n<e.length;n++)if(e[n].toLowerCase()===t.toLowerCase())return n;return-1},a={dateSettings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["AM","PM"],ordinal:function(t){var e=t%10,n={1:"st",2:"nd",3:"rd"};return 1!==Math.floor(t%100/10)&&n[e]?n[e]:"th"}},separators:/[ \-+\/\.T:@]/g,validParts:/[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,intParts:/[djwNzmnyYhHgGis]/g,tzParts:/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,tzClip:/[^-+\dA-Z]/g},(DateFormatter=function(t){var e=this,r=n(a,t);e.dateSettings=r.dateSettings,e.separators=r.separators,e.validParts=r.validParts,e.intParts=r.intParts,e.tzParts=r.tzParts,e.tzClip=r.tzClip}).prototype={constructor:DateFormatter,getMonth:function(t){var e;return 0===(e=r(t,this.dateSettings.monthsShort)+1)&&(e=r(t,this.dateSettings.months)+1),e},parseDate:function(e,n){var r,a,u,i,s,o,c,f,l,h,d=this,g=!1,m=!1,p=d.dateSettings,y={date:null,year:null,month:null,day:null,hour:0,min:0,sec:0};if(!e)return null;if(e instanceof Date)return e;if("U"===n)return(u=parseInt(e))?new Date(1e3*u):e;switch(typeof e){case"number":return new Date(e);case"string":break;default:return null}if(!(r=n.match(d.validParts))||0===r.length)throw new Error("Invalid date format definition.");for(a=e.replace(d.separators,"\0").split("\0"),u=0;u<a.length;u++)switch(i=a[u],s=parseInt(i),r[u]){case"y":case"Y":if(!s)return null;l=i.length,y.year=2===l?parseInt((70>s?"20":"19")+i):s,g=!0;break;case"m":case"n":case"M":case"F":if(isNaN(s)){if(!((o=d.getMonth(i))>0))return null;y.month=o}else{if(!(s>=1&&12>=s))return null;y.month=s}g=!0;break;case"d":case"j":if(!(s>=1&&31>=s))return null;y.day=s,g=!0;break;case"g":case"h":if(h=a[c=r.indexOf("a")>-1?r.indexOf("a"):r.indexOf("A")>-1?r.indexOf("A"):-1],c>-1)f=t(h,p.meridiem[0])?0:t(h,p.meridiem[1])?12:-1,s>=1&&12>=s&&f>-1?y.hour=s+f-1:s>=0&&23>=s&&(y.hour=s);else{if(!(s>=0&&23>=s))return null;y.hour=s}m=!0;break;case"G":case"H":if(!(s>=0&&23>=s))return null;y.hour=s,m=!0;break;case"i":if(!(s>=0&&59>=s))return null;y.min=s,m=!0;break;case"s":if(!(s>=0&&59>=s))return null;y.sec=s,m=!0}if(!0===g&&y.year&&y.month&&y.day)y.date=new Date(y.year,y.month-1,y.day,y.hour,y.min,y.sec,0);else{if(!0!==m)return null;y.date=new Date(0,0,0,y.hour,y.min,y.sec,0)}return y.date},guessDate:function(t,e){if("string"!=typeof t)return t;var n,r,a,u,i,s,o=t.replace(this.separators,"\0").split("\0"),c=e.match(this.validParts),f=new Date,l=0;if(!/^[djmn]/g.test(c[0]))return t;for(a=0;a<o.length;a++){if(l=2,i=o[a],s=parseInt(i.substr(0,2)),isNaN(s))return null;switch(a){case 0:"m"===c[0]||"n"===c[0]?f.setMonth(s-1):f.setDate(s);break;case 1:"m"===c[0]||"n"===c[0]?f.setDate(s):f.setMonth(s-1);break;case 2:if(r=f.getFullYear(),l=4>(n=i.length)?n:4,!(r=parseInt(4>n?r.toString().substr(0,4-n)+i:i.substr(0,4))))return null;f.setFullYear(r);break;case 3:f.setHours(s);break;case 4:f.setMinutes(s);break;case 5:f.setSeconds(s)}(u=i.substr(l)).length>0&&o.splice(a+1,0,u)}return f},parseFormat:function(t,n){var r,a=this,u=a.dateSettings,i=/\\?(.?)/gi,s=function(t,e){return r[t]?r[t]():e};return r={d:function(){return e(r.j(),2)},D:function(){return u.daysShort[r.w()]},j:function(){return n.getDate()},l:function(){return u.days[r.w()]},N:function(){return r.w()||7},w:function(){return n.getDay()},z:function(){var t=new Date(r.Y(),r.n()-1,r.j()),e=new Date(r.Y(),0,1);return Math.round((t-e)/864e5)},W:function(){var t=new Date(r.Y(),r.n()-1,r.j()-r.N()+3),n=new Date(t.getFullYear(),0,4);return e(1+Math.round((t-n)/864e5/7),2)},F:function(){return u.months[n.getMonth()]},m:function(){return e(r.n(),2)},M:function(){return u.monthsShort[n.getMonth()]},n:function(){return n.getMonth()+1},t:function(){return new Date(r.Y(),r.n(),0).getDate()},L:function(){var t=r.Y();return t%4==0&&t%100!=0||t%400==0?1:0},o:function(){var t=r.n(),e=r.W();return r.Y()+(12===t&&9>e?1:1===t&&e>9?-1:0)},Y:function(){return n.getFullYear()},y:function(){return r.Y().toString().slice(-2)},a:function(){return r.A().toLowerCase()},A:function(){var t=r.G()<12?0:1;return u.meridiem[t]},B:function(){var t=3600*n.getUTCHours(),r=60*n.getUTCMinutes(),a=n.getUTCSeconds();return e(Math.floor((t+r+a+3600)/86.4)%1e3,3)},g:function(){return r.G()%12||12},G:function(){return n.getHours()},h:function(){return e(r.g(),2)},H:function(){return e(r.G(),2)},i:function(){return e(n.getMinutes(),2)},s:function(){return e(n.getSeconds(),2)},u:function(){return e(1e3*n.getMilliseconds(),6)},e:function(){return/\((.*)\)/.exec(String(n))[1]||"Coordinated Universal Time"},I:function(){return new Date(r.Y(),0)-Date.UTC(r.Y(),0)!=new Date(r.Y(),6)-Date.UTC(r.Y(),6)?1:0},O:function(){var t=n.getTimezoneOffset(),r=Math.abs(t);return(t>0?"-":"+")+e(100*Math.floor(r/60)+r%60,4)},P:function(){var t=r.O();return t.substr(0,3)+":"+t.substr(3,2)},T:function(){return(String(n).match(a.tzParts)||[""]).pop().replace(a.tzClip,"")||"UTC"},Z:function(){return 60*-n.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(i,s)},r:function(){return"D, d M Y H:i:s O".replace(i,s)},U:function(){return n.getTime()/1e3||0}},s(t,t)},formatDate:function(t,e){var n,r,a,u,i,s=this,o="";if("string"==typeof t&&!(t=s.parseDate(t,e)))return null;if(t instanceof Date){for(a=e.length,n=0;a>n;n++)"S"!==(i=e.charAt(n))&&"\\"!==i&&(n>0&&"\\"===e.charAt(n-1)?o+=i:(u=s.parseFormat(i,t),n!==a-1&&s.intParts.test(i)&&"S"===e.charAt(n+1)&&(r=parseInt(u)||0,u+=s.dateSettings.ordinal(r)),o+=u));return o}return""}}}();
|
|
|
|
/**
|
|
* @preserve jQuery DateTimePicker
|
|
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
|
* @author Chupurnov Valeriy (<chupurnov@gmail.com>)
|
|
*/
|
|
|
|
/**
|
|
* @param {jQuery} $
|
|
*/
|
|
var datetimepickerFactory=function(e){"use strict";var t={i18n:{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"]},fr:{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],dayOfWeekShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],dayOfWeek:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]}},ownerDocument:document,contentWindow:window,value:"",rtl:!1,format:"Y/m/d H:i",formatTime:"H:i",formatDate:"Y/m/d",startDate:!1,step:60,monthChangeSpinner:!0,closeOnDateSelect:!1,closeOnTimeSelect:!0,closeOnWithoutClick:!0,closeOnInputClick:!0,openOnFocus:!0,timepicker:!0,datepicker:!0,weeks:!1,defaultTime:!1,defaultDate:!1,minDate:!1,maxDate:!1,minTime:!1,maxTime:!1,minDateTime:!1,maxDateTime:!1,allowTimes:[],opened:!1,initTime:!0,inline:!1,theme:"",touchMovedThreshold:5,onSelectDate:function(){},onSelectTime:function(){},onChangeMonth:function(){},onGetWeekOfYear:function(){},onChangeYear:function(){},onChangeDateTime:function(){},onShow:function(){},onClose:function(){},onGenerate:function(){},withoutCopyright:!0,inverseButton:!1,hours12:!1,next:"xdsoft_next",prev:"xdsoft_prev",dayOfWeekStart:0,parentID:"body",timeHeightInTimePicker:25,timepickerScrollbar:!0,todayButton:!0,prevButton:!0,nextButton:!0,defaultSelect:!0,scrollMonth:!0,scrollTime:!0,scrollInput:!0,lazyInit:!1,mask:!1,validateOnBlur:!0,allowBlank:!0,yearStart:1950,yearEnd:2050,monthStart:0,monthEnd:11,style:"",id:"",fixed:!1,roundTime:"round",className:"",weekends:[],highlightedDates:[],highlightedPeriods:[],allowDates:[],allowDateRe:null,disabledDates:[],disabledWeekDays:[],yearOffset:0,beforeShowDay:null,enterLikeTab:!0,showApplyButton:!1,insideParent:!1},o=null,n=null,a="en",i={meridiem:["AM","PM"]},r=function(){var r=t.i18n[a],s={days:r.dayOfWeek,daysShort:r.dayOfWeekShort,months:r.months,monthsShort:e.map(r.months,function(e){return e.substring(0,3)})};"function"==typeof DateFormatter&&(o=n=new DateFormatter({dateSettings:e.extend({},i,s)}))},s={moment:{default_options:{format:"YYYY/MM/DD HH:mm",formatDate:"YYYY/MM/DD",formatTime:"HH:mm"},formatter:{parseDate:function(e,t){if(l(t))return n.parseDate(e,t);var o=moment(e,t);return!!o.isValid()&&o.toDate()},formatDate:function(e,t){return l(t)?n.formatDate(e,t):moment(e).format(t)},formatMask:function(e){return e.replace(/Y{4}/g,"9999").replace(/Y{2}/g,"99").replace(/M{2}/g,"19").replace(/D{2}/g,"39").replace(/H{2}/g,"29").replace(/m{2}/g,"59").replace(/s{2}/g,"59")}}}};e.datetimepicker={setLocale:function(e){var o=t.i18n[e]?e:"en";a!==o&&(a=o,r())},setDateFormatter:function(n){if("string"==typeof n&&s.hasOwnProperty(n)){var a=s[n];e.extend(t,a.default_options),o=a.formatter}else o=n}};var d={RFC_2822:"D, d M Y H:i:s O",ATOM:"Y-m-dTH:i:sP",ISO_8601:"Y-m-dTH:i:sO",RFC_822:"D, d M y H:i:s O",RFC_850:"l, d-M-y H:i:s T",RFC_1036:"D, d M y H:i:s O",RFC_1123:"D, d M Y H:i:s O",RSS:"D, d M Y H:i:s O",W3C:"Y-m-dTH:i:sP"},l=function(e){return-1!==Object.values(d).indexOf(e)};function u(e,t,o){this.date=e,this.desc=t,this.style=o}e.extend(e.datetimepicker,d),r(),window.getComputedStyle||(window.getComputedStyle=function(e){return this.el=e,this.getPropertyValue=function(t){var o=/(-([a-z]))/g;return"float"===t&&(t="styleFloat"),o.test(t)&&(t=t.replace(o,function(e,t,o){return o.toUpperCase()})),e.currentStyle[t]||null},this}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var o,n;for(o=t||0,n=this.length;o<n;o+=1)if(this[o]===e)return o;return-1}),Date.prototype.countDaysInMonth=function(){return new Date(this.getFullYear(),this.getMonth()+1,0).getDate()},e.fn.xdsoftScroller=function(t,o){return this.each(function(){var n,a,i,r,s,d=e(this),l=function(e){var t,o={x:0,y:0};return"touchstart"===e.type||"touchmove"===e.type||"touchend"===e.type||"touchcancel"===e.type?(t=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],o.x=t.clientX,o.y=t.clientY):"mousedown"!==e.type&&"mouseup"!==e.type&&"mousemove"!==e.type&&"mouseover"!==e.type&&"mouseout"!==e.type&&"mouseenter"!==e.type&&"mouseleave"!==e.type||(o.x=e.clientX,o.y=e.clientY),o},u=0,c=100,f=!1,m=0,h=0,g=0,p=!1,x=0,D=function(){};"hide"!==o?(e(this).hasClass("xdsoft_scroller_box")||(n=d.children().eq(0),u=Math.abs(parseInt(n.css("marginTop"),10)),a=d[0].clientHeight,i=n[0].offsetHeight,r=e('<div class="xdsoft_scrollbar"></div>'),s=e('<div class="xdsoft_scroller"></div>'),r.append(s),d.addClass("xdsoft_scroller_box").append(r),D=function(e){var t=l(e).y-m+x;t<0&&(t=0),t+s[0].offsetHeight>g&&(t=g-s[0].offsetHeight),d.trigger("scroll_element.xdsoft_scroller",[c?t/c:0])},s.on("touchstart.xdsoft_scroller mousedown.xdsoft_scroller",function(n){a||d.trigger("resize_scroll.xdsoft_scroller",[o]),m=l(n).y,x=parseInt(s.css("marginTop"),10),g=r[0].offsetHeight,"mousedown"===n.type||"touchstart"===n.type?(t.ownerDocument&&e(t.ownerDocument.body).addClass("xdsoft_noselect"),e([t.ownerDocument.body,t.contentWindow]).on("touchend mouseup.xdsoft_scroller",function o(){e([t.ownerDocument.body,t.contentWindow]).off("touchend mouseup.xdsoft_scroller",o).off("mousemove.xdsoft_scroller",D).removeClass("xdsoft_noselect")}),e(t.ownerDocument.body).on("mousemove.xdsoft_scroller",D)):(p=!0,n.stopPropagation(),n.preventDefault())}).on("touchmove",function(e){p&&(e.preventDefault(),D(e))}).on("touchend touchcancel",function(){p=!1,x=0}),d.on("scroll_element.xdsoft_scroller",function(e,t){a||d.trigger("resize_scroll.xdsoft_scroller",[t,!0]),t=t>1?1:t<0||isNaN(t)?0:t,u=parseFloat(Math.abs((n[0].offsetHeight-a)*t).toFixed(4)),s.css("marginTop",c*t),n.css("marginTop",-u)}).on("resize_scroll.xdsoft_scroller",function(e,t,o){var l,f;a=d[0].clientHeight,i=n[0].offsetHeight,f=(l=a/i)*r[0].offsetHeight,l>1?s.hide():(s.show(),s.css("height",parseInt(f>10?f:10,10)),c=r[0].offsetHeight-s[0].offsetHeight,!0!==o&&d.trigger("scroll_element.xdsoft_scroller",[t||u/(i-a)]))}),d.on("mousewheel",function(e){var t=function(e){var t=0;return"detail"in e&&(t=e.detail),"wheelDelta"in e&&(t=-e.wheelDelta/120),"wheelDeltaY"in e&&(t=-e.wheelDeltaY/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=0),t*=10,"deltaY"in e&&(t=e.deltaY),t&&e.deltaMode&&(1===e.deltaMode?t*=40:t*=800),t}(e.originalEvent),o=Math.max(0,u-t);return d.trigger("scroll_element.xdsoft_scroller",[o/(i-a)]),e.stopPropagation(),!1}),d.on("touchstart",function(e){f=l(e),h=u}),d.on("touchmove",function(e){if(f){e.preventDefault();var t=l(e);d.trigger("scroll_element.xdsoft_scroller",[(h-(t.y-f.y))/(i-a)])}}),d.on("touchend touchcancel",function(){f=!1,h=0})),d.trigger("resize_scroll.xdsoft_scroller",[o])):d.find(".xdsoft_scrollbar").hide()})},e.fn.datetimepicker=function(n,i){var r,s,d=this,l=48,c=57,f=96,m=105,h=17,g=46,p=13,x=27,D=8,v=37,T=38,y=39,w=40,_=9,b=116,k=65,M=67,S=86,O=90,C=89,Y=!1,F=e.isPlainObject(n)||!n?e.extend(!0,{},t,n):e.extend(!0,{},t),H=0;return r=function(t){var i,r,s,d,H,W,I=e('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),P=e('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),A=e('<div class="xdsoft_datepicker active"></div>'),R=e('<div class="xdsoft_monthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button><div class="xdsoft_label xdsoft_month"><span></span><i></i></div><div class="xdsoft_label xdsoft_year"><span></span><i></i></div><button type="button" class="xdsoft_next"></button></div>'),j=e('<div class="xdsoft_calendar"></div>'),q=e('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),E=q.find(".xdsoft_time_box").eq(0),V=e('<div class="xdsoft_time_variant"></div>'),B=e('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),N=e('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),z=e('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),G=!1,L=0;F.id&&I.attr("id",F.id),F.style&&I.attr("style",F.style),F.weeks&&I.addClass("xdsoft_showweeks"),F.rtl&&I.addClass("xdsoft_rtl"),I.addClass("xdsoft_"+F.theme),I.addClass(F.className),R.find(".xdsoft_month span").after(N),R.find(".xdsoft_year span").after(z),R.find(".xdsoft_month,.xdsoft_year").on("touchstart mousedown.xdsoft",function(t){var o,n,a=e(this).find(".xdsoft_select").eq(0),i=0,r=0,s=a.is(":visible");for(R.find(".xdsoft_select").hide(),H.currentTime&&(i=H.currentTime[e(this).hasClass("xdsoft_month")?"getMonth":"getFullYear"]()),a[s?"hide":"show"](),o=a.find("div.xdsoft_option"),n=0;n<o.length&&o.eq(n).data("value")!==i;n+=1)r+=o[0].offsetHeight;return a.xdsoftScroller(F,r/(a.children()[0].offsetHeight-a[0].clientHeight)),t.stopPropagation(),!1});var $=function(e){var t=e.originalEvent,o=t.touches?t.touches[0]:t;this.touchStartPosition=this.touchStartPosition||o;var n=Math.abs(this.touchStartPosition.clientX-o.clientX),a=Math.abs(this.touchStartPosition.clientY-o.clientY);Math.sqrt(n*n+a*a)>F.touchMovedThreshold&&(this.touchMoved=!0)};function J(){var e,o=!1;return F.startDate?o=H.strToDate(F.startDate):(o=F.value||(t&&t.val&&t.val()?t.val():""))?(o=H.strToDateTime(o),F.yearOffset&&(o=new Date(o.getFullYear()-F.yearOffset,o.getMonth(),o.getDate(),o.getHours(),o.getMinutes(),o.getSeconds(),o.getMilliseconds()))):F.defaultDate&&(o=H.strToDateTime(F.defaultDate),F.defaultTime&&(e=H.strtotime(F.defaultTime),o.setHours(e.getHours()),o.setMinutes(e.getMinutes()))),o&&H.isValidDate(o)?I.data("changed",!0):o="",o||0}function X(n){var a=function(e,t){var o=e.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 new RegExp(o).test(t)},i=function(e,t){if(!(e="string"==typeof e||e instanceof String?n.ownerDocument.getElementById(e):e))return!1;if(e.createTextRange){var o=e.createTextRange();return o.collapse(!0),o.moveEnd("character",t),o.moveStart("character",t),o.select(),!0}return!!e.setSelectionRange&&(e.setSelectionRange(t,t),!0)};n.mask&&t.off("keydown.xdsoft"),!0===n.mask&&(o.formatMask?n.mask=o.formatMask(n.format):n.mask=n.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")),"string"===e.type(n.mask)&&(a(n.mask,t.val())||(t.val(n.mask.replace(/[0-9]/g,"_")),i(t[0],0)),t.on("paste.xdsoft",function(o){var r=(o.clipboardData||o.originalEvent.clipboardData||window.clipboardData).getData("text"),s=this.value,d=this.selectionStart,l=s.substr(0,d),u=s.substr(d+r.length);return s=l+r+u,d+=r.length,a(n.mask,s)?(this.value=s,i(this,d)):""===e.trim(s)?this.value=n.mask.replace(/[0-9]/g,"_"):t.trigger("error_input.xdsoft"),o.preventDefault(),!1}),t.on("keydown.xdsoft",function(o){var r,s=this.value,d=o.which,u=this.selectionStart,F=this.selectionEnd,H=u!==F;if(d>=l&&d<=c||d>=f&&d<=m||d===D||d===g){for(r=d===D||d===g?"_":String.fromCharCode(f<=d&&d<=m?d-l:d),d===D&&u&&!H&&(u-=1);;){var W=n.mask.substr(u,1),I=u<n.mask.length,P=u>0;if(!(/[^0-9_]/.test(W)&&I&&P))break;u+=d!==D||H?1:-1}if(o.metaKey&&(u=0,H=!0),H){var A=F-u,R=n.mask.replace(/[0-9]/g,"_"),j=R.substr(u,A).substr(1),q=s.substr(0,u),E=r+j,V=s.substr(u+A);s=q+E+V}else{var B=s.substr(0,u),N=r,z=s.substr(u+1);s=B+N+z}if(""===e.trim(s))s=R;else if(u===n.mask.length)return o.preventDefault(),!1;for(u+=d===D?0:1;/[^0-9_]/.test(n.mask.substr(u,1))&&u<n.mask.length&&u>0;)u+=d===D?0:1;a(n.mask,s)?(this.value=s,i(this,u)):""===e.trim(s)?this.value=n.mask.replace(/[0-9]/g,"_"):t.trigger("error_input.xdsoft")}else if(-1!==[k,M,S,O,C].indexOf(d)&&Y||-1!==[x,T,w,v,y,b,h,_,p].indexOf(d))return!0;return o.preventDefault(),!1}))}R.find(".xdsoft_select").xdsoftScroller(F).on("touchstart mousedown.xdsoft",function(e){var t=e.originalEvent;this.touchMoved=!1,this.touchStartPosition=t.touches?t.touches[0]:t,e.stopPropagation(),e.preventDefault()}).on("touchmove",".xdsoft_option",$).on("touchend mousedown.xdsoft",".xdsoft_option",function(){if(!this.touchMoved){void 0!==H.currentTime&&null!==H.currentTime||(H.currentTime=H.now());var t=H.currentTime.getFullYear();H&&H.currentTime&&H.currentTime[e(this).parent().parent().hasClass("xdsoft_monthselect")?"setMonth":"setFullYear"](e(this).data("value")),e(this).parent().parent().hide(),I.trigger("xchange.xdsoft"),F.onChangeMonth&&e.isFunction(F.onChangeMonth)&&F.onChangeMonth.call(I,H.currentTime,I.data("input")),t!==H.currentTime.getFullYear()&&e.isFunction(F.onChangeYear)&&F.onChangeYear.call(I,H.currentTime,I.data("input"))}}),I.getValue=function(){return H.getCurrentTime()},I.setOptions=function(n){var a={};F=e.extend(!0,{},F,n),n.allowTimes&&e.isArray(n.allowTimes)&&n.allowTimes.length&&(F.allowTimes=e.extend(!0,[],n.allowTimes)),n.weekends&&e.isArray(n.weekends)&&n.weekends.length&&(F.weekends=e.extend(!0,[],n.weekends)),n.allowDates&&e.isArray(n.allowDates)&&n.allowDates.length&&(F.allowDates=e.extend(!0,[],n.allowDates)),n.allowDateRe&&"[object String]"===Object.prototype.toString.call(n.allowDateRe)&&(F.allowDateRe=new RegExp(n.allowDateRe)),n.highlightedDates&&e.isArray(n.highlightedDates)&&n.highlightedDates.length&&(e.each(n.highlightedDates,function(t,n){var i,r=e.map(n.split(","),e.trim),s=new u(o.parseDate(r[0],F.formatDate),r[1],r[2]),d=o.formatDate(s.date,F.formatDate);void 0!==a[d]?(i=a[d].desc)&&i.length&&s.desc&&s.desc.length&&(a[d].desc=i+"\n"+s.desc):a[d]=s}),F.highlightedDates=e.extend(!0,[],a)),n.highlightedPeriods&&e.isArray(n.highlightedPeriods)&&n.highlightedPeriods.length&&(a=e.extend(!0,[],F.highlightedDates),e.each(n.highlightedPeriods,function(t,n){var i,r,s,d,l,c,f;if(e.isArray(n))i=n[0],r=n[1],s=n[2],f=n[3];else{var m=e.map(n.split(","),e.trim);i=o.parseDate(m[0],F.formatDate),r=o.parseDate(m[1],F.formatDate),s=m[2],f=m[3]}for(;i<=r;)d=new u(i,s,f),l=o.formatDate(i,F.formatDate),i.setDate(i.getDate()+1),void 0!==a[l]?(c=a[l].desc)&&c.length&&d.desc&&d.desc.length&&(a[l].desc=c+"\n"+d.desc):a[l]=d}),F.highlightedDates=e.extend(!0,[],a)),n.disabledDates&&e.isArray(n.disabledDates)&&n.disabledDates.length&&(F.disabledDates=e.extend(!0,[],n.disabledDates)),n.disabledWeekDays&&e.isArray(n.disabledWeekDays)&&n.disabledWeekDays.length&&(F.disabledWeekDays=e.extend(!0,[],n.disabledWeekDays)),!F.open&&!F.opened||F.inline||t.trigger("open.xdsoft"),F.inline&&(G=!0,I.addClass("xdsoft_inline"),t.after(I).hide()),F.inverseButton&&(F.next="xdsoft_prev",F.prev="xdsoft_next"),F.datepicker?A.addClass("active"):A.removeClass("active"),F.timepicker?q.addClass("active"):q.removeClass("active"),F.value&&(H.setCurrentTime(F.value),t&&t.val&&t.val(H.str)),isNaN(F.dayOfWeekStart)?F.dayOfWeekStart=0:F.dayOfWeekStart=parseInt(F.dayOfWeekStart,10)%7,F.timepickerScrollbar||E.xdsoftScroller(F,"hide"),F.minDate&&/^[\+\-](.*)$/.test(F.minDate)&&(F.minDate=o.formatDate(H.strToDateTime(F.minDate),F.formatDate)),F.maxDate&&/^[\+\-](.*)$/.test(F.maxDate)&&(F.maxDate=o.formatDate(H.strToDateTime(F.maxDate),F.formatDate)),F.minDateTime&&/^\+(.*)$/.test(F.minDateTime)&&(F.minDateTime=H.strToDateTime(F.minDateTime).dateFormat(F.formatDate)),F.maxDateTime&&/^\+(.*)$/.test(F.maxDateTime)&&(F.maxDateTime=H.strToDateTime(F.maxDateTime).dateFormat(F.formatDate)),B.toggle(F.showApplyButton),R.find(".xdsoft_today_button").css("visibility",F.todayButton?"visible":"hidden"),R.find("."+F.prev).css("visibility",F.prevButton?"visible":"hidden"),R.find("."+F.next).css("visibility",F.nextButton?"visible":"hidden"),X(F),F.validateOnBlur&&t.off("blur.xdsoft").on("blur.xdsoft",function(){if(F.allowBlank&&(!e.trim(e(this).val()).length||"string"==typeof F.mask&&e.trim(e(this).val())===F.mask.replace(/[0-9]/g,"_")))e(this).val(null),I.data("xdsoft_datetime").empty();else{var t=o.parseDate(e(this).val(),F.format);if(t)e(this).val(o.formatDate(t,F.format));else{var n=+[e(this).val()[0],e(this).val()[1]].join(""),a=+[e(this).val()[2],e(this).val()[3]].join("");!F.datepicker&&F.timepicker&&n>=0&&n<24&&a>=0&&a<60?e(this).val([n,a].map(function(e){return e>9?e:"0"+e}).join(":")):e(this).val(o.formatDate(H.now(),F.format))}I.data("xdsoft_datetime").setCurrentTime(e(this).val())}I.trigger("changedatetime.xdsoft"),I.trigger("close.xdsoft")}),F.dayOfWeekStartPrev=0===F.dayOfWeekStart?6:F.dayOfWeekStart-1,I.trigger("xchange.xdsoft").trigger("afterOpen.xdsoft")},I.data("options",F).on("touchstart mousedown.xdsoft",function(e){return e.stopPropagation(),e.preventDefault(),z.hide(),N.hide(),!1}),E.append(V),E.xdsoftScroller(F),I.on("afterOpen.xdsoft",function(){E.xdsoftScroller(F)}),I.append(A).append(q),!0!==F.withoutCopyright&&I.append(P),A.append(R).append(j).append(B),F.insideParent?e(t).parent().append(I):e(F.parentID).append(I),H=new function(){var t=this;t.now=function(e){var o,n,a=new Date;return!e&&F.defaultDate&&(o=t.strToDateTime(F.defaultDate),a.setFullYear(o.getFullYear()),a.setMonth(o.getMonth()),a.setDate(o.getDate())),a.setFullYear(a.getFullYear()),!e&&F.defaultTime&&(n=t.strtotime(F.defaultTime),a.setHours(n.getHours()),a.setMinutes(n.getMinutes()),a.setSeconds(n.getSeconds()),a.setMilliseconds(n.getMilliseconds())),a},t.isValidDate=function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())},t.setCurrentTime=function(e,o){"string"==typeof e?t.currentTime=t.strToDateTime(e):t.isValidDate(e)?t.currentTime=e:e||o||!F.allowBlank||F.inline?t.currentTime=t.now():t.currentTime=null,I.trigger("xchange.xdsoft")},t.empty=function(){t.currentTime=null},t.getCurrentTime=function(){return t.currentTime},t.nextMonth=function(){void 0!==t.currentTime&&null!==t.currentTime||(t.currentTime=t.now());var o,n=t.currentTime.getMonth()+1;return 12===n&&(t.currentTime.setFullYear(t.currentTime.getFullYear()+1),n=0),o=t.currentTime.getFullYear(),t.currentTime.setDate(Math.min(new Date(t.currentTime.getFullYear(),n+1,0).getDate(),t.currentTime.getDate())),t.currentTime.setMonth(n),F.onChangeMonth&&e.isFunction(F.onChangeMonth)&&F.onChangeMonth.call(I,H.currentTime,I.data("input")),o!==t.currentTime.getFullYear()&&e.isFunction(F.onChangeYear)&&F.onChangeYear.call(I,H.currentTime,I.data("input")),I.trigger("xchange.xdsoft"),n},t.prevMonth=function(){void 0!==t.currentTime&&null!==t.currentTime||(t.currentTime=t.now());var o=t.currentTime.getMonth()-1;return-1===o&&(t.currentTime.setFullYear(t.currentTime.getFullYear()-1),o=11),t.currentTime.setDate(Math.min(new Date(t.currentTime.getFullYear(),o+1,0).getDate(),t.currentTime.getDate())),t.currentTime.setMonth(o),F.onChangeMonth&&e.isFunction(F.onChangeMonth)&&F.onChangeMonth.call(I,H.currentTime,I.data("input")),I.trigger("xchange.xdsoft"),o},t.getWeekOfYear=function(t){if(F.onGetWeekOfYear&&e.isFunction(F.onGetWeekOfYear)){var o=F.onGetWeekOfYear.call(I,t);if(void 0!==o)return o}var n=new Date(t.getFullYear(),0,1);return 4!==n.getDay()&&n.setMonth(0,1+(4-n.getDay()+7)%7),Math.ceil(((t-n)/864e5+n.getDay()+1)/7)},t.strToDateTime=function(e){var n,a,i=[];return e&&e instanceof Date&&t.isValidDate(e)?e:((i=/^([+-]{1})(.*)$/.exec(e))&&(i[2]=o.parseDate(i[2],F.formatDate)),i&&i[2]?(n=i[2].getTime()-6e4*i[2].getTimezoneOffset(),a=new Date(t.now(!0).getTime()+parseInt(i[1]+"1",10)*n)):a=e?o.parseDate(e,F.format):t.now(),t.isValidDate(a)||(a=t.now()),a)},t.strToDate=function(e){if(e&&e instanceof Date&&t.isValidDate(e))return e;var n=e?o.parseDate(e,F.formatDate):t.now(!0);return t.isValidDate(n)||(n=t.now(!0)),n},t.strtotime=function(e){if(e&&e instanceof Date&&t.isValidDate(e))return e;var n=e?o.parseDate(e,F.formatTime):t.now(!0);return t.isValidDate(n)||(n=t.now(!0)),n},t.str=function(){var e=F.format;return F.yearOffset&&(e=(e=e.replace("Y",t.currentTime.getFullYear()+F.yearOffset)).replace("y",String(t.currentTime.getFullYear()+F.yearOffset).substring(2,4))),o.formatDate(t.currentTime,e)},t.currentTime=this.now()},B.on("touchend click",function(e){e.preventDefault(),I.data("changed",!0),H.setCurrentTime(J()),t.val(H.str()),I.trigger("close.xdsoft")}),R.find(".xdsoft_today_button").on("touchend mousedown.xdsoft",function(){I.data("changed",!0),H.setCurrentTime(0,!0),I.trigger("afterOpen.xdsoft")}).on("dblclick.xdsoft",function(){var e,o,n=H.getCurrentTime();n=new Date(n.getFullYear(),n.getMonth(),n.getDate()),e=H.strToDate(F.minDate),n<(e=new Date(e.getFullYear(),e.getMonth(),e.getDate()))||(o=H.strToDate(F.maxDate),n>(o=new Date(o.getFullYear(),o.getMonth(),o.getDate()))||(t.val(H.str()),t.trigger("change"),I.trigger("close.xdsoft")))}),R.find(".xdsoft_prev,.xdsoft_next").on("touchend mousedown.xdsoft",function(){var t=e(this),o=0,n=!1;!function e(a){t.hasClass(F.next)?H.nextMonth():t.hasClass(F.prev)&&H.prevMonth(),F.monthChangeSpinner&&(n||(o=setTimeout(e,a||100)))}(500),e([F.ownerDocument.body,F.contentWindow]).on("touchend mouseup.xdsoft",function t(){clearTimeout(o),n=!0,e([F.ownerDocument.body,F.contentWindow]).off("touchend mouseup.xdsoft",t)})}),q.find(".xdsoft_prev,.xdsoft_next").on("touchend mousedown.xdsoft",function(){var t=e(this),o=0,n=!1,a=110;!function e(i){var r=E[0].clientHeight,s=V[0].offsetHeight,d=Math.abs(parseInt(V.css("marginTop"),10));t.hasClass(F.next)&&s-r-F.timeHeightInTimePicker>=d?V.css("marginTop","-"+(d+F.timeHeightInTimePicker)+"px"):t.hasClass(F.prev)&&d-F.timeHeightInTimePicker>=0&&V.css("marginTop","-"+(d-F.timeHeightInTimePicker)+"px"),E.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(V[0].style.marginTop,10)/(s-r))]),a=a>10?10:a-10,n||(o=setTimeout(e,i||a))}(500),e([F.ownerDocument.body,F.contentWindow]).on("touchend mouseup.xdsoft",function t(){clearTimeout(o),n=!0,e([F.ownerDocument.body,F.contentWindow]).off("touchend mouseup.xdsoft",t)})}),i=0,I.on("xchange.xdsoft",function(r){clearTimeout(i),i=setTimeout(function(){void 0!==H.currentTime&&null!==H.currentTime||(H.currentTime=H.now());for(var i,r,s,d,l,u,c,f,m,h,g="",p=new Date(H.currentTime.getFullYear(),H.currentTime.getMonth(),1,12,0,0),x=0,D=H.now(),v=!1,T=!1,y=!1,w=!1,_=[],b=!0,k="";p.getDay()!==F.dayOfWeekStart;)p.setDate(p.getDate()-1);for(g+="<table><thead><tr>",F.weeks&&(g+="<th></th>"),i=0;i<7;i+=1)g+="<th>"+F.i18n[a].dayOfWeekShort[(i+F.dayOfWeekStart)%7]+"</th>";for(g+="</tr></thead>",g+="<tbody>",!1!==F.maxDate&&(v=H.strToDate(F.maxDate),v=new Date(v.getFullYear(),v.getMonth(),v.getDate(),23,59,59,999)),!1!==F.minDate&&(T=H.strToDate(F.minDate),T=new Date(T.getFullYear(),T.getMonth(),T.getDate())),!1!==F.minDateTime&&(y=H.strToDate(F.minDateTime),y=new Date(y.getFullYear(),y.getMonth(),y.getDate(),y.getHours(),y.getMinutes(),y.getSeconds())),!1!==F.maxDateTime&&(w=H.strToDate(F.maxDateTime),w=new Date(w.getFullYear(),w.getMonth(),w.getDate(),w.getHours(),w.getMinutes(),w.getSeconds())),!1!==w&&(h=31*(12*w.getFullYear()+w.getMonth())+w.getDate());x<H.currentTime.countDaysInMonth()||p.getDay()!==F.dayOfWeekStart||H.currentTime.getMonth()===p.getMonth();){_=[],x+=1,s=p.getDay(),d=p.getDate(),l=p.getFullYear(),Y=p.getMonth(),u=H.getWeekOfYear(p),m="",_.push("xdsoft_date"),c=F.beforeShowDay&&e.isFunction(F.beforeShowDay.call)?F.beforeShowDay.call(I,p):null,F.allowDateRe&&"[object RegExp]"===Object.prototype.toString.call(F.allowDateRe)&&(F.allowDateRe.test(o.formatDate(p,F.formatDate))||_.push("xdsoft_disabled")),F.allowDates&&F.allowDates.length>0&&-1===F.allowDates.indexOf(o.formatDate(p,F.formatDate))&&_.push("xdsoft_disabled");var M=31*(12*p.getFullYear()+p.getMonth())+p.getDate();(!1!==v&&p>v||!1!==y&&p<y||!1!==T&&p<T||!1!==w&&M>h||c&&!1===c[0])&&_.push("xdsoft_disabled"),-1!==F.disabledDates.indexOf(o.formatDate(p,F.formatDate))&&_.push("xdsoft_disabled"),-1!==F.disabledWeekDays.indexOf(s)&&_.push("xdsoft_disabled"),t.is("[disabled]")&&_.push("xdsoft_disabled"),c&&""!==c[1]&&_.push(c[1]),H.currentTime.getMonth()!==Y&&_.push("xdsoft_other_month"),(F.defaultSelect||I.data("changed"))&&o.formatDate(H.currentTime,F.formatDate)===o.formatDate(p,F.formatDate)&&_.push("xdsoft_current"),o.formatDate(D,F.formatDate)===o.formatDate(p,F.formatDate)&&_.push("xdsoft_today"),0!==p.getDay()&&6!==p.getDay()&&-1===F.weekends.indexOf(o.formatDate(p,F.formatDate))||_.push("xdsoft_weekend"),void 0!==F.highlightedDates[o.formatDate(p,F.formatDate)]&&(r=F.highlightedDates[o.formatDate(p,F.formatDate)],_.push(void 0===r.style?"xdsoft_highlighted_default":r.style),m=void 0===r.desc?"":r.desc),F.beforeShowDay&&e.isFunction(F.beforeShowDay)&&_.push(F.beforeShowDay(p)),b&&(g+="<tr>",b=!1,F.weeks&&(g+="<th>"+u+"</th>")),g+='<td data-date="'+d+'" data-month="'+Y+'" data-year="'+l+'" class="xdsoft_date xdsoft_day_of_week'+p.getDay()+" "+_.join(" ")+'" title="'+m+'"><div>'+d+"</div></td>",p.getDay()===F.dayOfWeekStartPrev&&(g+="</tr>",b=!0),p.setDate(d+1)}g+="</tbody></table>",j.html(g),R.find(".xdsoft_label span").eq(0).text(F.i18n[a].months[H.currentTime.getMonth()]),R.find(".xdsoft_label span").eq(1).text(H.currentTime.getFullYear()+F.yearOffset),k="",Y="";var S=0;if(!1!==F.minTime){var O=H.strtotime(F.minTime);S=60*O.getHours()+O.getMinutes()}var C=1440;if(!1!==F.maxTime){O=H.strtotime(F.maxTime);C=60*O.getHours()+O.getMinutes()}if(!1!==F.minDateTime){O=H.strToDateTime(F.minDateTime);if(o.formatDate(H.currentTime,F.formatDate)===o.formatDate(O,F.formatDate))(Y=60*O.getHours()+O.getMinutes())>S&&(S=Y)}if(!1!==F.maxDateTime){var Y;O=H.strToDateTime(F.maxDateTime);if(o.formatDate(H.currentTime,F.formatDate)===o.formatDate(O,F.formatDate))(Y=60*O.getHours()+O.getMinutes())<C&&(C=Y)}if(f=function(n,a){var i,r=H.now(),s=F.allowTimes&&e.isArray(F.allowTimes)&&F.allowTimes.length;r.setHours(n),n=parseInt(r.getHours(),10),r.setMinutes(a),a=parseInt(r.getMinutes(),10),_=[];var d=60*n+a;(t.is("[disabled]")||d>=C||d<S)&&_.push("xdsoft_disabled"),(i=new Date(H.currentTime)).setHours(parseInt(H.currentTime.getHours(),10)),s||i.setMinutes(Math[F.roundTime](H.currentTime.getMinutes()/F.step)*F.step),(F.initTime||F.defaultSelect||I.data("changed"))&&i.getHours()===parseInt(n,10)&&(!s&&F.step>59||i.getMinutes()===parseInt(a,10))&&(F.defaultSelect||I.data("changed")?_.push("xdsoft_current"):F.initTime&&_.push("xdsoft_init_time")),parseInt(D.getHours(),10)===parseInt(n,10)&&parseInt(D.getMinutes(),10)===parseInt(a,10)&&_.push("xdsoft_today"),k+='<div class="xdsoft_time '+_.join(" ")+'" data-hour="'+n+'" data-minute="'+a+'">'+o.formatDate(r,F.formatTime)+"</div>"},F.allowTimes&&e.isArray(F.allowTimes)&&F.allowTimes.length)for(x=0;x<F.allowTimes.length;x+=1)f(H.strtotime(F.allowTimes[x]).getHours(),Y=H.strtotime(F.allowTimes[x]).getMinutes());else for(x=0,i=0;x<(F.hours12?12:24);x+=1)for(i=0;i<60;i+=F.step){var W=60*x+i;W<S||(W>=C||f((x<10?"0":"")+x,Y=(i<10?"0":"")+i))}for(V.html(k),n="",x=parseInt(F.yearStart,10);x<=parseInt(F.yearEnd,10);x+=1)n+='<div class="xdsoft_option '+(H.currentTime.getFullYear()===x?"xdsoft_current":"")+'" data-value="'+x+'">'+(x+F.yearOffset)+"</div>";for(z.children().eq(0).html(n),x=parseInt(F.monthStart,10),n="";x<=parseInt(F.monthEnd,10);x+=1)n+='<div class="xdsoft_option '+(H.currentTime.getMonth()===x?"xdsoft_current":"")+'" data-value="'+x+'">'+F.i18n[a].months[x]+"</div>";N.children().eq(0).html(n),e(I).trigger("generate.xdsoft")},10),r.stopPropagation()}).on("afterOpen.xdsoft",function(){var e,t,o,n;F.timepicker&&(V.find(".xdsoft_current").length?e=".xdsoft_current":V.find(".xdsoft_init_time").length&&(e=".xdsoft_init_time"),e?(t=E[0].clientHeight,(o=V[0].offsetHeight)-t<(n=V.find(e).index()*F.timeHeightInTimePicker+1)&&(n=o-t),E.trigger("scroll_element.xdsoft_scroller",[parseInt(n,10)/(o-t)])):E.trigger("scroll_element.xdsoft_scroller",[0]))}),r=0,j.on("touchend click.xdsoft","td",function(o){o.stopPropagation(),r+=1;var n=e(this),a=H.currentTime;if(null==a&&(H.currentTime=H.now(),a=H.currentTime),n.hasClass("xdsoft_disabled"))return!1;a.setDate(1),a.setFullYear(n.data("year")),a.setMonth(n.data("month")),a.setDate(n.data("date")),I.trigger("select.xdsoft",[a]),t.val(H.str()),F.onSelectDate&&e.isFunction(F.onSelectDate)&&F.onSelectDate.call(I,H.currentTime,I.data("input"),o),I.data("changed",!0),I.trigger("xchange.xdsoft"),I.trigger("changedatetime.xdsoft"),(r>1||!0===F.closeOnDateSelect||!1===F.closeOnDateSelect&&!F.timepicker)&&!F.inline&&I.trigger("close.xdsoft"),setTimeout(function(){r=0},200)}),V.on("touchstart","div",function(e){this.touchMoved=!1}).on("touchmove","div",$).on("touchend click.xdsoft","div",function(t){if(!this.touchMoved){t.stopPropagation();var o=e(this),n=H.currentTime;if(null==n&&(H.currentTime=H.now(),n=H.currentTime),o.hasClass("xdsoft_disabled"))return!1;n.setHours(o.data("hour")),n.setMinutes(o.data("minute")),I.trigger("select.xdsoft",[n]),I.data("input").val(H.str()),F.onSelectTime&&e.isFunction(F.onSelectTime)&&F.onSelectTime.call(I,H.currentTime,I.data("input"),t),I.data("changed",!0),I.trigger("xchange.xdsoft"),I.trigger("changedatetime.xdsoft"),!0!==F.inline&&!0===F.closeOnTimeSelect&&I.trigger("close.xdsoft")}}),A.on("mousewheel.xdsoft",function(e){return!F.scrollMonth||(e.deltaY<0?H.nextMonth():H.prevMonth(),!1)}),t.on("mousewheel.xdsoft",function(e){return!F.scrollInput||(!F.datepicker&&F.timepicker?((s=V.find(".xdsoft_current").length?V.find(".xdsoft_current").eq(0).index():0)+e.deltaY>=0&&s+e.deltaY<V.children().length&&(s+=e.deltaY),V.children().eq(s).length&&V.children().eq(s).trigger("mousedown"),!1):F.datepicker&&!F.timepicker?(A.trigger(e,[e.deltaY,e.deltaX,e.deltaY]),t.val&&t.val(H.str()),I.trigger("changedatetime.xdsoft"),!1):void 0)}),I.on("changedatetime.xdsoft",function(t){if(F.onChangeDateTime&&e.isFunction(F.onChangeDateTime)){var o=I.data("input");F.onChangeDateTime.call(I,H.currentTime,o,t),delete F.value,o.trigger("change")}}).on("generate.xdsoft",function(){F.onGenerate&&e.isFunction(F.onGenerate)&&F.onGenerate.call(I,H.currentTime,I.data("input")),G&&(I.trigger("afterOpen.xdsoft"),G=!1)}).on("click.xdsoft",function(e){e.stopPropagation()}),s=0,W=function(e,t){do{if(!(e=e.parentNode)||!1===t(e))break}while("HTML"!==e.nodeName)},d=function(){var t,o,n,a,i,r,s,d,l,u,c,f,m;if(t=(d=I.data("input")).offset(),o=d[0],u="top",n=t.top+o.offsetHeight-1,a=t.left,i="absolute",l=e(F.contentWindow).width(),f=e(F.contentWindow).height(),m=e(F.contentWindow).scrollTop(),F.ownerDocument.documentElement.clientWidth-t.left<A.parent().outerWidth(!0)){var h=A.parent().outerWidth(!0)-o.offsetWidth;a-=h}"rtl"===d.parent().css("direction")&&(a-=I.outerWidth()-d.outerWidth()),F.fixed?(n-=m,a-=e(F.contentWindow).scrollLeft(),i="fixed"):(s=!1,W(o,function(e){return null!==e&&("fixed"===F.contentWindow.getComputedStyle(e).getPropertyValue("position")?(s=!0,!1):void 0)}),s&&!F.insideParent?(i="fixed",n+I.outerHeight()>f+m?(u="bottom",n=f+m-t.top):n-=m):n+I[0].offsetHeight>f+m&&(n=t.top-I[0].offsetHeight+1),n<0&&(n=0),a+o.offsetWidth>l&&(a=l-o.offsetWidth)),r=I[0],W(r,function(e){if("relative"===F.contentWindow.getComputedStyle(e).getPropertyValue("position")&&l>=e.offsetWidth)return a-=(l-e.offsetWidth)/2,!1}),c={position:i,left:F.insideParent?o.offsetLeft:a,top:"",bottom:""},F.insideParent?c[u]=o.offsetTop+o.offsetHeight:c[u]=n,I.css(c)},I.on("open.xdsoft",function(t){var o=!0;F.onShow&&e.isFunction(F.onShow)&&(o=F.onShow.call(I,H.currentTime,I.data("input"),t)),!1!==o&&(I.show(),d(),e(F.contentWindow).off("resize.xdsoft",d).on("resize.xdsoft",d),F.closeOnWithoutClick&&e([F.ownerDocument.body,F.contentWindow]).on("touchstart mousedown.xdsoft",function t(){I.trigger("close.xdsoft"),e([F.ownerDocument.body,F.contentWindow]).off("touchstart mousedown.xdsoft",t)}))}).on("close.xdsoft",function(t){var o=!0;R.find(".xdsoft_month,.xdsoft_year").find(".xdsoft_select").hide(),F.onClose&&e.isFunction(F.onClose)&&(o=F.onClose.call(I,H.currentTime,I.data("input"),t)),!1===o||F.opened||F.inline||I.hide(),t.stopPropagation()}).on("toggle.xdsoft",function(){I.is(":visible")?I.trigger("close.xdsoft"):I.trigger("open.xdsoft")}).data("input",t),L=0,I.data("xdsoft_datetime",H),I.setOptions(F),H.setCurrentTime(J()),t.data("xdsoft_datetimepicker",I).on("open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart",function(){t.is(":disabled")||t.data("xdsoft_datetimepicker").is(":visible")&&F.closeOnInputClick||F.openOnFocus&&(clearTimeout(L),L=setTimeout(function(){t.is(":disabled")||(G=!0,H.setCurrentTime(J(),!0),F.mask&&X(F),I.trigger("open.xdsoft"))},100))}).on("keydown.xdsoft",function(t){var o,n=t.which;return-1!==[p].indexOf(n)&&F.enterLikeTab?(o=e("input:visible,textarea:visible,button:visible,a:visible"),I.trigger("close.xdsoft"),o.eq(o.index(this)+1).focus(),!1):-1!==[_].indexOf(n)?(I.trigger("close.xdsoft"),!0):void 0}).on("blur.xdsoft",function(){I.trigger("close.xdsoft")})},s=function(t){var o=t.data("xdsoft_datetimepicker");o&&(o.data("xdsoft_datetime",null),o.remove(),t.data("xdsoft_datetimepicker",null).off(".xdsoft"),e(F.contentWindow).off("resize.xdsoft"),e([F.contentWindow,F.ownerDocument.body]).off("mousedown.xdsoft touchstart"),t.unmousewheel&&t.unmousewheel())},e(F.ownerDocument).off("keydown.xdsoftctrl keyup.xdsoftctrl").off("keydown.xdsoftcmd keyup.xdsoftcmd").on("keydown.xdsoftctrl",function(e){e.keyCode===h&&(Y=!0)}).on("keyup.xdsoftctrl",function(e){e.keyCode===h&&(Y=!1)}).on("keydown.xdsoftcmd",function(e){91===e.keyCode&&!0}).on("keyup.xdsoftcmd",function(e){91===e.keyCode&&!1}),this.each(function(){var t,a=e(this).data("xdsoft_datetimepicker");if(a){if("string"===e.type(n))switch(n){case"show":e(this).select().focus(),a.trigger("open.xdsoft");break;case"hide":a.trigger("close.xdsoft");break;case"toggle":a.trigger("toggle.xdsoft");break;case"destroy":s(e(this));break;case"reset":this.value=this.defaultValue,this.value&&a.data("xdsoft_datetime").isValidDate(o.parseDate(this.value,F.format))||a.data("changed",!1),a.data("xdsoft_datetime").setCurrentTime(this.value);break;case"validate":a.data("input").trigger("blur.xdsoft");break;default:a[n]&&e.isFunction(a[n])&&(d=a[n](i))}else a.setOptions(n);return 0}"string"!==e.type(n)&&(!F.lazyInit||F.open||F.inline?r(e(this)):(t=e(this)).on("open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart",function e(){t.is(":disabled")||t.data("xdsoft_datetimepicker")||(clearTimeout(H),H=setTimeout(function(){t.data("xdsoft_datetimepicker")||r(t),t.off("open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart",e).trigger("open.xdsoft")},100))}))}),d},e.fn.datetimepicker.defaults=t};!function(e){"function"==typeof define&&define.amd?define(["jquery","jquery-mousewheel"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(datetimepickerFactory);
|
|
|
|
/*!
|
|
* jQuery Mousewheel 3.1.13
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license
|
|
* http://jquery.org/license
|
|
*/
|
|
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){var t,i,n=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],o="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var s=n.length;s;)e.event.fixHooks[n[--s]]=e.event.mouseHooks;var a=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var t=o.length;t;)this.addEventListener(o[--t],h,!1);else this.onmousewheel=h;e.data(this,"mousewheel-line-height",a.getLineHeight(this)),e.data(this,"mousewheel-page-height",a.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var t=o.length;t;)this.removeEventListener(o[--t],h,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var i=e(t),n=i["offsetParent"in e.fn?"offsetParent":"parent"]();return n.length||(n=e("body")),parseInt(n.css("fontSize"),10)||parseInt(i.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function h(n){var o,s=n||window.event,h=l.call(arguments,1),f=0,d=0,c=0,m=0,g=0;if((n=e.event.fix(s)).type="mousewheel","detail"in s&&(c=-1*s.detail),"wheelDelta"in s&&(c=s.wheelDelta),"wheelDeltaY"in s&&(c=s.wheelDeltaY),"wheelDeltaX"in s&&(d=-1*s.wheelDeltaX),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(d=-1*c,c=0),f=0===c?d:c,"deltaY"in s&&(f=c=-1*s.deltaY),"deltaX"in s&&(d=s.deltaX,0===c&&(f=-1*d)),0!==c||0!==d){if(1===s.deltaMode){var w=e.data(this,"mousewheel-line-height");f*=w,c*=w,d*=w}else if(2===s.deltaMode){var v=e.data(this,"mousewheel-page-height");f*=v,c*=v,d*=v}if(o=Math.max(Math.abs(c),Math.abs(d)),(!i||o<i)&&(i=o,u(s,o)&&(i/=40)),u(s,o)&&(f/=40,d/=40,c/=40),f=Math[f>=1?"floor":"ceil"](f/i),d=Math[d>=1?"floor":"ceil"](d/i),c=Math[c>=1?"floor":"ceil"](c/i),a.settings.normalizeOffset&&this.getBoundingClientRect){var p=this.getBoundingClientRect();m=n.clientX-p.left,g=n.clientY-p.top}return n.deltaX=d,n.deltaY=c,n.deltaFactor=i,n.offsetX=m,n.offsetY=g,n.deltaMode=0,h.unshift(n,f,d,c),t&&clearTimeout(t),t=setTimeout(r,200),(e.event.dispatch||e.event.handle).apply(this,h)}}function r(){i=null}function u(e,t){return a.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})});
|