]> cgit.babelmonkeys.de Git - socialXMPP.git/blobdiff - scripts/basic.js
Some vCard work
[socialXMPP.git] / scripts / basic.js
index cc4fde5a693a6ea63da3ec3760b687b0ce040eaa..934308c22fc1fc413305f34911545322d563514f 100644 (file)
@@ -47,6 +47,18 @@ function populateVCard(e, jid) {
        $("#"+jid2id(jid)+" img").attr('src', 'data:'+mime+';base64,'+binval);
        $("#PHOTO img").attr('src', 'data:'+mime+';base64,'+binval);
     }
+    $(e).find('TEL:has(HOME)').each(function() {
+        $('#TELHOME').append(Strophe.xmlTextNode($(this).find('NUMBER').text()));
+    });
+    $(e).find('TEL:has(WORK)').each(function() {
+        $('#TELWORK').append(Strophe.xmlTextNode($(this).find('NUMBER').text()));
+    });
+    $(e).find('EMAIL:has(HOME)').each(function() {
+        $('#EMAILHOME').append(Strophe.xmlTextNode($(this).find('USERID').text()));
+    });
+    $(e).find('EMAIL:has(WORK)').each(function() {
+        $('#EMAILWORK').append(Strophe.xmlTextNode($(this).find('USERID').text()));
+    });
     $('#vCard_container').slideDown("normal");
 }
 
@@ -65,6 +77,11 @@ 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'));
+    });
     var easy_cases = new Array('FN', 'FAMILY', 'MIDDLE', 'GIVEN', 'NICKNAME', 'BDAY', 'CTRY', 'USERID');
     for (var i=0; i<easy_cases.length; i++) {
        var text = e.getElementsByTagName(easy_cases[i])[0];
@@ -80,7 +97,20 @@ function _cbOwnVCard(e) {
 
        $("#ownPHOTO img").attr('src', 'data:'+mime+';base64,'+binval);
     }
+    $(e).find('TEL:has(HOME)').each(function() {
+        $('#ownTELHOME').append(Strophe.xmlTextNode($(this).find('NUMBER').text()));
+    });
+    $(e).find('TEL:has(WORK)').each(function() {
+        $('#ownTELWORK').append(Strophe.xmlTextNode($(this).find('NUMBER').text()));
+    });
+    $(e).find('EMAIL:has(HOME)').each(function() {
+        $('#ownEMAILHOME').append(Strophe.xmlTextNode($(this).find('USERID').text()));
+    });
+    $(e).find('EMAIL:has(WORK)').each(function() {
+        $('#ownEMAILWORK').append(Strophe.xmlTextNode($(this).find('USERID').text()));
+    });
     $('#ownInfo').show();
+    });
 
     return false;
 }
@@ -231,7 +261,7 @@ function showConnect() {
     var button = $('#connect').get(0); 
 
     $('#log').empty();
-    $('#ownInfo').empty();
+    $('#ownInfo').hide();
     $('#vCard_container').empty();
     $('#friends').empty();
     $('label').show();