|
Well after screwing around a lot I figured I'd try and make some code, and I just decided to make a PM bar because every PB coder has his own PM bar. Am I right? It's slightly different than your normal PM bar, but I like it. There are a few things I'm going to add later, but this is just the basic part. I made some cool CSS Menu buttons for the links which is what makes it unique. I just want to know what I can do now to make it better before I go on. I know that the RegExp part is probably not that good because I really don't know much about RegExp, and I didn't want to use split() because I see people saying to try to not to use it everwhere. By the way, what is the best thing to put in the comment tag? I don't know much about all that copyright stuff. Preview<style type="text/css"><!-- .pmbar {background-color: #272a2f; width: 25%; text-align: center;} .pmbar a {display: block; width: 100%; padding: 5px 0px 5px 0px;} .pmbar a:link, .pmbar a:visited {color: #ffffff; text-decoration: none;} .pmbar a:hover {background-color: #333333; text-decoration: underline;} .pmbar2 {padding: 5px 0px 5px 0px;} --></style> <script type="text/javascript"><!-- /* PM Bar v1 - Triad */ var iClass = "windowbg"; var td = document.getElementsByTagName("td"); var iCell = document.getElementsByTagName("table")[0].insertRow(2).insertCell(0); if(td[2].innerHTML.match(/(\d+)\s(are|is)/i)){ var newPm = RegExp.$1} if(td[2].innerHTML.match(/(\d+) message/i)){ var totalPm = RegExp.$1} if(pb_username=="Guest"){ iCell.innerHTML="<table width='100%' cellpadding='5' cellspacing='0'><tr><td class='"+iClass+"'>Welcome, Guest! Please <a href='/?action=login'>login<\/a> or <a href='/?action=register'>register<\/a>.<\/td><\/tr><\/table>"; } else { iCell.innerHTML="<table width='100%' cellpadding='0' cellspacing='0'><tr><td class='pmbar'><a href='/index.cgi?action=pm'>Inbox<\/a><\/td><td class='pmbar'><a href='/index.cgi?action=pm&view=2'>Outbox<\/a><\/td><td class='pmbar'><a href='/index.cgi?action=pmsend'>New Message<\/a><\/td><td class='pmbar'><a href='/index.cgi?action=pmprefs'>Preferences<\/a><\/td><\/tr><tr><td colspan='2' class='pmbar2'>Logged in as: <a href='/index.cgi?action=viewprofile'>"+pb_displayname+"<\/a><\/td><td colspan='2' align='right' class='pmbar2'>Inbox [ New: <a href='/index.cgi?action=pm'>"+newPm+"<\/a> | Total: <a href='/index.cgi?action=pm'>"+totalPm+"<\/a> ]<\/td><\/tr><\/table>";} //--></script>
Last Edit: Oct 23, 2006 2:14:17 GMT by Jordan
|
|
|
|
|
If the person isn't logged in, then hide the first row (the one with all the links), then make it so "Guest" isn't a like, and instead of having "Inbox [ New: undefined | Total: undefined ]" have "Please Login or Register" and have those two be links.
|
Support Rob Scuderi, the #1 Penguins Defender!
"Behold: me! I have authority in this building."
|
|
|
|
It is like that, I just took that part out so you didn't have to login to see it. Go to the home page to see the guest part. I just want to see if there are any improvements I can make with the actual coding.
|
|
|
|
|
|
Thanks.
|
|
|
|
|
looks good ...just clean up the coding and space it out
|
|
|
|
|
What exactly do you mean by space it out?
|
|
|
|
|
something like this <style type="text/css"> <!-- .pmbar { background-color: #272a2f; width: 25%; text-align: center; } .pmbar a { display: block; width: 100%; padding: 5px 0px 5px 0px; } .pmbar a:link, .pmbar a:visited { color: #ffffff; text-decoration: none; } .pmbar a:hover { background-color: #333333; text-decoration: underline; } .pmbar2 { padding: 5px 0px 5px 0px; }
--> </style>
CSS uses --> not //--> causes an error otherwise.
Last Edit: Oct 23, 2006 0:38:05 GMT by (¯`•DregondRahl•._)
|
|
|
|
|
something like this <style type="text/css"> <!-- .pmbar { background-color: #272a2f; width: 25%; text-align: center; } .pmbar a { display: block; width: 100%; padding: 5px 0px 5px 0px; } .pmbar a:link, .pmbar a:visited { color: #ffffff; text-decoration: none; } .pmbar a:hover { background-color: #333333; text-decoration: underline; } .pmbar2 { padding: 5px 0px 5px 0px; }
--> </style>
CSS uses --> not //--> causes an error otherwise. I only do that when I have a lot of css. I like to take up the least amount of space I can except I like to space out the characters (ex padding: 5x; instead of padding:5px;). And on the //--> part...I just always mix up CSS and JavaScript. A lot of times I will do <style type="text/javascript">...and vice versa. Thanks for pointing that out for me. Edit - I found my first major problem...If you noticed I had the You are logging in as: username and Inbox [0 | 0] below the css pm buttons it was still in the main table. I put the same code on a different forum to see if it still worked, and I noticed that since my border and background were already black on my other forum it looked fine (because I wanted the background to be the same as the body background), but when I put it on my other forum I saw it had the background of the main table (.bordercolor). How do I put the bottom part right under the welcome table? Preview
Last Edit: Oct 24, 2006 1:55:42 GMT by Jordan
|
|
|
|
|
I don't mean to double post, but can you look under the Edit part after my last post please.
|
|
|
|
|
okay firstly, when you insert a cell it takes on the bg color of the table you added it to in this case the main table[0]. i would recomend you use this to insert the row insted. document.getElementsByTagName("table")[0].insertRow(-1).insertCell(0);
that way it will always add to the bottom row. now for the background color problem, just give your table the class you want it to have. <table width='100%' cellpadding='5' cellspacing='0'>also the text "logged" and the last ] braket are a bit too close to the corners, add alittle space
|
|
|
|
|
Thanks for that little tip on the -1 part. For the other part I just forgot to say that I do not want a border around it. If I put it in the main table (see I did put a background, but I didn't like the border of the main table[0]) it still has the cellspacing, so I want it right below the main table. Also, if you notice on the first preview it is spaced out, but I also took that out because I wanted to get all that crap out of the way while I was trying to fix this problem. So how do I put it right under the menu table? Also, is the backslash \ neccasary for tables? <\/td><\/tr><\/table>
Last Edit: Oct 24, 2006 22:04:23 GMT by Jordan
|
|
|
|