X-Git-Url: http://git.babelmonkeys.de/?a=blobdiff_plain;f=scripts%2Fbasic.js;h=4b306950714a66569ba9b888097a2b0ed55d4f51;hb=13b28a1b50a2a84366f5781e9434d7f46c0ceed1;hp=aecaa7eeed3e062a490b4d5d5f2be1ccee3c815a;hpb=b12b35d39a99293eadee739b291f64433f5da34e;p=socialXMPP.git diff --git a/scripts/basic.js b/scripts/basic.js index aecaa7e..4b30695 100644 --- a/scripts/basic.js +++ b/scripts/basic.js @@ -61,11 +61,22 @@ function populateVCard(e, jid) { $('#EMAILWORK').append(Strophe.xmlTextNode($(this).find('USERID').text())); }); + if (!roster[jid2id(jid)].tune.isEmpty()) { + $('#vCard ul').append('
  • Tune: Listening to '+ + roster[jid2id(jid)].tune.title + ' by ' + roster[jid2id(jid)].tune.artist + + ' from ' + roster[jid2id(jid)].tune.source + '
  • ') + } + $('#vCard').click(function () { - $('#vCard_container').slideUp("normal"); + $('#vCard_container').slideUp("normal", function() { + $('#box-overlay').hide(); + }); + roster[jid2id(jid)].visible = false; }); + $('#box-overlay').show(); $('#vCard_container').slideDown("normal"); + roster[jid2id(jid)].visible = true; } function _cbVCard(e) { @@ -84,10 +95,7 @@ function _cbVCard(e) { function _cbOwnVCard(e) { $('#ownInfo').empty(); - $('#ownInfo').load('vCard.html #vCard', function() { - $('#ownInfo').find('div').each(function() { - $(this).attr('id', 'own' + $(this).attr('id')); - }); + $('#ownInfo').load('vCard.html #ownvCard', function() { var easy_cases = new Array('FN', 'FAMILY', 'MIDDLE', 'GIVEN', 'NICKNAME', 'BDAY', 'CTRY', 'USERID'); for (var i=0; i'); + if ($('#' + id + ' p *').length > 0) { + $('#' + id + ' p').append('
    '); + } $('#' + id + ' p').append('' + localJID + ': '); $('#' + id + ' p').append(form.text.value); form.text.value = ''; @@ -220,7 +234,8 @@ function sendMessage(form, to) { function createBubble(jid) { var id = jid2id(jid) + 'Chat'; - $('body').append('
    Close

    '); + $('body').append('
    Close' + + ' ' + jid + '

    '); $('#' + id).append('
    ') $('#' + id).css( 'top', $('#' + jid2id(jid)).position().top + 40); $('#' + id).css( 'left', $('#' + jid2id(jid)).position().left + 40); @@ -242,7 +257,9 @@ function _cbMessage(msg) { if ($('#' + id).length <= 0) { createBubble(jid); } - $('#' + id + ' p').append('
    '); + if ($('#' + id + ' p *').length > 0) { + $('#' + id + ' p').append('
    '); + } $('#' + id + ' p').append('' + jid + ': '); $('#' + id + ' p').append(body); $('#' + id).show(); @@ -277,16 +294,19 @@ function _cbPEP(e) { tune.title= Strophe.getText(items.getElementsByTagName('title')[0]); tune.track= Strophe.getText(items.getElementsByTagName('track')[0]); tune.uri= Strophe.getText(items.getElementsByTagName('uri')[0]); - if ( $('#'+jid2id(from)+' .tune').length > 0 ) { - $('#'+jid2id(from)+' .tune').empty(); - $('#'+jid2id(from)+' .tune').append(Strophe.xmlTextNode('Listening to '+ tune.title + ' by ' + tune.artist + ' from ' + tune.source)); - } else { - $('#'+jid2id(from)).append('
    Listening to '+ tune.title + ' by ' + tune.artist + ' from ' + tune.source + ''); + if (roster[jid2id(from)].visible == true) { + if ( $('#tune').length > 0) { + $('#tune').empty(); + $('#tune').append('Tune: '); + $('#tune').append(Strophe.xmlTextNode('Listening to '+ tune.title + + ' by ' + tune.artist + ' from ' + tune.source)); + } else { + $('#vCard ul').append('
  • Tune: Listening to '+ tune.title + + ' by ' + tune.artist + ' from ' + tune.source + '
  • ') + } } } else { - if ( $('#'+jid2id(from)+' .tune').length > 0 ) { - $('#'+jid2id(from)+' .tune').empty(); - } + $('#tune').remove(); } roster[jid2id(from)].tune = tune; } @@ -324,9 +344,11 @@ function showConnect() { var button = $('#connect').get(0); $('#log').empty(); + $('#ownInfo').empty(); $('#ownInfo').hide(); $('#vCard_container').empty(); $('#friends').empty(); + $('#friends').hide(); $('.chat').remove(); $('label').show(); jid.show(); @@ -369,7 +391,6 @@ $(document).ready(function () { onConnect); } else { connection.disconnect(); - showConnect(); } return false; });