From 5f119f19dbbfaf64a9e1d6658575b13f12893288 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Sat, 10 Sep 2011 16:17:48 +0200 Subject: minor --- public/media/js/fullcalendar.js | 708 +++++++++++++++++++++++++++------------- 1 file changed, 479 insertions(+), 229 deletions(-) (limited to 'public') diff --git a/public/media/js/fullcalendar.js b/public/media/js/fullcalendar.js index 73e6f35..9df34f4 100644 --- a/public/media/js/fullcalendar.js +++ b/public/media/js/fullcalendar.js @@ -1,18 +1,14 @@ /** - * @preserve - * FullCalendar v1.5.1 - * http://arshaw.com/fullcalendar/ - * - * Use fullcalendar.css for basic styling. - * For event drag & drop, requires jQuery UI draggable. - * For event resizing, requires jQuery UI resizable. - * - * Copyright (c) 2011 Adam Shaw - * Dual licensed under the MIT and GPL licenses, located in - * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. - * + * @preserve FullCalendar v1.5.1 http://arshaw.com/fullcalendar/ + * + * Use fullcalendar.css for basic styling. For event drag & drop, requires + * jQuery UI draggable. For event resizing, requires jQuery UI resizable. + * + * Copyright (c) 2011 Adam Shaw Dual licensed under the MIT and GPL licenses, + * located in MIT-LICENSE.txt and GPL-LICENSE.txt respectively. + * * Date: Sat Apr 9 14:09:51 2011 -0700 - * + * */ (function($, undefined) { @@ -31,9 +27,9 @@ var defaults = { weekends: true, // editing - //editable: false, - //disableDragging: false, - //disableResizing: false, + // editable: false, + // disableDragging: false, + // disableResizing: false, allDayDefault: true, ignoreTimezone: true, @@ -83,7 +79,7 @@ var defaults = { next: 'circle-triangle-e' }, - //selectable: false, + // selectable: false, unselectAuto: true, dropAccept: '*' @@ -141,7 +137,8 @@ $.fn.fullCalendar = function(options) { } - // would like to have this logic in EventManager, but needs to happen before options are recursively extended + // would like to have this logic in EventManager, but needs to happen before + // options are recursively extended var eventSources = options.eventSources || []; delete options.eventSources; if (options.events) { @@ -160,7 +157,8 @@ $.fn.fullCalendar = function(options) { this.each(function(i, _element) { var element = $(_element); var calendar = new Calendar(element, options, eventSources); - element.data('fullCalendar', calendar); // TODO: look into memory leak implications + element.data('fullCalendar', calendar); // TODO: look into memory leak + // implications calendar.render(); }); @@ -233,8 +231,10 @@ function Calendar(element, options, eventSources) { - /* Main Rendering - -----------------------------------------------------------------------------*/ + /* + * Main Rendering + * ----------------------------------------------------------------------------- + */ setYMD(date, options.year, options.month, options.date); @@ -270,18 +270,24 @@ function Calendar(element, options, eventSources) { } changeView(options.defaultView); $(window).resize(windowResize); - // needed for IE in a 0x0 iframe, b/c when it is resized, never triggers a windowResize + // needed for IE in a 0x0 iframe, b/c when it is resized, never triggers + // a windowResize if (!bodyVisible()) { lateRender(); } } - // called when we know the calendar couldn't be rendered when it was initialized, + // called when we know the calendar couldn't be rendered when it was + // initialized, // but we think it's ready now function lateRender() { - setTimeout(function() { // IE7 needs this so dimensions are calculated correctly - if (!currentView.start && bodyVisible()) { // !currentView.start makes sure this never happens more than once + setTimeout(function() { // IE7 needs this so dimensions are calculated + // correctly + if (!currentView.start && bodyVisible()) { // !currentView.start + // makes sure this never + // happens more than + // once renderView(); } },0); @@ -308,14 +314,19 @@ function Calendar(element, options, eventSources) { - /* View Rendering - -----------------------------------------------------------------------------*/ + /* + * View Rendering + * ----------------------------------------------------------------------------- + */ - // TODO: improve view switching (still weird transition in IE, and FF has whiteout problem) + // TODO: improve view switching (still weird transition in IE, and FF has + // whiteout problem) function changeView(newViewName) { if (!currentView || newViewName != currentView.name) { - ignoreWindowResize++; // because setMinHeight might change the height before render (and subsequently setSize) is reached + ignoreWindowResize++; // because setMinHeight might change the + // height before render (and subsequently + // setSize) is reached unselect(); @@ -323,11 +334,16 @@ function Calendar(element, options, eventSources) { var newViewElement; if (oldView) { - (oldView.beforeHide || noop)(); // called before changing min-height. if called after, scroll state is reset (in Opera) + (oldView.beforeHide || noop)(); // called before changing + // min-height. if called after, + // scroll state is reset (in + // Opera) setMinHeight(content, content.height()); oldView.element.hide(); }else{ - setMinHeight(content, 1); // needs to be 1 (not 0) for IE7, or else view dimensions miscalculated + setMinHeight(content, 1); // needs to be 1 (not 0) for IE7, or + // else view dimensions + // miscalculated } content.css('overflow', 'hidden'); @@ -348,7 +364,9 @@ function Calendar(element, options, eventSources) { } header.activateButton(newViewName); - renderView(); // after height has been set, will make absoluteViewElement's position=relative, then set to null + renderView(); // after height has been set, will make + // absoluteViewElement's position=relative, then set + // to null content.css('overflow', ''); if (oldView) { @@ -356,7 +374,10 @@ function Calendar(element, options, eventSources) { } if (!newViewElement) { - (currentView.afterShow || noop)(); // called after setting min-height/overflow, so in final scroll state (for Opera) + (currentView.afterShow || noop)(); // called after setting + // min-height/overflow, so + // in final scroll state + // (for Opera) } ignoreWindowResize--; @@ -367,7 +388,9 @@ function Calendar(element, options, eventSources) { function renderView(inc) { if (elementVisible()) { - ignoreWindowResize++; // because renderEvents might temporarily change the height before setSize is reached + ignoreWindowResize++; // because renderEvents might temporarily + // change the height before setSize is + // reached unselect(); @@ -377,8 +400,10 @@ function Calendar(element, options, eventSources) { var forceEventRender = false; if (!currentView.start || inc || date < currentView.start || date >= currentView.end) { - // view must render an entire new date range (and refetch/render events) - currentView.render(date, inc || 0); // responsible for clearing events + // view must render an entire new date range (and refetch/render + // events) + currentView.render(date, inc || 0); // responsible for clearing + // events setSize(true); forceEventRender = true; } @@ -413,8 +438,10 @@ function Calendar(element, options, eventSources) { - /* Resizing - -----------------------------------------------------------------------------*/ + /* + * Resizing + * ----------------------------------------------------------------------------- + */ function updateSize() { @@ -469,7 +496,9 @@ function Calendar(element, options, eventSources) { setTimeout(function() { // add a delay if (uid == resizeUID && !ignoreWindowResize && elementVisible()) { if (elementOuterWidth != (elementOuterWidth = element.outerWidth())) { - ignoreWindowResize++; // in case the windowResize callback changes the height + ignoreWindowResize++; // in case the windowResize + // callback changes the + // height updateSize(); currentView.trigger('windowResize', _element); ignoreWindowResize--; @@ -477,7 +506,8 @@ function Calendar(element, options, eventSources) { } }, 200); }else{ - // calendar must have been initialized in a 0x0 iframe that has just been resized + // calendar must have been initialized in a 0x0 iframe that has + // just been resized lateRender(); } } @@ -485,8 +515,10 @@ function Calendar(element, options, eventSources) { - /* Event Fetching/Rendering - -----------------------------------------------------------------------------*/ + /* + * Event Fetching/Rendering + * ----------------------------------------------------------------------------- + */ // fetches events if necessary, rerenders events if necessary (or if forced) @@ -501,7 +533,8 @@ function Calendar(element, options, eventSources) { function refetchEvents() { - fetchEvents(currentView.visStart, currentView.visEnd); // will call reportEvents + fetchEvents(currentView.visStart, currentView.visEnd); // will call + // reportEvents } @@ -537,8 +570,10 @@ function Calendar(element, options, eventSources) { - /* Selection - -----------------------------------------------------------------------------*/ + /* + * Selection + * ----------------------------------------------------------------------------- + */ function select(start, end, allDay) { @@ -554,8 +589,10 @@ function Calendar(element, options, eventSources) { - /* Date - -----------------------------------------------------------------------------*/ + /* + * Date + * ----------------------------------------------------------------------------- + */ function prev() { @@ -616,8 +653,10 @@ function Calendar(element, options, eventSources) { - /* Misc - -----------------------------------------------------------------------------*/ + /* + * Misc + * ----------------------------------------------------------------------------- + */ function getView() { @@ -647,8 +686,10 @@ function Calendar(element, options, eventSources) { - /* External Dragging - ------------------------------------------------------------------------*/ + /* + * External Dragging + * ------------------------------------------------------------------------ + */ if (options.droppable) { $(document) @@ -734,17 +775,29 @@ function Header(calendar, options) { }else{ var buttonClick; if (calendar[buttonName]) { - buttonClick = calendar[buttonName]; // calendar method + buttonClick = calendar[buttonName]; // calendar + // method } else if (fcViews[buttonName]) { buttonClick = function() { - button.removeClass(tm + '-state-hover'); // forget why + button.removeClass(tm + '-state-hover'); // forget + // why calendar.changeView(buttonName); }; } if (buttonClick) { - var icon = options.theme ? smartProperty(options.buttonIcons, buttonName) : null; // why are we using smartProperty here? - var text = smartProperty(options.buttonText, buttonName); // why are we using smartProperty here? + var icon = options.theme ? smartProperty(options.buttonIcons, buttonName) : null; // why + // are + // we + // using + // smartProperty + // here? + var text = smartProperty(options.buttonText, buttonName); // why + // are + // we + // using + // smartProperty + // here? var button = $( "" + "" + @@ -888,8 +941,10 @@ function EventManager(options, _sources) { - /* Fetching - -----------------------------------------------------------------------------*/ + /* + * Fetching + * ----------------------------------------------------------------------------- + */ function isFetchNeeded(start, end) { @@ -1003,15 +1058,18 @@ function EventManager(options, _sources) { - /* Sources - -----------------------------------------------------------------------------*/ + /* + * Sources + * ----------------------------------------------------------------------------- + */ function addEventSource(source) { source = _addEventSource(source); if (source) { pendingSourceCnt++; - fetchEventSource(source, currentFetchID); // will eventually call reportEvents + fetchEventSource(source, currentFetchID); // will eventually call + // reportEvents } } @@ -1044,8 +1102,10 @@ function EventManager(options, _sources) { - /* Manipulation - -----------------------------------------------------------------------------*/ + /* + * Manipulation + * ----------------------------------------------------------------------------- + */ function updateEvent(event) { // update an existing event @@ -1053,8 +1113,19 @@ function EventManager(options, _sources) { defaultEventEnd = getView().defaultEventEnd, // getView??? startDelta = event.start - event._start, endDelta = event.end ? - (event.end - (event._end || defaultEventEnd(event))) // event._end would be null if event.end - : 0; // was null and event was just resized + (event.end - (event._end || defaultEventEnd(event))) // event._end + // would + // be + // null + // if + // event.end + : 0; // was + // null + // and + // event + // was + // just + // resized for (i=0; i)), return null instead + // TODO: never return invalid dates (like from new Date()), return + // null instead return null; } @@ -1463,8 +1547,10 @@ function parseTime(s) { // returns minutes since start of day -/* Date Formatting ------------------------------------------------------------------------------*/ +/* + * Date Formatting + * ----------------------------------------------------------------------------- + */ // TODO: use same function formatDate(date, [date2], format, [options]) @@ -1589,8 +1675,10 @@ var dateFormatters = { fc.applyAll = applyAll; -/* Event Date Math ------------------------------------------------------------------------------*/ +/* + * Event Date Math + * ----------------------------------------------------------------------------- + */ function exclEndDay(event) { @@ -1619,8 +1707,10 @@ function segsCollide(seg1, seg2) { -/* Event Sorting ------------------------------------------------------------------------------*/ +/* + * Event Sorting + * ----------------------------------------------------------------------------- + */ // event rendering utilities @@ -1698,8 +1788,10 @@ function stackSegs(segs) { -/* Event Element Binding ------------------------------------------------------------------------------*/ +/* + * Event Element Binding + * ----------------------------------------------------------------------------- + */ function lazySegBind(container, segs, bindHandlers) { @@ -1722,8 +1814,10 @@ function lazySegBind(container, segs, bindHandlers) { -/* Element Dimensions ------------------------------------------------------------------------------*/ +/* + * Element Dimensions + * ----------------------------------------------------------------------------- + */ function setOuterWidth(element, width, includeMargins) { @@ -1801,12 +1895,14 @@ function setMinHeight(element, height) { -/* Misc Utils ------------------------------------------------------------------------------*/ +/* + * Misc Utils + * ----------------------------------------------------------------------------- + */ -//TODO: arraySlice -//TODO: isFunction, grep ? +// TODO: arraySlice +// TODO: isFunction, grep ? function noop() { } @@ -1827,7 +1923,8 @@ function zeroPad(n) { } -function smartProperty(obj, name) { // get a camel-cased/namespaced property of an object +function smartProperty(obj, name) { // get a camel-cased/namespaced property of + // an object if (obj[name] !== undefined) { return obj[name]; } @@ -1867,13 +1964,9 @@ function disableTextSelection(element) { /* -function enableTextSelection(element) { - element - .attr('unselectable', 'off') - .css('MozUserSelect', '') - .unbind('selectstart.ui'); -} -*/ + * function enableTextSelection(element) { element .attr('unselectable', 'off') + * .css('MozUserSelect', '') .unbind('selectstart.ui'); } + */ function markFirstLast(e) { @@ -2066,7 +2159,7 @@ function BasicWeekView(element, calendar) { fcViews.basicDay = BasicDayView; -//TODO: when calendar's date starts out on a weekend, shouldn't happen +// TODO: when calendar's date starts out on a weekend, shouldn't happen function BasicDayView(element, calendar) { @@ -2179,8 +2272,9 @@ function BasicView(element, calendar, viewName) { - /* Rendering - ------------------------------------------------------------*/ + /* + * Rendering ------------------------------------------------------------ + */ disableTextSelection(element.addClass('fc-grid')); @@ -2231,7 +2325,8 @@ function BasicView(element, calendar, viewName) { ""; for (i=0; i"; // need fc- for setDayID + ""; // need fc- for + // setDayID } s += "" + @@ -2242,7 +2337,10 @@ function BasicView(element, calendar, viewName) { ""; for (j=0; j" + // need fc- for setDayID + "" + // need + // fc- + // for + // setDayID "
" + (showNumbers ? "
" : @@ -2272,7 +2370,8 @@ function BasicView(element, calendar, viewName) { markFirstLast(head.add(head.find('tr'))); // marks first+last tr/th's markFirstLast(bodyRows); // marks first+last td's - bodyRows.eq(0).addClass('fc-first'); // fc-last is done in updateCells + bodyRows.eq(0).addClass('fc-first'); // fc-last is done in + // updateCells dayBind(bodyCells); @@ -2284,7 +2383,9 @@ function BasicView(element, calendar, viewName) { function updateCells(firstTime) { - var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating? + var dowDirty = firstTime || rowCnt == 1; // could the cells' + // day-of-weeks need + // updating? var month = t.start.getMonth(); var today = clearTime(new Date()); var cell; @@ -2373,8 +2474,10 @@ function BasicView(element, calendar, viewName) { - /* Day clicking and binding - -----------------------------------------------------------*/ + /* + * Day clicking and binding + * ----------------------------------------------------------- + */ function dayBind(days) { @@ -2384,8 +2487,12 @@ function BasicView(element, calendar, viewName) { function dayClick(ev) { - if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick - var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data + if (!opt('selectable')) { // if selectable, SelectionManager will + // worry about dayClick + var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: + // maybe + // use + // .data var date = indexDate(index); trigger('dayClick', this, date, true, ev); } @@ -2393,11 +2500,15 @@ function BasicView(element, calendar, viewName) { - /* Semi-transparent Overlay Helpers - ------------------------------------------------------*/ + /* + * Semi-transparent Overlay Helpers + * ------------------------------------------------------ + */ - function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive + function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd + // is + // exclusive if (refreshCoordinateGrid) { coordinateGrid.build(); } @@ -2425,15 +2536,18 @@ function BasicView(element, calendar, viewName) { } - function renderCellOverlay(row0, col0, row1, col1) { // row1,col1 is inclusive + function renderCellOverlay(row0, col0, row1, col1) { // row1,col1 is + // inclusive var rect = coordinateGrid.rect(row0, col0, row1, col1, element); return renderOverlay(rect, element); } - /* Selection - -----------------------------------------------------------------------*/ + /* + * Selection + * ----------------------------------------------------------------------- + */ function defaultSelectionEnd(startDate, allDay) { @@ -2442,7 +2556,9 @@ function BasicView(element, calendar, viewName) { function renderSelection(startDate, endDate, allDay) { - renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild every time??? + renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild + // every + // time??? } @@ -2459,8 +2575,10 @@ function BasicView(element, calendar, viewName) { - /* External Dragging - -----------------------------------------------------------------------*/ + /* + * External Dragging + * ----------------------------------------------------------------------- + */ function dragStart(_dragElement, ev, ui) { @@ -2484,8 +2602,9 @@ function BasicView(element, calendar, viewName) { - /* Utilities - --------------------------------------------------------*/ + /* + * Utilities -------------------------------------------------------- + */ function defaultEventEnd(event) { @@ -2601,7 +2720,7 @@ function BasicEventRenderer() { DayEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; - //var setOverflowHidden = t.setOverflowHidden; + // var setOverflowHidden = t.setOverflowHidden; var isEventDraggable = t.isEventDraggable; var isEventResizable = t.isEventResizable; var reportEvents = t.reportEvents; @@ -2621,8 +2740,10 @@ function BasicEventRenderer() { - /* Rendering - --------------------------------------------------------------------*/ + /* + * Rendering + * -------------------------------------------------------------------- + */ function renderEvents(events, modifiedEventId) { @@ -2673,13 +2794,16 @@ function BasicEventRenderer() { resizableDayEvent(event, eventElement, seg); } eventElementHandlers(event, eventElement); - // needs to be after, because resizableDayEvent might stopImmediatePropagation on click + // needs to be after, because resizableDayEvent might + // stopImmediatePropagation on click } - /* Dragging - ----------------------------------------------------------------------------*/ + /* + * Dragging + * ---------------------------------------------------------------------------- + */ function draggableDayEvent(event, eventElement) { @@ -2697,14 +2821,14 @@ function BasicEventRenderer() { eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta); clearOverlays(); if (cell) { - //setOverflowHidden(true); + // setOverflowHidden(true); dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1); renderDayOverlay( addDays(cloneDate(event.start), dayDelta), addDays(exclEndDay(event), dayDelta) ); }else{ - //setOverflowHidden(false); + // setOverflowHidden(false); dayDelta = 0; } }, ev, 'drag'); @@ -2716,10 +2840,11 @@ function BasicEventRenderer() { if (dayDelta) { eventDrop(this, event, dayDelta, 0, event.allDay, ev, ui); }else{ - eventElement.css('filter', ''); // clear IE opacity side-effects + eventElement.css('filter', ''); // clear IE opacity + // side-effects showEvents(event, eventElement); } - //setOverflowHidden(false); + // setOverflowHidden(false); } }); } @@ -2934,8 +3059,10 @@ function AgendaView(element, calendar, viewName) { - /* Rendering - -----------------------------------------------------------------------------*/ + /* + * Rendering + * ----------------------------------------------------------------------------- + */ disableTextSelection(element.addClass('fc-agenda')); @@ -2989,7 +3116,10 @@ function AgendaView(element, calendar, viewName) { " "; for (i=0; i"; // fc- needed for setDayID + ""; // fc- + // needed + // for + // setDayID } s += " " + @@ -3000,7 +3130,10 @@ function AgendaView(element, calendar, viewName) { " "; for (i=0; i" + // fc- needed for setDayID + "" + // fc- + // needed + // for + // setDayID "
" + "
" + "
 
" + @@ -3147,7 +3280,8 @@ function AgendaView(element, calendar, viewName) { var allDayHeight = slotScroller.position().top; // including divider var bodyHeight = Math.min( // total body height, including borders height - headHeight, // when scrollbars - slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border + slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 + // for bottom border ); dayBodyFirstCellStretcher @@ -3180,8 +3314,10 @@ function AgendaView(element, calendar, viewName) { axisWidth ); - var slotTableWidth = slotScroller[0].clientWidth; // needs to be done after axisWidth (for IE7) - //slotTable.width(slotTableWidth); + var slotTableWidth = slotScroller[0].clientWidth; // needs to be done + // after axisWidth + // (for IE7) + // slotTable.width(slotTableWidth); gutterWidth = slotScroller.width() - slotTableWidth; if (gutterWidth) { @@ -3212,7 +3348,8 @@ function AgendaView(element, calendar, viewName) { slotScroller.scrollTop(top); } scroll(); - setTimeout(scroll, 0); // overrides any previous scroll state made by the browser + setTimeout(scroll, 0); // overrides any previous scroll state made by + // the browser } @@ -3227,8 +3364,10 @@ function AgendaView(element, calendar, viewName) { - /* Slot/Day clicking and binding - -----------------------------------------------------------------------*/ + /* + * Slot/Day clicking and binding + * ----------------------------------------------------------------------- + */ function dayBind(cells) { @@ -3244,10 +3383,14 @@ function AgendaView(element, calendar, viewName) { function slotClick(ev) { - if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick + if (!opt('selectable')) { // if selectable, SelectionManager will + // worry about dayClick var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth)); var date = colDate(col); - var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data + var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: + // maybe + // use + // data if (rowMatch) { var mins = parseInt(rowMatch[1]) * opt('slotMinutes'); var hours = Math.floor(mins/60); @@ -3262,11 +3405,15 @@ function AgendaView(element, calendar, viewName) { - /* Semi-transparent Overlay Helpers - -----------------------------------------------------*/ + /* + * Semi-transparent Overlay Helpers + * ----------------------------------------------------- + */ - function renderDayOverlay(startDate, endDate, refreshCoordinateGrid) { // endDate is exclusive + function renderDayOverlay(startDate, endDate, refreshCoordinateGrid) { // endDate + // is + // exclusive if (refreshCoordinateGrid) { coordinateGrid.build(); } @@ -3303,7 +3450,12 @@ function AgendaView(element, calendar, viewName) { var stretchEnd = new Date(Math.min(dayEnd, overlayEnd)); if (stretchStart < stretchEnd) { var col = i*dis+dit; - var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only use it for horizontal coords + var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only + // use + // it + // for + // horizontal + // coords var top = timePosition(dayStart, stretchStart); var bottom = timePosition(dayStart, stretchEnd); rect.top = top; @@ -3319,8 +3471,10 @@ function AgendaView(element, calendar, viewName) { - /* Coordinate Utilities - -----------------------------------------------------------------------------*/ + /* + * Coordinate Utilities + * ----------------------------------------------------------------------------- + */ coordinateGrid = new CoordinateGrid(function(rows, cols) { @@ -3413,8 +3567,10 @@ function AgendaView(element, calendar, viewName) { - // get the Y coordinate of the given time on the given day (both Date objects) - function timePosition(day, time) { // both date objects. day holds 00:00 of current day + // get the Y coordinate of the given time on the given day (both Date + // objects) + function timePosition(day, time) { // both date objects. day holds 00:00 of + // current day day = cloneDate(day, true); if (time < addMinutes(cloneDate(day), minMinute)) { return 0; @@ -3427,7 +3583,11 @@ function AgendaView(element, calendar, viewName) { slotI = Math.floor(minutes / slotMinutes), slotTop = slotTopCache[slotI]; if (slotTop === undefined) { - slotTop = slotTopCache[slotI] = slotTable.find('tr:eq(' + slotI + ') td div')[0].offsetTop; //.position().top; // need this optimization??? + slotTop = slotTopCache[slotI] = slotTable.find('tr:eq(' + slotI + ') td div')[0].offsetTop; // .position().top; + // // + // need + // this + // optimization??? } return Math.max(0, Math.round( slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes) @@ -3458,8 +3618,10 @@ function AgendaView(element, calendar, viewName) { - /* Selection - ---------------------------------------------------------------------------------*/ + /* + * Selection + * --------------------------------------------------------------------------------- + */ function defaultSelectionEnd(startDate, allDay) { @@ -3486,11 +3648,16 @@ function AgendaView(element, calendar, viewName) { coordinateGrid.build(); if (helperOption) { var col = dayDiff(startDate, t.visStart) * dis + dit; - if (col >= 0 && col < colCnt) { // only works when times are on same day - var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only for horizontal coords + if (col >= 0 && col < colCnt) { // only works when times are on same + // day + var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only + // for + // horizontal + // coords var top = timePosition(startDate, startDate); var bottom = timePosition(startDate, endDate); - if (bottom > top) { // protect against selections that are entirely before or after visible range + if (bottom > top) { // protect against selections that are + // entirely before or after visible range rect.top = top; rect.height = bottom - top; rect.left += 2; @@ -3522,7 +3689,11 @@ function AgendaView(element, calendar, viewName) { if (selectionHelper) { slotBind(selectionHelper); slotContent.append(selectionHelper); - setOuterWidth(selectionHelper, rect.width, true); // needs to be after appended + setOuterWidth(selectionHelper, rect.width, true); // needs + // to + // be + // after + // appended setOuterHeight(selectionHelper, rect.height, true); } } @@ -3543,7 +3714,8 @@ function AgendaView(element, calendar, viewName) { function slotSelectionMousedown(ev) { - if (ev.which == 1 && opt('selectable')) { // ev.which==1 means left mouse button + if (ev.which == 1 && opt('selectable')) { // ev.which==1 means left + // mouse button unselect(ev); var dates; hoverListener.start(function(cell, origCell) { @@ -3581,8 +3753,10 @@ function AgendaView(element, calendar, viewName) { - /* External Dragging - --------------------------------------------------------------------------------*/ + /* + * External Dragging + * -------------------------------------------------------------------------------- + */ function dragStart(_dragElement, ev, ui) { @@ -3628,7 +3802,7 @@ function AgendaEventRenderer() { DayEventRenderer.call(t); var opt = t.opt; var trigger = t.trigger; - //var setOverflowHidden = t.setOverflowHidden; + // var setOverflowHidden = t.setOverflowHidden; var isEventDraggable = t.isEventDraggable; var isEventResizable = t.isEventResizable; var eventEnd = t.eventEnd; @@ -3645,7 +3819,8 @@ function AgendaEventRenderer() { var colContentLeft = t.colContentLeft; var colContentRight = t.colContentRight; var renderDaySegs = t.renderDaySegs; - var resizableDayEvent = t.resizableDayEvent; // TODO: streamline binding architecture + var resizableDayEvent = t.resizableDayEvent; // TODO: streamline binding + // architecture var getColCnt = t.getColCnt; var getColWidth = t.getColWidth; var getSlotHeight = t.getSlotHeight; @@ -3663,8 +3838,10 @@ function AgendaEventRenderer() { - /* Rendering - ----------------------------------------------------------------------------*/ + /* + * Rendering + * ---------------------------------------------------------------------------- + */ function renderEvents(events, modifiedEventId) { @@ -3794,20 +3971,30 @@ function AgendaEventRenderer() { forward = seg.forward || 0; leftmost = colContentLeft(colI*dis + dit); availWidth = colContentRight(colI*dis + dit) - leftmost; - availWidth = Math.min(availWidth-6, availWidth*.95); // TODO: move this to CSS + availWidth = Math.min(availWidth-6, availWidth*.95); // TODO: + // move this + // to CSS if (levelI) { // indented and thin outerWidth = availWidth / (levelI + forward + 1); }else{ if (forward) { // moderately wide, aligned left still - outerWidth = ((availWidth / (forward + 1)) - (12/2)) * 2; // 12 is the predicted width of resizer = + outerWidth = ((availWidth / (forward + 1)) - (12/2)) * 2; // 12 + // is + // the + // predicted + // width + // of + // resizer + // = }else{ // can be entire width, aligned left outerWidth = availWidth; } } - left = leftmost + // leftmost possible + left = leftmost + // leftmost + // possible (availWidth / (levelI + forward + 1) * levelI) // indentation * dis + (rtl ? availWidth - outerWidth : 0); // rtl seg.top = top; @@ -3819,7 +4006,8 @@ function AgendaEventRenderer() { slotSegmentContainer[0].innerHTML = html; // faster than html() eventElements = slotSegmentContainer.children(); - // retrieve elements, run through eventRender callback, bind event handlers + // retrieve elements, run through eventRender callback, bind event + // handlers for (i=0; i" + - "   " + // makes hit area a lot better for IE6/7 + "   " + // makes hit area a lot better for + // IE6/7 "
"; } html += @@ -4836,7 +5061,10 @@ function DayEventRenderer() { var rowCnt = rowDivs.length; var tops = []; for (i=0; i selection for IE element - .mousedown(function(ev) { // prevent native selection for others + .mousedown(function(ev) { // prevent native selection for + // others ev.preventDefault(); }) .click(function(ev) { if (isResizing) { - ev.preventDefault(); // prevent link from being visited (only method that worked in IE6) - ev.stopImmediatePropagation(); // prevent fullcalendar eventClick handler from being called - // (eventElementHandlers needs to be bound after resizableDayEvent) + ev.preventDefault(); // prevent link from being visited + // (only method that worked in IE6) + ev.stopImmediatePropagation(); // prevent fullcalendar + // eventClick handler from + // being called + // (eventElementHandlers + // needs to be bound after + // resizableDayEvent) } }); @@ -4938,7 +5174,12 @@ function DayEventRenderer() { } } clearOverlays(); - renderDayOverlay(event.start, addDays(cloneDate(newEnd), 1)); // coordinate grid already rebuild at hoverListener.start + renderDayOverlay(event.start, addDays(cloneDate(newEnd), 1)); // coordinate + // grid + // already + // rebuild + // at + // hoverListener.start } }, ev); @@ -4953,7 +5194,8 @@ function DayEventRenderer() { } // otherwise, the drag handler already restored the old events - setTimeout(function() { // make this happen after the element's click event + setTimeout(function() { // make this happen after the element's + // click event isResizing = false; },0); } @@ -4964,7 +5206,7 @@ function DayEventRenderer() { } -//BUG: unselect needs to be triggered when events are dragged+dropped +// BUG: unselect needs to be triggered when events are dragged+dropped function SelectionManager() { var t = this; @@ -4995,7 +5237,9 @@ function SelectionManager() { $(document).mousedown(function(ev) { var ignore = opt('unselectCancel'); if (ignore) { - if ($(ev.target).parents(ignore).length) { // could be optimized to stop after first match + if ($(ev.target).parents(ignore).length) { // could be + // optimized to stop + // after first match return; } } @@ -5029,16 +5273,21 @@ function SelectionManager() { } - function daySelectionMousedown(ev) { // not really a generic manager method, oh well + function daySelectionMousedown(ev) { // not really a generic manager + // method, oh well var cellDate = t.cellDate; var cellIsAllDay = t.cellIsAllDay; var hoverListener = t.getHoverListener(); - var reportDayClick = t.reportDayClick; // this is hacky and sort of weird - if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button + var reportDayClick = t.reportDayClick; // this is hacky and sort of + // weird + if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse + // button unselect(ev); var _mousedownElement = this; var dates; - hoverListener.start(function(cell, origCell) { // TODO: maybe put cellDate/cellIsAllDay info in cell + hoverListener.start(function(cell, origCell) { // TODO: maybe put + // cellDate/cellIsAllDay + // info in cell clearSelection(); if (cell && cellIsAllDay(cell)) { dates = [ cellDate(origCell), cellDate(cell) ].sort(cmp); @@ -5133,7 +5382,8 @@ function CoordinateGrid(buildFunc) { }; - t.rect = function(row0, col0, row1, col1, originElement) { // row1,col1 is inclusive + t.rect = function(row0, col0, row1, col1, originElement) { // row1,col1 is + // inclusive var origin = originElement.offset(); return { top: rows[row0][0] - origin.top, -- cgit v1.2.3-55-g7522