]> git.babelmonkeys.de Git - socialXMPP.git/commitdiff
Some vCard work
authorFlorian Zeitz <florob@babelmonkeys.de>
Sat, 28 Mar 2009 23:32:22 +0000 (00:32 +0100)
committerFlorian Zeitz <florob@babelmonkeys.de>
Sat, 28 Mar 2009 23:32:22 +0000 (00:32 +0100)
index.html
scripts/basic.js
vCard.html

index f68b77745c583aea3984383a7ca78a10c91d0159..e06ee7d10db66d68266f101e58b586bd76c5e56a 100644 (file)
     </form>
   </div>
   <div id="ownInfo">
-    <div id="ownPHOTO"><span class="vCardName">Avatar: </span><img src="imgs/none.png" /></div>
-    <div id="ownFN"><span class="vCardName">Full Name: </span></div>
-    <div id="ownFAMILY"><span class="vCardName">Last Name: </span></div>
-    <div id="ownGIVEN"><span class="vCardName">First Name: </span></div>
-    <div id="ownMIDDLE"><span class="vCardName">Middle Name: </span></div>
-    <div id="ownNICKNAME"><span class="vCardName">Nickname: </span></div>
-    <div id="ownBDAY"><span class="vCardName">Birthday: </span></div>
-    <div id="ownTELWORK"><span class="vCardName">Telephone (Work): </span></div>
-    <div id="ownTELHOME"><span class="vCardName">Telephone (Home): </span></div>
-    <div id="ownCTRY"><span class="vCardName">Country: </span></div>
-    <div id="ownUSERID"><span class="vCardName">E-Mail: </span></div>
   </div>
   <div id='friends'>
   </div>
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();
index 3f8da90ad7479f1a94a49e7006259c65bc652450..28e56979322fbce7ed99d90b621d460e94b62a45 100644 (file)
     <div id="MIDDLE"><span class="vCardName">Middle Name: </span></div>
     <div id="NICKNAME"><span class="vCardName">Nickname: </span></div>
     <div id="BDAY"><span class="vCardName">Birthday: </span></div>
-    <div id="TELWORK"><span class="vCardName">Telephone (Work): </span></div>
     <div id="TELHOME"><span class="vCardName">Telephone (Home): </span></div>
+    <div id="TELWORK"><span class="vCardName">Telephone (Work): </span></div>
+    <div id="EMAILHOME"><span class="vCardName">E-Mail (Home): </span></div>
+    <div id="EMAILWORK"><span class="vCardName">E-Mail (Work): </span></div>
     <div id="CTRY"><span class="vCardName">Country: </span></div>
     <div id="USERID"><span class="vCardName">E-Mail: </span></div>
   </div>