more bugfixes for 1.4
This commit is contained in:
parent
9db94207cb
commit
0cf59ac85c
109
src/agenda.js
109
src/agenda.js
|
@ -5,9 +5,9 @@
|
||||||
setDefaults({
|
setDefaults({
|
||||||
allDayHeader: true,
|
allDayHeader: true,
|
||||||
allDayText: 'all-day',
|
allDayText: 'all-day',
|
||||||
|
firstHour: 6,
|
||||||
slotMinutes: 30,
|
slotMinutes: 30,
|
||||||
defaultEventMinutes: 120,
|
defaultEventMinutes: 120,
|
||||||
defaultScrollHour: 6,
|
|
||||||
axisFormat: 'h(:mm)tt',
|
axisFormat: 'h(:mm)tt',
|
||||||
timeFormat: {
|
timeFormat: {
|
||||||
agenda: 'h:mm{ - h:mm}'
|
agenda: 'h:mm{ - h:mm}'
|
||||||
|
@ -52,7 +52,7 @@ function Agenda(element, options, methods) {
|
||||||
|
|
||||||
var head, body, bodyContent, bodyTable, bg,
|
var head, body, bodyContent, bodyTable, bg,
|
||||||
colCnt,
|
colCnt,
|
||||||
timeWidth, colWidth, rowHeight, // todo: timeWidth -> axisWidth, rowHeight->slotHeight ?
|
axisWidth, colWidth, slotHeight, // todo: axisWidth -> axisWidth, slotHeight->slotHeight ?
|
||||||
cachedDaySegs, cachedSlotSegs,
|
cachedDaySegs, cachedSlotSegs,
|
||||||
tm, firstDay,
|
tm, firstDay,
|
||||||
rtl, dis, dit, // day index sign / translate
|
rtl, dis, dit, // day index sign / translate
|
||||||
|
@ -220,7 +220,7 @@ function Agenda(element, options, methods) {
|
||||||
|
|
||||||
updateSize();
|
updateSize();
|
||||||
|
|
||||||
scrollDate.setHours(options.defaultScrollHour);
|
scrollDate.setHours(options.firstHour);
|
||||||
body.scrollTop(timePosition(d0, scrollDate) + 1); // +1 for the border
|
body.scrollTop(timePosition(d0, scrollDate) + 1); // +1 for the border
|
||||||
|
|
||||||
fetchEvents(renderEvents);
|
fetchEvents(renderEvents);
|
||||||
|
@ -243,31 +243,31 @@ function Agenda(element, options, methods) {
|
||||||
bodyTable.width(contentWidth);
|
bodyTable.width(contentWidth);
|
||||||
|
|
||||||
// time-axis width
|
// time-axis width
|
||||||
timeWidth = 0;
|
axisWidth = 0;
|
||||||
setOuterWidth(
|
setOuterWidth(
|
||||||
head.find('tr:lt(2) th:first').add(body.find('tr:first th'))
|
head.find('tr:lt(2) th:first').add(body.find('tr:first th'))
|
||||||
.width('')
|
.width('')
|
||||||
.each(function() {
|
.each(function() {
|
||||||
timeWidth = Math.max(timeWidth, $(this).outerWidth());
|
axisWidth = Math.max(axisWidth, $(this).outerWidth());
|
||||||
})
|
})
|
||||||
.add(stripeTDs.eq(0)),
|
.add(stripeTDs.eq(0)),
|
||||||
timeWidth
|
axisWidth
|
||||||
);
|
);
|
||||||
|
|
||||||
// column width
|
// column width
|
||||||
colWidth = Math.floor((contentWidth - timeWidth) / colCnt);
|
colWidth = Math.floor((contentWidth - axisWidth) / colCnt);
|
||||||
setOuterWidth(stripeTDs.slice(0, -1), colWidth);
|
setOuterWidth(stripeTDs.slice(0, -1), colWidth);
|
||||||
setOuterWidth(topTDs.slice(1, -2), colWidth);
|
setOuterWidth(topTDs.slice(1, -2), colWidth);
|
||||||
setOuterWidth(topTDs.slice(-2, -1), contentWidth - timeWidth - colWidth*(colCnt-1));
|
setOuterWidth(topTDs.slice(-2, -1), contentWidth - axisWidth - colWidth*(colCnt-1));
|
||||||
|
|
||||||
bg.css({
|
bg.css({
|
||||||
top: head.find('tr').height(),
|
top: head.find('tr').height(),
|
||||||
left: timeWidth,
|
left: axisWidth,
|
||||||
width: contentWidth - timeWidth,
|
width: contentWidth - axisWidth,
|
||||||
height: element.height()
|
height: element.height()
|
||||||
});
|
});
|
||||||
|
|
||||||
rowHeight = body.find('tr:eq(1)').height(); // use second, first prob doesn't have a border
|
slotHeight = body.find('tr:first div').height() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function slotClick(ev) {
|
function slotClick(ev) {
|
||||||
|
@ -345,8 +345,9 @@ function Agenda(element, options, methods) {
|
||||||
if (options.allDayHeader) {
|
if (options.allDayHeader) {
|
||||||
var td = head.find('td'),
|
var td = head.find('td'),
|
||||||
tdInner = td.find('div div'),
|
tdInner = td.find('div div'),
|
||||||
top = tdInner.position().top,
|
tr = td.parent(),
|
||||||
rowHeight = 0,
|
top = safePosition(tdInner, td, tr, tr.parent()).top,
|
||||||
|
rowContentHeight = 0,
|
||||||
i, len=segRow.length, level,
|
i, len=segRow.length, level,
|
||||||
levelHeight,
|
levelHeight,
|
||||||
j, seg,
|
j, seg,
|
||||||
|
@ -377,16 +378,16 @@ function Agenda(element, options, methods) {
|
||||||
}
|
}
|
||||||
if (leftRounded) {
|
if (leftRounded) {
|
||||||
className += 'fc-corner-left ';
|
className += 'fc-corner-left ';
|
||||||
left = bg.find('td:eq('+(((leftDay-firstDay+colCnt)%colCnt)*dis+dit)+') div div').position().left + timeWidth;
|
left = bg.find('td:eq('+(((leftDay-firstDay+colCnt)%colCnt)*dis+dit)+') div div').position().left + axisWidth;
|
||||||
}else{
|
}else{
|
||||||
left = timeWidth;
|
left = axisWidth;
|
||||||
}
|
}
|
||||||
if (rightRounded) {
|
if (rightRounded) {
|
||||||
className += 'fc-corner-right ';
|
className += 'fc-corner-right ';
|
||||||
right = bg.find('td:eq('+(((rightDay-firstDay+colCnt)%colCnt)*dis+dit)+') div div');
|
right = bg.find('td:eq('+(((rightDay-firstDay+colCnt)%colCnt)*dis+dit)+') div div');
|
||||||
right = right.position().left + right.width() + timeWidth;
|
right = right.position().left + right.width() + axisWidth;
|
||||||
}else{
|
}else{
|
||||||
right = timeWidth + bg.width();
|
right = axisWidth + bg.width();
|
||||||
}
|
}
|
||||||
eventElement = $("<div class='" + className + event.className.join(' ') + "'/>")
|
eventElement = $("<div class='" + className + event.className.join(' ') + "'/>")
|
||||||
.append(anchorElement = $("<a/>")
|
.append(anchorElement = $("<a/>")
|
||||||
|
@ -421,9 +422,9 @@ function Agenda(element, options, methods) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
top += levelHeight;
|
top += levelHeight;
|
||||||
rowHeight += levelHeight;
|
rowContentHeight += levelHeight;
|
||||||
}
|
}
|
||||||
tdInner.height(rowHeight);
|
tdInner.height(rowContentHeight);
|
||||||
updateSize(); // tdInner might have pushed the body down, so resize
|
updateSize(); // tdInner might have pushed the body down, so resize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -468,7 +469,7 @@ function Agenda(element, options, methods) {
|
||||||
width = availWidth * .96;
|
width = availWidth * .96;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
left = timeWidth + tdInner.position().left + // leftmost possible
|
left = axisWidth + tdInner.position().left + // leftmost possible
|
||||||
(availWidth / (levelI + forward + 1) * levelI) // indentation
|
(availWidth / (levelI + forward + 1) * levelI) // indentation
|
||||||
* dis + (rtl ? availWidth - width : 0); // rtl
|
* dis + (rtl ? availWidth - width : 0); // rtl
|
||||||
className = 'fc-event fc-event-vert ';
|
className = 'fc-event fc-event-vert ';
|
||||||
|
@ -480,16 +481,10 @@ function Agenda(element, options, methods) {
|
||||||
}
|
}
|
||||||
eventElement = $("<div class='" + className + event.className.join(' ') + "' />")
|
eventElement = $("<div class='" + className + event.className.join(' ') + "' />")
|
||||||
.append(anchorElement = $("<a><span class='fc-event-bg'/></a>")
|
.append(anchorElement = $("<a><span class='fc-event-bg'/></a>")
|
||||||
|
.append(timeElement = $("<span class='fc-event-time'/>")
|
||||||
|
.text(formatDates(event.start, event.end, view.option('timeFormat'))))
|
||||||
.append(titleElement = $("<span class='fc-event-title'/>")
|
.append(titleElement = $("<span class='fc-event-title'/>")
|
||||||
.text(event.title)))
|
.text(event.title)))
|
||||||
if (seg.isStart) {
|
|
||||||
// add the time header
|
|
||||||
anchorElement
|
|
||||||
.prepend(timeElement = $("<span class='fc-event-time'/>")
|
|
||||||
.text(formatDates(event.start, event.end, view.option('timeFormat'))))
|
|
||||||
}else{
|
|
||||||
timeElement = null;
|
|
||||||
}
|
|
||||||
if (event.url) {
|
if (event.url) {
|
||||||
anchorElement.attr('href', event.url);
|
anchorElement.attr('href', event.url);
|
||||||
}
|
}
|
||||||
|
@ -508,7 +503,7 @@ function Agenda(element, options, methods) {
|
||||||
.appendTo(bodyContent);
|
.appendTo(bodyContent);
|
||||||
setOuterWidth(eventElement, width, true);
|
setOuterWidth(eventElement, width, true);
|
||||||
setOuterHeight(eventElement, bottom-top, true);
|
setOuterHeight(eventElement, bottom-top, true);
|
||||||
if (timeElement && eventElement.height() - titleElement.position().top < 10) {
|
if (eventElement.height() - titleElement.position().top < 10) {
|
||||||
// event title doesn't have enough room, put next to the time
|
// event title doesn't have enough room, put next to the time
|
||||||
timeElement.text(formatDate(event.start, view.option('timeFormat')) + ' - ' + event.title);
|
timeElement.text(formatDate(event.start, view.option('timeFormat')) + ' - ' + event.title);
|
||||||
titleElement.remove();
|
titleElement.remove();
|
||||||
|
@ -572,7 +567,7 @@ function Agenda(element, options, methods) {
|
||||||
// convert event to temporary slot-event
|
// convert event to temporary slot-event
|
||||||
setOuterHeight(
|
setOuterHeight(
|
||||||
eventElement.width(colWidth - 10), // don't use entire width
|
eventElement.width(colWidth - 10), // don't use entire width
|
||||||
rowHeight * Math.round(
|
slotHeight * Math.round(
|
||||||
(event.end ? ((event.end - event.start)/MINUTE_MS) : options.defaultEventMinutes)
|
(event.end ? ((event.end - event.start)/MINUTE_MS) : options.defaultEventMinutes)
|
||||||
/options.slotMinutes)
|
/options.slotMinutes)
|
||||||
);
|
);
|
||||||
|
@ -607,13 +602,16 @@ function Agenda(element, options, methods) {
|
||||||
if (!cell || !dayDelta && !cell.rowDelta) {
|
if (!cell || !dayDelta && !cell.rowDelta) {
|
||||||
// over nothing (has reverted)
|
// over nothing (has reverted)
|
||||||
resetElement();
|
resetElement();
|
||||||
|
if ($.browser.msie) {
|
||||||
|
eventElement.css('filter', ''); // clear IE opacity side-effects
|
||||||
|
}
|
||||||
view.showEvents(event, eventElement);
|
view.showEvents(event, eventElement);
|
||||||
}else{
|
}else{
|
||||||
//eventElement.find('a').removeAttr('href'); // prevents safari from visiting the link
|
eventElement.find('a').removeAttr('href'); // prevents safari from visiting the link
|
||||||
view.eventDrop(
|
view.eventDrop(
|
||||||
this, event, dayDelta,
|
this, event, dayDelta,
|
||||||
allDay ? 0 : // minute delta
|
allDay ? 0 : // minute delta
|
||||||
Math.round((eventElement.offset().top - bodyContent.offset().top) / rowHeight)
|
Math.round((eventElement.offset().top - bodyContent.offset().top) / slotHeight)
|
||||||
* options.slotMinutes
|
* options.slotMinutes
|
||||||
- (event.start.getHours() * 60 + event.start.getMinutes()),
|
- (event.start.getHours() * 60 + event.start.getMinutes()),
|
||||||
allDay, ev, ui
|
allDay, ev, ui
|
||||||
|
@ -638,7 +636,7 @@ function Agenda(element, options, methods) {
|
||||||
eventElement.draggable({
|
eventElement.draggable({
|
||||||
zIndex: 9,
|
zIndex: 9,
|
||||||
scroll: false,
|
scroll: false,
|
||||||
grid: [colWidth, rowHeight],
|
grid: [colWidth, slotHeight],
|
||||||
axis: colCnt==1 ? 'y' : false,
|
axis: colCnt==1 ? 'y' : false,
|
||||||
opacity: view.option('dragOpacity'),
|
opacity: view.option('dragOpacity'),
|
||||||
revertDuration: options.dragRevertDuration,
|
revertDuration: options.dragRevertDuration,
|
||||||
|
@ -652,10 +650,8 @@ function Agenda(element, options, methods) {
|
||||||
resetElement = function() {
|
resetElement = function() {
|
||||||
// convert back to original slot-event
|
// convert back to original slot-event
|
||||||
if (allDay) {
|
if (allDay) {
|
||||||
if (timeElement) {
|
timeElement.css('display', ''); // show() was causing display=inline
|
||||||
timeElement.css('display', ''); // show() was causing display=inline
|
eventElement.draggable('option', 'grid', [colWidth, slotHeight]);
|
||||||
}
|
|
||||||
eventElement.draggable('option', 'grid', [colWidth, rowHeight]);
|
|
||||||
allDay = false;
|
allDay = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -667,9 +663,7 @@ function Agenda(element, options, methods) {
|
||||||
if (!allDay) {
|
if (!allDay) {
|
||||||
// convert to temporary all-day event
|
// convert to temporary all-day event
|
||||||
allDay = true;
|
allDay = true;
|
||||||
if (timeElement) {
|
timeElement.hide();
|
||||||
timeElement.hide();
|
|
||||||
}
|
|
||||||
eventElement.draggable('option', 'grid', null);
|
eventElement.draggable('option', 'grid', null);
|
||||||
}
|
}
|
||||||
view.showOverlay(cell);
|
view.showOverlay(cell);
|
||||||
|
@ -691,9 +685,9 @@ function Agenda(element, options, methods) {
|
||||||
matrix.mouse(ev.pageX, ev.pageY);
|
matrix.mouse(ev.pageX, ev.pageY);
|
||||||
},
|
},
|
||||||
drag: function(ev, ui) {
|
drag: function(ev, ui) {
|
||||||
slotDelta = Math.round((ui.position.top - origPosition.top) / rowHeight);
|
slotDelta = Math.round((ui.position.top - origPosition.top) / slotHeight);
|
||||||
if (slotDelta != prevSlotDelta) {
|
if (slotDelta != prevSlotDelta) {
|
||||||
if (timeElement && !allDay) {
|
if (!allDay) {
|
||||||
// update time header
|
// update time header
|
||||||
var minuteDelta = slotDelta*options.slotMinutes,
|
var minuteDelta = slotDelta*options.slotMinutes,
|
||||||
newStart = addMinutes(cloneDate(event.start), minuteDelta),
|
newStart = addMinutes(cloneDate(event.start), minuteDelta),
|
||||||
|
@ -726,7 +720,6 @@ function Agenda(element, options, methods) {
|
||||||
eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position
|
eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position
|
||||||
view.showEvents(event, eventElement);
|
view.showEvents(event, eventElement);
|
||||||
}else{
|
}else{
|
||||||
//TODO: eventElement.find('a').removeAttr('href'); // prevents safari from visiting the link
|
|
||||||
view.eventDrop(
|
view.eventDrop(
|
||||||
this, event, dayDelta,
|
this, event, dayDelta,
|
||||||
allDay ? 0 : slotDelta * options.slotMinutes, // minute delta
|
allDay ? 0 : slotDelta * options.slotMinutes, // minute delta
|
||||||
|
@ -752,7 +745,7 @@ function Agenda(element, options, methods) {
|
||||||
eventElement
|
eventElement
|
||||||
.resizable({
|
.resizable({
|
||||||
handles: 's',
|
handles: 's',
|
||||||
grid: rowHeight,
|
grid: slotHeight,
|
||||||
start: function(ev, ui) {
|
start: function(ev, ui) {
|
||||||
slotDelta = prevSlotDelta = 0;
|
slotDelta = prevSlotDelta = 0;
|
||||||
view.hideEvents(event, eventElement);
|
view.hideEvents(event, eventElement);
|
||||||
|
@ -764,18 +757,16 @@ function Agenda(element, options, methods) {
|
||||||
},
|
},
|
||||||
resize: function(ev, ui) {
|
resize: function(ev, ui) {
|
||||||
// don't rely on ui.size.height, doesn't take grid into account
|
// don't rely on ui.size.height, doesn't take grid into account
|
||||||
slotDelta = Math.round((Math.max(rowHeight, eventElement.height()) - ui.originalSize.height) / rowHeight);
|
slotDelta = Math.round((Math.max(slotHeight, eventElement.height()) - ui.originalSize.height) / slotHeight);
|
||||||
if (slotDelta != prevSlotDelta) {
|
if (slotDelta != prevSlotDelta) {
|
||||||
if (timeElement) {
|
timeElement.text(
|
||||||
timeElement.text(
|
formatDates(
|
||||||
formatDates(
|
event.start,
|
||||||
event.start,
|
(!slotDelta && !event.end) ? null : // no change, so don't display time range
|
||||||
(!slotDelta && !event.end) ? null : // no change, so don't display time range
|
addMinutes(view.eventEnd(event), options.slotMinutes*slotDelta),
|
||||||
addMinutes(view.eventEnd(event), options.slotMinutes*slotDelta),
|
view.option('timeFormat')
|
||||||
view.option('timeFormat')
|
)
|
||||||
)
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
prevSlotDelta = slotDelta;
|
prevSlotDelta = slotDelta;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -812,8 +803,12 @@ function Agenda(element, options, methods) {
|
||||||
var slotMinutes = options.slotMinutes,
|
var slotMinutes = options.slotMinutes,
|
||||||
minutes = time.getHours()*60 + time.getMinutes(),
|
minutes = time.getHours()*60 + time.getMinutes(),
|
||||||
slotI = Math.floor(minutes / slotMinutes),
|
slotI = Math.floor(minutes / slotMinutes),
|
||||||
innerDiv = body.find('tr:eq(' + slotI + ') td div');
|
tr = body.find('tr:eq(' + slotI + ')'),
|
||||||
return Math.max(0, Math.round(innerDiv.position().top - 1 + rowHeight * ((minutes % slotMinutes) / slotMinutes)));
|
td = tr.find('td'),
|
||||||
|
innerDiv = td.find('div');
|
||||||
|
return Math.max(0, Math.round(
|
||||||
|
safePosition(innerDiv, td, tr, tr.parent()).top - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,10 @@ table.fc-header {
|
||||||
|
|
||||||
.fc-header .fc-no-right {
|
.fc-header .fc-no-right {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-header .fc-no-right a {
|
||||||
|
margin-right: 0;
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
47
src/grid.js
47
src/grid.js
|
@ -67,9 +67,7 @@ views.basicDay = function(element, options) {
|
||||||
|
|
||||||
// rendering bugs
|
// rendering bugs
|
||||||
|
|
||||||
var tdTopBug, trTopBug, tbodyTopBug,
|
var tdHeightBug, rtlLeftDiff;
|
||||||
tdHeightBug,
|
|
||||||
rtlLeftDiff;
|
|
||||||
|
|
||||||
|
|
||||||
function Grid(element, options, methods) {
|
function Grid(element, options, methods) {
|
||||||
|
@ -269,21 +267,13 @@ function Grid(element, options, methods) {
|
||||||
rowHeight1 = Math.floor(tbodyHeight / rowCnt);
|
rowHeight1 = Math.floor(tbodyHeight / rowCnt);
|
||||||
rowHeight2 = tbodyHeight - rowHeight1*(rowCnt-1);
|
rowHeight2 = tbodyHeight - rowHeight1*(rowCnt-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdTopBug == undefined) {
|
reportTBody(tbody);
|
||||||
// nasty bugs in opera 9.25
|
|
||||||
// position() returning relative to direct parent
|
|
||||||
var tr = tbody.find('tr:first'),
|
|
||||||
td = tr.find('td:first'),
|
|
||||||
trTop = tr.position().top,
|
|
||||||
tdTop = td.position().top;
|
|
||||||
tdTopBug = tdTop < 0;
|
|
||||||
trTopBug = trTop != tdTop;
|
|
||||||
tbodyTopBug = tbody.position().top != trTop;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tdHeightBug == undefined) {
|
if (tdHeightBug == undefined) {
|
||||||
// bug in firefox where cell height includes padding
|
// bug in firefox where cell height includes padding
|
||||||
|
var tr = tbody.find('tr:first'),
|
||||||
|
td = tr.find('td:first');
|
||||||
td.height(rowHeight1);
|
td.height(rowHeight1);
|
||||||
tdHeightBug = rowHeight1 != td.height();
|
tdHeightBug = rowHeight1 != td.height();
|
||||||
}
|
}
|
||||||
|
@ -344,7 +334,7 @@ function Grid(element, options, methods) {
|
||||||
tr, td,
|
tr, td,
|
||||||
innerDiv,
|
innerDiv,
|
||||||
top,
|
top,
|
||||||
weekHeight,
|
rowContentHeight,
|
||||||
j, segs,
|
j, segs,
|
||||||
levelHeight,
|
levelHeight,
|
||||||
k, seg,
|
k, seg,
|
||||||
|
@ -359,17 +349,8 @@ function Grid(element, options, methods) {
|
||||||
tr = tbody.find('tr:eq('+i+')');
|
tr = tbody.find('tr:eq('+i+')');
|
||||||
td = tr.find('td:first');
|
td = tr.find('td:first');
|
||||||
innerDiv = td.find('div.fc-day-content div').css('position', 'relative');
|
innerDiv = td.find('div.fc-day-content div').css('position', 'relative');
|
||||||
top = innerDiv.position().top;
|
top = safePosition(innerDiv, td, tr, tbody).top;
|
||||||
if (tdTopBug) {
|
rowContentHeight = 0;
|
||||||
top -= td.position().top;
|
|
||||||
}
|
|
||||||
if (trTopBug) {
|
|
||||||
top += tr.position().top;
|
|
||||||
}
|
|
||||||
if (tbodyTopBug) {
|
|
||||||
top += tbody.position().top;
|
|
||||||
}
|
|
||||||
weekHeight = 0;
|
|
||||||
for (j=0; j<levels.length; j++) {
|
for (j=0; j<levels.length; j++) {
|
||||||
segs = levels[j];
|
segs = levels[j];
|
||||||
levelHeight = 0;
|
levelHeight = 0;
|
||||||
|
@ -444,10 +425,10 @@ function Grid(element, options, methods) {
|
||||||
levelHeight = Math.max(levelHeight, eventElement.outerHeight(true));
|
levelHeight = Math.max(levelHeight, eventElement.outerHeight(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
weekHeight += levelHeight;
|
rowContentHeight += levelHeight;
|
||||||
top += levelHeight;
|
top += levelHeight;
|
||||||
}
|
}
|
||||||
innerDiv.height(weekHeight);
|
innerDiv.height(rowContentHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +458,7 @@ function Grid(element, options, methods) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tbody.find('tr').each(function() {
|
tbody.find('tr').each(function() {
|
||||||
matrix.row(this, tbodyTopBug);
|
matrix.row(this);
|
||||||
});
|
});
|
||||||
var tds = tbody.find('tr:first td');
|
var tds = tbody.find('tr:first td');
|
||||||
if (rtl) {
|
if (rtl) {
|
||||||
|
@ -492,13 +473,13 @@ function Grid(element, options, methods) {
|
||||||
matrix.mouse(ev.pageX, ev.pageY);
|
matrix.mouse(ev.pageX, ev.pageY);
|
||||||
},
|
},
|
||||||
stop: function(ev, ui) {
|
stop: function(ev, ui) {
|
||||||
if ($.browser.msie) {
|
|
||||||
eventElement.css('filter', ''); // clear IE opacity side-effects
|
|
||||||
}
|
|
||||||
view.hideOverlay();
|
view.hideOverlay();
|
||||||
view.trigger('eventDragStop', eventElement, event, ev, ui);
|
view.trigger('eventDragStop', eventElement, event, ev, ui);
|
||||||
var cell = matrix.cell;
|
var cell = matrix.cell;
|
||||||
if (!cell || !cell.rowDelta && !cell.colDelta) {
|
if (!cell || !cell.rowDelta && !cell.colDelta) {
|
||||||
|
if ($.browser.msie) {
|
||||||
|
eventElement.css('filter', ''); // clear IE opacity side-effects
|
||||||
|
}
|
||||||
view.showEvents(event, eventElement);
|
view.showEvents(event, eventElement);
|
||||||
}else{
|
}else{
|
||||||
eventElement.find('a').removeAttr('href'); // prevents safari from visiting the link
|
eventElement.find('a').removeAttr('href'); // prevents safari from visiting the link
|
||||||
|
|
49
src/main.js
49
src/main.js
|
@ -210,15 +210,6 @@ $.fn.fullCalendar = function(options) {
|
||||||
});
|
});
|
||||||
unfixContentSize();
|
unfixContentSize();
|
||||||
view.date = cloneDate(date);
|
view.date = cloneDate(date);
|
||||||
if (header) {
|
|
||||||
// enable/disable 'today' button
|
|
||||||
var today = new Date();
|
|
||||||
if (today >= view.start && today < view.end) {
|
|
||||||
header.find('div.fc-button-today').addClass(tm + '-state-disabled');
|
|
||||||
}else{
|
|
||||||
header.find('div.fc-button-today').removeClass(tm + '-state-disabled');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (view.sizeDirty) {
|
else if (view.sizeDirty) {
|
||||||
view.updateSize();
|
view.updateSize();
|
||||||
|
@ -233,6 +224,13 @@ $.fn.fullCalendar = function(options) {
|
||||||
if (header) {
|
if (header) {
|
||||||
// update title text
|
// update title text
|
||||||
header.find('h2.fc-header-title').html(view.title);
|
header.find('h2.fc-header-title').html(view.title);
|
||||||
|
// enable/disable 'today' button
|
||||||
|
var today = new Date();
|
||||||
|
if (today >= view.start && today < view.end) {
|
||||||
|
header.find('div.fc-button-today').addClass(tm + '-state-disabled');
|
||||||
|
}else{
|
||||||
|
header.find('div.fc-button-today').removeClass(tm + '-state-disabled');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
view.sizeDirty = false;
|
view.sizeDirty = false;
|
||||||
view.eventsDirty = false;
|
view.eventsDirty = false;
|
||||||
|
@ -574,8 +572,8 @@ $.fn.fullCalendar = function(options) {
|
||||||
prevButton.addClass(tm + '-no-right');
|
prevButton.addClass(tm + '-no-right');
|
||||||
}
|
}
|
||||||
var button,
|
var button,
|
||||||
icon = options.theme ? viewOption(options, 'buttonIcons', buttonName) : null,
|
icon = options.theme ? smartProperty(options.buttonIcons, buttonName) : null,
|
||||||
text = viewOption(options, 'buttonText', buttonName);
|
text = smartProperty(options.buttonText, buttonName);
|
||||||
if (icon) {
|
if (icon) {
|
||||||
button = $("<div class='fc-button-" + buttonName + " ui-state-default'>" +
|
button = $("<div class='fc-button-" + buttonName + " ui-state-default'>" +
|
||||||
"<a><span class='ui-icon ui-icon-" + icon + "'/></a></div>");
|
"<a><span class='ui-icon ui-icon-" + icon + "'/></a></div>");
|
||||||
|
@ -586,7 +584,11 @@ $.fn.fullCalendar = function(options) {
|
||||||
}
|
}
|
||||||
if (button) {
|
if (button) {
|
||||||
button
|
button
|
||||||
.click(buttonClick)
|
.click(function() {
|
||||||
|
if (!button.hasClass(tm + '-state-disabled')) {
|
||||||
|
buttonClick();
|
||||||
|
}
|
||||||
|
})
|
||||||
.mousedown(function() {
|
.mousedown(function() {
|
||||||
button.addClass(tm + '-state-down');
|
button.addClass(tm + '-state-down');
|
||||||
})
|
})
|
||||||
|
@ -689,29 +691,6 @@ $.fn.fullCalendar = function(options) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: rename
|
|
||||||
|
|
||||||
function viewOption(options, property, viewName) {
|
|
||||||
var v = options[property];
|
|
||||||
if (typeof v == 'object') {
|
|
||||||
if (v[viewName] != undefined) {
|
|
||||||
return v[viewName];
|
|
||||||
}
|
|
||||||
var parts = viewName.split(/(?=[A-Z])/),
|
|
||||||
i=parts.length-1, res;
|
|
||||||
for (; i>=0; i--) {
|
|
||||||
res = v[parts[i].toLowerCase()];
|
|
||||||
if (res != undefined) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return v[''];
|
|
||||||
}
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Important Event Utilities
|
/* Important Event Utilities
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
43
src/util.js
43
src/util.js
|
@ -270,6 +270,29 @@ function setOuterHeight(element, height, includeMargins) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Position Calculation
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
// nasty bugs in opera 9.25
|
||||||
|
// position() returning relative to direct parent
|
||||||
|
|
||||||
|
var operaPositionBug;
|
||||||
|
|
||||||
|
function reportTBody(tbody) {
|
||||||
|
if (operaPositionBug == undefined) {
|
||||||
|
operaPositionBug = tbody.position().top != tbody.find('tr').position().top;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function safePosition(element, td, tr, tbody) {
|
||||||
|
var position = element.position();
|
||||||
|
if (operaPositionBug) {
|
||||||
|
position.top += tbody.position().top + tr.position().top - td.position().top;
|
||||||
|
}
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Hover Matrix
|
/* Hover Matrix
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -282,7 +305,9 @@ function HoverMatrix(changeCallback) {
|
||||||
|
|
||||||
this.row = function(e, topBug) {
|
this.row = function(e, topBug) {
|
||||||
prevRowE = $(e);
|
prevRowE = $(e);
|
||||||
tops.push(prevRowE.offset().top + (topBug ? prevRowE.parent().position().top : 0));
|
tops.push(prevRowE.offset().top + (
|
||||||
|
(operaPositionBug && prevRowE.is('tr')) ? prevRowE.parent().position().top : 0
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
this.col = function(e) {
|
this.col = function(e) {
|
||||||
|
@ -341,3 +366,19 @@ function zeroPad(n) {
|
||||||
return (n < 10 ? '0' : '') + n;
|
return (n < 10 ? '0' : '') + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function smartProperty(obj, name) { // get a camel-cased/namespaced property
|
||||||
|
if (obj[name] != undefined) {
|
||||||
|
return obj[name];
|
||||||
|
}
|
||||||
|
var parts = name.split(/(?=[A-Z])/),
|
||||||
|
i=parts.length-1, res;
|
||||||
|
for (; i>=0; i--) {
|
||||||
|
res = obj[parts[i].toLowerCase()];
|
||||||
|
if (res != undefined) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj[''];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,11 @@ var viewMethods = {
|
||||||
// get a property from the 'options' object, using smart view naming
|
// get a property from the 'options' object, using smart view naming
|
||||||
|
|
||||||
option: function(name, viewName) {
|
option: function(name, viewName) {
|
||||||
return viewOption(this.options, name, this.name || viewName);
|
var v = this.options[name];
|
||||||
|
if (typeof v == 'object') {
|
||||||
|
return smartProperty(v, viewName || this.name);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
$('#calendar').fullCalendar({
|
$('#calendar').fullCalendar({
|
||||||
header: {
|
header: {
|
||||||
left: 'prevYear,prev,next,nextYear today',
|
left: 'prev,next today',
|
||||||
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
|
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
|
||||||
},
|
},
|
||||||
editable: true,
|
editable: true,
|
||||||
|
|
Loading…
Reference in a new issue