eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Development resources
 ::   WebWare 2.1 (Perl)
 ::   WebWare 2.0 (Java)
 ::   Cool hacks
cool hacks
Reversing the Chat Messages in WebChat to Most Recent at Bottom  

sent in the following hack...

I figured this one out, and in case anyone is interested, here's what I did:

Change this line in chat.cgi:

for ($x = $high_message; $x >= $msg_to_read; $x--) {
To this:
for ($x = $msg_to_read; $x <= $high_message; $x++) {

After making this change, all new messages will now appear at the bottom. The only trouble is that you have to manually scroll down to the bottom of the page to view them.

To have the browser automatically jump down to the bottom of the page, you need to add some javascript (and if someone thinks of a better way, please let me know!).

Within chat-html.pl, change the body tag to include a javascript call (the <BODY> tag in the sub PrintChatScreen, about half-way through the script):


Then, within the <HEAD> element of this same sub, add this javascript code:

function GoBot() {
	self.scrollTo(0,5000);
}

Depending on the #number of messages you have displayed at any one given time, you may need to increase the 5000 value to something higher.

I've tested this in NN6.1 and IE6, and it seems to work fine. Brad