Wikipedia:WikiProject User scripts/Scripts/Get user name

From Wikipedia, the free encyclopedia

/*

*/
/*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;
  }

}
/*

*/