mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
17 lines
No EOL
525 B
JavaScript
17 lines
No EOL
525 B
JavaScript
// super, super simple
|
|
Gravatar = {
|
|
getGravatar: function(user, options) {
|
|
var options = options || {};
|
|
|
|
var protocol = options.secure ? 'https' : 'http';
|
|
delete options.secure;
|
|
var hash = !!user.email_hash ? user.email_hash : ''; // if hash not available, just pass empty string
|
|
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;
|
|
}
|
|
}; |