Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -55,10 +55,10 @@ |
56 | 56 | return true; |
57 | 57 | }, |
58 | 58 | compareObject : function( objectA, objectB ) { |
59 | | - |
| 59 | + |
60 | 60 | // Do a simple check if the types match |
61 | 61 | if ( typeof objectA == typeof objectB ) { |
62 | | - |
| 62 | + |
63 | 63 | // Only loop over the contents if it really is an object |
64 | 64 | if ( typeof objectA == 'object' ) { |
65 | 65 | // If they are aliases of the same object (ie. mw and mediaWiki) return now |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | var index = parseInt( match, 10 ) - 1; |
251 | 251 | return index in parameters ? parameters[index] : '$' + match; |
252 | 252 | } ); |
253 | | - |
| 253 | + |
254 | 254 | if ( this.format === 'plain' ) { |
255 | 255 | return text; |
256 | 256 | } |
— | — | @@ -258,7 +258,7 @@ |
259 | 259 | // still todo |
260 | 260 | return mw.html.escape( text ); |
261 | 261 | } |
262 | | - |
| 262 | + |
263 | 263 | /* This should be fixed up when we have a parser |
264 | 264 | if ( this.format === 'parse' && 'language' in mediaWiki ) { |
265 | 265 | text = mw.language.parse( text ); |
— | — | @@ -286,10 +286,10 @@ |
287 | 287 | this.format = 'plain'; |
288 | 288 | return this.toString(); |
289 | 289 | }; |
290 | | - |
| 290 | + |
291 | 291 | /** |
292 | 292 | * Changes the format to html escaped and converts message to string |
293 | | - * |
| 293 | + * |
294 | 294 | * @return {string} String form of html escaped message |
295 | 295 | */ |
296 | 296 | Message.prototype.escaped = function() { |
— | — | @@ -323,10 +323,10 @@ |
324 | 324 | |
325 | 325 | /** |
326 | 326 | * Generates a random user session ID (32 alpha-numeric characters). |
327 | | - * |
| 327 | + * |
328 | 328 | * This information would potentially be stored in a cookie to identify a user during a |
329 | 329 | * session or series of sessions. It's uniqueness should not be depended on. |
330 | | - * |
| 330 | + * |
331 | 331 | * @return string random set of 32 alpha-numeric characters |
332 | 332 | */ |
333 | 333 | function generateId() { |
— | — | @@ -341,7 +341,7 @@ |
342 | 342 | |
343 | 343 | /** |
344 | 344 | * Gets the current user's name. |
345 | | - * |
| 345 | + * |
346 | 346 | * @return mixed user name string or null if users is anonymous |
347 | 347 | */ |
348 | 348 | this.name = function() { |
— | — | @@ -350,7 +350,7 @@ |
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Checks if the current user is anonymous. |
354 | | - * |
| 354 | + * |
355 | 355 | * @return boolean |
356 | 356 | */ |
357 | 357 | this.anonymous = function() { |
— | — | @@ -359,14 +359,14 @@ |
360 | 360 | |
361 | 361 | /** |
362 | 362 | * Gets a random session ID automatically generated and kept in a cookie. |
363 | | - * |
| 363 | + * |
364 | 364 | * This ID is ephemeral for everyone, staying in their browser only until they close |
365 | 365 | * their browser. |
366 | | - * |
| 366 | + * |
367 | 367 | * Do not use this method before the first call to mw.loader.go(), it depends on |
368 | 368 | * jquery.cookie, which is added to the first pay-load just after mediaWiki is defined, but |
369 | 369 | * won't be loaded until the first call to go(). |
370 | | - * |
| 370 | + * |
371 | 371 | * @return string user name or random session ID |
372 | 372 | */ |
373 | 373 | this.sessionId = function () { |
— | — | @@ -380,15 +380,15 @@ |
381 | 381 | |
382 | 382 | /** |
383 | 383 | * Gets the current user's name or a random ID automatically generated and kept in a cookie. |
384 | | - * |
| 384 | + * |
385 | 385 | * This ID is persistent for anonymous users, staying in their browser up to 1 year. The |
386 | 386 | * expiration time is reset each time the ID is queried, so in most cases this ID will |
387 | 387 | * persist until the browser's cookies are cleared or the user doesn't visit for 1 year. |
388 | | - * |
| 388 | + * |
389 | 389 | * Do not use this method before the first call to mw.loader.go(), it depends on |
390 | 390 | * jquery.cookie, which is added to the first pay-load just after mediaWiki is defined, but |
391 | 391 | * won't be loaded until the first call to go(). |
392 | | - * |
| 392 | + * |
393 | 393 | * @return string user name or random session ID |
394 | 394 | */ |
395 | 395 | this.id = function() { |
— | — | @@ -407,7 +407,7 @@ |
408 | 408 | |
409 | 409 | /** |
410 | 410 | * Gets the user's bucket, placing them in one at random based on set odds if needed. |
411 | | - * |
| 411 | + * |
412 | 412 | * @param key String: Name of bucket |
413 | 413 | * @param options Object: Bucket configuration options |
414 | 414 | * @param options.buckets Object: List of bucket-name/relative-probability pairs (required, |
— | — | @@ -419,7 +419,7 @@ |
420 | 420 | * @param options.expires Number: Length of time (in days) until the user gets rebucketed |
421 | 421 | * (optional, default: 30) |
422 | 422 | * @return String: Bucket name - the randomly chosen key of the options.buckets object |
423 | | - * |
| 423 | + * |
424 | 424 | * @example |
425 | 425 | * mw.user.bucket( 'test', { |
426 | 426 | * 'buckets': { 'ignored': 50, 'control': 25, 'test': 25 }, |
— | — | @@ -820,7 +820,7 @@ |
821 | 821 | |
822 | 822 | /** |
823 | 823 | * Automatically executes jobs and modules which are pending with satistifed dependencies. |
824 | | - * |
| 824 | + * |
825 | 825 | * This is used when dependencies are satisfied, such as when a module is executed. |
826 | 826 | */ |
827 | 827 | function handlePending() { |
— | — | @@ -916,7 +916,7 @@ |
917 | 917 | } |
918 | 918 | return sorted; |
919 | 919 | } |
920 | | - |
| 920 | + |
921 | 921 | /** |
922 | 922 | * Converts a module map of the form { foo: [ 'bar', 'baz' ], bar: [ 'baz, 'quux' ] } |
923 | 923 | * to a query string of the form foo.bar,baz|bar.baz,quux |
— | — | @@ -933,7 +933,7 @@ |
934 | 934 | /** |
935 | 935 | * Adds a script tag to the body, either using document.write or low-level DOM manipulation, |
936 | 936 | * depending on whether document-ready has occured yet. |
937 | | - * |
| 937 | + * |
938 | 938 | * @param src String: URL to script, will be used as the src attribute in the script tag |
939 | 939 | * @param callback Function: Optional callback which will be run when the script is done |
940 | 940 | */ |
— | — | @@ -1051,7 +1051,7 @@ |
1052 | 1052 | var bytesAdded = prefix in reqs[r] ? |
1053 | 1053 | suffix.length + 3 : // '%2C'.length == 3 |
1054 | 1054 | groups[group][i].length + 3; // '%7C'.length == 3 |
1055 | | - |
| 1055 | + |
1056 | 1056 | // If the request would become too long, create a new one, |
1057 | 1057 | // but don't create empty requests |
1058 | 1058 | if ( limit > 0 && reqs[r] != {} && l + bytesAdded > limit ) { |
— | — | @@ -1085,7 +1085,7 @@ |
1086 | 1086 | addScript( src ); |
1087 | 1087 | } |
1088 | 1088 | }; |
1089 | | - |
| 1089 | + |
1090 | 1090 | /** |
1091 | 1091 | * Registers a module, letting the system know about it and its |
1092 | 1092 | * dependencies. loader.js files contain calls to this function. |
— | — | @@ -1107,7 +1107,7 @@ |
1108 | 1108 | throw new Error( 'module must be a string, not a ' + typeof module ); |
1109 | 1109 | } |
1110 | 1110 | if ( typeof registry[module] !== 'undefined' ) { |
1111 | | - throw new Error( 'module already implemeneted: ' + module ); |
| 1111 | + throw new Error( 'module already implemented: ' + module ); |
1112 | 1112 | } |
1113 | 1113 | // List the module as registered |
1114 | 1114 | registry[module] = { |
— | — | @@ -1130,9 +1130,9 @@ |
1131 | 1131 | * Implements a module, giving the system a course of action to take |
1132 | 1132 | * upon loading. Results of a request for one or more modules contain |
1133 | 1133 | * calls to this function. |
1134 | | - * |
| 1134 | + * |
1135 | 1135 | * All arguments are required. |
1136 | | - * |
| 1136 | + * |
1137 | 1137 | * @param module String: Name of module |
1138 | 1138 | * @param script Mixed: Function of module code or String of URL to be used as the src |
1139 | 1139 | * attribute when adding a script element to the body |