In the template headinclude, there's this code:
Code:
var SESSIONURL = "{vb:raw session.sessionurl_js}";
var SECURITYTOKEN = "{vb:raw bbuserinfo.securitytoken}";
var IMGDIR_MISC = "{vb:stylevar imgdir_misc}";
So I was thinking of adding a line like:
Code:
var USER_NAME = "{vb:raw bbuserinfo.username}";
To be honest I'm not sure what special chars in a user name might cause problems with this, but in any case it seems like that should allow you to use USER_NAME in your js code.