PDA

View Full Version : Avatar hack add-on


19 Jun 2000, 10:27
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]

19 Jun 2000, 11:03
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

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

19 Jun 2000, 11:56
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.

20 Jun 2000, 10:09
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

20 Jun 2000, 10:25
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

20 Jun 2000, 10:37
Hmmm.

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

Kath

20 Jun 2000, 10:45
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.