1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
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"));
|
13 | else
|
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) {
|
17 |
|
18 | var installedModules = {};
|
19 |
|
20 |
|
21 | function __webpack_require__(moduleId) {
|
22 |
|
23 |
|
24 | if(installedModules[moduleId]) {
|
25 | return installedModules[moduleId].exports;
|
26 | }
|
27 |
|
28 | var module = installedModules[moduleId] = {
|
29 | i: moduleId,
|
30 | l: false,
|
31 | exports: {}
|
32 | };
|
33 |
|
34 |
|
35 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
36 |
|
37 |
|
38 | module.l = true;
|
39 |
|
40 |
|
41 | return module.exports;
|
42 | }
|
43 |
|
44 |
|
45 |
|
46 | __webpack_require__.m = modules;
|
47 |
|
48 |
|
49 | __webpack_require__.c = installedModules;
|
50 |
|
51 |
|
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,
|
57 | get: getter
|
58 | /******/ });
|
59 | /******/ }
|
60 | /******/ };
|
61 | /******/
|
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;
|
69 | };
|
70 |
|
71 |
|
72 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
73 |
|
74 |
|
75 | __webpack_require__.p = "";
|
76 |
|
77 |
|
78 | return __webpack_require__(__webpack_require__.s = 270);
|
79 | })
|
80 |
|
81 | ({
|
82 |
|
83 | 1:
|
84 | (function(module, exports) {
|
85 |
|
86 | module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
|
87 |
|
88 | }),
|
89 |
|
90 | 2:
|
91 | (function(module, exports) {
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
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))
|
103 | d[p] = b[p]; };
|
104 | exports.__extends = function (d, b) {
|
105 | extendStatics(d, b);
|
106 | function __() { this.constructor = d; }
|
107 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
108 | };
|
109 |
|
110 |
|
111 | }),
|
112 |
|
113 | 270:
|
114 | (function(module, exports, __webpack_require__) {
|
115 |
|
116 | Object.defineProperty(exports, "__esModule", { value: true });
|
117 | var exportHooks = __webpack_require__(1);
|
118 | var GcalEventSource_1 = __webpack_require__(271);
|
119 | exportHooks.EventSourceParser.registerClass(GcalEventSource_1.default);
|
120 | exportHooks.GcalEventSource = GcalEventSource_1.default;
|
121 |
|
122 |
|
123 | }),
|
124 |
|
125 | 271:
|
126 | (function(module, exports, __webpack_require__) {
|
127 |
|
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 = (function (_super) {
|
133 | tslib_1.__extends(GcalEventSource, _super);
|
134 | function GcalEventSource() {
|
135 | return _super !== null && _super.apply(this, arguments) || this;
|
136 | }
|
137 | GcalEventSource.parse = function (rawInput, calendar) {
|
138 | var rawProps;
|
139 | if (typeof rawInput === 'object') {
|
140 | rawProps = rawInput;
|
141 | }
|
142 | else if (typeof rawInput === 'string') {
|
143 | rawProps = { url: rawInput };
|
144 | }
|
145 | if (rawProps) {
|
146 | return fullcalendar_1.EventSource.parse.call(this, rawProps, calendar);
|
147 | }
|
148 | return false;
|
149 | };
|
150 | GcalEventSource.prototype.fetch = function (start, end, timezone) {
|
151 | var _this = this;
|
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();
|
158 | }
|
159 | this.calendar.pushLoading();
|
160 | return fullcalendar_1.Promise.construct(function (onResolve, onReject) {
|
161 | $.ajax($.extend({},
|
162 | fullcalendar_1.JsonFeedEventSource.AJAX_DEFAULTS, ajaxSettings, {
|
163 | url: url,
|
164 | data: requestParams,
|
165 | success: function (responseData, status, xhr) {
|
166 | var rawEventDefs;
|
167 | var successRes;
|
168 | _this.calendar.popLoading();
|
169 | if (responseData.error) {
|
170 | _this.reportError('Google Calendar API: ' + responseData.error.message, responseData.error.errors);
|
171 | onReject();
|
172 | }
|
173 | else if (responseData.items) {
|
174 | rawEventDefs = _this.gcalItemsToRawEventDefs(responseData.items, requestParams.timeZone);
|
175 | successRes = fullcalendar_1.applyAll(onSuccess, _this, [responseData, status, xhr]);
|
176 | if ($.isArray(successRes)) {
|
177 | rawEventDefs = successRes;
|
178 | }
|
179 | onResolve(_this.parseEventDefs(rawEventDefs));
|
180 | }
|
181 | },
|
182 | error: function (xhr, statusText, errorThrown) {
|
183 | _this.reportError('Google Calendar network failure: ' + statusText, [xhr, errorThrown]);
|
184 | _this.calendar.popLoading();
|
185 | onReject();
|
186 | }
|
187 | }));
|
188 | });
|
189 | };
|
190 | GcalEventSource.prototype.gcalItemsToRawEventDefs = function (items, gcalTimezone) {
|
191 | var _this = this;
|
192 | return items.map(function (item) {
|
193 | return _this.gcalItemToRawEventDef(item, gcalTimezone);
|
194 | });
|
195 | };
|
196 | GcalEventSource.prototype.gcalItemToRawEventDef = function (item, gcalTimezone) {
|
197 | var url = item.htmlLink || null;
|
198 |
|
199 | if (url && gcalTimezone) {
|
200 | url = injectQsComponent(url, 'ctz=' + gcalTimezone);
|
201 | }
|
202 | var extendedProperties = {};
|
203 | if (typeof item.extendedProperties === 'object' &&
|
204 | typeof item.extendedProperties.shared === 'object') {
|
205 | extendedProperties = item.extendedProperties.shared;
|
206 | }
|
207 | return {
|
208 | id: item.id,
|
209 | title: item.summary,
|
210 | start: item.start.dateTime || item.start.date,
|
211 | end: item.end.dateTime || item.end.date,
|
212 | url: url,
|
213 | location: item.location,
|
214 | description: item.description,
|
215 | extendedProperties: extendedProperties
|
216 | };
|
217 | };
|
218 | GcalEventSource.prototype.buildUrl = function () {
|
219 | return GcalEventSource.API_BASE + '/' +
|
220 | encodeURIComponent(this.googleCalendarId) +
|
221 | '/events?callback=?';
|
222 | };
|
223 | GcalEventSource.prototype.buildRequestParams = function (start, end, timezone) {
|
224 | var apiKey = this.googleCalendarApiKey || this.calendar.opt('googleCalendarApiKey');
|
225 | var params;
|
226 | if (!apiKey) {
|
227 | this.reportError('Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/');
|
228 | return null;
|
229 | }
|
230 |
|
231 |
|
232 |
|
233 |
|
234 | if (!start.hasZone()) {
|
235 | start = start.clone().utc().add(-1, 'day');
|
236 | }
|
237 | if (!end.hasZone()) {
|
238 | end = end.clone().utc().add(1, 'day');
|
239 | }
|
240 | params = $.extend(this.ajaxSettings.data || {}, {
|
241 | key: apiKey,
|
242 | timeMin: start.format(),
|
243 | timeMax: end.format(),
|
244 | singleEvents: true,
|
245 | maxResults: 9999
|
246 | });
|
247 | if (timezone && timezone !== 'local') {
|
248 |
|
249 | params.timeZone = timezone.replace(' ', '_');
|
250 | }
|
251 | return params;
|
252 | };
|
253 | GcalEventSource.prototype.reportError = function (message, apiErrorObjs) {
|
254 | var calendar = this.calendar;
|
255 | var calendarOnError = calendar.opt('googleCalendarError');
|
256 | var errorObjs = apiErrorObjs || [{ message: message }];
|
257 | if (this.googleCalendarError) {
|
258 | this.googleCalendarError.apply(calendar, errorObjs);
|
259 | }
|
260 | if (calendarOnError) {
|
261 | calendarOnError.apply(calendar, errorObjs);
|
262 | }
|
263 |
|
264 | fullcalendar_1.warn.apply(null, [message].concat(apiErrorObjs || []));
|
265 | };
|
266 | GcalEventSource.prototype.getPrimitive = function () {
|
267 | return this.googleCalendarId;
|
268 | };
|
269 | GcalEventSource.prototype.applyManualStandardProps = function (rawProps) {
|
270 | var superSuccess = fullcalendar_1.EventSource.prototype.applyManualStandardProps.apply(this, arguments);
|
271 | var googleCalendarId = rawProps.googleCalendarId;
|
272 | if (googleCalendarId == null && rawProps.url) {
|
273 | googleCalendarId = parseGoogleCalendarId(rawProps.url);
|
274 | }
|
275 | if (googleCalendarId != null) {
|
276 | this.googleCalendarId = googleCalendarId;
|
277 | return superSuccess;
|
278 | }
|
279 | return false;
|
280 | };
|
281 | GcalEventSource.prototype.applyMiscProps = function (rawProps) {
|
282 | if (!this.ajaxSettings) {
|
283 | this.ajaxSettings = {};
|
284 | }
|
285 | $.extend(this.ajaxSettings, rawProps);
|
286 | };
|
287 | GcalEventSource.API_BASE = 'https://www.googleapis.com/calendar/v3/calendars';
|
288 | return GcalEventSource;
|
289 | }(fullcalendar_1.EventSource));
|
290 | exports.default = GcalEventSource;
|
291 | GcalEventSource.defineStandardProps({
|
292 |
|
293 | url: false,
|
294 | googleCalendarId: false,
|
295 |
|
296 | googleCalendarApiKey: true,
|
297 | googleCalendarError: true
|
298 | });
|
299 | function parseGoogleCalendarId(url) {
|
300 | var match;
|
301 |
|
302 |
|
303 | if (/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(url)) {
|
304 | return url;
|
305 | }
|
306 | else if ((match = /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(url)) ||
|
307 | (match = /^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(url))) {
|
308 | return decodeURIComponent(match[1]);
|
309 | }
|
310 | }
|
311 |
|
312 | function injectQsComponent(url, component) {
|
313 |
|
314 | return url.replace(/(\?.*?)?(#|$)/, function (whole, qs, hash) {
|
315 | return (qs ? qs + '&' : '?') + component + hash;
|
316 | });
|
317 | }
|
318 |
|
319 |
|
320 | }),
|
321 |
|
322 | 3:
|
323 | (function(module, exports) {
|
324 |
|
325 | module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
|
326 |
|
327 | })
|
328 |
|
329 | });
|
330 | }); |
\ | No newline at end of file |