var stickySource = {id: 'stickySource', events: []};
var sources = [stickySource];
var rangeStart, rangeEnd;
var currentFetchID = 0;
var pendingSourceCnt = 0;
var pendingSourceCntBackground = 0;
var loadingLevel = 0;
var fetchTime = 0;
var fetchTiming = false;
var renderTime = 0;
var cache = [];
var fullCache = {};
var currentFilterId;
var cacheToleration = options.cacheToleration; // Retrieve a cached list of events that includes up to this many more days than the range we're looking for
if (longEvent(event)) { // if an event lasts a long time, put it in the all day slot
event.mostDay = true; // but we still want to indicate the beginning and ending times
event.allDay = true; // set this so that the event is treated like all day events (TO DO: in the case of editing events, check that events are properly dealt with)
function parseDate(s, ignoreTimezone) { // ignoreTimezone defaults to true
if (typeof s == 'object') { // already a Date object
return s;
}
if (typeof s == 'number') { // a UNIX timestamp
return new Date(s * 1000);
}
if (typeof s == 'string') {
if (s.match(/^\d+(\.\d+)?$/)) { // a UNIX timestamp
return new Date(parseFloat(s) * 1000);
}
if (ignoreTimezone === undefined) {
ignoreTimezone = true;
}
return parseISO8601(s, ignoreTimezone) || (s ? new Date(s) : null);
}
// TODO: never return invalid dates (like from new Date(<string>)), return null instead
return null;
}
var testParse = Date.parse('2014-05-15T09:34:36+02:00'); // Test for built-in support of parsing dates in ISO 8601 format.
var parseSupport;
if (testParse === 1400139276000) {
parseSupport = true;
} else {
parseSupport = false;
}
function parseISO8601(s, ignoreTimezone) { // ignoreTimezone defaults to false
// derived from http://delete.me.uk/2005/03/iso8601.html
// TODO: for a know glitch/feature, read tests/issue_206_parseDate_dst.html
if (parseSupport) {
var date = new Date(Date.parse(s));
//fixDate(date, false);
return date;
}
var m = s.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/);