Skip to content

Instantly share code, notes, and snippets.

@uyjulian
Created March 2, 2014 23:46
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 uyjulian/9315793 to your computer and use it in GitHub Desktop.
Save uyjulian/9315793 to your computer and use it in GitHub Desktop.
{
if (!window.hasOwnProperty('tppuniquechatters')) {
var liveCount = $("#live-count");
var uniqueChattersSpan = $("<span class=\"stat\" id=\"unique-count\" original-title=\"Unique Chatters\">~</span>");
uniqueChattersSpan.insertBefore(liveCount);
var usernames = {};
setInterval(function () {
$('#chat_line_list').find('.nick').each(function (i, e) {
var name = $(e).text();
usernames[name] = (usernames[name] || 0) + 1;
})
}, 500);
setInterval(function () {
$("#unique-count").text(Object.keys(usernames).length);
}, 1000);
window.tppuniquechatters = true;
}
};
void(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment