Index: trunk/phase3/resources/mediawiki/mediawiki.util.js |
— | — | @@ -342,7 +342,7 @@ |
343 | 343 | switch ( mw.config.get( 'skin' ) ) { |
344 | 344 | case 'standard' : |
345 | 345 | case 'cologneblue' : |
346 | | - $( '#quickbar' ).append( $link.after( '<br />' ) ); |
| 346 | + $( '#quickbar' ).append( $link.after( '<br/>' ) ); |
347 | 347 | return $link[0]; |
348 | 348 | case 'nostalgia' : |
349 | 349 | $( '#searchform' ).before( $link).before( ' | ' ); |
Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -2,8 +2,8 @@ |
3 | 3 | * Core MediaWiki JavaScript Library |
4 | 4 | */ |
5 | 5 | |
6 | | -// Attach to window |
7 | | -window.mediaWiki = new ( function( $ ) { |
| 6 | +// Attach to window and globally alias |
| 7 | +window.mw = window.mediaWiki = new ( function( $ ) { |
8 | 8 | |
9 | 9 | /* Private Members */ |
10 | 10 | |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | * that allow both single and multiple variables at once. |
23 | 23 | * |
24 | 24 | * @param global boolean Whether to store the values in the global window |
25 | | - * object or a exclusively in the object property 'values'. |
| 25 | + * object or a exclusively in the object property 'values'. |
26 | 26 | * @return Map |
27 | 27 | */ |
28 | 28 | function Map( global ) { |
— | — | @@ -37,9 +37,9 @@ |
38 | 38 | * @param selection mixed String key or array of keys to get values for. |
39 | 39 | * @param fallback mixed Value to use in case key(s) do not exist (optional). |
40 | 40 | * @return mixed If selection was a string returns the value or null, |
41 | | - * If selection was an array, returns an object of key/values (value is null if not found), |
42 | | - * If selection was not passed or invalid, will return the 'values' object member (be careful as |
43 | | - * objects are always passed by reference in JavaScript!). |
| 41 | + * If selection was an array, returns an object of key/values (value is null if not found), |
| 42 | + * If selection was not passed or invalid, will return the 'values' object member (be careful as |
| 43 | + * objects are always passed by reference in JavaScript!). |
44 | 44 | * @return Values as a string or object, null if invalid/inexistant. |
45 | 45 | */ |
46 | 46 | Map.prototype.get = function( selection, fallback ) { |
— | — | @@ -147,8 +147,9 @@ |
148 | 148 | // Return <key> if key does not exist |
149 | 149 | return '<' + this.key + '>'; |
150 | 150 | } |
151 | | - var text = this.map.get( this.key ); |
152 | | - var parameters = this.parameters; |
| 151 | + var text = this.map.get( this.key ); |
| 152 | + parameters = this.parameters; |
| 153 | + |
153 | 154 | text = text.replace( /\$(\d+)/g, function( string, match ) { |
154 | 155 | var index = parseInt( match, 10 ) - 1; |
155 | 156 | return index in parameters ? parameters[index] : '$' + match; |
— | — | @@ -164,7 +165,7 @@ |
165 | 166 | } |
166 | 167 | |
167 | 168 | /* This should be fixed up when we have a parser |
168 | | - if ( this.format === 'parse' && 'language' in mediaWiki ) { |
| 169 | + if ( this.format === 'parse' && 'language' in mw ) { |
169 | 170 | text = mw.language.parse( text ); |
170 | 171 | } |
171 | 172 | */ |
— | — | @@ -219,7 +220,7 @@ |
220 | 221 | this.log = function() { }; |
221 | 222 | |
222 | 223 | /** |
223 | | - * @var constructor Make the Map-class publicly available. |
| 224 | + * @var constructor Make the Map constructor publicly available. |
224 | 225 | */ |
225 | 226 | this.Map = Map; |
226 | 227 | |
— | — | @@ -251,7 +252,7 @@ |
252 | 253 | * |
253 | 254 | * @param key string Key of message to get |
254 | 255 | * @param parameter_1 mixed First argument in a list of variadic arguments, |
255 | | - * each a parameter for $N replacement in messages. |
| 256 | + * each a parameter for $N replacement in messages. |
256 | 257 | * @return Message |
257 | 258 | */ |
258 | 259 | this.message = function( key, parameter_1 /* [, parameter_2] */ ) { |
— | — | @@ -271,7 +272,7 @@ |
272 | 273 | * |
273 | 274 | * @param key string Key of message to get |
274 | 275 | * @param parameters mixed First argument in a list of variadic arguments, |
275 | | - * each a parameter for $N replacement in messages. |
| 276 | + * each a parameter for $N replacement in messages. |
276 | 277 | * @return String. |
277 | 278 | */ |
278 | 279 | this.msg = function( key, parameters ) { |
— | — | @@ -295,28 +296,27 @@ |
296 | 297 | * mediawiki. |
297 | 298 | * |
298 | 299 | * Format: |
299 | | - * { |
300 | | - * 'moduleName': { |
301 | | - * 'dependencies': ['required module', 'required module', ...], (or) function() {} |
302 | | - * 'state': 'registered', 'loading', 'loaded', 'ready', or 'error' |
303 | | - * 'script': function() {}, |
304 | | - * 'style': 'css code string', |
305 | | - * 'messages': { 'key': 'value' }, |
306 | | - * 'version': ############## (unix timestamp) |
307 | | - * } |
308 | | - * } |
| 300 | + * { |
| 301 | + * 'moduleName': { |
| 302 | + * 'dependencies': ['required module', 'required module', ...], (or) function() {} |
| 303 | + * 'state': 'registered', 'loading', 'loaded', 'ready', or 'error' |
| 304 | + * 'script': function() {}, |
| 305 | + * 'style': 'css code string', |
| 306 | + * 'messages': { 'key': 'value' }, |
| 307 | + * 'version': ############## (unix timestamp) |
| 308 | + * } |
309 | 309 | */ |
310 | | - var registry = {}; |
311 | | - // List of modules which will be loaded as when ready |
312 | | - var batch = []; |
313 | | - // List of modules to be loaded |
314 | | - var queue = []; |
315 | | - // List of callback functions waiting for modules to be ready to be called |
316 | | - var jobs = []; |
317 | | - // Flag inidicating that document ready has occured |
318 | | - var ready = false; |
319 | | - // Selector cache for the marker element. Use getMarker() to get/use the marker! |
320 | | - var $marker = null; |
| 310 | + var registry = {}, |
| 311 | + // List of modules which will be loaded as when ready |
| 312 | + batch = [], |
| 313 | + // List of modules to be loaded |
| 314 | + queue = [], |
| 315 | + // List of callback functions waiting for modules to be ready to be called |
| 316 | + jobs = [], |
| 317 | + // Flag inidicating that document ready has occured |
| 318 | + ready = false, |
| 319 | + // Selector cache for the marker element. Use getMarker() to get/use the marker! |
| 320 | + $marker = null; |
321 | 321 | |
322 | 322 | /* Private Methods */ |
323 | 323 | |
— | — | @@ -336,7 +336,7 @@ |
337 | 337 | } |
338 | 338 | |
339 | 339 | function compare( a, b ) { |
340 | | - if ( a.length != b.length ) { |
| 340 | + if ( a.length !== b.length ) { |
341 | 341 | return false; |
342 | 342 | } |
343 | 343 | for ( var i = 0; i < b.length; i++ ) { |
— | — | @@ -356,11 +356,10 @@ |
357 | 357 | * Generates an ISO8601 "basic" string from a UNIX timestamp |
358 | 358 | */ |
359 | 359 | function formatVersionNumber( timestamp ) { |
360 | | - function pad( a, b, c ) { |
361 | | - return [a < 10 ? '0' + a : a, b < 10 ? '0' + b : b, c < 10 ? '0' + c : c].join( '' ); |
362 | | - } |
363 | | - var d = new Date(); |
364 | | - d.setTime( timestamp * 1000 ); |
| 360 | + var pad = function( a, b, c ) { |
| 361 | + return [a < 10 ? '0' + a : a, b < 10 ? '0' + b : b, c < 10 ? '0' + c : c].join( '' ); |
| 362 | + }, |
| 363 | + d = new Date().setTime( timestamp * 1000 ); |
365 | 364 | return [ |
366 | 365 | pad( d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate() ), 'T', |
367 | 366 | pad( d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds() ), 'Z' |
— | — | @@ -435,7 +434,7 @@ |
436 | 435 | * |
437 | 436 | * @param states string or array of strings of module states to filter by |
438 | 437 | * @param modules array list of module names to filter (optional, all modules |
439 | | - * will be used by default) |
| 438 | + * will be used by default) |
440 | 439 | * @return array list of filtered module names |
441 | 440 | */ |
442 | 441 | function filter( states, modules ) { |
— | — | @@ -456,7 +455,7 @@ |
457 | 456 | for ( var m = 0; m < modules.length; m++ ) { |
458 | 457 | if ( registry[modules[m]] === undefined ) { |
459 | 458 | // Module does not exist |
460 | | - if ( states[s] == 'undefined' ) { |
| 459 | + if ( states[s] === 'undefined' ) { |
461 | 460 | // OK, undefined |
462 | 461 | list[list.length] = modules[m]; |
463 | 462 | } |
— | — | @@ -478,7 +477,6 @@ |
479 | 478 | * @param module string module name to execute |
480 | 479 | */ |
481 | 480 | function execute( module, callback ) { |
482 | | - var _fn = 'mw.loader::execute> '; |
483 | 481 | if ( registry[module] === undefined ) { |
484 | 482 | throw new Error( 'Module has not been registered yet: ' + module ); |
485 | 483 | } else if ( registry[module].state === 'registered' ) { |
— | — | @@ -489,9 +487,10 @@ |
490 | 488 | throw new Error( 'Module has already been loaded: ' + module ); |
491 | 489 | } |
492 | 490 | // Add styles |
| 491 | + var style; |
493 | 492 | if ( $.isPlainObject( registry[module].style ) ) { |
494 | 493 | for ( var media in registry[module].style ) { |
495 | | - var style = registry[module].style[media]; |
| 494 | + style = registry[module].style[media]; |
496 | 495 | if ( $.isArray( style ) ) { |
497 | 496 | for ( var i = 0; i < style.length; i++ ) { |
498 | 497 | getMarker().before( mw.html.element( 'link', { |
— | — | @@ -515,14 +514,15 @@ |
516 | 515 | } |
517 | 516 | // Execute script |
518 | 517 | try { |
519 | | - var script = registry[module].script; |
520 | | - var markModuleReady = function() { |
521 | | - registry[module].state = 'ready'; |
522 | | - handlePending( module ); |
523 | | - if ( $.isFunction( callback ) ) { |
524 | | - callback(); |
525 | | - } |
526 | | - }; |
| 518 | + var script = registry[module].script, |
| 519 | + markModuleReady = function() { |
| 520 | + registry[module].state = 'ready'; |
| 521 | + handlePending( module ); |
| 522 | + if ( $.isFunction( callback ) ) { |
| 523 | + callback(); |
| 524 | + } |
| 525 | + }; |
| 526 | + |
527 | 527 | if ( $.isArray( script ) ) { |
528 | 528 | var done = 0; |
529 | 529 | if ( script.length === 0 ) { |
— | — | @@ -532,7 +532,7 @@ |
533 | 533 | for ( var i = 0; i < script.length; i++ ) { |
534 | 534 | registry[module].state = 'loading'; |
535 | 535 | addScript( script[i], function() { |
536 | | - if ( ++done == script.length ) { |
| 536 | + if ( ++done === script.length ) { |
537 | 537 | markModuleReady(); |
538 | 538 | } |
539 | 539 | } ); |
— | — | @@ -545,7 +545,7 @@ |
546 | 546 | // This needs to NOT use mw.log because these errors are common in production mode |
547 | 547 | // and not in debug mode, such as when a symbol that should be global isn't exported |
548 | 548 | if ( window.console && typeof window.console.log === 'function' ) { |
549 | | - console.log( _fn + 'Exception thrown by ' + module + ': ' + e.message ); |
| 549 | + console.log( 'mw.loader::execute> Exception thrown by ' + module + ': ' + e.message ); |
550 | 550 | } |
551 | 551 | registry[module].state = 'error'; |
552 | 552 | throw e; |
— | — | @@ -574,7 +574,7 @@ |
575 | 575 | } |
576 | 576 | // Execute modules who's dependencies have just been met |
577 | 577 | for ( var r in registry ) { |
578 | | - if ( registry[r].state == 'loaded' ) { |
| 578 | + if ( registry[r].state === 'loaded' ) { |
579 | 579 | if ( compare( |
580 | 580 | filter( ['ready'], registry[r].dependencies ), |
581 | 581 | registry[r].dependencies ) ) |
— | — | @@ -611,8 +611,7 @@ |
612 | 612 | dependencies = [dependencies]; |
613 | 613 | if ( dependencies[0] in registry ) { |
614 | 614 | for ( var n = 0; n < registry[dependencies[0]].dependencies.length; n++ ) { |
615 | | - dependencies[dependencies.length] = |
616 | | - registry[dependencies[0]].dependencies[n]; |
| 615 | + dependencies[dependencies.length] = registry[dependencies[0]].dependencies[n]; |
617 | 616 | } |
618 | 617 | } |
619 | 618 | } |
— | — | @@ -621,7 +620,8 @@ |
622 | 621 | jobs[jobs.length] = { |
623 | 622 | 'dependencies': filter( |
624 | 623 | ['undefined', 'registered', 'loading', 'loaded'], |
625 | | - dependencies ), |
| 624 | + dependencies |
| 625 | + ), |
626 | 626 | 'ready': ready, |
627 | 627 | 'error': error |
628 | 628 | }; |
— | — | @@ -656,9 +656,9 @@ |
657 | 657 | * to a query string of the form foo.bar,baz|bar.baz,quux |
658 | 658 | */ |
659 | 659 | function buildModulesString( moduleMap ) { |
660 | | - var arr = []; |
| 660 | + var arr = [], p; |
661 | 661 | for ( var prefix in moduleMap ) { |
662 | | - var p = prefix === '' ? '' : prefix + '.'; |
| 662 | + p = prefix === '' ? '' : prefix + '.'; |
663 | 663 | arr.push( p + moduleMap[prefix].join( ',' ) ); |
664 | 664 | } |
665 | 665 | return arr.join( '|' ); |
— | — | @@ -676,11 +676,11 @@ |
677 | 677 | // jQuery's getScript method is NOT better than doing this the old-fassioned way |
678 | 678 | // because jQuery will eval the script's code, and errors will not have sane |
679 | 679 | // line numbers. |
680 | | - var script = document.createElement( 'script' ); |
| 680 | + var done = false, |
| 681 | + script = document.createElement( 'script' ); |
681 | 682 | script.setAttribute( 'src', src ); |
682 | 683 | script.setAttribute( 'type', 'text/javascript' ); |
683 | 684 | if ( $.isFunction( callback ) ) { |
684 | | - var done = false; |
685 | 685 | // Attach handlers for all browsers -- this is based on jQuery.getScript |
686 | 686 | script.onload = script.onreadystatechange = function() { |
687 | 687 | if ( |
— | — | @@ -719,10 +719,21 @@ |
720 | 720 | * Requests dependencies from server, loading and executing when things when ready. |
721 | 721 | */ |
722 | 722 | this.work = function() { |
| 723 | + // Build a list of request parameters |
| 724 | + var base = { |
| 725 | + 'skin': mw.config.get( 'skin' ), |
| 726 | + 'lang': mw.config.get( 'wgUserLanguage' ), |
| 727 | + 'debug': mw.config.get( 'debug' ) |
| 728 | + }, |
| 729 | + // Extend request parameters with a list of modules in the batch |
| 730 | + requests = [], |
| 731 | + // Split into groups |
| 732 | + groups = {}; |
| 733 | + |
723 | 734 | // Appends a list of modules to the batch |
724 | 735 | for ( var q = 0; q < queue.length; q++ ) { |
725 | 736 | // Only request modules which are undefined or registered |
726 | | - if ( !( queue[q] in registry ) || registry[queue[q]].state == 'registered' ) { |
| 737 | + if ( !( queue[q] in registry ) || registry[queue[q]].state === 'registered' ) { |
727 | 738 | // Prevent duplicate entries |
728 | 739 | if ( $.inArray( queue[q], batch ) === -1 ) { |
729 | 740 | batch[batch.length] = queue[q]; |
— | — | @@ -742,22 +753,12 @@ |
743 | 754 | // Always order modules alphabetically to help reduce cache |
744 | 755 | // misses for otherwise identical content |
745 | 756 | batch.sort(); |
746 | | - // Build a list of request parameters |
747 | | - var base = { |
748 | | - 'skin': mw.config.get( 'skin' ), |
749 | | - 'lang': mw.config.get( 'wgUserLanguage' ), |
750 | | - 'debug': mw.config.get( 'debug' ) |
751 | | - }; |
752 | | - // Extend request parameters with a list of modules in the batch |
753 | | - var requests = []; |
754 | | - // Split into groups |
755 | | - var groups = {}; |
756 | 757 | for ( var b = 0; b < batch.length; b++ ) { |
757 | | - var group = registry[batch[b]].group; |
758 | | - if ( !( group in groups ) ) { |
759 | | - groups[group] = []; |
| 758 | + var bGroup = registry[batch[b]].group; |
| 759 | + if ( !( bGroup in groups ) ) { |
| 760 | + groups[bGroup] = []; |
760 | 761 | } |
761 | | - groups[group][groups[group].length] = batch[b]; |
| 762 | + groups[bGroup][groups[bGroup].length] = batch[b]; |
762 | 763 | } |
763 | 764 | for ( var group in groups ) { |
764 | 765 | // Calculate the highest timestamp |
— | — | @@ -767,24 +768,27 @@ |
768 | 769 | version = registry[groups[group][g]].version; |
769 | 770 | } |
770 | 771 | } |
771 | | - var reqBase = $.extend( { 'version': formatVersionNumber( version ) }, base ); |
772 | | - var reqBaseLength = $.param( reqBase ).length; |
773 | | - var reqs = []; |
774 | | - var limit = mw.config.get( 'wgResourceLoaderMaxQueryLength', -1 ); |
775 | | - // We may need to split up the request to honor the query string length limit |
776 | | - // So build it piece by piece |
777 | | - var l = reqBaseLength + 9; // '&modules='.length == 9 |
778 | | - var r = 0; |
| 772 | + |
| 773 | + var reqBase = $.extend( { 'version': formatVersionNumber( version ) }, base ), |
| 774 | + reqBaseLength = $.param( reqBase ).length, |
| 775 | + reqs = [], |
| 776 | + limit = mw.config.get( 'wgResourceLoaderMaxQueryLength', -1 ), |
| 777 | + // We may need to split up the request to honor the query string length limit, |
| 778 | + // so build it piece by piece. |
| 779 | + l = reqBaseLength + 9, // '&modules='.length == 9 |
| 780 | + r = 0; |
| 781 | + |
779 | 782 | reqs[0] = {}; // { prefix: [ suffixes ] } |
| 783 | + |
780 | 784 | for ( var i = 0; i < groups[group].length; i++ ) { |
781 | | - // Determine how many bytes this module would add to the query string |
782 | | - var lastDotIndex = groups[group][i].lastIndexOf( '.' ); |
783 | | - // Note that these substr() calls work even if lastDotIndex == -1 |
784 | | - var prefix = groups[group][i].substr( 0, lastDotIndex ); |
785 | | - var suffix = groups[group][i].substr( lastDotIndex + 1 ); |
786 | | - var bytesAdded = prefix in reqs[r] ? |
787 | | - suffix.length + 3 : // '%2C'.length == 3 |
788 | | - groups[group][i].length + 3; // '%7C'.length == 3 |
| 785 | + // Determine how many bytes this module would add to the query string |
| 786 | + var lastDotIndex = groups[group][i].lastIndexOf( '.' ), |
| 787 | + // Note that these substr() calls work even if lastDotIndex == -1 |
| 788 | + prefix = groups[group][i].substr( 0, lastDotIndex ), |
| 789 | + suffix = groups[group][i].substr( lastDotIndex + 1 ), |
| 790 | + bytesAdded = prefix in reqs[r] |
| 791 | + ? suffix.length + 3 // '%2C'.length == 3 |
| 792 | + : groups[group][i].length + 3; // '%7C'.length == 3 |
789 | 793 | |
790 | 794 | // If the request would become too long, create a new one, |
791 | 795 | // but don't create empty requests |
— | — | @@ -870,9 +874,9 @@ |
871 | 875 | * |
872 | 876 | * @param module String: Name of module |
873 | 877 | * @param script Mixed: Function of module code or String of URL to be used as the src |
874 | | - * attribute when adding a script element to the body |
| 878 | + * attribute when adding a script element to the body |
875 | 879 | * @param style Object: Object of CSS strings keyed by media-type or Object of lists of URLs |
876 | | - * keyed by media-type |
| 880 | + * keyed by media-type |
877 | 881 | * @param msgs Object: List of key/value pairs to be passed through mw.messages.set |
878 | 882 | */ |
879 | 883 | this.implement = function( module, script, style, msgs ) { |
— | — | @@ -918,19 +922,18 @@ |
919 | 923 | * Executes a function as soon as one or more required modules are ready |
920 | 924 | * |
921 | 925 | * @param dependencies string or array of strings of modules names the callback |
922 | | - * dependencies to be ready before |
923 | | - * executing |
| 926 | + * dependencies to be ready before executing |
924 | 927 | * @param ready function callback to execute when all dependencies are ready (optional) |
925 | 928 | * @param error function callback to execute when if dependencies have a errors (optional) |
926 | 929 | */ |
927 | 930 | this.using = function( dependencies, ready, error ) { |
| 931 | + var tod = typeof dependencies; |
928 | 932 | // Validate input |
929 | | - if ( typeof dependencies !== 'object' && typeof dependencies !== 'string' ) { |
930 | | - throw new Error( 'dependencies must be a string or an array, not a ' + |
931 | | - typeof dependencies ); |
| 933 | + if ( tod !== 'object' && tod !== 'string' ) { |
| 934 | + throw new Error( 'dependencies must be a string or an array, not a ' + tod ); |
932 | 935 | } |
933 | 936 | // Allow calling with a single dependency as a string |
934 | | - if ( typeof dependencies === 'string' ) { |
| 937 | + if ( tod === 'string' ) { |
935 | 938 | dependencies = [dependencies]; |
936 | 939 | } |
937 | 940 | // Resolve entire dependency map |
— | — | @@ -957,24 +960,22 @@ |
958 | 961 | * Loads an external script or one or more modules for future use |
959 | 962 | * |
960 | 963 | * @param modules mixed either the name of a module, array of modules, |
961 | | - * or a URL of an external script or style |
| 964 | + * or a URL of an external script or style |
962 | 965 | * @param type string mime-type to use if calling with a URL of an |
963 | | - * external script or style; acceptable values are "text/css" and |
964 | | - * "text/javascript"; if no type is provided, text/javascript is |
965 | | - * assumed |
| 966 | + * external script or style; acceptable values are "text/css" and |
| 967 | + * "text/javascript"; if no type is provided, text/javascript is assumed. |
966 | 968 | */ |
967 | 969 | this.load = function( modules, type ) { |
968 | 970 | // Validate input |
969 | 971 | if ( typeof modules !== 'object' && typeof modules !== 'string' ) { |
970 | | - throw new Error( 'modules must be a string or an array, not a ' + |
971 | | - typeof modules ); |
| 972 | + throw new Error( 'modules must be a string or an array, not a ' + typeof modules ); |
972 | 973 | } |
973 | 974 | // Allow calling with an external script or single dependency as a string |
974 | 975 | if ( typeof modules === 'string' ) { |
975 | 976 | // Support adding arbitrary external scripts |
976 | | - if ( modules.substr( 0, 7 ) == 'http://' || modules.substr( 0, 8 ) == 'https://' ) { |
| 977 | + if ( modules.substr( 0, 7 ) === 'http://' || modules.substr( 0, 8 ) === 'https://' ) { |
977 | 978 | if ( type === 'text/css' ) { |
978 | | - $( 'head' ).append( $( '<link />', { |
| 979 | + $( 'head' ).append( $( '<link/>', { |
979 | 980 | rel: 'stylesheet', |
980 | 981 | type: 'text/css', |
981 | 982 | href: modules |
— | — | @@ -1037,11 +1038,12 @@ |
1038 | 1039 | } |
1039 | 1040 | return null; |
1040 | 1041 | }; |
| 1042 | + |
1041 | 1043 | /** |
1042 | 1044 | * @deprecated use mw.loader.getVersion() instead |
1043 | 1045 | */ |
1044 | 1046 | this.version = function() { |
1045 | | - return mediaWiki.loader.getVersion.apply( mediaWiki.loader, arguments ); |
| 1047 | + return mw.loader.getVersion.apply( mw.loader, arguments ); |
1046 | 1048 | }; |
1047 | 1049 | |
1048 | 1050 | /** |
— | — | @@ -1106,17 +1108,17 @@ |
1107 | 1109 | * @param name The tag name. |
1108 | 1110 | * @param attrs An object with members mapping element names to values |
1109 | 1111 | * @param contents The contents of the element. May be either: |
1110 | | - * - string: The string is escaped. |
1111 | | - * - null or undefined: The short closing form is used, e.g. <br/>. |
1112 | | - * - this.Raw: The value attribute is included without escaping. |
1113 | | - * - this.Cdata: The value attribute is included, and an exception is |
1114 | | - * thrown if it contains an illegal ETAGO delimiter. |
1115 | | - * See http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.3.2 |
| 1112 | + * - string: The string is escaped. |
| 1113 | + * - null or undefined: The short closing form is used, e.g. <br/>. |
| 1114 | + * - this.Raw: The value attribute is included without escaping. |
| 1115 | + * - this.Cdata: The value attribute is included, and an exception is |
| 1116 | + * thrown if it contains an illegal ETAGO delimiter. |
| 1117 | + * See http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.3.2 |
1116 | 1118 | * |
1117 | 1119 | * Example: |
1118 | | - * var h = mw.html; |
1119 | | - * return h.element( 'div', {}, |
1120 | | - * new h.Raw( h.element( 'img', {src: '<'} ) ) ); |
| 1120 | + * var h = mw.html; |
| 1121 | + * return h.element( 'div', {}, |
| 1122 | + * new h.Raw( h.element( 'img', {src: '<'} ) ) ); |
1121 | 1123 | * Returns <div><img src="<"/></div> |
1122 | 1124 | */ |
1123 | 1125 | this.element = function( name, attrs, contents ) { |
— | — | @@ -1160,9 +1162,6 @@ |
1161 | 1163 | // Alias $j to jQuery for backwards compatibility |
1162 | 1164 | window.$j = jQuery; |
1163 | 1165 | |
1164 | | -// Global alias |
1165 | | -window.mw = mediaWiki; |
1166 | | - |
1167 | 1166 | /* Auto-register from pre-loaded startup scripts */ |
1168 | 1167 | |
1169 | 1168 | if ( jQuery.isFunction( startUp ) ) { |