Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -297,7 +297,7 @@ |
298 | 298 | |
299 | 299 | /* Public Methods */ |
300 | 300 | |
301 | | - /* |
| 301 | + /** |
302 | 302 | * Generates a random user session ID (32 alpha-numeric characters). |
303 | 303 | * |
304 | 304 | * This information would potentially be stored in a cookie to identify a user during a |
— | — | @@ -315,7 +315,7 @@ |
316 | 316 | return id; |
317 | 317 | } |
318 | 318 | |
319 | | - /* |
| 319 | + /** |
320 | 320 | * Gets the current user's name. |
321 | 321 | * |
322 | 322 | * @return mixed user name string or null if users is anonymous |
— | — | @@ -324,7 +324,16 @@ |
325 | 325 | return mediaWiki.config.get( 'wgUserName' ); |
326 | 326 | }; |
327 | 327 | |
328 | | - /* |
| 328 | + /** |
| 329 | + * Checks if the current user is anonymous. |
| 330 | + * |
| 331 | + * @return boolean |
| 332 | + */ |
| 333 | + this.anonymous = function() { |
| 334 | + return that.name() ? false : true; |
| 335 | + }; |
| 336 | + |
| 337 | + /** |
329 | 338 | * Gets a random session ID automatically generated and kept in a cookie. |
330 | 339 | * |
331 | 340 | * This ID is ephemeral for everyone, staying in their browser only until they close |
— | — | @@ -346,7 +355,7 @@ |
347 | 356 | return sessionId; |
348 | 357 | }; |
349 | 358 | |
350 | | - /* |
| 359 | + /** |
351 | 360 | * Gets the current user's name or a random ID automatically generated and kept in a cookie. |
352 | 361 | * |
353 | 362 | * This ID is persistent for anonymous users, staying in their browser up to 1 year. The |