resolve issue #384 and also clear chat counter whenever focus is on chat input. Just a slightly nicer chat experience

This commit is contained in:
John McLear 2012-06-12 22:52:22 +02:00
parent 638e4cf9d3
commit 0483802841
1 changed files with 10 additions and 2 deletions

View File

@ -114,9 +114,13 @@ var chat = (function()
{
var count = Number($("#chatcounter").text());
count++;
// is the users focus already in the chatbox?
var alreadyFocused = $("#chatinput").is(":focus");
$("#chatcounter").text(count);
// chat throb stuff -- Just make it throw for twice as long
if(wasMentioned)
if(wasMentioned && !alreadyFocused)
{ // If the user was mentioned show for twice as long and flash the browser window
if (chatMentions == 0){
title = document.title;
@ -130,7 +134,11 @@ var chat = (function()
$('#chatthrob').html("<b>"+authorName+"</b>" + ": " + text).show().delay(2000).hide(400);
}
}
// Clear the chat mentions when the user clicks on the chat input box
$('#chatinput').click(function(){
chatMentions = 0;
document.title = title;
});
self.scrollDown();
},