Wikipedia:WikiProject User scripts/Scripts/Get user name

This is an old revision of this page, as edited by Piotrus (talk | contribs) at 23:01, 6 February 2007 (Category:Wikipedia scripts). 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;
  }

}
/*

*/