Skip to content

Instantly share code, notes, and snippets.

@fcsonline
Created September 6, 2012 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fcsonline/3656251 to your computer and use it in GitHub Desktop.
Save fcsonline/3656251 to your computer and use it in GitHub Desktop.
Teambox QRCode for contacts
$(window).bind('hashchange', function(){
if (window.location.hash.match('users')) {
setTimeout(function() {
console.log('Showing Contact QR-Code...');
var data = "";
data += "BEGIN:VCARD\n";
data += "VERSION:2.1\n";
data += "FN:" + $(".profile_title h2").html() + "\n";
//data += "N:Last;First\n";
data += "TEL;WORK;VOICE:" + $(".phone_numbers .item_content").html() + "\n";
//data += "TEL;HOME;VOICE:PHONE-HOME\n";
//data += "EMAIL;HOME;INTERNET:EMAIL-HOME\n";
data += "EMAIL;WORK;INTERNET:" + $(".email_addresses .item_content").html() + "\n";
data += "URL:" + $(".websites .item_content").html() + "\n";
data += "END:VCARD\n";
var qrcodeurl = "http://api.qrserver.com/v1/create-qr-code/?data=" + encodeURI(data) + "&size=160x160";
$(".profile_image").after('<div class="ims section"><span class="icon card"></span><div class="im item"><div class="type">QR Code:</div></div><div class="item_content"><img src="' + qrcodeurl + '"></div></div>');
}, 1500);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment