From 19ee4865f476caa4d926ca4ec1f75a11e8792b6f Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 27 Nov 2011 20:39:47 +0000 Subject: [PATCH] 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 --- static/js/chat.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/static/js/chat.js b/static/js/chat.js index 1f6267be7..1bc44d201 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -16,6 +16,8 @@ var chat = (function() { + var chatMentions = 0; + var title = document.title; var self = { show: function () { @@ -43,6 +45,8 @@ var chat = (function() } }); }); + chatMentions = 0; + document.title = title; }, hide: function () { @@ -54,8 +58,6 @@ var chat = (function() }, scrollDown: function() { - //console.log($('#chatbox').css("display")); - if($('#chatbox').css("display") != "none") $('#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 if(wasMentioned) { // If the user was mentioned show for twice as long and flash the browser window + if (chatMentions == 0){ + title = document.title; + } $('#chatthrob').html(""+authorName+"" + ": " + text); $('#chatthrob').effect("pulsate", {times:1,mode:"hide"},4000); - document.title = "You were mentioned in a chat: " + document.title; + chatMentions++; + document.title = "("+chatMentions+") " + title; } else {