From e0c6e75d7c56ee68814d3f291f6fe00fb1e88888 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Sat, 21 Mar 2009 04:10:14 +0100 Subject: [PATCH] Basic vCard support --- css/standard.css | 7 +++++++ index.html | 5 ++++- scripts/basic.js | 54 ++++++++++++++++++++++++++++++++++++++---------- scripts/buddy.js | 5 +++++ vCard.html | 22 ++++++++++++++++++++ 5 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 scripts/buddy.js create mode 100644 vCard.html diff --git a/css/standard.css b/css/standard.css index 54cbc06..53313c8 100644 --- a/css/standard.css +++ b/css/standard.css @@ -6,7 +6,14 @@ clear: both; } +#vCard_container { + clear: both; + display: none; + margin: 1em; +} + .friend { float: left; margin: 2em; + text-align: center; } diff --git a/index.html b/index.html index 82c688d..a2a067e 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,7 @@ + @@ -22,10 +23,12 @@
+
+
Status Log :
-
+ diff --git a/scripts/basic.js b/scripts/basic.js index 35719ac..1246bfb 100644 --- a/scripts/basic.js +++ b/scripts/basic.js @@ -4,6 +4,8 @@ var BOSH_SERVICE = 'http://localhost:5280/http-bind/'; var connection = null; var show_log = true; +var roster = new Array(); + function log(msg) { var entry = $('
').append(document.createTextNode(msg)); $('#log').append(entry); @@ -21,34 +23,60 @@ function jid2id(jid) { return jid.split('@').join('-').split('.').join('-'); } -function _cbVCard(e) { - var jid = e.getAttribute('from'); +function populateVCard(e, jid) { + var easy_cases = new Array('FN', 'FAMILY', 'MIDDLE', 'GIVEN', 'NICKNAME', 'BDAY', 'CTRY', 'USERID'); + for (var i=0; i
'+nick+''); $('#'+jid2id(jid)).click(function() { - getAvatar(jid); + getVCard(jid); }); } @@ -101,6 +129,7 @@ function showConnect() { var button = $('#connect').get(0); $('#log').empty(); + $('#vCard_container').empty(); $('#friends').empty(); $('label').show(); jid.show(); @@ -126,10 +155,13 @@ $(document).ready(function () { connection.rawInput = rawInput; connection.rawOutput = rawOutput; - $("#log_toggle").bind('click', function () { + $("#log_toggle").click(function () { $("#log").toggle(); - } - ); + }); + + $('#vCard_container').click(function () { + $('#vCard_container').slideUp("normal"); + }); $('#cred').bind('submit', function () { var button = $('#connect').get(0); diff --git a/scripts/buddy.js b/scripts/buddy.js new file mode 100644 index 0000000..1382787 --- /dev/null +++ b/scripts/buddy.js @@ -0,0 +1,5 @@ +Buddy = function(name, jid) { + this.name = name; + this.jid = jid; + this.vCard = ""; +}; diff --git a/vCard.html b/vCard.html new file mode 100644 index 0000000..3f8da90 --- /dev/null +++ b/vCard.html @@ -0,0 +1,22 @@ + + + + vCard + + +
+
Avatar:
+
Full Name:
+
Last Name:
+
First Name:
+
Middle Name:
+
Nickname:
+
Birthday:
+
Telephone (Work):
+
Telephone (Home):
+
Country:
+
E-Mail:
+
+ + + -- 2.39.5