diff --git a/package.json b/package.json index 62729ea37c..a496ed42f6 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "emailjs": "0.3.4", "cookie": "0.0.6", "connect-redis": "1.4.5", - "path": "0.4.9" + "path": "0.4.9", + "crypto": "0.0.3" }, "devDependencies": {}, "optionalDependencies": {}, diff --git a/public/templates/footer.tpl b/public/templates/footer.tpl index 6f76fc8673..0d5ee09518 100644 --- a/public/templates/footer.tpl +++ b/public/templates/footer.tpl @@ -15,7 +15,8 @@ (function() { var num_users = document.getElementById('number_of_users'), latest_user = document.getElementById('latest_user'), - active_users = document.getElementById('active_users'); + active_users = document.getElementById('active_users'), + user_label = document.getElementById('user_label'); socket.emit('user.count', {}); socket.on('user.count', function(data) { @@ -29,6 +30,17 @@ socket.on('api:user.active.get', function(data) { active_users.innerHTML = 'There ' + (parseInt(data.users) !== 1 ? 'are' : 'is') + ' ' + data.users + ' user' + (parseInt(data.users) !== 1 ? 's' : '') + ' and ' + data.anon + ' guest' + (parseInt(data.anon) !== 1 ? 's' : '') + ' online'; }); + socket.emit('api:user.get', { fields: ['username', 'picture'] }); + socket.on('api:user.get', function(data) { + var gravatar = document.createElement('img'), + name = document.createElement('span'); + + name.innerHTML = data['username']; + gravatar.src = data['picture']; + + user_label.appendChild(gravatar); + user_label.appendChild(name); + }); }()); diff --git a/public/templates/header.tpl b/public/templates/header.tpl index 6c0a7e95bc..76e960b22f 100644 --- a/public/templates/header.tpl +++ b/public/templates/header.tpl @@ -102,6 +102,16 @@ .topic-container li.topic-row:hover { background-color: #eee; } + + #user_label img { + border: 1px solid #999; + margin-right: 8px; + } + + #user_label span { + font-size: 12px; + font-weight: bold; + } @@ -117,7 +127,7 @@