|
|
@@ -1,5 +1,5 @@
|
|
|
/*!
|
|
|
- * FullCalendar v2.0.1
|
|
|
+ * FullCalendar v2.0.2
|
|
|
* Docs & License: http://arshaw.com/fullcalendar/
|
|
|
* (c) 2013 Adam Shaw
|
|
|
*/
|
|
|
@@ -166,7 +166,7 @@ var rtlDefaults = {
|
|
|
|
|
|
;;
|
|
|
|
|
|
-var fc = $.fullCalendar = { version: "2.0.1" };
|
|
|
+var fc = $.fullCalendar = { version: "2.0.2" };
|
|
|
var fcViews = fc.views = {};
|
|
|
|
|
|
|
|
|
@@ -1334,11 +1334,21 @@ function EventManager(options) { // assumed to be a calendar
|
|
|
|
|
|
function fetchEventSource(source, fetchID) {
|
|
|
_fetchEventSource(source, function(events) {
|
|
|
+ var isArraySource = $.isArray(source.events);
|
|
|
+ var i;
|
|
|
+ var event;
|
|
|
+
|
|
|
if (fetchID == currentFetchID) {
|
|
|
|
|
|
if (events) {
|
|
|
- for (var i=0; i<events.length; i++) {
|
|
|
- var event = buildEvent(events[i], source);
|
|
|
+ for (i=0; i<events.length; i++) {
|
|
|
+ event = events[i];
|
|
|
+
|
|
|
+ // event array sources have already been convert to Event Objects
|
|
|
+ if (!isArraySource) {
|
|
|
+ event = buildEvent(event, source);
|
|
|
+ }
|
|
|
+
|
|
|
if (event) {
|
|
|
cache.push(event);
|
|
|
}
|
|
|
@@ -1472,6 +1482,7 @@ function EventManager(options) { // assumed to be a calendar
|
|
|
function addEventSource(sourceInput) {
|
|
|
var source = buildEventSource(sourceInput);
|
|
|
if (source) {
|
|
|
+ sources.push(source);
|
|
|
pendingSourceCnt++;
|
|
|
fetchEventSource(source, currentFetchID); // will eventually call reportEvents
|
|
|
}
|
|
|
@@ -1499,6 +1510,14 @@ function EventManager(options) { // assumed to be a calendar
|
|
|
}
|
|
|
|
|
|
if (source) {
|
|
|
+
|
|
|
+ // for array sources, we convert to standard Event Objects up front
|
|
|
+ if ($.isArray(source.events)) {
|
|
|
+ source.events = $.map(source.events, function(eventInput) {
|
|
|
+ return buildEvent(eventInput, source);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
for (i=0; i<normalizers.length; i++) {
|
|
|
normalizers[i].call(t, source);
|
|
|
}
|
|
|
@@ -1597,30 +1616,31 @@ function EventManager(options) { // assumed to be a calendar
|
|
|
|
|
|
|
|
|
function removeEvents(filter) {
|
|
|
+ var eventID;
|
|
|
var i;
|
|
|
- if (!filter) { // remove all
|
|
|
- cache = [];
|
|
|
- // clear all array sources
|
|
|
- for (i=0; i<sources.length; i++) {
|
|
|
- if ($.isArray(sources[i].events)) {
|
|
|
- sources[i].events = [];
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- if (!$.isFunction(filter)) { // an event ID
|
|
|
- var id = filter + '';
|
|
|
- filter = function(e) {
|
|
|
- return e._id == id;
|
|
|
- };
|
|
|
- }
|
|
|
- cache = $.grep(cache, filter, true);
|
|
|
- // remove events from array sources
|
|
|
- for (i=0; i<sources.length; i++) {
|
|
|
- if ($.isArray(sources[i].events)) {
|
|
|
- sources[i].events = $.grep(sources[i].events, filter, true);
|
|
|
- }
|
|
|
+
|
|
|
+ if (filter == null) { // null or undefined. remove all events
|
|
|
+ filter = function() { return true; }; // will always match
|
|
|
+ }
|
|
|
+ else if (!$.isFunction(filter)) { // an event ID
|
|
|
+ eventID = filter + '';
|
|
|
+ filter = function(event) {
|
|
|
+ return event._id == eventID;
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ // Purge event(s) from our local cache
|
|
|
+ cache = $.grep(cache, filter, true); // inverse=true
|
|
|
+
|
|
|
+ // Remove events from array sources.
|
|
|
+ // This works because they have been converted to official Event Objects up front.
|
|
|
+ // (and as a result, event._id has been calculated).
|
|
|
+ for (i=0; i<sources.length; i++) {
|
|
|
+ if ($.isArray(sources[i].events)) {
|
|
|
+ sources[i].events = $.grep(sources[i].events, filter, true);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
reportEvents(cache);
|
|
|
}
|
|
|
|
|
|
@@ -1629,7 +1649,7 @@ function EventManager(options) { // assumed to be a calendar
|
|
|
if ($.isFunction(filter)) {
|
|
|
return $.grep(cache, filter);
|
|
|
}
|
|
|
- else if (filter) { // an event ID
|
|
|
+ else if (filter != null) { // not null, not undefined. an event ID
|
|
|
filter += '';
|
|
|
return $.grep(cache, function(e) {
|
|
|
return e._id == filter;
|