Added anonymous function to mediaWiki.user
authorTrevor Parscal <tparscal@users.mediawiki.org>
Fri, 17 Dec 2010 19:18:26 +0000 (19:18 +0000)
committerTrevor Parscal <tparscal@users.mediawiki.org>
Fri, 17 Dec 2010 19:18:26 +0000 (19:18 +0000)
resources/mediawiki/mediawiki.js

index 15aa766..ea1a9ef 100644 (file)
@@ -297,7 +297,7 @@ window.mediaWiki = new ( function( $ ) {
 
                /* Public Methods */
 
-               /*
+               /**
                 * Generates a random user session ID (32 alpha-numeric characters).
                 * 
                 * This information would potentially be stored in a cookie to identify a user during a
@@ -315,7 +315,7 @@ window.mediaWiki = new ( function( $ ) {
                        return id;
                }
 
-               /*
+               /**
                 * Gets the current user's name.
                 * 
                 * @return mixed user name string or null if users is anonymous
@@ -324,7 +324,16 @@ window.mediaWiki = new ( function( $ ) {
                        return mediaWiki.config.get( 'wgUserName' );
                };
 
-               /*
+               /**
+                * Checks if the current user is anonymous.
+                * 
+                * @return boolean
+                */
+               this.anonymous = function() {
+                       return that.name() ? false : true;
+               };
+
+               /**
                 * Gets a random session ID automatically generated and kept in a cookie.
                 * 
                 * This ID is ephemeral for everyone, staying in their browser only until they close
@@ -346,7 +355,7 @@ window.mediaWiki = new ( function( $ ) {
                        return sessionId;
                };
 
-               /*
+               /**
                 * Gets the current user's name or a random ID automatically generated and kept in a cookie.
                 * 
                 * This ID is persistent for anonymous users, staying in their browser up to 1 year. The