|
|
@@ -51,53 +51,3 @@ var complexOptions = [ // names of options that are objects whose properties sho
|
|
|
function mergeOptions(optionObjs) {
|
|
|
return mergeProps(optionObjs, complexOptions);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-// Given options specified for the calendar's constructor, massages any legacy options into a non-legacy form.
|
|
|
-// Converts View-Option-Hashes into the View-Specific-Options format.
|
|
|
-function massageOverrides(input) {
|
|
|
- var overrides = { views: input.views || {} }; // the output. ensure a `views` hash
|
|
|
- var subObj;
|
|
|
-
|
|
|
- // iterate through all option override properties (except `views`)
|
|
|
- $.each(input, function(name, val) {
|
|
|
- if (name != 'views') {
|
|
|
-
|
|
|
- // could the value be a legacy View-Option-Hash?
|
|
|
- if (
|
|
|
- $.isPlainObject(val) &&
|
|
|
- !/(time|duration|interval)$/i.test(name) && // exclude duration options. might be given as objects
|
|
|
- $.inArray(name, complexOptions) == -1 // complex options aren't allowed to be View-Option-Hashes
|
|
|
- ) {
|
|
|
- subObj = null;
|
|
|
-
|
|
|
- // iterate through the properties of this possible View-Option-Hash value
|
|
|
- $.each(val, function(subName, subVal) {
|
|
|
-
|
|
|
- // is the property targeting a view?
|
|
|
- if (/^(month|week|day|default|basic(Week|Day)?|agenda(Week|Day)?)$/.test(subName)) {
|
|
|
- if (!overrides.views[subName]) { // ensure the view-target entry exists
|
|
|
- overrides.views[subName] = {};
|
|
|
- }
|
|
|
- overrides.views[subName][name] = subVal; // record the value in the `views` object
|
|
|
- }
|
|
|
- else { // a non-View-Option-Hash property
|
|
|
- if (!subObj) {
|
|
|
- subObj = {};
|
|
|
- }
|
|
|
- subObj[subName] = subVal; // accumulate these unrelated values for later
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- if (subObj) { // non-View-Option-Hash properties? transfer them as-is
|
|
|
- overrides[name] = subObj;
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- overrides[name] = val; // transfer normal options as-is
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- return overrides;
|
|
|
-}
|