it/itf/static/js/fullcalendar.min.js

16 lines
16 KiB
JavaScript
Raw Permalink Normal View History

2010-03-03 14:28:00 +00:00
/*
* FullCalendar v1.2
* http://arshaw.com/fullcalendar/
*
* use fullcalendar.css for basic styling
* requires jQuery UI core and draggables ONLY if you plan to do drag & drop
*
* Copyright (c) 2009 Adam Shaw
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Date: 2009-05-31 15:56:02 -0500 (Sun, 31 May 2009)
* Revision: 23
*/
(function(c){c.fn.fullCalendar=function(w){if(typeof w=="string"){var s=Array.prototype.slice.call(arguments,1);var r;this.each(function(){var y=c.data(this,"fullCalendar")[w].apply(this,s);if(typeof r=="undefined"){r=y}});if(typeof r!="undefined"){return r}return this}w=w||{};var t=w.rightToLeft;var m,l;if(t){m=-1;l=6;this.addClass("r2l")}else{m=1;l=0}var x=typeof w.showTime=="undefined"?"guess":w.showTime;var k=typeof w.buttons=="undefined"?true:w.buttons;var v=(w.weekStart||0)%7;var n=w.timeFormat||"gx";var p=w.titleFormat||(t?"Y F":"F Y");var o,j,q,u=true;this.each(function(){var at=w.year?new Date(w.year,w.month||0,1):new Date();var U,M;var L;var aE;var I=false;var V=[];var X=w.eventSources||[];if(w.events){X.push(w.events)}function ax(){aB();af()}function ae(){d(at,-1);ax()}function an(){d(at,1);ax()}function E(){at=new Date();ax()}function az(aF,aG){at=new Date(aF,aG,1);ax()}function aq(){h(at,-1);ax()}function y(){h(at,1);ax()}c.data(this,"fullCalendar",{refresh:ax,prevMonth:ae,nextMonth:an,today:E,gotoMonth:az,prevYear:aq,nextYear:y,addEvent:function(aF){V.push(f(aF));aB();B()},updateEvent:function(aJ){aJ.start=c.fullCalendar.parseDate(aJ.start);aJ.end=c.fullCalendar.parseDate(aJ.end);var aI=aJ.start-aJ._start;var aG=aJ.end-aJ.start;aJ._start=a(aJ.start);for(var aH=0;aH<V.length;aH++){var aK=V[aH];if(aK.id===aJ.id&&aK!==aJ){aK.start=new Date(aK.start.getTime()+aI);aK._start=a(aK.start);aK.end=new Date(aK.start.getTime()+aG);for(var aF in aJ){if(aF&&aF!="start"&&aF!="end"&&aF.charAt(0)!="_"){aK[aF]=aJ[aF]}}}}aB();B()},removeEvent:function(aJ){if(typeof aJ=="object"){aJ=aJ.id}var aI=[];for(var aH=0;aH<V.length;aH++){if(V[aH].id!==aJ){aI.push(V[aH])}}V=aI;for(var aH=0;aH<X.length;aH++){var aK=X[aH];if(typeof aK!="string"&&!c.isFunction(aK)){var aG=[];for(var aF=0;aF<aK.length;aF++){if(aK[aF].id!==aJ){aG.push(aK[aF])}}X[aH]=aG}}aB();B()},getEventsById:function(aH){var aG=[];for(var aF=0;aF<V.length;aF++){if(V[aF].id===aH){aG.push(V[aF])}}return aG},addEventSource:function(aF){X.push(aF);if(w.loading){w.loading(true)}G(aF,function(){if(w.loading){w.loading(false)}aB();B()})},removeEventSource:function(aI){var aH=[];for(var aF=0;aF<X.length;aF++){if(aI!==X[aF]){aH.push(X[aF])}}X=aH;var aG=[];for(var aF=0;aF<V.length;aF++){if(V[aF].source!==aI){aG.push(V[aF])}}V=aG;aB();B()}});var ad,z,ao,ay;var A=c("<div class='full-calendar-header'/>").appendTo(this);if(k){var ac=c("<div class='full-calendar-buttons'/>").appendTo(A);if(k==true||k.today!==false){z=c("<button class='today' />").append(c("<span />").html(typeof k.today=="string"?k.today:"today")).click(E);ac.append(z)}if(k.prevYear){var aC=c("<button class='prev-year' />").append(c("<span />").html(typeof k.prevYear=="string"?k.prevYear:"&laquo;")).click(aq);if(t){ac.prepend(aC)}else{ac.append(aC)}}if(k==true||k.prevMonth!==false){var aC=c("<button class='prev-month' />").append(c("<span />").html(typeof k.prevMonth=="string"?k.prevMonth:(t?"&gt;":"&lt;"))).click(ae);if(t){ac.prepend(aC)}else{ac.append(aC)}}if(k==true||k.nextMonth!==false){var aC=c("<button class='next-month' />").append(c("<span />").html(typeof k.nextMonth=="string"?k.nextMonth:(t?"&lt;":"&gt;"))).click(an);if(t){ac.prepend(aC)}else{ac.append(aC)}}if(k.nextYear){var aC=c("<button class='next-year' />").append(c("<span />").html(typeof k.nextYear=="string"?k.nextYear:"&raquo;")).click(y);if(t){ac.prepend(aC)}else{ac.append(aC)}}}if(w.title!==false){ad=c("<h2 class='full-calendar-title'/>").appendTo(A)}ao=c("<div class='full-calendar-month' style='position:relative'/>").appendTo(c("<div class='full-calendar-month-wrap'/>").appendTo(this));var aa,al,D;function af(){I=true;at.setDate(1);g(at);var aR=at.getFullYear();var aO=at.getMonth();var aL=c.fullCalendar.formatDate(at,p);if(ad){ad.text(aL)}g(at);U=a(at);i(U,-((U.getDay()-v+7)%7));M=a(at);d(M,1);i(M,(7-M.getDay()+v)%7);aE=Math.round((M.getTime()-U.getTime())/604800000);if(w.fixedWeeks!=false){i(M,(6-aE)*7);aE=6}L=g(new Date());if(z){if(L.getFullYear()==aR&&L.getMonth()==aO){z.css("visibility","hidden")}else{z.css("visibility","visible")}}var aF=c.full