Post by ⓦ৹₪deⓡ on Jan 30, 2010 23:35:52 GMT -8
This code will allow you to display a user's display name in a post and it will change in the post if the user changes their display name. The format of the UBBC tag is:
[user=X]
Where X is the user's username. Once posted, the UBBC code will be replaced with that user's display name and will be updated automatically if the user changes it.
Place in Global Footer.
[user=X]
Where X is the user's username. Once posted, the UBBC code will be replaced with that user's display name and will be updated automatically if the user changes it.
Place in Global Footer.
<script>
//Show user's current display name in posts v1.0
//Copyright 01-31-2010 ~Wonder
//May be reposted anywhere as long as this header remains in tact
//Place in Global Footer
//To use enter [user=X] Where X is the user's username
if(location.href.match(/action\=(display|modifypost|pmview|recent|userrecentposts|gotopost|search|calendarview)/) || (!location.href.match(/action\=/) && document.postForm))
{
for(i=0;i<document.links.length;i++)
{
if(document.links[i].href.match(/action=gotopost/) && document.links[i].href.match(/board=permaname/) && document.links[i].href.match(/thread=0/) && document.links[i].href.match(/post=0/))
{
s=document.createElement("span")
if(document.links[i+1].href.match(/user=/))
s.innerHTML=document.links[i+1].innerHTML;
else
s.innerHTML=document.links[i].nextSibling.nodeValue.replace(/, | wrote\:/g,"");
document.links[i].parentNode.nextSibling.style.display="none";
document.links[i].parentNode.style.display="none";
document.links[i].parentNode.parentNode.replaceChild(s,document.links[i].parentNode.previousSibling);
}
}
}
mainForm=false;
if(document.postForm)
{
mainForm=document.postForm;
}
else if(location.href.match(/action\=display/))
{
ta=document.getElementsByTagName("textarea");
if(ta.length>0 && ta[0].name=="message")
{
mainForm=ta[0].parentNode;
}
}
if(mainForm)
{
var tmpFunc = mainForm.onsubmit;
mainForm.onsubmit=function(){
permaNameSubmit();
tmpFunc();
};
mainForm.message.value=mainForm.message.value.replace(/\[quote author="@(.+?)" timestamp="0" source="/post/0/thread"][/quote]");
}
</script>