Welcome Guest [Log In] [Register]
Viewing Single Post From: Default avatar
HelenaZF
Member Avatar
advanced techno feeb
[ *  *  *  *  *  *  * ]
Code by by CraZyJ
repost until topics are restored:

Code description: It adds a default avatar for everyone who doesn't yet have a avatar.
Code preview: click
Code placement: Board wrappers > Footers
Code instructions: Replace DEFAULT AVATAR IMAGE HERE with the url of the default avatar

Code:
 
<script type='text/javascript'>
/* Default avatar by CrAzY_J
do not redistribure this code without the creator's permission
This copyright header must stay intact at all times*/

var img = 'DEFAULT AVATAR IMAGE HERE';
if(/(showtopic|code=03)/i.test(this.location.href)){
var span = document.getElementsByTagName('span');
for(var s=0;s<span.length;s++){
if(span[s].className == 'postdetails' && /Posts:/.test(span[s].innerHTML) && !/img/i.test(span[s].firstChild.nodeName)){
var imag = document.createElement('img');
imag.border = '0';
imag.alt = 'Avatar';
imag.src = img;
span[s].insertBefore(imag,span[s].firstChild);
}
}
}else if(/showuser/i.test(this.location.href)){
var tr = document.getElementsByTagName('tr');
for(var r=0;r<tr.length;r++){
if(tr[r].cells.length == 2 && tr[r].cells[0].getElementsByTagName('b')[0] && /Avatar/.test(tr[r].cells[0].getElementsByTagName('b')[0].firstChild.data) && tr[r].cells[1].innerHTML == ''){
var imag = document.createElement('img');
imag.border = '0';
imag.alt = 'Avatar';
imag.src = img;
tr[r].cells[1].appendChild(imag);
}
}
}

</script>


[Edited to removed quote tags around code--conversion of this board to ZB caused quote tags to alter the code.]
Edited by HelenaZF, Mar 14 2009, 02:56 PM.
Online Profile Quote Post
Default avatar · Code Snippets