Use Tinycon to display chat mentions in favicon.

This commit is contained in:
Marcel Klehr 2012-07-12 20:18:33 +02:00
parent ead379cf66
commit dc9eda9364
2 changed files with 242 additions and 7 deletions

View file

@ -23,11 +23,12 @@
var padutils = require('./pad_utils').padutils;
var padcookie = require('./pad_cookie').padcookie;
require('./tinycon');
var chat = (function()
{
var isStuck = false;
var chatMentions = 0;
var title = document.title;
var self = {
show: function ()
{
@ -35,7 +36,7 @@ var chat = (function()
$("#chatbox").show();
self.scrollDown();
chatMentions = 0;
document.title = title;
Tinycon.setBubble(0);
},
stickToScreen: function(fromInitialCall) // Make chat stick to right hand side of screen
{
@ -126,12 +127,9 @@ var chat = (function()
// chat throb stuff -- Just make it throw for twice as long
if(wasMentioned && !alreadyFocused)
{ // 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).show().delay(4000).hide(400);
chatMentions++;
document.title = "("+chatMentions+") " + title;
Tinycon.setBubble(chatMentions);
}
else
{
@ -141,7 +139,7 @@ var chat = (function()
// Clear the chat mentions when the user clicks on the chat input box
$('#chatinput').click(function(){
chatMentions = 0;
document.title = title;
Tinycon.setBubble(0);
});
self.scrollDown();