2009-09-08 05:01:28 +02:00
|
|
|
|
2010-10-13 06:23:59 +02:00
|
|
|
var fc = $.fullCalendar = { version: "@VERSION" };
|
2010-09-19 07:54:35 +02:00
|
|
|
var fcViews = fc.views = {};
|
2009-09-08 05:01:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
$.fn.fullCalendar = function(options) {
|
|
|
|
|
2010-09-19 07:54:35 +02:00
|
|
|
|
2009-09-08 05:01:28 +02:00
|
|
|
// method calling
|
|
|
|
if (typeof options == 'string') {
|
2010-09-19 07:54:35 +02:00
|
|
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
|
|
var res;
|
2009-09-08 05:01:28 +02:00
|
|
|
this.each(function() {
|
2010-09-19 07:54:35 +02:00
|
|
|
var calendar = $.data(this, 'fullCalendar');
|
2010-09-19 14:01:30 +02:00
|
|
|
if (calendar && $.isFunction(calendar[options])) {
|
2010-09-19 07:54:35 +02:00
|
|
|
var r = calendar[options].apply(calendar, args);
|
|
|
|
if (res === undefined) {
|
|
|
|
res = r;
|
|
|
|
}
|
|
|
|
if (options == 'destroy') {
|
|
|
|
$.removeData(this, 'fullCalendar');
|
2010-02-21 02:44:24 +01:00
|
|
|
}
|
2009-09-21 06:57:20 +02:00
|
|
|
}
|
2009-09-08 05:01:28 +02:00
|
|
|
});
|
2010-03-14 02:06:13 +01:00
|
|
|
if (res !== undefined) {
|
2009-09-08 05:01:28 +02:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
2010-09-19 07:54:35 +02:00
|
|
|
|
|
|
|
|
2010-11-20 07:45:44 +01:00
|
|
|
// would like to have this logic in EventManager, but needs to happen before options are recursively extended
|
2009-09-08 05:01:28 +02:00
|
|
|
var eventSources = options.eventSources || [];
|
|
|
|
delete options.eventSources;
|
|
|
|
if (options.events) {
|
|
|
|
eventSources.push(options.events);
|
2009-10-05 07:47:26 +02:00
|
|
|
delete options.events;
|
2009-09-08 05:01:28 +02:00
|
|
|
}
|
|
|
|
|
2010-09-19 07:54:35 +02:00
|
|
|
|
2009-09-08 05:01:28 +02:00
|
|
|
options = $.extend(true, {},
|
|
|
|
defaults,
|
2010-03-14 02:06:13 +01:00
|
|
|
(options.isRTL || options.isRTL===undefined && defaults.isRTL) ? rtlDefaults : {},
|
2009-09-08 05:01:28 +02:00
|
|
|
options
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2010-09-19 07:54:35 +02:00
|
|
|
this.each(function(i, _element) {
|
|
|
|
var element = $(_element);
|
|
|
|
var calendar = new Calendar(element, options, eventSources);
|
|
|
|
element.data('fullCalendar', calendar); // TODO: look into memory leak implications
|
|
|
|
calendar.render();
|
2009-09-08 05:01:28 +02:00
|
|
|
});
|
|
|
|
|
2010-09-19 07:54:35 +02:00
|
|
|
|
2009-09-14 12:28:23 +02:00
|
|
|
return this;
|
|
|
|
|
2009-09-08 05:01:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-09-19 07:54:35 +02:00
|
|
|
// function for adding/overriding defaults
|
|
|
|
function setDefaults(d) {
|
|
|
|
$.extend(true, defaults, d);
|
2009-09-08 05:01:28 +02:00
|
|
|
}
|
2010-09-19 07:54:35 +02:00
|
|
|
|
2009-09-08 05:01:28 +02:00
|
|
|
|