Skip to content

Instantly share code, notes, and snippets.

@Buildstarted
Created December 4, 2011 05:29
Show Gist options
  • Save Buildstarted/1429285 to your computer and use it in GitHub Desktop.
Save Buildstarted/1429285 to your computer and use it in GitHub Desktop.
function createProfile(profileContainer, profile) {
var expand = $("li.user div[data-val-gravatar='" + profile.hash + "']");
var twitter = loadTwitter(profile);
var p = {
hash: profile.hash,
bio: {
name: profile.formatted,
about: profile.aboutMe,
hasTwitter: twitter != null
},
twitter: twitter
};
$('#profile-template').tmpl(p).appendTo(expand);
profileContainer.show("slow");
}
function loadTwitter(profile) {
for (var index in profile.accounts) {
var account = profile.accounts[index];
if (account.domain == 'twitter.com') {
return account;
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment