Cam
Administrator
[M:5000]
Posts: 6,381
|
Post by Cam on Aug 16, 2011 3:29:53 GMT
Code's Name: Styled Mini-profile v1 Preview: Go hereDescription: Kinda basic but allows you to modify the CSS and make a smexy looking mini-profile background thingy. Change the CSS to suit your needs. <style type = "text/css"> .miniprofile { margin: 0 auto; background: #bcbcbc url(http://mirrorimg.net/im1/2nl.png) top repeat-x; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; width: 92%; border: 1px solid #7d7d7d; }
</style>
<script type="text/javascript"> <!-- // Styled Mini-profile v1 // [url]http://codercommunity.proboards.com[/url]
if(pb_action == "display" || pb_action == "viewprofile") { for(var td = document.getElementsByTagName("td"), x = 6; x < td.length; x++) { if(td[x].width == "20%" && td[x].getElementsByTagName("center")[0]) { var a = td[x].getElementsByTagName("a"), b = a.length, c = 0;
td[x].innerHTML = '<div class="miniprofile">'+td[x].innerHTML + '</div>';
} } } //--> </script>
|
|
Jordan
Elite Poster
[M:5000]
Posts: 286
|
Post by Jordan on Aug 16, 2011 22:52:37 GMT
Nice code, it looks very good. I recommend that you combine the last two logical lines, though. td[x].innerHTML = '<div class="miniprofile">'+td[x].innerHTML; td[x].innerHTML += '</div>' td[x].innerHTML = '<div class="miniprofile">'+td[x].innerHTML + '</div>'; (Do this instead) The reason is that you are making the browser parse the code twice for every mini-profile cell. Nobody will ever notice the difference since this process is so fast these days, but it's a suggestion. Whenever you are working with the innerHTML property and can't fit everything into one line, create a string and populate it with all your HTML. Once you are finished generating all the HTML, then set the innerHTML's value to the string so it is only changed once. There are many codes on Proboards Support that do stuff like: obj.innerHTML = "asdf"; obj.innerHTML += "asdf"; obj.innerHTML += "asdf"; obj.innerHTML += "asdf"; obj.innerHTML += "asdf"; This is terrible. Do this instead. var html = "asdfasdf"; html += "asdfasd"; html += "asdfasd"; html += "asdfasd"; obj.innerHTML = html; Much better and faster.
|
|
Cam
Administrator
[M:5000]
Posts: 6,381
|
Post by Cam on Aug 16, 2011 23:17:21 GMT
Yeah, thanks. Was kinda just trying to make everything easy to read for people to edit. Thanks again!
|
|
Cam
Administrator
[M:5000]
Posts: 6,381
|
Post by Cam on Aug 29, 2011 4:41:21 GMT
Accepted and moved...
|
|