Post by Perseus on Mar 13, 2013 9:37:57 GMT -8
I don't personally know this code and I only understand JavaScript to a certain degree, it's from a layout I'm interested in using although I'm not very happy that it fails to display the username of the member on the text menu.
This is the following code I pulled that sort of redesigns the menu's appearance. It divides the CPs and the rest like Members, Home, Search, etc into two different sets. One aligned to the left and the other aligned to the right.
But for some reason the "+name+" value is failing to work, I'm hoping that someone here could be able to see what I don't and get it to work. It's making me absolutely livid, logged in you can see the 'Welcome' no problem but the Username is not there.
As a Guest, you can see the 'Welcome Guest' no problem. So I don't understand why this isn't working, I have looked everywhere but I do not think I have a code on the board that cancels it out.
Can anyone give me a helping hand?
<script type="text/Javascript">
<!--
//Copyright All Rights Reserved to Nate
//This header must stay intact
//Do not repost without my permission
var TD = document.getElementsByTagName('TD');
if(TD[2].innerHTML.match(/welcome/i))
{
TD[5].innerHTML = "<table width='100%'><tr><td align='left'>Welcome Guest (<a href='index.cgi?action=login'>Login</a>|<a href='index.cgi?action=register'>Register</a>)</td><td align='right'>[<a href='index.cgi?'>Home</a>] [<a href='http://help.proboards.com'>Help</a>] [<a href='index.cgi?action=search'>Search</a>]</td></tr></table>";
}
if(TD[2].innerHTML.match(/hey, (.+?),/i) && TD[5].innerHTML.match(/=admin/i))
{
var name = RegExp.$1;
TD[5].innerHTML = "<table width='100%'><tr><td align='left'>Welcome "+name+"(<a href='index.cgi?action=viewprofile'> User CP </a>|<a href='index.cgi?action=admin'> Admin CP </a>)</td><td align='right'>[<a href='index.cgi?'>Home</a>] [<a href='http://help.proboards.com'>Help</a>] [<a href='index.cgi?action=search'>Search</a>] [<a href='index.cgi?action=calendar'>Calendar</a>] [<a href='index.cgi?action=members'>Members</a>] [<a href='index.cgi?action=logout'>Logout</a>]</td></tr></table>";
}
if(TD[2].innerHTML.match(/hey,s(.+?),s/i) && !TD[5].innerHTML.match(/admin/i))
{
var name = RegExp.$1;
TD[5].innerHTML = "<table width='100%'><tr><td align='left'>(<a href='index.cgi?action=viewprofile'> User CP </a>)</td><td align='right'>[<a href='index.cgi?'>Home</a>] [<a href='http://help.proboards.com'>Help</a>] [<a href='index.cgi?action=search'>Search</a>] [<a href='index.cgi?action=calendar'>Calendar</a>] [<a href='index.cgi?action=members'>Members</a>] [<a href='index.cgi?action=logout'>Logout</a>]</td></tr></table>";
}
//-->
</script>
This is the following code I pulled that sort of redesigns the menu's appearance. It divides the CPs and the rest like Members, Home, Search, etc into two different sets. One aligned to the left and the other aligned to the right.
But for some reason the "+name+" value is failing to work, I'm hoping that someone here could be able to see what I don't and get it to work. It's making me absolutely livid, logged in you can see the 'Welcome' no problem but the Username is not there.
As a Guest, you can see the 'Welcome Guest' no problem. So I don't understand why this isn't working, I have looked everywhere but I do not think I have a code on the board that cancels it out.
Can anyone give me a helping hand?
<script type="text/Javascript">
<!--
//Copyright All Rights Reserved to Nate
//This header must stay intact
//Do not repost without my permission
var TD = document.getElementsByTagName('TD');
if(TD[2].innerHTML.match(/welcome/i))
{
TD[5].innerHTML = "<table width='100%'><tr><td align='left'>Welcome Guest (<a href='index.cgi?action=login'>Login</a>|<a href='index.cgi?action=register'>Register</a>)</td><td align='right'>[<a href='index.cgi?'>Home</a>] [<a href='http://help.proboards.com'>Help</a>] [<a href='index.cgi?action=search'>Search</a>]</td></tr></table>";
}
if(TD[2].innerHTML.match(/hey, (.+?),/i) && TD[5].innerHTML.match(/=admin/i))
{
var name = RegExp.$1;
TD[5].innerHTML = "<table width='100%'><tr><td align='left'>Welcome "+name+"(<a href='index.cgi?action=viewprofile'> User CP </a>|<a href='index.cgi?action=admin'> Admin CP </a>)</td><td align='right'>[<a href='index.cgi?'>Home</a>] [<a href='http://help.proboards.com'>Help</a>] [<a href='index.cgi?action=search'>Search</a>] [<a href='index.cgi?action=calendar'>Calendar</a>] [<a href='index.cgi?action=members'>Members</a>] [<a href='index.cgi?action=logout'>Logout</a>]</td></tr></table>";
}
if(TD[2].innerHTML.match(/hey,s(.+?),s/i) && !TD[5].innerHTML.match(/admin/i))
{
var name = RegExp.$1;
TD[5].innerHTML = "<table width='100%'><tr><td align='left'>(<a href='index.cgi?action=viewprofile'> User CP </a>)</td><td align='right'>[<a href='index.cgi?'>Home</a>] [<a href='http://help.proboards.com'>Help</a>] [<a href='index.cgi?action=search'>Search</a>] [<a href='index.cgi?action=calendar'>Calendar</a>] [<a href='index.cgi?action=members'>Members</a>] [<a href='index.cgi?action=logout'>Logout</a>]</td></tr></table>";
}
//-->
</script>