Javascript runs in the browser, so it only has access to data that's included in the html document. If you look at the headinclude template there's a section that sets some javascript variables just for that purpose (so the data is available in js functions on the page). So you could edit the headinclude template and add the username there.
If you switched to a php widget with a template I don't think you'd have to rewrite the widget, you'd just copy what you have to a template and the widget code would be a few lines as posted above (if you wanted you could try it by creating a new widget so if it doesn't work out you can just delete it).
|