/**
 * LiveJournal Real Usernames
 * 
 * Reverses the change made in http://community.livejournal.com/lj_releases/43180.html
 * that lets you change the text of the username link. <lj user="exampleusername" title="example" />
 *
 * v0.1 - 28 Feb, 2009
 * v0.2 -  1 Mar, 2009 - Fixed bug where it was changing communities to all say "community", and user
 *                       names with "_" in them were changed to "www".
 * v0.3 -  1 Mar, 2009 - Fixed bug when the link is users.livejournal.com.
 * v0.4 -  2 Mar, 2009 - Re-did most of the script so that it uses the lj:user attribute rather than
 *                       trying to parse the information with regexps.
 * v0.5 - 16 Jul, 2009 - Made sure the span has the lj:user attrib because some new spans were added
 *                       with the ljuser class, causing it to display blank usernames.
 */

// ==UserScript==
// @name           LiveJournal Real Usernames
// @namespace      http://lj.wblinks.com
// @description    Reverses the change made in R46 that lets users change the text of username links.
// @include        http://*.livejournal.com/*
// ==/UserScript==

var spans_all = document.getElementsByTagName("span");
var spans     = [];
for (var i in spans_all)
{
    if (spans_all[i].className == "ljuser" && spans_all[i].hasAttribute("lj:user"))
        spans[spans.length] = spans_all[i];
}

for (var i in spans)
{
    var links = spans[i].getElementsByTagName("a");
    
    for (var t in links)
    {
        var bolds   = links[t].getElementsByTagName("b");
        
        if (bolds.length == 1)
        {
            bolds[0].innerHTML = spans[i].getAttribute("lj:user");      
        }  
    }
}

