ScoDoc/static/libjs/fullcalendar/fullcalendar.min.js

7 lines
54 KiB
JavaScript
Raw Permalink Normal View History

2020-09-26 16:19:37 +02:00
/*!
* FullCalendar v2.0.0-beta2
* Docs & License: http://arshaw.com/fullcalendar/
* (c) 2013 Adam Shaw
*/
(function(t){"function"==typeof define&&define.amd?define(["jquery","moment"],t):t(jQuery,moment)})(function(t,e){function n(t,e){return e.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"t")}function r(t,e){var n=e.longDateFormat("L");return n=n.replace(/^Y+[^\w\s]*|[^\w\s]*Y+$/g,""),t.isRTL?n+=" ddd":n="ddd "+n,n}function a(t){o(Me,t)}function o(e){function n(n,r){t.isPlainObject(r)&&t.isPlainObject(e[n])&&!i(n)?e[n]=o({},e[n],r):void 0!==r&&(e[n]=r)}for(var r=1;arguments.length>r;r++)t.each(arguments[r],n);return e}function i(t){return/(Time|Duration)$/.test(t)}function s(n,r){function a(t){oe?f()&&(b(),m(t)):i()}function i(){ie=te.theme?"ui":"fc",n.addClass("fc"),te.isRTL?n.addClass("fc-rtl"):n.addClass("fc-ltr"),te.theme&&n.addClass("ui-widget"),oe=t("<div class='fc-content' />").prependTo(n),re=new l(J,te),ae=re.render(),ae&&n.prepend(ae),h(te.defaultView),te.handleWindowResize&&t(window).resize(D),v()||s()}function s(){setTimeout(function(){!se.start&&v()&&g()},0)}function d(){se&&(Q("viewDestroy",se,se,se.element),se.triggerEventDestroy()),t(window).unbind("resize",D),re.destroy(),oe.remove(),n.removeClass("fc fc-rtl ui-widget")}function f(){return n.is(":visible")}function v(){return t("body").is(":visible")}function h(t){se&&t==se.name||p(t)}function p(e){ge++,se&&(Q("viewDestroy",se,se,se.element),H(),se.triggerEventDestroy(),$(),se.element.remove(),re.deactivateButton(se.name)),re.activateButton(e),se=new Fe[e](t("<div class='fc-view fc-view-"+e+"' />").appendTo(oe),J),g(),V(),ge--}function g(t){se.start&&!t&&de.isWithin(se.intervalStart,se.intervalEnd)||f()&&m(t)}function m(t){ge++,se.start&&(Q("viewDestroy",se,se,se.element),H(),x()),$(),t&&(de=se.incrementDate(de,t)),se.render(de.clone()),w(),V(),(se.afterRender||k)(),F(),N(),Q("viewRender",se,se,se.element),ge--,M()}function y(){f()&&(H(),x(),b(),w(),S())}function b(){ce=te.contentHeight?te.contentHeight:te.height?te.height-(ae?ae.height():0)-T(oe):Math.round(oe.width()/Math.max(te.aspectRatio,.5))}function w(){void 0===ce&&b(),ge++,se.setHeight(ce),se.setWidth(oe.width()),ge--,le=n.outerWidth()}function D(){if(!ge)if(se.start){var t=++pe;setTimeout(function(){t==pe&&!ge&&f()&&le!=(le=n.outerWidth())&&(ge++,y(),se.trigger("windowResize",he),ge--)},200)}else s()}function C(){x(),z()}function E(t){x(),S(t)}function S(t){f()&&(se.renderEvents(me,t),se.trigger("eventAfterAllRender"))}function x(){se.triggerEventDestroy(),se.clearEvents(),se.clearEventData()}function M(){!te.lazyFetching||fe(se.start,se.end)?z():S()}function z(){ve(se.start,se.end)}function R(t){me=t,S()}function _(t){E(t)}function F(){re.updateTitle(se.title)}function N(){var t=J.getNow();t.isWithin(se.intervalStart,se.intervalEnd)?re.disableButton("today"):re.enableButton("today")}function Y(t,e){se.select(t,e)}function H(){se&&se.unselect()}function O(){g(-1)}function A(){g(1)}function W(){de.add("years",-1),g()}function L(){de.add("years",1),g()}function Z(){de=J.getNow(),g()}function P(t){de=J.moment(t),g()}function j(){de.add.apply(de,arguments),g()}function I(){return de.clone()}function $(){oe.css({width:"100%",height:oe.height(),overflow:"hidden"})}function V(){oe.css({width:"",height:"",overflow:""})}function X(){return J}function U(){return se}function G(t,e){return void 0===e?te[t]:(("height"==t||"contentHeight"==t||"aspectRatio"==t)&&(te[t]=e,y()),void 0)}function Q(t,e){return te[t]?te[t].apply(e||he,Array.prototype.slice.call(arguments,2)):void 0}var J=this;r=r||{};var K,te=o({},Me,r);K=te.lang in ze?ze[te.lang]:ze[Me.lang],K&&(te=o({},Me,K,r)),te.isRTL&&(te=o({},Me,Re,K||{},r)),J.options=te,J.render=a,J.destroy=d,J.refetchEvents=C,J.reportEvents=R,J.reportEventChange=_,J.rerenderEvents=E,J.changeView=h,J.select=Y,J.unselect=H,J.prev=O,J.next=A,J.prevYear=W,J.nextYear=L,J.today=Z,J.gotoDate=P,J.incrementDate=j,J.getDate=I,J.getCalendar=X,J.getView=U,J.option=G,J.trigger=Q;var ee=u(e.langData(te.lang));if(te.monthNames&&(ee._months=te.monthNames),te.monthNamesShort&&(ee._monthsShort=te.monthNamesShort),te.dayNames&&(ee._weekdays=te.dayNames
}),Re=new Se(ze),_e=new xe(function(t){return Q.eq(t)}),Fe=new xe(function(t){return J.eq(t)})}function ie(){function n(t,e){var n,r=t.length,o=[],s=[];for(n=0;r>n;n++)t[n].allDay?o.push(t[n]):s.push(t[n]);v("allDaySlot")&&(V(o,e),D()),i(a(s),e)}function r(){C().empty(),E().empty()}function a(t){var e,n,r,a,i,s=F(),l=X(),c=U(),d=[];for(n=0;s>n;n++)for(e=_(0,n),i=o(t,e.clone().time(l),e.clone().time(c)),i=se(i),r=0;i.length>r;r++)a=i[r],a.col=n,d.push(a);return d}function o(t,e,n){e=e.clone().stripZone(),n=n.clone().stripZone();var r,a,o,i,s,l,c,d,u=[],f=t.length;for(r=0;f>r;r++)a=t[r],o=a.start.clone().stripZone(),i=K(a).stripZone(),i>e&&n>o&&(e>o?(s=e.clone(),c=!1):(s=o,c=!0),i>n?(l=n.clone(),d=!1):(l=i,d=!0),u.push({event:a,start:s,end:l,isStart:c,isEnd:d}));return u.sort(ge)}function i(e,n){var r,a,o,i,c,d,u,f,g,m,b,w,D,C,S,x,R=e.length,_="",F=E(),N=v("isRTL");for(r=0;R>r;r++)a=e[r],o=a.event,i=k(a.start,a.start),c=k(a.end,a.start),d=M(a.col),u=z(a.col),f=u-d,u-=.025*f,f=u-d,g=f*(a.forwardCoord-a.backwardCoord),v("slotEventOverlap")&&(g=Math.max(2*(g-10),g)),N?(b=u-a.backwardCoord*f,m=b-g):(m=d+a.backwardCoord*f,b=m+g),m=Math.max(m,d),b=Math.min(b,u),g=b-m,a.top=i,a.left=m,a.outerWidth=g,a.outerHeight=c-i,_+=s(o,a);for(F[0].innerHTML=_,w=F.children(),r=0;R>r;r++)a=e[r],o=a.event,D=t(w[r]),C=h("eventRender",o,o,D),C===!1?D.remove():(C&&C!==!0&&(D.remove(),D=t(C).css({position:"absolute",top:a.top,left:a.left}).appendTo(F)),a.element=D,o._id===n?l(o,D,a):D[0]._fci=r,Z(o,D));for(p(F,e,l),r=0;R>r;r++)a=e[r],(D=a.element)&&(a.vsides=T(D,!0),a.hsides=y(D,!0),S=D.find(".fc-event-title"),S.length&&(a.contentTop=S[0].offsetTop));for(r=0;R>r;r++)a=e[r],(D=a.element)&&(D[0].style.width=Math.max(0,a.outerWidth-a.hsides)+"px",x=Math.max(0,a.outerHeight-a.vsides),D[0].style.height=x+"px",o=a.event,void 0!==a.contentTop&&10>x-a.contentTop&&(D.find("div.fc-event-time").text(Q(o.start,v("timeFormat"))+" - "+o.title),D.find("div.fc-event-title").remove()),h("eventAfterRender",o,o,D))}function s(t,e){var n="<",r=t.url,a=Y(t,v),o=["fc-event","fc-event-vert"];return g(t)&&o.push("fc-event-draggable"),e.isStart&&o.push("fc-event-start"),e.isEnd&&o.push("fc-event-end"),o=o.concat(t.className),t.source&&(o=o.concat(t.source.className||[])),n+=r?"a href='"+R(t.url)+"'":"div",n+=" class='"+o.join(" ")+"'"+" style="+"'"+"position:absolute;"+"top:"+e.top+"px;"+"left:"+e.left+"px;"+a+"'"+">"+"<div class='fc-event-inner'>"+"<div class='fc-event-time'>",n+=t.end?R(J(t.start,t.end,v("timeFormat"))):R(Q(t.start,v("timeFormat"))),n+="</div><div class='fc-event-title'>"+R(t.title||"")+"</div>"+"</div>"+"<div class='fc-event-bg'></div>",e.isEnd&&b(t)&&(n+="<div class='ui-resizable-handle ui-resizable-s'>=</div>"),n+="</"+(r?"a":"div")+">"}function l(t,e,n){var r=e.find("div.fc-event-time");g(t)&&d(t,e,r),n.isEnd&&b(t)&&u(t,e,r),w(t,e)}function c(t,n,r){function a(){c||(n.width(o).height("").draggable("option","grid",null),c=!0)}var o,i,s,l=r.isStart,c=!0,d=S(),u=N(),f=X(),p=W(),g=A(),y=O(),b=H();n.draggable({opacity:v("dragOpacity","month"),revertDuration:v("dragRevertDuration"),start:function(e,r){h("eventDragStart",n,t,e,r),B(t,n),o=n.width(),d.start(function(e,r){if($(),e){i=!1;var o=_(0,r.col),d=_(0,e.col);s=d.diff(o,"days"),e.row?l?c&&(n.width(u-10),m(n,G.defaultTimedEventDuration/p*g),n.draggable("option","grid",[u,1]),c=!1):i=!0:(q(t.start.clone().add("days",s),K(t).add("days",s)),a()),i=i||c&&!s}else a(),i=!0;n.draggable("option","revert",i)},e,"drag")},stop:function(r,o){if(d.stop(),$(),h("eventDragStop",n,t,r,o),i)a(),n.css("filter",""),P(t,n);else{var l,u,v=t.start.clone().add("days",s);c||(u=Math.round((n.offset().top-L().offset().top)/b),l=e.duration(f+u*y),v=G.rezoneDate(v.clone().time(l))),j(this,t,v,r,o)}}})}function d(t,e,n){function r(){$(),s&&(c?(n.hide(),e.draggable("option","grid",null),q(b,w)):(a(),n.css("display",""),e.draggable("option","grid",[C,E])))}function a(){var e;b&&(e=t.end?J(b,w,v("timeFormat")):Q(b,v("timeFormat")),n.text(e))}var o,i,s,l,c,d,u,p,g,m,y,b,w,D=f.getCoordinateGrid(),T=F(),C=N(),E=H(),S=O();e.draggable({sc