Wikipedia:WikiProject User scripts/Scripts/Get user name

This is an old revision of this page, as edited by Lupin (talk | contribs) at 12:14, 17 August 2006 (and again). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

//

/*This script gets a username from the current page
Example: On [[User:Digitalme/getusername.js]], getUserName() would return Digitalme
*/

function getUserName(){

  switch (wgCanonicalNamespace) {
    case 'User': case 'User_talk': return wgTitle.split('/')[0];
    default: return null;
  }

}
//