* Added support for basic version of ISO_8601 timestamp format (see http://en.wikiped...
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.js
1 /*
2 * JavaScript backwards-compatibility and support
3 */
4
5 // Make calling .indexOf() on an array work on older browsers
6 if ( typeof Array.prototype.indexOf === 'undefined' ) {
7 Array.prototype.indexOf = function( needle ) {
8 for ( var i = 0; i < this.length; i++ ) {
9 if ( this[i] === needle ) {
10 return i;
11 }
12 }
13 return -1;
14 };
15 }
16 // Add array comparison functionality
17 if ( typeof Array.prototype.compare === 'undefined' ) {
18 Array.prototype.compare = function( against ) {
19 if ( this.length != against.length ) {
20 return false;
21 }
22 for ( var i = 0; i < against.length; i++ ) {
23 if ( this[i].compare ) {
24 if ( !this[i].compare( against[i] ) ) {
25 return false;
26 }
27 }
28 if ( this[i] !== against[i] ) {
29 return false;
30 }
31 }
32 return true;
33 };
34 }
35
36 /*
37 * Core MediaWiki JavaScript Library
38 */
39 // Attach to window
40 window.mediaWiki = new ( function( $ ) {
41
42 /* Constants */
43
44 // This will not change until we are 100% ready to turn off legacy globals
45 var LEGACY_GLOBALS = true;
46
47 /* Private Members */
48
49 var that = this;
50
51 /* Prototypes */
52
53 this.prototypes = {
54 /*
55 * An object which allows single and multiple get/set/exists functionality on a list of key / value pairs
56 *
57 * @param {boolean} global whether to get/set/exists values on the window object or a private object
58 * @param {function} parser function to perform extra processing before while getting a value which accepts
59 * value and options parameters where value is a string to be parsed and options is an object of options for the
60 * parser
61 */
62 'configuration': function( global, parser ) {
63
64 /* Private Members */
65
66 var that = this;
67 var values = global === true ? window : {};
68
69 /* Public Methods */
70
71 /**
72 * Gets one or more values
73 *
74 * If called with no arguments, all values will be returned. If a parser is in use, no parsing will take
75 * place when calling with no arguments or calling with an array of names.
76 *
77 * @param {mixed} selection string name of value to get, array of string names of values to get, or object
78 * of name/option pairs
79 * @param {object} options optional set of options which are also passed to a parser if in use; only used
80 * when selection is a string
81 * @format options
82 * {
83 * // Value to use if key does not exist
84 * 'fallback': ''
85 * }
86 */
87 this.get = function( selection, options ) {
88 if ( typeof selection === 'object' ) {
89 var results = {};
90 for ( s in selection ) {
91 if ( selection.hasOwnProperty( s ) ) {
92 if ( typeof s === 'string' ) {
93 return that.get( values[s], selection[s] );
94 } else {
95 return that.get( selection[s] );
96 }
97 }
98 }
99 return results;
100 } else if ( typeof selection === 'string' ) {
101 if ( typeof values[selection] === 'undefined' ) {
102 return typeof options === 'object' && 'fallback' in options ?
103 options.fallback : '<' + selection + '>';
104 } else {
105 if ( typeof parser === 'function' ) {
106 return parser( values[selection], options );
107 } else {
108 return values[selection];
109 }
110 }
111 } else {
112 return values;
113 }
114 };
115
116 /**
117 * Sets one or multiple configuration values using a key and a value or an object of keys and values
118 *
119 * @param {mixed} key string of name by which value will be made accessible, or object of name/value pairs
120 * @param {mixed} value optional value to set, only in use when key is a string
121 */
122 this.set = function( selection, value ) {
123 if ( typeof selection === 'object' ) {
124 for ( var s in selection ) {
125 values[s] = selection[s];
126 }
127 } else if ( typeof selection === 'string' && typeof value !== 'undefined' ) {
128 values[selection] = value;
129 }
130 };
131
132 /**
133 * Checks if one or multiple configuration fields exist
134 */
135 this.exists = function( selection ) {
136 if ( typeof keys === 'object' ) {
137 for ( var s = 0; s < selection.length; s++ ) {
138 if ( !( selection[s] in values ) ) {
139 return false;
140 }
141 }
142 return true;
143 } else {
144 return selection in values;
145 }
146 };
147 }
148 };
149
150 /* Methods */
151
152 /*
153 * Dummy function which in debug mode can be replaced with a function that does something clever
154 */
155 this.log = function() { };
156
157 /*
158 * List of configuration values
159 *
160 * In legacy mode the values this object wraps will be in the global space
161 */
162 this.config = new this.prototypes.configuration( LEGACY_GLOBALS );
163
164 /*
165 * Information about the current user
166 */
167 this.user = new ( function() {
168
169 /* Public Members */
170
171 this.options = new that.prototypes.configuration();
172 } )();
173
174 /*
175 * Basic parser, can be replaced with something more robust
176 */
177 this.parser = function( text, options ) {
178 if ( typeof options === 'object' && typeof options.parameters === 'object' ) {
179 for ( var p = 0; p < options.parameters.length; p++ ) {
180 text = text.replace( '\$' + ( parseInt( p ) + 1 ), options.parameters[p] );
181 }
182 }
183 return text;
184 };
185
186 /*
187 * Localization system
188 */
189 this.msg = new that.prototypes.configuration( false, this.parser );
190
191 /*
192 * Client-side module loader which integrates with the MediaWiki ResourceLoader
193 */
194 this.loader = new ( function() {
195
196 /* Private Members */
197
198 var that = this;
199 /*
200 * Mapping of registered modules
201 *
202 * The jquery module is pre-registered, because it must have already been provided for this object to have
203 * been built, and in debug mode jquery would have been provided through a unique loader request, making it
204 * impossible to hold back registration of jquery until after mediawiki.
205 *
206 * Format:
207 * {
208 * 'moduleName': {
209 * 'dependencies': ['required module', 'required module', ...], (or) function() {}
210 * 'state': 'registered', 'loading', 'loaded', 'ready', or 'error'
211 * 'script': function() {},
212 * 'style': 'css code string',
213 * 'messages': { 'key': 'value' },
214 * 'version': ############## (unix timestamp)
215 * }
216 * }
217 */
218 var registry = {};
219 // List of modules which will be loaded as when ready
220 var batch = [];
221 // List of modules to be loaded
222 var queue = [];
223 // List of callback functions waiting for modules to be ready to be called
224 var jobs = [];
225 // Flag indicating that requests should be suspended
226 var suspended = true;
227 // Flag inidicating that document ready has occured
228 var ready = false;
229
230 /* Private Methods */
231
232 /**
233 * Generates an ISO8601 "basic" string from a UNIX timestamp
234 */
235 function formatVersionNumber( timestamp ) {
236 function pad( a, b, c ) {
237 return [a < 10 ? '0' + a : a, b < 10 ? '0' + b : b, c < 10 ? '0' + c : c].join();
238 }
239 var d = new Date()
240 d.setTime( timestamp * 1000 );
241 return [
242 pad( d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate() ), 'T',
243 pad( d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds() ), 'Z'
244 ].join();
245 }
246
247 /**
248 * Recursively resolves dependencies and detects circular references
249 */
250 function recurse( module, resolved, unresolved ) {
251 unresolved[unresolved.length] = module;
252 // Resolves dynamic loader function and replaces it with it's own results
253 if ( typeof registry[module].dependencies === 'function' ) {
254 registry[module].dependencies = registry[module].dependencies();
255 // Gaurantees the module's dependencies are always in an array
256 if ( typeof registry[module].dependencies !== 'object' ) {
257 registry[module].dependencies = [registry[module].dependencies];
258 }
259 }
260 // Tracks down dependencies
261 for ( var n = 0; n < registry[module].dependencies.length; n++ ) {
262 if ( resolved.indexOf( registry[module].dependencies[n] ) === -1 ) {
263 if ( unresolved.indexOf( registry[module].dependencies[n] ) !== -1 ) {
264 throw new Error(
265 'Circular reference detected: ' + module + ' -> ' + registry[module].dependencies[n]
266 );
267 }
268 recurse( registry[module].dependencies[n], resolved, unresolved );
269 }
270 }
271 resolved[resolved.length] = module;
272 unresolved.splice( unresolved.indexOf( module ), 1 );
273 }
274
275 /**
276 * Gets a list of modules names that a module dependencies in their proper dependency order
277 *
278 * @param mixed string module name or array of string module names
279 * @return list of dependencies
280 * @throws Error if circular reference is detected
281 */
282 function resolve( module, resolved, unresolved ) {
283 // Allow calling with an array of module names
284 if ( typeof module === 'object' ) {
285 var modules = [];
286 for ( var m = 0; m < module.length; m++ ) {
287 var dependencies = resolve( module[m] );
288 for ( var n = 0; n < dependencies.length; n++ ) {
289 modules[modules.length] = dependencies[n];
290 }
291 }
292 return modules;
293 } else if ( typeof module === 'string' ) {
294 // Undefined modules have no dependencies
295 if ( !( module in registry ) ) {
296 return [];
297 }
298 var resolved = [];
299 recurse( module, resolved, [] );
300 return resolved;
301 }
302 throw new Error( 'Invalid module argument: ' + module );
303 };
304
305 /**
306 * Narrows a list of module names down to those matching a specific state. Possible states are 'undefined',
307 * 'registered', 'loading', 'loaded', or 'ready'
308 *
309 * @param mixed string or array of strings of module states to filter by
310 * @param array list of module names to filter (optional, all modules will be used by default)
311 * @return array list of filtered module names
312 */
313 function filter( states, modules ) {
314 // Allow states to be given as a string
315 if ( typeof states === 'string' ) {
316 states = [states];
317 }
318 // If called without a list of modules, build and use a list of all modules
319 var list = [];
320 if ( typeof modules === 'undefined' ) {
321 modules = [];
322 for ( module in registry ) {
323 modules[modules.length] = module;
324 }
325 }
326 // Build a list of modules which are in one of the specified states
327 for ( var s = 0; s < states.length; s++ ) {
328 for ( var m = 0; m < modules.length; m++ ) {
329 if (
330 ( states[s] == 'undefined' && typeof registry[modules[m]] === 'undefined' ) ||
331 ( typeof registry[modules[m]] === 'object' && registry[modules[m]].state === states[s] )
332 ) {
333 list[list.length] = modules[m];
334 }
335 }
336 }
337 return list;
338 }
339
340 /**
341 * Executes a loaded module, making it ready to use
342 *
343 * @param string module name to execute
344 */
345 function execute( module ) {
346 if ( typeof registry[module] === 'undefined' ) {
347 throw new Error( 'Module has not been registered yet: ' + module );
348 } else if ( registry[module].state === 'registered' ) {
349 throw new Error( 'Module has not been requested from the server yet: ' + module );
350 } else if ( registry[module].state === 'loading' ) {
351 throw new Error( 'Module has not completed loading yet: ' + module );
352 } else if ( registry[module].state === 'ready' ) {
353 throw new Error( 'Module has already been loaded: ' + module );
354 }
355 // Add style sheet to document
356 if ( typeof registry[module].style === 'string' && registry[module].style.length ) {
357 $( 'head' ).append( '<style type="text/css">' + registry[module].style + '</style>' );
358 } else if ( typeof registry[module].style === 'object' && !( registry[module].style instanceof Array ) ) {
359 for ( var media in registry[module].style ) {
360 $( 'head' ).append(
361 '<style type="text/css" media="' + media + '">' + registry[module].style[media] + '</style>'
362 );
363 }
364 }
365 // Add localizations to message system
366 if ( typeof registry[module].messages === 'object' ) {
367 mediaWiki.msg.set( registry[module].messages );
368 }
369 // Execute script
370 try {
371 registry[module].script();
372 registry[module].state = 'ready';
373 // Run jobs who's dependencies have just been met
374 for ( var j = 0; j < jobs.length; j++ ) {
375 if ( filter( 'ready', jobs[j].dependencies ).compare( jobs[j].dependencies ) ) {
376 if ( typeof jobs[j].ready === 'function' ) {
377 jobs[j].ready();
378 }
379 jobs.splice( j, 1 );
380 j--;
381 }
382 }
383 // Execute modules who's dependencies have just been met
384 for ( r in registry ) {
385 if ( registry[r].state == 'loaded' ) {
386 if ( filter( ['ready'], registry[r].dependencies ).compare( registry[r].dependencies ) ) {
387 execute( r );
388 }
389 }
390 }
391 } catch ( e ) {
392 mediaWiki.log( 'Exception thrown by ' + module + ': ' + e.message );
393 mediaWiki.log( e );
394 registry[module].state = 'error';
395 // Run error callbacks of jobs affected by this condition
396 for ( var j = 0; j < jobs.length; j++ ) {
397 if ( jobs[j].dependencies.indexOf( module ) !== -1 ) {
398 if ( typeof jobs[j].error === 'function' ) {
399 jobs[j].error();
400 }
401 jobs.splice( j, 1 );
402 j--;
403 }
404 }
405 }
406 }
407
408 /**
409 * Adds a dependencies to the queue with optional callbacks to be run when the dependencies are ready or fail
410 *
411 * @param mixed string moulde name or array of string module names
412 * @param function ready callback to execute when all dependencies are ready
413 * @param function error callback to execute when any dependency fails
414 */
415 function request( dependencies, ready, error ) {
416 // Allow calling by single module name
417 if ( typeof dependencies === 'string' ) {
418 dependencies = [dependencies];
419 if ( dependencies[0] in registry ) {
420 for ( var n = 0; n < registry[dependencies[0]].dependencies.length; n++ ) {
421 dependencies[dependencies.length] = registry[dependencies[0]].dependencies[n];
422 }
423 }
424 }
425 // Add ready and error callbacks if they were given
426 if ( arguments.length > 1 ) {
427 jobs[jobs.length] = {
428 'dependencies': filter( ['undefined', 'registered', 'loading', 'loaded'], dependencies ),
429 'ready': ready,
430 'error': error
431 };
432 }
433 // Queue up any dependencies that are undefined or registered
434 dependencies = filter( ['undefined', 'registered'], dependencies );
435 for ( var n = 0; n < dependencies.length; n++ ) {
436 if ( queue.indexOf( dependencies[n] ) === -1 ) {
437 queue[queue.length] = dependencies[n];
438 }
439 }
440 // Work the queue
441 that.work();
442 }
443
444 function sortQuery(o) {
445 var sorted = {}, key, a = [];
446 for ( key in o ) {
447 if ( o.hasOwnProperty( key ) ) {
448 a.push( key );
449 }
450 }
451 a.sort();
452 for ( key = 0; key < a.length; key++ ) {
453 sorted[a[key]] = o[a[key]];
454 }
455 return sorted;
456 }
457
458 /* Public Methods */
459
460 /**
461 * Requests dependencies from server, loading and executing when things when ready.
462 */
463 this.work = function() {
464 // Appends a list of modules to the batch
465 for ( var q = 0; q < queue.length; q++ ) {
466 // Only request modules which are undefined or registered
467 if ( !( queue[q] in registry ) || registry[queue[q]].state == 'registered' ) {
468 // Prevent duplicate entries
469 if ( batch.indexOf( queue[q] ) === -1 ) {
470 batch[batch.length] = queue[q];
471 // Mark registered modules as loading
472 if ( queue[q] in registry ) {
473 registry[queue[q]].state = 'loading';
474 }
475 }
476 }
477 }
478 // Clean up the queue
479 queue = [];
480 // After document ready, handle the batch
481 if ( !suspended && batch.length ) {
482 // Always order modules alphabetically to help reduce cache misses for otherwise identical content
483 batch.sort();
484 // Build a list of request parameters
485 var base = {
486 'skin': mediaWiki.config.get( 'skin' ),
487 'lang': mediaWiki.config.get( 'wgUserLanguage' ),
488 'debug': mediaWiki.config.get( 'debug' )
489 };
490 // Extend request parameters with a list of modules in the batch
491 var requests = [];
492 if ( base.debug == '1' ) {
493 for ( var b = 0; b < batch.length; b++ ) {
494 requests[requests.length] = $.extend(
495 { 'modules': batch[b], 'version': registry[batch[b]].version }, base
496 );
497 }
498 } else {
499 // Split into groups
500 var groups = {};
501 for ( var b = 0; b < batch.length; b++ ) {
502 var group = registry[batch[b]].group;
503 if ( !( group in groups ) ) {
504 groups[group] = [];
505 }
506 groups[group][groups[group].length] = batch[b];
507 }
508 for ( var group in groups ) {
509 // Calculate the highest timestamp
510 var version = 0;
511 for ( var g = 0; g < groups[group].length; g++ ) {
512 if ( registry[groups[group][g]].version > version ) {
513 version = registry[groups[group][g]].version;
514 }
515 }
516 requests[requests.length] = $.extend(
517 { 'modules': groups[group].join( '|' ), 'version': formatVersionNumber( version ) }, base
518 );
519 }
520 }
521 // Clear the batch - this MUST happen before we append the script element to the body or it's
522 // possible that the script will be locally cached, instantly load, and work the batch again,
523 // all before we've cleared it causing each request to include modules which are already loaded
524 batch = [];
525 // Asynchronously append a script tag to the end of the body
526 function request() {
527 var html = '';
528 for ( var r = 0; r < requests.length; r++ ) {
529 requests[r] = sortQuery( requests[r] );
530 // Build out the HTML
531 var src = mediaWiki.config.get( 'wgLoadScript' ) + '?' + $.param( requests[r] );
532 html += '<script type="text/javascript" src="' + src + '"></script>';
533 }
534 return html;
535 }
536 // Load asynchronously after doumument ready
537 if ( ready ) {
538 setTimeout( function() { $( 'body' ).append( request() ); }, 0 )
539 } else {
540 document.write( request() );
541 }
542 }
543 };
544
545 /**
546 * Registers a module, letting the system know about it and it's dependencies. loader.js files contain calls
547 * to this function.
548 */
549 this.register = function( module, version, dependencies, group ) {
550 // Allow multiple registration
551 if ( typeof module === 'object' ) {
552 for ( var m = 0; m < module.length; m++ ) {
553 if ( typeof module[m] === 'string' ) {
554 that.register( module[m] );
555 } else if ( typeof module[m] === 'object' ) {
556 that.register.apply( that, module[m] );
557 }
558 }
559 return;
560 }
561 // Validate input
562 if ( typeof module !== 'string' ) {
563 throw new Error( 'module must be a string, not a ' + typeof module );
564 }
565 if ( typeof registry[module] !== 'undefined' ) {
566 throw new Error( 'module already implemeneted: ' + module );
567 }
568 // List the module as registered
569 registry[module] = {
570 'state': 'registered',
571 'group': typeof group === 'string' ? group : null,
572 'dependencies': [],
573 'version': typeof version !== 'undefined' ? parseInt( version ) : 0
574 };
575 if ( typeof dependencies === 'string' ) {
576 // Allow dependencies to be given as a single module name
577 registry[module].dependencies = [dependencies];
578 } else if ( typeof dependencies === 'object' || typeof dependencies === 'function' ) {
579 // Allow dependencies to be given as an array of module names or a function which returns an array
580 registry[module].dependencies = dependencies;
581 }
582 };
583
584 /**
585 * Implements a module, giving the system a course of action to take upon loading. Results of a request for
586 * one or more modules contain calls to this function.
587 */
588 this.implement = function( module, script, style, localization ) {
589 // Automaically register module
590 if ( typeof registry[module] === 'undefined' ) {
591 that.register( module );
592 }
593 // Validate input
594 if ( typeof script !== 'function' ) {
595 throw new Error( 'script must be a function, not a ' + typeof script );
596 }
597 if ( typeof style !== 'undefined' && typeof style !== 'string' && typeof style !== 'object' ) {
598 throw new Error( 'style must be a string or object, not a ' + typeof style );
599 }
600 if ( typeof localization !== 'undefined' && typeof localization !== 'object' ) {
601 throw new Error( 'localization must be an object, not a ' + typeof localization );
602 }
603 if ( typeof registry[module] !== 'undefined' && typeof registry[module].script !== 'undefined' ) {
604 throw new Error( 'module already implemeneted: ' + module );
605 }
606 // Mark module as loaded
607 registry[module].state = 'loaded';
608 // Attach components
609 registry[module].script = script;
610 if ( typeof style === 'string' || typeof style === 'object' && !( style instanceof Array ) ) {
611 registry[module].style = style;
612 }
613 if ( typeof localization === 'object' ) {
614 registry[module].messages = localization;
615 }
616 // Execute or queue callback
617 if ( filter( ['ready'], registry[module].dependencies ).compare( registry[module].dependencies ) ) {
618 execute( module );
619 } else {
620 request( module );
621 }
622 };
623
624 /**
625 * Executes a function as soon as one or more required modules are ready
626 *
627 * @param mixed string or array of strings of modules names the callback dependencies to be ready before
628 * executing
629 * @param function callback to execute when all dependencies are ready (optional)
630 * @param function callback to execute when if dependencies have a errors (optional)
631 */
632 this.using = function( dependencies, ready, error ) {
633 // Validate input
634 if ( typeof dependencies !== 'object' && typeof dependencies !== 'string' ) {
635 throw new Error( 'dependencies must be a string or an array, not a ' + typeof dependencies )
636 }
637 // Allow calling with a single dependency as a string
638 if ( typeof dependencies === 'string' ) {
639 dependencies = [dependencies];
640 }
641 // Resolve entire dependency map
642 dependencies = resolve( dependencies );
643 // If all dependencies are met, execute ready immediately
644 if ( filter( ['ready'], dependencies ).compare( dependencies ) ) {
645 if ( typeof ready === 'function' ) {
646 ready();
647 }
648 }
649 // If any dependencies have errors execute error immediately
650 else if ( filter( ['error'], dependencies ).length ) {
651 if ( typeof error === 'function' ) {
652 error();
653 }
654 }
655 // Since some dependencies are not yet ready, queue up a request
656 else {
657 request( dependencies, ready, error );
658 }
659 };
660
661 /**
662 * Loads an external script or one or more modules for future use
663 *
664 * @param {mixed} modules either the name of a module, array of modules, or a URL of an external script or style
665 * @param {string} type mime-type to use if calling with a URL of an external script or style; acceptable values
666 * are "text/css" and "text/javascript"; if no type is provided, text/javascript is assumed
667 */
668 this.load = function( modules, type ) {
669 // Validate input
670 if ( typeof modules !== 'object' && typeof modules !== 'string' ) {
671 throw new Error( 'dependencies must be a string or an array, not a ' + typeof dependencies )
672 }
673 // Allow calling with an external script or single dependency as a string
674 if ( typeof modules === 'string' ) {
675 // Support adding arbitrary external scripts
676 if ( modules.substr( 0, 7 ) == 'http://' || modules.substr( 0, 8 ) == 'https://' ) {
677 if ( type === 'text/css' ) {
678 setTimeout( function() {
679 $( 'head' ).append( '<link rel="stylesheet" type="text/css" href="' + modules + '" />' );
680 }, 0 );
681 return true;
682 } else if ( type === 'text/javascript' || typeof type === 'undefined' ) {
683 setTimeout( function() {
684 $( 'body' ).append( '<script type="text/javascript" src="' + modules + '"></script>' );
685 }, 0 );
686 return true;
687 }
688 // Unknown type
689 return false;
690 }
691 // Called with single module
692 modules = [modules];
693 }
694 // Resolve entire dependency map
695 modules = resolve( modules );
696 // If all modules are ready, nothing dependency be done
697 if ( filter( ['ready'], modules ).compare( modules ) ) {
698 return true;
699 }
700 // If any modules have errors return false
701 else if ( filter( ['error'], modules ).length ) {
702 return false;
703 }
704 // Since some modules are not yet ready, queue up a request
705 else {
706 request( modules );
707 return true;
708 }
709 };
710
711 /**
712 * Flushes the request queue and begin executing load requests on demand
713 */
714 this.go = function() {
715 suspended = false;
716 that.work();
717 };
718
719 /**
720 * Changes the state of a module
721 *
722 * @param mixed module string module name or object of module name/state pairs
723 * @param string state string state name
724 */
725 this.state = function( module, state ) {
726 if ( typeof module === 'object' ) {
727 for ( var m in module ) {
728 that.state( m, module[m] );
729 }
730 return;
731 }
732 if ( !( module in registry ) ) {
733 that.register( module );
734 }
735 registry[module].state = state;
736 };
737
738 /**
739 * Gets the version of a module
740 *
741 * @param string module name of module to get version for
742 */
743 this.version = function( module ) {
744 if ( module in registry && 'version' in registry[module] ) {
745 return formatVersionNumber( registry[module].version );
746 }
747 return null;
748 }
749
750 /* Cache document ready status */
751
752 $(document).ready( function() { ready = true; } );
753 } )();
754
755 /* Extension points */
756
757 this.util = {};
758 this.legacy = {};
759
760 } )( jQuery );
761
762
763 /* Auto-register from pre-loaded startup scripts */
764
765 if ( typeof window['startUp'] === 'function' ) {
766 window['startUp']();
767 delete window['startUp'];
768 }