* More updates to instant messenger. When new messages arrive, the window
authorArt Cancro <ajc@citadel.org>
Wed, 11 Jan 2006 22:00:59 +0000 (22:00 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 11 Jan 2006 22:00:59 +0000 (22:00 +0000)
  automatically scrolls to the bottom and the input box is refocused.

webcit/ChangeLog
webcit/static/instant_messenger.html

index 372c02b8559e79a35a233579cb136303d7c206c2..4794c837f276285c8448fa5fb636a9b4751a0e6c 100644 (file)
@@ -1,5 +1,9 @@
 $Id$
 
+Wed Jan 11 16:59:54 EST 2006 ajc
+* More updates to instant messenger.  When new messages arrive, the window
+  automatically scrolls to the bottom and the input box is refocused.
+
 Wed Jan 11 15:21:18 EST 2006 ajc
 * Corrected a small javascript syntax error
 
index 6d12105baab548530427372f05b00034535db7f1..57666ac8cc8e3d620e67bb4cc057c1f82092f7c9 100644 (file)
@@ -32,7 +32,7 @@ function SendSomething(which_div, sendform, recipient) {
        // Clear the box
        document.forms[sendform].elements['sendthis'].value = '';
 
-       // Write it to the window
+       // Write it to the tab
        $(which_div).innerHTML = $(which_div).innerHTML
                                + '<b>'
                                + '<font color=\"#FF0000\">'
@@ -42,6 +42,9 @@ function SendSomething(which_div, sendform, recipient) {
                                + thetext
                                + '<br />\n';
 
+       // Scroll to the bottom of the tab
+       $('main').scrollTop = 999999;
+
        // Send the text to the server
        parms = 'r=' + Math.random()
                + '&g_cmd=SEXP ' + recipient + '|' + thetext;
@@ -52,6 +55,9 @@ function SendSomething(which_div, sendform, recipient) {
                }
        );
 
+       // Refocus to the text box
+       document.forms[sendform].elements['sendthis'].focus();
+
        // Don't submit the form
        return false;
 }
@@ -141,7 +147,13 @@ function ShowNewMsg(gexp_xmlresponse) {
                                + '<br />\n';
 
        // Scroll to the bottom of the tab
-       $(which_div).scrolltop = $(which_div).scrollHeight - $(which_div).clientHeight;
+       $('main').scrollTop = 999999;
+
+       // Refocus to the send box
+       document.forms['sendform_'+which_div].elements['sendthis'].focus();
+
+       // Keep trying for new messages until the server tells us to stop.
+       FetchNewMsgs();
 }
 
 // This is called periodically to check for new incoming messages