Ver código fonte

version 2.2.3

Adam Shaw 11 anos atrás
pai
commit
e89b325606

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "fullcalendar",
-  "version": "2.2.2",
+  "version": "2.2.3",
   "description": "Full-sized drag & drop event calendar",
   "keywords": [
     "calendar",

+ 1 - 1
dist/fullcalendar.css

@@ -1,5 +1,5 @@
 /*!
- * FullCalendar v2.2.2 Stylesheet
+ * FullCalendar v2.2.3 Stylesheet
  * Docs & License: http://arshaw.com/fullcalendar/
  * (c) 2013 Adam Shaw
  */

+ 26 - 23
dist/fullcalendar.js

@@ -1,5 +1,5 @@
 /*!
- * FullCalendar v2.2.2
+ * FullCalendar v2.2.3
  * Docs & License: http://arshaw.com/fullcalendar/
  * (c) 2013 Adam Shaw
  */
@@ -174,7 +174,7 @@ var rtlDefaults = {
 
 ;;
 
-var fc = $.fullCalendar = { version: "2.2.2" };
+var fc = $.fullCalendar = { version: "2.2.3" };
 var fcViews = fc.views = {};
 
 
@@ -1588,7 +1588,7 @@ function EventManager(options) { // assumed to be a calendar
 	function getSourcePrimitive(source) {
 		return (
 			(typeof source === 'object') ? // a normalized event source?
-				(source.origArray || source.url || source.events) : // get the primitive
+				(source.origArray || source.googleCalendarId || source.url || source.events) : // get the primitive
 				null
 		) ||
 		source; // the given argument *is* the primitive
@@ -1812,7 +1812,7 @@ function EventManager(options) { // assumed to be a calendar
 			if (end) {
 				end = t.moment(end);
 				if (!end.isValid()) {
-					return false;
+					end = null; // let defaults take over
 				}
 			}
 
@@ -1864,6 +1864,10 @@ function EventManager(options) { // assumed to be a calendar
 			}
 		}
 
+		if (end && end <= start) { // end is exclusive. must be after start
+			end = null; // let defaults take over
+		}
+
 		event.allDay = allDay;
 		event.start = start;
 		event.end = end || null; // ensure null if falsy
@@ -1879,11 +1883,9 @@ function EventManager(options) { // assumed to be a calendar
 	// If the given event is a recurring event, break it down into an array of individual instances.
 	// If not a recurring event, return an array with the single original event.
 	// If given a falsy input (probably because of a failed buildEventFromInput call), returns an empty array.
-	function expandEvent(abstractEvent) {
+	// HACK: can override the recurring window by providing custom rangeStart/rangeEnd (for businessHours).
+	function expandEvent(abstractEvent, _rangeStart, _rangeEnd) {
 		var events = [];
-		var view;
-		var _rangeStart = rangeStart;
-		var _rangeEnd = rangeEnd;
 		var dowHash;
 		var dow;
 		var i;
@@ -1892,12 +1894,8 @@ function EventManager(options) { // assumed to be a calendar
 		var start, end;
 		var event;
 
-		// hack for when fetchEvents hasn't been called yet (calculating businessHours for example)
-		if (!_rangeStart || !_rangeEnd) {
-			view = t.getView();
-			_rangeStart = view.start;
-			_rangeEnd = view.end;
-		}
+		_rangeStart = _rangeStart || rangeStart;
+		_rangeEnd = _rangeEnd || rangeEnd;
 
 		if (abstractEvent) {
 			if (abstractEvent._recurring) {
@@ -2129,7 +2127,7 @@ function EventManager(options) { // assumed to be a calendar
 	t.getBusinessHoursEvents = getBusinessHoursEvents;
 
 
-	// Returns an array of events as to when the business hours occur in the current view.
+	// Returns an array of events as to when the business hours occur in the given view.
 	// Abuse of our event system :(
 	function getBusinessHoursEvents() {
 		var optionVal = options.businessHours;
@@ -2140,6 +2138,7 @@ function EventManager(options) { // assumed to be a calendar
 			dow: [ 1, 2, 3, 4, 5 ], // monday - friday
 			rendering: 'inverse-background'
 		};
+		var view = t.getView();
 		var eventInput;
 
 		if (optionVal) {
@@ -2154,7 +2153,11 @@ function EventManager(options) { // assumed to be a calendar
 		}
 
 		if (eventInput) {
-			return expandEvent(buildEventFromInput(eventInput));
+			return expandEvent(
+				buildEventFromInput(eventInput),
+				view.start,
+				view.end
+			);
 		}
 
 		return [];
@@ -2599,11 +2602,6 @@ function isNativeDate(input) {
 }
 
 
-function dateCompare(a, b) { // works with Moments and native Dates
-	return a - b;
-}
-
-
 // Returns a boolean about whether the given input is a time string, like "06:40:00" or "06:00"
 function isTimeString(str) {
 	return /^\d+\:\d+(?:\:\d+\.?(?:\d{3})?)?$/.test(str);
@@ -2668,6 +2666,11 @@ function capitaliseFirstLetter(str) {
 }
 
 
+function compareNumbers(a, b) { // for .sort()
+	return a - b;
+}
+
+
 // Returns a function, that, as long as it continues to be invoked, will not
 // be triggered. The function will be called after it stops being called for
 // N milliseconds.
@@ -4501,7 +4504,7 @@ $.extend(Grid.prototype, {
 
 					dayEl = _this.getCellDayEl(cell);
 
-					dates = [ date, dragListener.origDate ].sort(dateCompare);
+					dates = [ date, dragListener.origDate ].sort(compareNumbers); // works with Moments
 					start = dates[0];
 					end = dates[1].clone().add(_this.cellDuration);
 
@@ -8168,7 +8171,7 @@ function View(calendar) {
 				var segmentCellLast = cellOffsetToCell(segmentCellOffsetLast);
 
 				// view might be RTL, so order by leftmost column
-				var cols = [ segmentCellFirst.col, segmentCellLast.col ].sort();
+				var cols = [ segmentCellFirst.col, segmentCellLast.col ].sort(compareNumbers);
 
 				// Determine if segment's first/last cell is the beginning/end of the date range.
 				// We need to compare "day offset" because "cell offsets" are often ambiguous and

Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
dist/fullcalendar.min.css


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 1
dist/fullcalendar.min.js


+ 1 - 1
dist/fullcalendar.print.css

@@ -1,5 +1,5 @@
 /*!
- * FullCalendar v2.2.2 Print Stylesheet
+ * FullCalendar v2.2.3 Print Stylesheet
  * Docs & License: http://arshaw.com/fullcalendar/
  * (c) 2013 Adam Shaw
  */

+ 30 - 5
dist/gcal.js

@@ -1,5 +1,5 @@
 /*!
- * FullCalendar v2.2.2 Google Calendar Plugin
+ * FullCalendar v2.2.3 Google Calendar Plugin
  * Docs & License: http://arshaw.com/fullcalendar/
  * (c) 2013 Adam Shaw
  */
@@ -27,8 +27,9 @@ fc.sourceNormalizers.push(function(sourceOptions) {
 	// if the Google Calendar ID hasn't been explicitly defined
 	if (!googleCalendarId && url) {
 
-		// detect if the ID was specified as a single string
-		if ((match = /^[^\/]+@([^\/]+\.)?calendar\.google\.com$/.test(url))) {
+		// detect if the ID was specified as a single string.
+		// will match calendars like "[email protected]" in addition to person email calendars.
+		if ((match = /^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(url))) {
 			googleCalendarId = url;
 		}
 		// try to scrape it out of a V1 or V3 API feed URL
@@ -54,6 +55,7 @@ fc.sourceNormalizers.push(function(sourceOptions) {
 
 		// We want removeEventSource to work, but it won't know about the googleCalendarId primitive.
 		// Shoehorn it into the url, which will function as the unique primitive. Won't cause side effects.
+		// This hack is obsolete since 2.2.3, but keep it so this plugin file is compatible with old versions.
 		sourceOptions.url = googleCalendarId;
 	}
 });
@@ -71,6 +73,7 @@ function transformOptions(sourceOptions, start, end, timezone, calendar) {
 	var apiKey = sourceOptions.googleCalendarApiKey || calendar.options.googleCalendarApiKey;
 	var success = sourceOptions.success;
 	var data;
+	var timezoneArg; // populated when a specific timezone. escaped to Google's liking
 
 	function reportError(message, apiErrorObjs) {
 		var errorObjs = apiErrorObjs || [ { message: message } ]; // to be passed into error handlers
@@ -103,10 +106,16 @@ function transformOptions(sourceOptions, start, end, timezone, calendar) {
 		end = end.clone().utc().add(1, 'day');
 	}
 
+	// when sending timezone names to Google, only accepts underscores, not spaces
+	if (timezone && timezone != 'local') {
+		timezoneArg = timezone.replace(' ', '_');
+	}
+
 	data = $.extend({}, sourceOptions.data || {}, {
 		key: apiKey,
 		timeMin: start.format(),
 		timeMax: end.format(),
+		timeZone: timezoneArg,
 		singleEvents: true,
 		maxResults: 9999
 	});
@@ -115,9 +124,9 @@ function transformOptions(sourceOptions, start, end, timezone, calendar) {
 		googleCalendarId: null, // prevents source-normalizing from happening again
 		url: url,
 		data: data,
-		timezoneParam: 'timeZone',
 		startParam: false, // `false` omits this parameter. we already included it above
 		endParam: false, // same
+		timezoneParam: false, // same
 		success: function(data) {
 			var events = [];
 			var successArgs;
@@ -128,12 +137,19 @@ function transformOptions(sourceOptions, start, end, timezone, calendar) {
 			}
 			else if (data.items) {
 				$.each(data.items, function(i, entry) {
+					var url = entry.htmlLink;
+
+					// make the URLs for each event show times in the correct timezone
+					if (timezoneArg) {
+						url = injectQsComponent(url, 'ctz=' + timezoneArg);
+					}
+
 					events.push({
 						id: entry.id,
 						title: entry.summary,
 						start: entry.start.dateTime || entry.start.date, // try timed. will fall back to all-day
 						end: entry.end.dateTime || entry.end.date, // same
-						url: entry.htmlLink,
+						url: url,
 						location: entry.location,
 						description: entry.description
 					});
@@ -153,4 +169,13 @@ function transformOptions(sourceOptions, start, end, timezone, calendar) {
 }
 
 
+// Injects a string like "arg=value" into the querystring of a URL
+function injectQsComponent(url, component) {
+	// inject it after the querystring but before the fragment
+	return url.replace(/(\?.*?)?(#|$)/, function(whole, qs, hash) {
+		return (qs ? qs + '&' : '?') + component + hash;
+	});
+}
+
+
 });

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
dist/lang/ru.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
dist/lang/sk.js


+ 1 - 1
fullcalendar.jquery.json

@@ -1,6 +1,6 @@
 {
   "name": "fullcalendar",
-  "version": "2.2.2",
+  "version": "2.2.3",
 
   "description": "Full-sized drag & drop event calendar",
   "keywords": [ "calendar", "event", "full-sized" ],

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "fullcalendar",
-  "version": "2.2.2",
+  "version": "2.2.3",
   "repository": {
     "type": "git",
     "url": "https://github.com/arshaw/fullcalendar.git"

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff