]> git.babelmonkeys.de Git - socialXMPP.git/blobdiff - scripts/basic.js
Small layout fixes
[socialXMPP.git] / scripts / basic.js
index aecaa7eeed3e062a490b4d5d5f2be1ccee3c815a..2f816f378633d2fbf767e04fbd247c7ab284491b 100644 (file)
@@ -175,11 +175,13 @@ function _cbRoster(e) {
     var initialPresence = $pres().c('show').t('online').up().c('status').t('Hy, I am an socialXMPP instance').up().c('priority').t('1').up().c('c', {xmlns: NS_CAPS, hash: 'sha-1', node: 'http://jabber.babelmonkeys.de', ver: genCaps()}).up();
     connection.send(initialPresence.tree());
 
+    $('#friends').show();
+
     return false;
 }
 
 function getRoster() {
-    var id = 'getRoster';
+    var id = connection.getUniqueId('roster');
 
     var rosteriq = $iq({'id':id,
                        'type':'get'}
@@ -209,7 +211,9 @@ function sendMessage(form, to) {
        var id = jid2id(to) + 'Chat';
        var message = $msg({'type': 'chat', 'to': to}).c('body').t(form.text.value);
        connection.send(message.tree());
-       $('#' + id + ' p').append('<br/>');
+       if ($('#' + id + ' p *').length > 0) {
+           $('#' + id + ' p').append('<br/>');
+       }
        $('#' + id + ' p').append('<span class="receiver">' + localJID + ': </span>');
        $('#' + id + ' p').append(form.text.value);
        form.text.value = '';
@@ -220,7 +224,8 @@ function sendMessage(form, to) {
 
 function createBubble(jid) {
     var id = jid2id(jid) + 'Chat';
-    $('body').append('<div class="chat" id="' + id + '" onmousedown="startDrag(this)"><a href="#" onclick="$(' + "'#" + id + "'" + ').hide()">Close</a><p></p></div>');
+    $('body').append('<div class="chat" id="' + id + '" onmousedown="startDrag(this)"><a href="#" onclick="$(' + "'#" + id + "'" + ').hide()">Close</a>' +
+                   '<span class ="chatTitle"> ' + jid + '</span><p></p></div>');
     $('#' + id).append('<form id="' + id + 'Form" class="chatForm" onsubmit="return sendMessage(this, \'' + jid + '\');" action="#"><input type="text" name="text" id="' + id + 'Text" class="chatForm" /></form>')
     $('#' + id).css( 'top', $('#' + jid2id(jid)).position().top + 40);
     $('#' + id).css( 'left', $('#' + jid2id(jid)).position().left + 40);
@@ -242,7 +247,9 @@ function _cbMessage(msg) {
     if ($('#' + id).length <= 0) {
        createBubble(jid);
     }
-    $('#' + id + ' p').append('<br/>');
+    if ($('#' + id + ' p *').length > 0) {
+       $('#' + id + ' p').append('<br/>');
+    }
     $('#' + id + ' p').append('<span class="sender">' + jid + ': </span>');
     $('#' + id + ' p').append(body);
     $('#' + id).show();
@@ -326,7 +333,7 @@ function showConnect() {
     $('#log').empty();
     $('#ownInfo').hide();
     $('#vCard_container').empty();
-    $('#friends').empty();
+    $('#friends').hide();
     $('.chat').remove();
     $('label').show();
     jid.show();
@@ -369,7 +376,6 @@ $(document).ready(function () {
                               onConnect);
        } else {
            connection.disconnect();
-           showConnect();
        }
        return false;
     });