3 * Docs & License: https://fullcalendar.io/
6 (function webpackUniversalModuleDefinition(root
, factory
) {
7 if(typeof exports
=== 'object' && typeof module
=== 'object')
8 module
.exports
= factory(require("fullcalendar"), require("jquery"));
9 else if(typeof define
=== 'function' && define
.amd
)
10 define(["fullcalendar", "jquery"], factory
);
11 else if(typeof exports
=== 'object')
12 factory(require("fullcalendar"), require("jquery"));
14 factory(root
["FullCalendar"], root
["jQuery"]);
15 })(typeof self
!== 'undefined' ? self
: this, function(__WEBPACK_EXTERNAL_MODULE_1__
, __WEBPACK_EXTERNAL_MODULE_3__
) {
16 return /******/ (function(modules
) { // webpackBootstrap
17 /******/ // The module cache
18 /******/ var installedModules
= {};
20 /******/ // The require function
21 /******/ function __webpack_require__(moduleId
) {
23 /******/ // Check if module is in cache
24 /******/ if(installedModules
[moduleId
]) {
25 /******/ return installedModules
[moduleId
].exports
;
27 /******/ // Create a new module (and put it into the cache)
28 /******/ var module
= installedModules
[moduleId
] = {
34 /******/ // Execute the module function
35 /******/ modules
[moduleId
].call(module
.exports
, module
, module
.exports
, __webpack_require__
);
37 /******/ // Flag the module as loaded
38 /******/ module
.l
= true;
40 /******/ // Return the exports of the module
41 /******/ return module
.exports
;
45 /******/ // expose the modules object (__webpack_modules__)
46 /******/ __webpack_require__
.m
= modules
;
48 /******/ // expose the module cache
49 /******/ __webpack_require__
.c
= installedModules
;
51 /******/ // define getter function for harmony exports
52 /******/ __webpack_require__
.d = function(exports
, name
, getter
) {
53 /******/ if(!__webpack_require__
.o(exports
, name
)) {
54 /******/ Object
.defineProperty(exports
, name
, {
55 /******/ configurable
: false,
56 /******/ enumerable
: true,
62 /******/ // getDefaultExport function for compatibility with non-harmony modules
63 /******/ __webpack_require__
.n = function(module
) {
64 /******/ var getter
= module
&& module
.__esModule
?
65 /******/ function getDefault() { return module
['default']; } :
66 /******/ function getModuleExports() { return module
; };
67 /******/ __webpack_require__
.d(getter
, 'a', getter
);
68 /******/ return getter
;
71 /******/ // Object.prototype.hasOwnProperty.call
72 /******/ __webpack_require__
.o = function(object
, property
) { return Object
.prototype.hasOwnProperty
.call(object
, property
); };
74 /******/ // __webpack_public_path__
75 /******/ __webpack_require__
.p
= "";
77 /******/ // Load entry module and return exports
78 /******/ return __webpack_require__(__webpack_require__
.s
= 266);
80 /************************************************************************/
84 /***/ (function(module
, exports
) {
86 module
.exports
= __WEBPACK_EXTERNAL_MODULE_1__
;
91 /***/ (function(module
, exports
) {
95 https://github.com/Microsoft/tslib/blob/v1.6.0/tslib.js
97 only include the helpers we need, to keep down filesize
99 var extendStatics
= Object
.setPrototypeOf
||
100 ({ __proto__
: [] } instanceof Array
&& function (d
, b
) { d
.__proto__
= b
; }) ||
101 function (d
, b
) { for (var p
in b
)
102 if (b
.hasOwnProperty(p
))
104 exports
.__extends = function (d
, b
) {
106 function __() { this.constructor = d
; }
107 d
.prototype = b
=== null ? Object
.create(b
) : (__
.prototype = b
.prototype, new __());
114 /***/ (function(module
, exports
, __webpack_require__
) {
116 Object
.defineProperty(exports
, "__esModule", { value
: true });
117 var exportHooks
= __webpack_require__(1);
118 var GcalEventSource_1
= __webpack_require__(267);
119 exportHooks
.EventSourceParser
.registerClass(GcalEventSource_1
.default);
120 exportHooks
.GcalEventSource
= GcalEventSource_1
.default;
126 /***/ (function(module
, exports
, __webpack_require__
) {
128 Object
.defineProperty(exports
, "__esModule", { value
: true });
129 var tslib_1
= __webpack_require__(2);
130 var $ = __webpack_require__(3);
131 var fullcalendar_1
= __webpack_require__(1);
132 var GcalEventSource
= /** @class */ (function (_super
) {
133 tslib_1
.__extends(GcalEventSource
, _super
);
134 function GcalEventSource() {
135 return _super
!== null && _super
.apply(this, arguments
) || this;
137 GcalEventSource
.parse = function (rawInput
, calendar
) {
139 if (typeof rawInput
=== 'object') {
142 else if (typeof rawInput
=== 'string') {
143 rawProps
= { url
: rawInput
}; // url will be parsed with parseGoogleCalendarId
146 return fullcalendar_1
.EventSource
.parse
.call(this, rawProps
, calendar
);
150 GcalEventSource
.prototype.fetch = function (start
, end
, timezone
) {
152 var url
= this.buildUrl();
153 var requestParams
= this.buildRequestParams(start
, end
, timezone
);
154 var ajaxSettings
= this.ajaxSettings
|| {};
155 var onSuccess
= ajaxSettings
.success
;
156 if (!requestParams
) {
157 return fullcalendar_1
.Promise
.reject();
159 this.calendar
.pushLoading();
160 return fullcalendar_1
.Promise
.construct(function (onResolve
, onReject
) {
161 $.ajax($.extend({}, // destination
162 fullcalendar_1
.JsonFeedEventSource
.AJAX_DEFAULTS
, ajaxSettings
, {
165 success: function (responseData
, status
, xhr
) {
168 _this
.calendar
.popLoading();
169 if (responseData
.error
) {
170 _this
.reportError('Google Calendar API: ' + responseData
.error
.message
, responseData
.error
.errors
);
173 else if (responseData
.items
) {
174 rawEventDefs
= _this
.gcalItemsToRawEventDefs(responseData
.items
, requestParams
.timeZone
);
175 successRes
= fullcalendar_1
.applyAll(onSuccess
, _this
, [responseData
, status
, xhr
]); // passthru
176 if ($.isArray(successRes
)) {
177 rawEventDefs
= successRes
;
179 onResolve(_this
.parseEventDefs(rawEventDefs
));
182 error: function (xhr
, statusText
, errorThrown
) {
183 _this
.reportError('Google Calendar network failure: ' + statusText
, [xhr
, errorThrown
]);
184 _this
.calendar
.popLoading();
190 GcalEventSource
.prototype.gcalItemsToRawEventDefs = function (items
, gcalTimezone
) {
192 return items
.map(function (item
) {
193 return _this
.gcalItemToRawEventDef(item
, gcalTimezone
);
196 GcalEventSource
.prototype.gcalItemToRawEventDef = function (item
, gcalTimezone
) {
197 var url
= item
.htmlLink
|| null;
198 // make the URLs for each event show times in the correct timezone
199 if (url
&& gcalTimezone
) {
200 url
= injectQsComponent(url
, 'ctz=' + gcalTimezone
);
205 start
: item
.start
.dateTime
|| item
.start
.date
,
206 end
: item
.end
.dateTime
|| item
.end
.date
,
208 location
: item
.location
,
209 description
: item
.description
212 GcalEventSource
.prototype.buildUrl = function () {
213 return GcalEventSource
.API_BASE
+ '/' +
214 encodeURIComponent(this.googleCalendarId
) +
215 '/events?callback=?'; // jsonp
217 GcalEventSource
.prototype.buildRequestParams = function (start
, end
, timezone
) {
218 var apiKey
= this.googleCalendarApiKey
|| this.calendar
.opt('googleCalendarApiKey');
221 this.reportError('Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/');
224 // The API expects an ISO8601 datetime with a time and timezone part.
225 // Since the calendar's timezone offset isn't always known, request the date in UTC and pad it by a day on each
226 // side, guaranteeing we will receive all events in the desired range, albeit a superset.
227 // .utc() will set a zone and give it a 00:00:00 time.
228 if (!start
.hasZone()) {
229 start
= start
.clone().utc().add(-1, 'day');
231 if (!end
.hasZone()) {
232 end
= end
.clone().utc().add(1, 'day');
234 params
= $.extend(this.ajaxSettings
.data
|| {}, {
236 timeMin
: start
.format(),
237 timeMax
: end
.format(),
241 if (timezone
&& timezone
!== 'local') {
242 // when sending timezone names to Google, only accepts underscores, not spaces
243 params
.timeZone
= timezone
.replace(' ', '_');
247 GcalEventSource
.prototype.reportError = function (message
, apiErrorObjs
) {
248 var calendar
= this.calendar
;
249 var calendarOnError
= calendar
.opt('googleCalendarError');
250 var errorObjs
= apiErrorObjs
|| [{ message
: message
}]; // to be passed into error handlers
251 if (this.googleCalendarError
) {
252 this.googleCalendarError
.apply(calendar
, errorObjs
);
254 if (calendarOnError
) {
255 calendarOnError
.apply(calendar
, errorObjs
);
257 // print error to debug console
258 fullcalendar_1
.warn
.apply(null, [message
].concat(apiErrorObjs
|| []));
260 GcalEventSource
.prototype.getPrimitive = function () {
261 return this.googleCalendarId
;
263 GcalEventSource
.prototype.applyManualStandardProps = function (rawProps
) {
264 var superSuccess
= fullcalendar_1
.EventSource
.prototype.applyManualStandardProps
.apply(this, arguments
);
265 var googleCalendarId
= rawProps
.googleCalendarId
;
266 if (googleCalendarId
== null && rawProps
.url
) {
267 googleCalendarId
= parseGoogleCalendarId(rawProps
.url
);
269 if (googleCalendarId
!= null) {
270 this.googleCalendarId
= googleCalendarId
;
275 GcalEventSource
.prototype.applyMiscProps = function (rawProps
) {
276 if (!this.ajaxSettings
) {
277 this.ajaxSettings
= {};
279 $.extend(this.ajaxSettings
, rawProps
);
281 GcalEventSource
.API_BASE
= 'https://www.googleapis.com/calendar/v3/calendars';
282 return GcalEventSource
;
283 }(fullcalendar_1
.EventSource
));
284 exports
.default = GcalEventSource
;
285 GcalEventSource
.defineStandardProps({
286 // manually process...
288 googleCalendarId
: false,
289 // automatically transfer...
290 googleCalendarApiKey
: true,
291 googleCalendarError
: true
293 function parseGoogleCalendarId(url
) {
295 // detect if the ID was specified as a single string.
296 // will match calendars like "asdf1234@calendar.google.com" in addition to person email calendars.
297 if (/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(url
)) {
300 else if ((match
= /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(url
)) ||
301 (match
= /^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(url
))) {
302 return decodeURIComponent(match
[1]);
305 // Injects a string like "arg=value" into the querystring of a URL
306 function injectQsComponent(url
, component
) {
307 // inject it after the querystring but before the fragment
308 return url
.replace(/(\?.*?)?(#|$)/, function (whole
, qs
, hash
) {
309 return (qs
? qs
+ '&' : '?') + component
+ hash
;
317 /***/ (function(module
, exports
) {
319 module
.exports
= __WEBPACK_EXTERNAL_MODULE_3__
;