]> cgit.babelmonkeys.de Git - socialXMPP.git/commitdiff
Add title to bubbles
authorFlorian Zeitz <florob@babelmonkeys.de>
Sat, 20 Jun 2009 20:06:56 +0000 (22:06 +0200)
committerFlorian Zeitz <florob@babelmonkeys.de>
Sat, 20 Jun 2009 20:06:56 +0000 (22:06 +0200)
* Title in bubbles
* Check whether to insert <br/>

css/standard.css
scripts/basic.js

index 62dbe00765609e49c99b577de8f0ed7c52c739bb..47fa53ab19551afb2eac4c819845546ce2e49f46 100644 (file)
@@ -59,3 +59,8 @@
 .chatForm {
   width: 100%;
 }
+
+.chatTitle {
+  font-size: 15pt;
+  font-weight: bold;
+}
index aecaa7eeed3e062a490b4d5d5f2be1ccee3c815a..23a5faa8457b27b266252d4ec54a462109769e5e 100644 (file)
@@ -209,7 +209,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 +222,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 +245,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();