made things more jslint-friendly (semicolons, operators, etc)
This commit is contained in:
parent
deed716b67
commit
226536478b
|
@ -191,9 +191,9 @@ function Agenda(element, options, methods) {
|
|||
for (i=0; d < maxd; i++) {
|
||||
minutes = d.getMinutes();
|
||||
s += "<tr class='" +
|
||||
(i==0 ? 'fc-first' : (minutes==0 ? '' : 'fc-minor')) +
|
||||
(!i ? 'fc-first' : (!minutes ? '' : 'fc-minor')) +
|
||||
"'><th class='fc-axis fc-leftmost " + tm + "-state-default'>" +
|
||||
((!slotNormal || minutes==0) ? formatDate(d, options.axisFormat) : ' ') +
|
||||
((!slotNormal || !minutes) ? formatDate(d, options.axisFormat) : ' ') +
|
||||
"</th><td class='fc-slot" + i + ' ' +
|
||||
tm + "-state-default'><div style='position:relative'> </div></td></tr>";
|
||||
addMinutes(d, options.slotMinutes);
|
||||
|
@ -216,7 +216,7 @@ function Agenda(element, options, methods) {
|
|||
s += "<td class='fc-" +
|
||||
dayIDs[d.getDay()] + ' ' + // needs to be first
|
||||
tm + '-state-default ' +
|
||||
(i==0 ? 'fc-leftmost ' : '') +
|
||||
(!i ? 'fc-leftmost ' : '') +
|
||||
(+d == +today ? tm + '-state-highlight fc-today' : 'fc-not-today') +
|
||||
"'><div class='fc-day-content'><div> </div></div></td>";
|
||||
addDays(d, dis);
|
||||
|
@ -264,7 +264,7 @@ function Agenda(element, options, methods) {
|
|||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function resetScroll() {
|
||||
|
@ -447,7 +447,7 @@ function Agenda(element, options, methods) {
|
|||
axisWidth,
|
||||
viewWidth,
|
||||
function() {
|
||||
return head.find('tr.fc-all-day')
|
||||
return head.find('tr.fc-all-day');
|
||||
},
|
||||
function(dayOfWeek) {
|
||||
return axisWidth + colContentPositions.left(day2col(dayOfWeek));
|
||||
|
@ -533,7 +533,7 @@ function Agenda(element, options, methods) {
|
|||
"<span class='fc-event-time'>" + htmlEscape(formatDates(event.start, event.end, view.option('timeFormat'))) + "</span>" +
|
||||
"<span class='fc-event-title'>" + htmlEscape(event.title) + "</span>" +
|
||||
"</a>" +
|
||||
((event.editable || event.editable == undefined && options.editable) && !options.disableResizing && $.fn.resizable ?
|
||||
((event.editable || event.editable === undefined && options.editable) && !options.disableResizing && $.fn.resizable ?
|
||||
"<div class='ui-resizable-handle ui-resizable-s'>=</div>"
|
||||
: '') +
|
||||
"</div>";
|
||||
|
@ -577,9 +577,9 @@ function Agenda(element, options, methods) {
|
|||
seg = segs[i];
|
||||
if (eventElement = seg.element) {
|
||||
val = vsideCache[key = seg.key = cssKey(eventElement[0])];
|
||||
seg.vsides = val == undefined ? (vsideCache[key] = vsides(eventElement[0], true)) : val;
|
||||
seg.vsides = val === undefined ? (vsideCache[key] = vsides(eventElement[0], true)) : val;
|
||||
val = hsideCache[key];
|
||||
seg.hsides = val == undefined ? (hsideCache[key] = hsides(eventElement[0], true)) : val;
|
||||
seg.hsides = val === undefined ? (hsideCache[key] = hsides(eventElement[0], true)) : val;
|
||||
titleSpan = eventElement.find('span.fc-event-title');
|
||||
if (titleSpan.length) {
|
||||
seg.titleTop = titleSpan[0].offsetTop;
|
||||
|
@ -594,7 +594,7 @@ function Agenda(element, options, methods) {
|
|||
eventElement[0].style.width = seg.outerWidth - seg.hsides + 'px';
|
||||
eventElement[0].style.height = (height = seg.outerHeight - seg.vsides) + 'px';
|
||||
event = seg.event;
|
||||
if (seg.titleTop != undefined && height - seg.titleTop < 10) {
|
||||
if (seg.titleTop !== undefined && height - seg.titleTop < 10) {
|
||||
// not enough room for title, put it in the time header
|
||||
eventElement.find('span.fc-event-time')
|
||||
.text(formatDate(event.start, view.option('timeFormat')) + ' - ' + event.title);
|
||||
|
@ -631,7 +631,7 @@ function Agenda(element, options, methods) {
|
|||
|
||||
function bindDaySegHandlers(event, eventElement, seg) {
|
||||
view.eventElementHandlers(event, eventElement);
|
||||
if (event.editable || event.editable == undefined && options.editable) {
|
||||
if (event.editable || event.editable === undefined && options.editable) {
|
||||
draggableDayEvent(event, eventElement, seg.isStart);
|
||||
if (seg.isEnd) {
|
||||
view.resizableDayEvent(event, eventElement, colWidth);
|
||||
|
@ -643,7 +643,7 @@ function Agenda(element, options, methods) {
|
|||
|
||||
function bindSlotSegHandlers(event, eventElement, seg) {
|
||||
view.eventElementHandlers(event, eventElement);
|
||||
if (event.editable || event.editable == undefined && options.editable) {
|
||||
if (event.editable || event.editable === undefined && options.editable) {
|
||||
var timeElement = eventElement.find('span.fc-event-time');
|
||||
draggableSlotEvent(event, eventElement, timeElement);
|
||||
if (seg.isEnd) {
|
||||
|
@ -936,7 +936,7 @@ function Agenda(element, options, methods) {
|
|||
minutes = time.getHours()*60 + time.getMinutes() - minMinute,
|
||||
slotI = Math.floor(minutes / slotMinutes),
|
||||
slotTop = slotTopCache[slotI];
|
||||
if (slotTop == undefined) {
|
||||
if (slotTop === undefined) {
|
||||
slotTop = slotTopCache[slotI] = body.find('tr:eq(' + slotI + ') td div')[0].offsetTop;
|
||||
}
|
||||
return Math.max(0, Math.round(
|
||||
|
|
20
src/grid.js
20
src/grid.js
|
@ -47,7 +47,7 @@ views.month = function(element, options) {
|
|||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
views.basicWeek = function(element, options) {
|
||||
return new Grid(element, options, {
|
||||
|
@ -99,7 +99,7 @@ views.basicDay = function(element, options) {
|
|||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// rendering bugs
|
||||
|
@ -119,7 +119,7 @@ function Grid(element, options, methods) {
|
|||
cachedEvents=[],
|
||||
segmentContainer,
|
||||
dayContentPositions = new HorizontalPositionCache(function(dayOfWeek) {
|
||||
return tbody.find('td:eq(' + ((dayOfWeek - Math.max(firstDay,nwe)+colCnt) % colCnt) + ') div div')
|
||||
return tbody.find('td:eq(' + ((dayOfWeek - Math.max(firstDay,nwe)+colCnt) % colCnt) + ') div div');
|
||||
}),
|
||||
// ...
|
||||
|
||||
|
@ -298,7 +298,7 @@ function Grid(element, options, methods) {
|
|||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function dayClick(ev) {
|
||||
|
@ -323,7 +323,7 @@ function Grid(element, options, methods) {
|
|||
rowHeight1 = Math.floor(tbodyHeight / rowCnt);
|
||||
rowHeight2 = tbodyHeight - rowHeight1*(rowCnt-1);
|
||||
}
|
||||
if (tdHeightBug == undefined) {
|
||||
if (tdHeightBug === undefined) {
|
||||
// bug in firefox where cell height includes padding
|
||||
var tr = tbody.find('tr:first'),
|
||||
td = tr.find('td:first');
|
||||
|
@ -431,7 +431,7 @@ function Grid(element, options, methods) {
|
|||
|
||||
function bindSegHandlers(event, eventElement, seg) {
|
||||
view.eventElementHandlers(event, eventElement);
|
||||
if (event.editable || event.editable == undefined && options.editable) {
|
||||
if (event.editable || event.editable === undefined && options.editable) {
|
||||
draggableEvent(event, eventElement);
|
||||
if (seg.isEnd) {
|
||||
view.resizableDayEvent(event, eventElement, colWidth);
|
||||
|
@ -500,7 +500,7 @@ function Grid(element, options, methods) {
|
|||
|
||||
// event resizing w/ 'view' methods...
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function _renderDaySegs(segs, rowCnt, view, minLeft, maxLeft, getRow, dayContentLeft, dayContentRight, segmentContainer, bindSegHandlers, modifiedEventId) {
|
||||
|
@ -556,7 +556,7 @@ function _renderDaySegs(segs, rowCnt, view, minLeft, maxLeft, getRow, dayContent
|
|||
:'') +
|
||||
"<span class='fc-event-title'>" + htmlEscape(event.title) + "</span>" +
|
||||
"</a>" +
|
||||
((event.editable || event.editable == undefined && options.editable) && !options.disableResizing && $.fn.resizable ?
|
||||
((event.editable || event.editable === undefined && options.editable) && !options.disableResizing && $.fn.resizable ?
|
||||
"<div class='ui-resizable-handle ui-resizable-" + (rtl ? 'w' : 'e') + "'></div>"
|
||||
: '') +
|
||||
"</div>";
|
||||
|
@ -601,7 +601,7 @@ function _renderDaySegs(segs, rowCnt, view, minLeft, maxLeft, getRow, dayContent
|
|||
seg = segs[i];
|
||||
if (eventElement = seg.element) {
|
||||
val = hsideCache[key = seg.key = cssKey(eventElement[0])];
|
||||
seg.hsides = val == undefined ? (hsideCache[key] = hsides(eventElement[0], true)) : val;
|
||||
seg.hsides = val === undefined ? (hsideCache[key] = hsides(eventElement[0], true)) : val;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -619,7 +619,7 @@ function _renderDaySegs(segs, rowCnt, view, minLeft, maxLeft, getRow, dayContent
|
|||
if (eventElement = seg.element) {
|
||||
val = vmarginCache[key = seg.key];
|
||||
seg.outerHeight = eventElement[0].offsetHeight + (
|
||||
val == undefined ? (vmarginCache[key] = vmargins(eventElement[0])) : val
|
||||
val === undefined ? (vmarginCache[key] = vmargins(eventElement[0])) : val
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
40
src/main.js
40
src/main.js
|
@ -94,7 +94,7 @@ var rtlDefaults = {
|
|||
// function for adding/overriding defaults
|
||||
var setDefaults = fc.setDefaults = function(d) {
|
||||
$.extend(true, defaults, d);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -111,12 +111,12 @@ $.fn.fullCalendar = function(options) {
|
|||
var data = $.data(this, 'fullCalendar');
|
||||
if (data) {
|
||||
var r = data[options].apply(this, args);
|
||||
if (res == undefined) {
|
||||
if (res === undefined) {
|
||||
res = r;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (res != undefined) {
|
||||
if (res !== undefined) {
|
||||
return res;
|
||||
}
|
||||
return this;
|
||||
|
@ -136,7 +136,7 @@ $.fn.fullCalendar = function(options) {
|
|||
// initialize options
|
||||
options = $.extend(true, {},
|
||||
defaults,
|
||||
(options.isRTL || options.isRTL==undefined && defaults.isRTL) ? rtlDefaults : {},
|
||||
(options.isRTL || options.isRTL===undefined && defaults.isRTL) ? rtlDefaults : {},
|
||||
options
|
||||
);
|
||||
var tm = options.theme ? 'ui' : 'fc'; // for making theme classes
|
||||
|
@ -171,16 +171,16 @@ $.fn.fullCalendar = function(options) {
|
|||
element.addClass('ui-widget');
|
||||
}
|
||||
|
||||
if (options.year != undefined && options.year != date.getFullYear()) {
|
||||
if (options.year !== undefined && options.year != date.getFullYear()) {
|
||||
date.setDate(1);
|
||||
date.setMonth(0);
|
||||
date.setFullYear(options.year);
|
||||
}
|
||||
if (options.month != undefined && options.month != date.getMonth()) {
|
||||
if (options.month !== undefined && options.month != date.getMonth()) {
|
||||
date.setDate(1);
|
||||
date.setMonth(options.month);
|
||||
}
|
||||
if (options.date != undefined) {
|
||||
if (options.date !== undefined) {
|
||||
date.setDate(options.date);
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ $.fn.fullCalendar = function(options) {
|
|||
if (elementVisible()) {
|
||||
ignoreWindowResize++; // because view.renderEvents might temporarily change the height before setSize is reached
|
||||
|
||||
if (suggestedViewHeight == undefined) {
|
||||
if (suggestedViewHeight === undefined) {
|
||||
calcSize();
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ $.fn.fullCalendar = function(options) {
|
|||
eventEnd = cloneDate(view.visEnd);
|
||||
var queued = eventSources.length,
|
||||
sourceDone = function() {
|
||||
if (--queued == 0) {
|
||||
if (!--queued) {
|
||||
if (callback) {
|
||||
callback(events);
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ $.fn.fullCalendar = function(options) {
|
|||
},
|
||||
|
||||
option: function(name, value) {
|
||||
if (value == undefined) {
|
||||
if (value === undefined) {
|
||||
return options[name];
|
||||
}
|
||||
if (name == 'height' || name == 'contentHeight' || name == 'aspectRatio') {
|
||||
|
@ -511,13 +511,13 @@ $.fn.fullCalendar = function(options) {
|
|||
if (typeof year == 'object') {
|
||||
date = cloneDate(year); // provided 1 argument, a Date
|
||||
}else{
|
||||
if (year != undefined) {
|
||||
if (year !== undefined) {
|
||||
date.setFullYear(year);
|
||||
}
|
||||
if (month != undefined) {
|
||||
if (month !== undefined) {
|
||||
date.setMonth(month);
|
||||
}
|
||||
if (dateNum != undefined) {
|
||||
if (dateNum !== undefined) {
|
||||
date.setDate(dateNum);
|
||||
}
|
||||
}
|
||||
|
@ -525,13 +525,13 @@ $.fn.fullCalendar = function(options) {
|
|||
},
|
||||
|
||||
incrementDate: function(years, months, days) {
|
||||
if (years != undefined) {
|
||||
if (years !== undefined) {
|
||||
addYears(date, years);
|
||||
}
|
||||
if (months != undefined) {
|
||||
if (months !== undefined) {
|
||||
addMonths(date, months);
|
||||
}
|
||||
if (days != undefined) {
|
||||
if (days !== undefined) {
|
||||
addDays(date, days);
|
||||
}
|
||||
render();
|
||||
|
@ -691,7 +691,7 @@ $.fn.fullCalendar = function(options) {
|
|||
else if (views[buttonName]) {
|
||||
buttonClick = function() {
|
||||
button.removeClass(tm + '-state-hover');
|
||||
changeView(buttonName)
|
||||
changeView(buttonName);
|
||||
};
|
||||
}
|
||||
if (buttonClick) {
|
||||
|
@ -807,7 +807,7 @@ $.fn.fullCalendar = function(options) {
|
|||
lateRender();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
$(window).resize(windowResize);
|
||||
|
||||
|
||||
|
@ -846,7 +846,7 @@ $.fn.fullCalendar = function(options) {
|
|||
var fakeID = 0;
|
||||
|
||||
function normalizeEvent(event, options) {
|
||||
event._id = event._id || (event.id == undefined ? '_fc' + fakeID++ : event.id + '');
|
||||
event._id = event._id || (event.id === undefined ? '_fc' + fakeID++ : event.id + '');
|
||||
if (event.date) {
|
||||
if (!event.start) {
|
||||
event.start = event.date;
|
||||
|
@ -859,7 +859,7 @@ function normalizeEvent(event, options) {
|
|||
event.end = null;
|
||||
}
|
||||
event._end = event.end ? cloneDate(event.end) : null;
|
||||
if (event.allDay == undefined) {
|
||||
if (event.allDay === undefined) {
|
||||
event.allDay = options.allDayDefault;
|
||||
}
|
||||
if (event.className) {
|
||||
|
|
41
src/util.js
41
src/util.js
|
@ -79,13 +79,13 @@ function zeroDate() { // returns a Date with time 00:00:00 and dateOfMonth=1
|
|||
var i=0, d;
|
||||
do {
|
||||
d = new Date(1970, i++, 1);
|
||||
} while (d.getHours() != 0);
|
||||
} while (d.getHours()); // != 0
|
||||
return d;
|
||||
}
|
||||
|
||||
function skipWeekend(date, inc, excl) {
|
||||
inc = inc || 1;
|
||||
while (date.getDay()==0 || (excl && date.getDay()==1 || !excl && date.getDay()==6)) {
|
||||
while (!date.getDay() || (excl && date.getDay()==1 || !excl && date.getDay()==6)) {
|
||||
addDays(date, inc);
|
||||
}
|
||||
return date;
|
||||
|
@ -111,7 +111,7 @@ var parseDate = fc.parseDate = function(s) {
|
|||
}
|
||||
// TODO: never return invalid dates (like from new Date(<string>)), return null instead
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
var parseISO8601 = fc.parseISO8601 = function(s, ignoreTimezone) {
|
||||
// derived from http://delete.me.uk/2005/03/iso8601.html
|
||||
|
@ -153,7 +153,7 @@ var parseISO8601 = fc.parseISO8601 = function(s, ignoreTimezone) {
|
|||
offset -= date.getTimezoneOffset();
|
||||
}
|
||||
return new Date(+date + (offset * 60 * 1000));
|
||||
}
|
||||
};
|
||||
|
||||
var parseTime = fc.parseTime = function(s) { // returns minutes since start of day
|
||||
if (typeof s == 'number') { // an hour
|
||||
|
@ -182,7 +182,7 @@ var parseTime = fc.parseTime = function(s) { // returns minutes since start of d
|
|||
|
||||
var formatDate = fc.formatDate = function(date, format, options) {
|
||||
return formatDates(date, null, format, options);
|
||||
}
|
||||
};
|
||||
|
||||
var formatDates = fc.formatDates = function(date1, date2, format, options) {
|
||||
options = options || defaults;
|
||||
|
@ -259,7 +259,7 @@ var formatDates = fc.formatDates = function(date1, date2, format, options) {
|
|||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
var dateFormatters = {
|
||||
s : function(d) { return d.getSeconds() },
|
||||
|
@ -287,7 +287,9 @@ var dateFormatters = {
|
|||
u : function(d) { return formatDate(d, "yyyy-MM-dd'T'HH:mm:ss'Z'") },
|
||||
S : function(d) {
|
||||
var date = d.getDate();
|
||||
if (date > 10 && date < 20) return 'th';
|
||||
if (date > 10 && date < 20) {
|
||||
return 'th';
|
||||
}
|
||||
return ['st', 'nd', 'rd'][date%10-1] || 'th';
|
||||
}
|
||||
};
|
||||
|
@ -359,7 +361,7 @@ function topCorrect(tr) { // tr/th/td or anything else
|
|||
if (tr.is('th,td')) {
|
||||
tr = (cell = tr).parent();
|
||||
}
|
||||
if (topBug == undefined && tr.is('tr')) {
|
||||
if (topBug === undefined && tr.is('tr')) {
|
||||
topBug = tr.position().top != tr.children().position().top;
|
||||
}
|
||||
if (topBug) {
|
||||
|
@ -393,14 +395,14 @@ function HoverMatrix(changeCallback) {
|
|||
};
|
||||
|
||||
t.mouse = function(x, y) {
|
||||
if (origRow == undefined) {
|
||||
if (origRow === undefined) {
|
||||
tops.push(tops[tops.length-1] + prevRowE.outerHeight());
|
||||
lefts.push(lefts[lefts.length-1] + prevColE.outerWidth());
|
||||
currRow = currCol = -1;
|
||||
}
|
||||
var r, c;
|
||||
for (r=0; r<tops.length && y>=tops[r]; r++) ;
|
||||
for (c=0; c<lefts.length && x>=lefts[c]; c++) ;
|
||||
for (r=0; r<tops.length && y>=tops[r]; r++) {}
|
||||
for (c=0; c<lefts.length && x>=lefts[c]; c++) {}
|
||||
r = r >= tops.length ? -1 : r - 1;
|
||||
c = c >= lefts.length ? -1 : c - 1;
|
||||
if (r != currRow || c != currCol) {
|
||||
|
@ -409,7 +411,7 @@ function HoverMatrix(changeCallback) {
|
|||
if (r == -1 || c == -1) {
|
||||
t.cell = null;
|
||||
}else{
|
||||
if (origRow == undefined) {
|
||||
if (origRow === undefined) {
|
||||
origRow = r;
|
||||
origCol = c;
|
||||
}
|
||||
|
@ -445,14 +447,14 @@ function zeroPad(n) {
|
|||
}
|
||||
|
||||
function smartProperty(obj, name) { // get a camel-cased/namespaced property of an object
|
||||
if (obj[name] != undefined) {
|
||||
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) {
|
||||
if (res !== undefined) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -465,7 +467,7 @@ function htmlEscape(s) {
|
|||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/"/g, '"');
|
||||
}
|
||||
|
||||
|
||||
|
@ -478,18 +480,15 @@ function HorizontalPositionCache(getElement) {
|
|||
rights = {};
|
||||
|
||||
function e(i) {
|
||||
return elements[i] =
|
||||
elements[i] || getElement(i);
|
||||
return elements[i] = elements[i] || getElement(i);
|
||||
}
|
||||
|
||||
t.left = function(i) {
|
||||
return lefts[i] =
|
||||
lefts[i] == undefined ? e(i).position().left : lefts[i];
|
||||
return lefts[i] = lefts[i] === undefined ? e(i).position().left : lefts[i];
|
||||
};
|
||||
|
||||
t.right = function(i) {
|
||||
return rights[i] =
|
||||
rights[i] == undefined ? t.left(i) + e(i).width() : rights[i];
|
||||
return rights[i] = rights[i] === undefined ? t.left(i) + e(i).width() : rights[i];
|
||||
};
|
||||
|
||||
t.clear = function() {
|
||||
|
|
|
@ -150,7 +150,7 @@ var viewMethods = {
|
|||
minuteDelta = minuteDelta || 0;
|
||||
for (var e, len=events.length, i=0; i<len; i++) {
|
||||
e = events[i];
|
||||
if (allDay != undefined) {
|
||||
if (allDay !== undefined) {
|
||||
e.allDay = allDay;
|
||||
}
|
||||
addMinutes(addDays(e.start, dayDelta, true), minuteDelta);
|
||||
|
@ -319,7 +319,7 @@ function lazySegBind(container, segs, bindHandlers) {
|
|||
e = parent;
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
if ((i = e._fci) != undefined) {
|
||||
if ((i = e._fci) !== undefined) {
|
||||
e._fci = undefined;
|
||||
seg = segs[i];
|
||||
bindHandlers(seg.event, seg.element, seg);
|
||||
|
|
Loading…
Reference in a new issue