Template:USERNAME/doc

Adds the username of the registered user viewing the page into the page.
 * Description

Uses Javascript to replace contents in span with viewing username:


 * Syntax
 * alt text
 * alt text is what is displayed when no user is logged in. If nothing is supplied as alt text, users will see " " when not logged in.


 * Example
 * is the best. 's userpage is good too.

The user reading will always see a compliment directed toward them and their userpage, no matter who they are.

This template requires you to add the following to your MediaWiki:Common.js:
 * Dependencies

/* Replaces with the name of the user browsing the page. Requires copying Template:USERNAME. */

$(function {   if (window.disableUsernameReplace || mw.config.get('wgUserName') === null) return;    $('span.insertusername').html(mw.config.get('wgUserName')); });

/* End of the replacement */