PDA

View Full Version : Avatar hack add-on


06-19-2000, 09:27 AM
Error with the last instructions. You'll want to edit 2 templates.

I was bored so I decided to add in some javascript to allow users to view the avatar before they select. You only need to edit the registeradult and modifyprofile templates.

So log into the control panel and select to edit the template. Find $cssinclude, and under it add:


<script language="javascript">
function showavatar()
{
if (!document.images)
return
document.images.pictures.src=
document.preferences.avatar.options[document.preferences.avatar.selectedIndex].value
}
</script>


Now find <select name="avatar" size="4"> and replace it with <select name="avatar" size="4" onChange="showavatar()">. Then a few lines down, underneat </select>, add <img src="images/avatars/blank.gif" name="pictures">.

I'd recommend having the initial image being a small box that says Select Avatar or something simple like that.

Thats it.

Working example: http://4.3.235.30/forums/member.php?action=register&who=adult

[Edited by Krucifyx on 06-20-2000 at 06:35 PM]

06-19-2000, 10:03 AM
I was bored so I decided to add in some javascript to allow users to view the avatar before they select. You only need to edit the template registeradult, and thats it.


I wish you were more often bored...
Great hack !

Benj

06-19-2000, 10:23 AM
Javascript was left out on purpose since the large forums have a lot of users on WebTV and other java-impaired platforms.

06-19-2000, 10:56 AM
So? Then the java script wont work for them, and nothing ill will come of it. And for java-enabled visitors, which I'm sure make up for than 90% of any sites traffic, will benefit from it.

06-20-2000, 09:09 AM
The other reason I removed it between v0.8 and v0.9 was because having the javascripted preview in breaks the register/profile forms in Netscape :P

Kath

06-20-2000, 09:25 AM
Actually, the problem there is in improper HTML sytnax in the insturctions. The HTML code has a line break tag after the </option> tag, which NS will interperate literally, while IE ignores it. So the problem isn't with the javascript, its with the instructions.

View the following page in NS, and you'll see that it works just fine, and looks just fine.

http://4.3.235.30/forums/member.php?action=register&who=adult

06-20-2000, 09:37 AM
Hmmm.

I'll see what it looks like and if it comes out properly, I'll have it optional to re-introduce ...

Kath

06-20-2000, 09:45 AM
Just thought I'd let you know, cause this is an awesome hack and no preview of the avatar kinda sux. Place the Javascript I wrote is VERY minimal and should work great.