Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | return results; |
54 | 54 | } else if ( typeof selection === 'string' ) { |
55 | 55 | if ( this.values[selection] === undefined ) { |
56 | | - if ( typeof fallback !== 'undefined' ) { |
| 56 | + if ( fallback !== undefined ) { |
57 | 57 | return fallback; |
58 | 58 | } |
59 | 59 | return null; |
— | — | @@ -75,7 +75,7 @@ |
76 | 76 | this.values[s] = selection[s]; |
77 | 77 | } |
78 | 78 | return true; |
79 | | - } else if ( typeof selection === 'string' && typeof value !== 'undefined' ) { |
| 79 | + } else if ( typeof selection === 'string' && value !== undefined ) { |
80 | 80 | this.values[selection] = value; |
81 | 81 | return true; |
82 | 82 | } |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | this.format = 'parse'; |
118 | 118 | this.map = map; |
119 | 119 | this.key = key; |
120 | | - this.parameters = typeof parameters === 'undefined' ? [] : $.makeArray( parameters ); |
| 120 | + this.parameters = parameters === undefined ? [] : $.makeArray( parameters ); |
121 | 121 | return this; |
122 | 122 | } |
123 | 123 | |
— | — | @@ -367,7 +367,7 @@ |
368 | 368 | * Recursively resolves dependencies and detects circular references |
369 | 369 | */ |
370 | 370 | function recurse( module, resolved, unresolved ) { |
371 | | - if ( typeof registry[module] === 'undefined' ) { |
| 371 | + if ( registry[module] === undefined ) { |
372 | 372 | throw new Error( 'Unknown dependency: ' + module ); |
373 | 373 | } |
374 | 374 | // Resolves dynamic loader function and replaces it with its own results |
— | — | @@ -441,7 +441,7 @@ |
442 | 442 | } |
443 | 443 | // If called without a list of modules, build and use a list of all modules |
444 | 444 | var list = [], module; |
445 | | - if ( typeof modules === 'undefined' ) { |
| 445 | + if ( modules === undefined ) { |
446 | 446 | modules = []; |
447 | 447 | for ( module in registry ) { |
448 | 448 | modules[modules.length] = module; |
— | — | @@ -450,7 +450,7 @@ |
451 | 451 | // Build a list of modules which are in one of the specified states |
452 | 452 | for ( var s = 0; s < states.length; s++ ) { |
453 | 453 | for ( var m = 0; m < modules.length; m++ ) { |
454 | | - if ( typeof registry[modules[m]] === 'undefined' ) { |
| 454 | + if ( registry[modules[m]] === undefined ) { |
455 | 455 | // Module does not exist |
456 | 456 | if ( states[s] == 'undefined' ) { |
457 | 457 | // OK, undefined |
— | — | @@ -475,7 +475,7 @@ |
476 | 476 | */ |
477 | 477 | function execute( module, callback ) { |
478 | 478 | var _fn = 'mw.loader::execute> '; |
479 | | - if ( typeof registry[module] === 'undefined' ) { |
| 479 | + if ( registry[module] === undefined ) { |
480 | 480 | throw new Error( 'Module has not been registered yet: ' + module ); |
481 | 481 | } else if ( registry[module].state === 'registered' ) { |
482 | 482 | throw new Error( 'Module has not been requested from the server yet: ' + module ); |
— | — | @@ -837,7 +837,7 @@ |
838 | 838 | if ( typeof module !== 'string' ) { |
839 | 839 | throw new Error( 'module must be a string, not a ' + typeof module ); |
840 | 840 | } |
841 | | - if ( typeof registry[module] !== 'undefined' ) { |
| 841 | + if ( registry[module] !== undefined ) { |
842 | 842 | throw new Error( 'module already implemented: ' + module ); |
843 | 843 | } |
844 | 844 | // List the module as registered |
— | — | @@ -845,7 +845,7 @@ |
846 | 846 | 'state': 'registered', |
847 | 847 | 'group': typeof group === 'string' ? group : null, |
848 | 848 | 'dependencies': [], |
849 | | - 'version': typeof version !== 'undefined' ? parseInt( version, 10 ) : 0 |
| 849 | + 'version': version !== undefined ? parseInt( version, 10 ) : 0 |
850 | 850 | }; |
851 | 851 | if ( typeof dependencies === 'string' ) { |
852 | 852 | // Allow dependencies to be given as a single module name |
— | — | @@ -886,13 +886,11 @@ |
887 | 887 | throw new Error( 'msgs must be an object, not a ' + typeof msgs ); |
888 | 888 | } |
889 | 889 | // Automatically register module |
890 | | - if ( typeof registry[module] === 'undefined' ) { |
| 890 | + if ( registry[module] === undefined ) { |
891 | 891 | mw.loader.register( module ); |
892 | 892 | } |
893 | 893 | // Check for duplicate implementation |
894 | | - if ( typeof registry[module] !== 'undefined' |
895 | | - && typeof registry[module].script !== 'undefined' ) |
896 | | - { |
| 894 | + if ( registry[module] !== undefined && registry[module].script !== undefined ) { |
897 | 895 | throw new Error( 'module already implemeneted: ' + module ); |
898 | 896 | } |
899 | 897 | // Mark module as loaded |
— | — | @@ -978,7 +976,7 @@ |
979 | 977 | href: modules |
980 | 978 | } ) ); |
981 | 979 | return true; |
982 | | - } else if ( type === 'text/javascript' || typeof type === 'undefined' ) { |
| 980 | + } else if ( type === 'text/javascript' || type === undefined ) { |
983 | 981 | addScript( modules ); |
984 | 982 | return true; |
985 | 983 | } |
— | — | @@ -1122,7 +1120,7 @@ |
1123 | 1121 | for ( var attrName in attrs ) { |
1124 | 1122 | s += ' ' + attrName + '="' + this.escape( attrs[attrName] ) + '"'; |
1125 | 1123 | } |
1126 | | - if ( typeof contents == 'undefined' || contents === null ) { |
| 1124 | + if ( contents === undefined || contents === null ) { |
1127 | 1125 | // Self close tag |
1128 | 1126 | s += '/>'; |
1129 | 1127 | return s; |
— | — | @@ -1157,11 +1155,13 @@ |
1158 | 1156 | |
1159 | 1157 | // Alias $j to jQuery for backwards compatibility |
1160 | 1158 | window.$j = jQuery; |
| 1159 | + |
| 1160 | +// Global alias |
1161 | 1161 | window.mw = mediaWiki; |
1162 | 1162 | |
1163 | 1163 | /* Auto-register from pre-loaded startup scripts */ |
1164 | 1164 | |
1165 | | -if ( $.isFunction( startUp ) ) { |
| 1165 | +if ( jQuery.isFunction( startUp ) ) { |
1166 | 1166 | startUp(); |
1167 | 1167 | delete startUp; |
1168 | 1168 | } |