Vulcan/lib/gravatar.js
Christian Bundy 86ec3ede93 Solve trivial JS errors
Using jshint and and fixmyjs I went through and removed 220 trivial
Javascript errors – mostly missing semicolons, and some properties that
weren’t written in dot notation. You can view the diff of jshint’s
output here:
https://gist.github.com/christianbundy/7b37c51bb6f7c8d739e7/revisions
2014-05-06 20:15:48 -07:00

24 lines
No EOL
904 B
JavaScript

// super, super simple
Gravatar = {
getGravatar: function(user, options) {
if(user.email_hash){
var options = options || {};
var protocol = options.secure ? 'https' : 'http';
delete options.secure;
var hash = user.email_hash;
var url = protocol + '://www.gravatar.com/avatar/' + hash;
var params = _.map(options, function(val, key) { return key + "=" + val;}).join('&');
if (params !== '')
url += '?' + params;
return url;
}else if(user.services && user.services.twitter){
return user.services.twitter.profile_image_url;//for the oauth-login avatar, diff for diff oauth, maybe it could be better
}else if(user.services && user.services.facebook){
return 'http://graph.facebook.com/'+user.services.facebook.id+'/picture';//for the oauth-login avatar, diff for diff oauth, maybe it could be better
}
}
};