Skip to content

Commit

Permalink
version 2.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Nov 26, 2014
1 parent 53b6a37 commit e89b325
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 40 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fullcalendar",
"version": "2.2.2",
"version": "2.2.3",
"description": "Full-sized drag & drop event calendar",
"keywords": [
"calendar",
Expand Down
2 changes: 1 addition & 1 deletion dist/fullcalendar.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* FullCalendar v2.2.2 Stylesheet
* FullCalendar v2.2.3 Stylesheet
* Docs & License: http://arshaw.com/fullcalendar/
* (c) 2013 Adam Shaw
*/
Expand Down
49 changes: 26 additions & 23 deletions dist/fullcalendar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* FullCalendar v2.2.2
* FullCalendar v2.2.3
* Docs & License: http://arshaw.com/fullcalendar/
* (c) 2013 Adam Shaw
*/
Expand Down Expand Up @@ -174,7 +174,7 @@ var rtlDefaults = {

;;

var fc = $.fullCalendar = { version: "2.2.2" };
var fc = $.fullCalendar = { version: "2.2.3" };
var fcViews = fc.views = {};


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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 [];
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dist/fullcalendar.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions dist/fullcalendar.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/fullcalendar.print.css
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down
35 changes: 30 additions & 5 deletions dist/gcal.js
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
});
Expand All @@ -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
Expand Down Expand Up @@ -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
});
Expand All @@ -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;
Expand All @@ -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
});
Expand All @@ -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;
});
}


});
Loading

0 comments on commit e89b325

Please sign in to comment.