Make the title changes Pita wanted which were show an increment and also fix the bug where it would keep increasing the title this is part of issue #125

This commit is contained in:
John McLear 2011-11-27 20:39:47 +00:00
parent f465ebaab9
commit 19ee4865f4

View file

@ -16,6 +16,8 @@
var chat = (function() var chat = (function()
{ {
var chatMentions = 0;
var title = document.title;
var self = { var self = {
show: function () show: function ()
{ {
@ -43,6 +45,8 @@ var chat = (function()
} }
}); });
}); });
chatMentions = 0;
document.title = title;
}, },
hide: function () hide: function ()
{ {
@ -54,8 +58,6 @@ var chat = (function()
}, },
scrollDown: function() scrollDown: function()
{ {
//console.log($('#chatbox').css("display"));
if($('#chatbox').css("display") != "none") if($('#chatbox').css("display") != "none")
$('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, "slow"); $('#chattext').animate({scrollTop: $('#chattext')[0].scrollHeight}, "slow");
}, },
@ -112,9 +114,13 @@ var chat = (function()
// chat throb stuff -- Just make it throw for twice as long // chat throb stuff -- Just make it throw for twice as long
if(wasMentioned) if(wasMentioned)
{ // If the user was mentioned show for twice as long and flash the browser window { // If the user was mentioned show for twice as long and flash the browser window
if (chatMentions == 0){
title = document.title;
}
$('#chatthrob').html("<b>"+authorName+"</b>" + ": " + text); $('#chatthrob').html("<b>"+authorName+"</b>" + ": " + text);
$('#chatthrob').effect("pulsate", {times:1,mode:"hide"},4000); $('#chatthrob').effect("pulsate", {times:1,mode:"hide"},4000);
document.title = "You were mentioned in a chat: " + document.title; chatMentions++;
document.title = "("+chatMentions+") " + title;
} }
else else
{ {