Slight tweak to nick hovers

This commit is contained in:
calzoneman 2014-11-24 19:32:06 -06:00
parent 2f2ed8aaf9
commit b09346392e
1 changed files with 4 additions and 10 deletions

View File

@ -1433,20 +1433,14 @@ function addChatMessage(data) {
var div = formatChatMessage(data, LASTCHAT);
// Incoming: a bunch of crap for the feature where if you hover over
// a message, it highlights messages from that user
div.data("sender", data.username);
var safeUsername = data.username.replace(/[^\w-]/g, '$');
div.addClass("chat-msg-" + safeUsername);
div.appendTo($("#messagebuffer"));
div.mouseover(function() {
$("#messagebuffer").children().each(function() {
var name = $(this).data("sender");
if(name == data.username) {
$(this).addClass("nick-hover");
}
});
$(".chat-msg-" + safeUsername).addClass("nick-hover");
});
div.mouseleave(function() {
$("#messagebuffer").children().each(function() {
$(this).removeClass("nick-hover");
});
$(".nick-hover").removeClass("nick-hover");
});
// Cap chatbox at most recent 100 messages
if($("#messagebuffer").children().length > 100) {