PageSourceSearch

https://bayalagbuteegch.mn/js/gcal.js

js bayalagbuteegch.mn collected 2026-10-04 13:27:26 UTC 2,659 bytes, 108 lines download raw bytes

1/*!
2 * FullCalendar v1.6.2 Google Calendar Plugin
3 * Docs & License: http://arshaw.com/fullcalendar/
4 * (c) 2013 Adam Shaw
5 */
6
7 
8(function($) {
9
10
11var fc = $.fullCalendar;
12var formatDate = fc.formatDate;
13var parseISO8601 = fc.parseISO8601;
14var addDays = fc.addDays;
15var applyAll = fc.applyAll;
16
17
18fc.sourceNormalizers.push(function(sourceOptions) {
19	if (sourceOptions.dataType == 'gcal' ||
20		sourceOptions.dataType === undefined &&
21		(sourceOptions.url || '').match(/^(http|https):\/\/www.google.com\/calendar\/feeds\//)) {
22			sourceOptions.dataType = 'gcal';
23			if (sourceOptions.editable === undefined) {
24				sourceOptions.editable = false;
25			}
26		}
27});
28
29
30fc.sourceFetchers.push(function(sourceOptions, start, end) {
31	if (sourceOptions.dataType == 'gcal') {
32		return transformOptions(sourceOptions, start, end);
33	}
34});
35
36
37function transformOptions(sourceOptions, start, end) {
38
39	var success = sourceOptions.success;
40	var data = $.extend({}, sourceOptions.data || {}, {
41		'start-min': formatDate(start, 'u'),
42		'start-max': formatDate(end, 'u'),
43		'singleevents': true,
44		'max-results': 9999
45	});
46	
47	var ctz = sourceOptions.currentTimezone;
48	if (ctz) {
49		data.ctz = ctz = ctz.replace(' ', '_');
50	}
51
52	return $.extend({}, sourceOptions, {
53		url: sourceOptions.url.replace(/\/basic$/, '/full') + '?alt=json-in-script&callback=?',
54		dataType: 'jsonp',
55		data: data,
56		startParam: false,
57		endParam: false,
58		success: function(data) {
59			var events = [];
60			if (data.feed.entry) {
61				$.each(data.feed.entry, function(i, entry) {
62					var startStr = entry['gd$when'][0]['startTime'];
63					var start = parseISO8601(startStr, true);
64					var end = parseISO8601(entry['gd$when'][0]['endTime'], true);
65					var allDay = startStr.indexOf('T') == -1;
66					var url;
67					$.each(entry.link, function(i, link) {
68						if (link.type == 'text/html') {
69							url = link.href;
70							if (ctz) {
71								url += (url.indexOf('?') == -1 ? '?' : '&') + 'ctz=' + ctz;
72							}
73						}
74					});
75					if (allDay) {
76						addDays(end, -1); // make inclusive
77					}
78					events.push({
79						id: entry['gCal$uid']['value'],
80						title: entry['title']['$t'],
81						url: url,
82						start: start,
83						end: end,
84						allDay: allDay,
85						location: entry['gd$where'][0]['valueString'],
86						description: entry['content']['$t']
87					});
88				});
89			}
90			var args = [events].concat(Array.prototype.slice.call(arguments, 1));
91			var res = applyAll(success, this, args);
92			if ($.isArray(res)) {
93				return res;
94			}
95			return events;
96		}
97	});
98	
99}
100
101
102// legacy
103fc.gcalFeed = function(url, sourceOptions) {
104	return $.extend({}, sourceOptions, { url: url, dataType: 'gcal' });
105};
106
107
108})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.