From: Trevor Parscal Date: Fri, 17 Dec 2010 19:18:26 +0000 (+0000) Subject: Added anonymous function to mediaWiki.user X-Git-Tag: 1.31.0-rc.0~33248 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=529c14b46d0240abc16f56dc7353e5b2c23b78bc;p=lhc%2Fweb%2Fwiklou.git Added anonymous function to mediaWiki.user --- diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index 15aa76642e..ea1a9ef8df 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -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