Post by SubDevo on May 25, 2010 23:01:04 GMT -8
Random Avatar for Certain Users by SubDevo
Tested in IE, FF, Opera, Safari and Chrome.
Allows certain users to have random (changing) avatar appear in their mini-profile (PMs, Posts, Searches, Profile etc.) with every page load. If the user has more than one post in a thread, every post gets a different avatar too. You provide as many images as you want.
Yes, there is another code out there like this one, but this one doesn't run on every page.
And it matches the EXACT username. The old code matched partial names.
For example: If you were changing the avatar for "admin", a user with the name "adminman" would also get the random avatar.
Enjoy!!!
SubDevo
Variables:
var avatar=[ // ["USERNAME","URL1","URL2"]
["admin","av1","av2","av3"],
["user1","av1","av2","av3","av4"],
["user2","av1","av2"] <----- NO COMMA
];
Enter the username (NOT displayname) followed by the Avatar URLs you want for that user. Separate the Avatar URLs with a comma. Do NOT put a comma after the last URL.
Copy/paste a line to add more users. Put a comma at the end of each line except for the last one in the list. If there is only ONE user in the list, do NOT put a comma at the end.
Location: Global Footer
<script type="text/javascript">
/* Random Avatar for Certain Users by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.com or lsdp.proboards.com */
var avatar=[
["admin","av1","av2","av3"],
["user1","av1","av2","av3","av4"],
["user2","av1","av2"]
];
var td=document.getElementsByTagName("td"),a,x=-1,i,p,n,m,pU,rm=/user=(.+?)\"/i;
if(/(calendar|pm|pre)view|viewprofile|search2|display/i.test(pb_action)){
while(td[++x]){a=td[x];
if(a.width=="20%"&&td[x+1].width=="80%"&&rm.test(a.innerHTML)){
pU=RegExp.$1;p=-1;m=a.getElementsByTagName("img");
while(m[++p]){
if(m
Tested in IE, FF, Opera, Safari and Chrome.
Allows certain users to have random (changing) avatar appear in their mini-profile (PMs, Posts, Searches, Profile etc.) with every page load. If the user has more than one post in a thread, every post gets a different avatar too. You provide as many images as you want.
Yes, there is another code out there like this one, but this one doesn't run on every page.
And it matches the EXACT username. The old code matched partial names.
For example: If you were changing the avatar for "admin", a user with the name "adminman" would also get the random avatar.
Enjoy!!!
SubDevo
Variables:
var avatar=[ // ["USERNAME","URL1","URL2"]
["admin","av1","av2","av3"],
["user1","av1","av2","av3","av4"],
["user2","av1","av2"] <----- NO COMMA
];
Enter the username (NOT displayname) followed by the Avatar URLs you want for that user. Separate the Avatar URLs with a comma. Do NOT put a comma after the last URL.
Copy/paste a line to add more users. Put a comma at the end of each line except for the last one in the list. If there is only ONE user in the list, do NOT put a comma at the end.
Location: Global Footer
<script type="text/javascript">
/* Random Avatar for Certain Users by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.com or lsdp.proboards.com */
var avatar=[
["admin","av1","av2","av3"],
["user1","av1","av2","av3","av4"],
["user2","av1","av2"]
];
var td=document.getElementsByTagName("td"),a,x=-1,i,p,n,m,pU,rm=/user=(.+?)\"/i;
if(/(calendar|pm|pre)view|viewprofile|search2|display/i.test(pb_action)){
while(td[++x]){a=td[x];
if(a.width=="20%"&&td[x+1].width=="80%"&&rm.test(a.innerHTML)){
pU=RegExp.$1;p=-1;m=a.getElementsByTagName("img");
while(m[++p]){
if(m
.alt=="[avatar]"){i=-1;
while(avatar[++i]){n=avatar;
if(pU==n[0]){m
.src=n[1+Math.round(Math.random()*(n.length-2))];
break;break;}}}}}}}
</script>