Changeset 4226 for trunk/licqweb

Show
Ignore:
Timestamp:
09/23/05 17:26:23 (3 years ago)
Author:
phatfil
Message:

- fix scrolling issues and bug (mozilla bug?) where contact windows would annoyingly scroll up and any text you were typing would disappear
- use timestamps from server for sending messages (since timestamps for receiving messages are from server)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/licqweb/licqweb.js

    r4186 r4226  
    185185    } else { 
    186186        contacts[pp][id] = new Contact(id, pp, nick, status, messages); 
    187         document.getElementById('windows').innerHTML += getWindowHtml(id, pp, nick); 
     187        var newcontact = document.createElement('div'); 
     188        newcontact.innerHTML = getWindowHtml(id, pp, nick); 
     189        document.getElementById('windows').appendChild(newcontact); 
     190        //document.getElementById('windows').innerHTML += getWindowHtml(id, pp, nick); 
     191        var txtdiv = document.getElementById(id + '-' + pp + '-txt'); 
     192        txtdiv.scrollTop = txtdiv.scrollHeight; 
    188193    } 
    189194} 
     
    232237    var uid = response.getElementsByTagName('uid')[0].firstChild.data; 
    233238    var res = response.getElementsByTagName('result')[0].firstChild.data; 
     239    var ts = response.getElementsByTagName('datetime')[0].firstChild.data; 
    234240    var message = ackMessages[uid]; 
    235241    var txt = document.getElementById(message.id + '-' + message.pp + '-txt'); 
    236     if (res == "success") { 
    237         var d = new Date(); 
    238         txt.innerHTML += "(" + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + ") " + nick + ": " + message.message + "<br/>"; 
     242    if (res == "done.") { 
     243        txt.innerHTML += "(" + ts + ") " + nick + ": " + message.message + "<br/>"; 
    239244    } else { 
    240245        txt.innerHTML += "--- Message failed!<br/>"; 
     
    256261        win.style.display = 'block'; 
    257262    } 
     263    var txtdiv = document.getElementById(id + '-' + pp + '-txt'); 
     264    txtdiv.scrollTop = txtdiv.scrollHeight; 
     265    //win.style.zIndex = ++dragwin.win.style.zIndex; 
     266    //dragwin.win = win; 
    258267} 
    259268