2022-05-29 09:24:36 +00:00
|
|
|
!function(De,T,k,ve){"use strict";De.isFunction=De.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},T=void 0!==T&&T.Math==Math?T:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),De.fn.calendar=function(g){var D,e=De(this),v=e.selector||"",y=(new Date).getTime(),b=[],C=g,w="string"==typeof C,M=[].slice.call(arguments,1),x={5:{row:4,column:3},10:{row:3,column:2},15:{row:2,column:2},20:{row:3,column:1},30:{row:2,column:1}},ge=["","one","two","three","four","five","six","seven","eight"];return e.each(function(){var c,e,le,de=De.isPlainObject(g)?De.extend(!0,{},De.fn.calendar.settings,g):De.extend({},De.fn.calendar.settings),ue=de.className,t=de.namespace,o=de.selector,fe=de.formatter,a=de.parser,ce=de.metadata,pe=x[de.minTimeGap],s=de.error,n="."+t,r="module-"+t,l=De(this),d=l.find(o.input),me=l.find(o.popup),u=l.find(o.activator),f=this,p=l.data(r),m=!1,he=l.hasClass(ue.inverted),h=!1,i=!1;le={initialize:function(){le.debug("Initializing calendar for",f,l),c=le.get.isTouch(),le.setup.config(),le.setup.popup(),le.setup.inline(),le.setup.input(),le.setup.date(),le.create.calendar(),le.bind.events(),le.observeChanges(),le.instantiate()},instantiate:function(){le.verbose("Storing instance of calendar"),p=le,l.data(r,p)},destroy:function(){le.verbose("Destroying previous calendar for",f),l.removeData(r),le.unbind.events(),le.disconnect.classObserver()},setup:{config:function(){null!==le.get.minDate()&&le.set.minDate(l.data(ce.minDate)),null!==le.get.maxDate()&&le.set.maxDate(l.data(ce.maxDate)),le.setting("type",le.get.type()),le.setting("on",de.on||(d.length?"focus":"click"))},popup:function(){if(!de.inline&&(u.length||(u=l.children().first()).length))if(De.fn.popup!==ve){if(!me.length){var e=u.parent(),t=0!==e.closest(o.append).length?"appendTo":"prependTo";me=De("<div/>").addClass(ue.popup)[t](e)}me.addClass(ue.calendar),he&&me.addClass(ue.inverted);var a=function(){return le.refreshTooltips(),de.onVisible.apply(me,arguments)},n=de.onHidden;d.length||(me.attr("tabindex","0"),a=function(){return le.refreshTooltips(),le.focus(),de.onVisible.apply(me,arguments)},n=function(){return le.blur(),de.onHidden.apply(me,arguments)});var r=le.setting("on"),i=De.extend({},de.popupOptions,{popup:me,on:r,hoverable:"hover"===r,closable:"click"===r,onShow:function(){return le.set.focusDate(le.get.date()),le.set.mode(le.get.validatedMode(de.startMode)),de.onShow.apply(me,arguments)},onVisible:a,onHide:de.onHide,onHidden:n});le.popup(i)}else le.error(s.popup)},inline:function(){u.length&&!de.inline||(de.inline=!0,me=De("<div/>").addClass(ue.calendar).appendTo(l),d.length||me.attr("tabindex","0"))},input:function(){de.touchReadonly&&d.length&&c&&d.prop("readonly",!0),le.check.disabled()},date:function(){var e;de.initialDate?e=a.date(de.initialDate,de):l.data(ce.date)!==ve?e=a.date(l.data(ce.date),de):d.length&&(e=a.date(d.val(),de)),le.set.date(e,de.formatInput,!1),le.set.mode(le.get.mode(),!1)}},trigger:{change:function(){var e=d[0];if(e){var t=k.createEvent("HTMLEvents");le.verbose("Triggering native change event"),t.initEvent("change",!0,!1),e.dispatchEvent(t)}}},create:{calendar:function(){var e,t,a,n,r,i,o,s=le.get.mode(),l=new Date,d=le.get.date(),u=le.get.focusDate(),f=le.helper.dateInRange(u||d||de.initialDate||l);u||(u=f,le.set.focusDate(u,!1,!1));var c="year"===s,p="month"===s,m="day"===s,h="hour"===s,g="minute"===s,D="time"===de.type,v=Math.max(de.multiMonth,1),y=m?le.get.monthOffset():0,b=f.getMinutes(),C=f.getHours(),w=f.getDate(),M=f.getMonth()+y,x=f.getFullYear(),T=m?de.showWeekNumbers?8:7:h?4:pe.column,k=m||h?6:pe.row,O=m?v:1,F=me,N=F.hasClass("left")?"right center":"left center";for(F.empty(),1<O&&(o=De("<div/>").addClass(ue.grid).appendTo(F)),n=0;n<O;n++){if(1<O)F=De("<div/>").addClass(ue.column).appendTo(o);var A=M+n,E=(new Date(x,A,1).getDay()-de.firstDayOfWeek%7+7)%7;if(!de.constantHeight&&m){var H=new Date(x,A+1,0).getDate()+E;k=Math.ceil(H/7)}var Y=c?10:p?1:0,I=m?1:0,j=h||g?1:0,S=h||g?w:1,q=new Date(x-Y,A-I,S-j,C),W=new Date(x+Y,A+I,S+j,C),R=c?new Date(10*Math.ceil(x
|