mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added icon even when chat is open
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
var blink_interval;
|
||||
var blink_interval_exists = false;
|
||||
var unseen = false;
|
||||
|
||||
function chat(data)
|
||||
{
|
||||
@@ -20,6 +21,7 @@ document.getElementById("chat-btn").addEventListener("click", function(){
|
||||
$("#chat-btn i").css("opacity", 1);
|
||||
clearInterval(blink_interval);
|
||||
blink_interval_exists = false;
|
||||
unseen = false;
|
||||
$("#favicon").attr("href", "static/images/favicon.png");
|
||||
});
|
||||
|
||||
@@ -31,6 +33,7 @@ $(".chat-tab").click(function(){
|
||||
socket.on("chat.all", function(data)
|
||||
{
|
||||
console.log("chat.all");
|
||||
console.log(document.hidden);
|
||||
if($("#chat-bar").position()["left"] != 0)
|
||||
{
|
||||
//$("#chat-btn").css("color", "grey");
|
||||
@@ -38,8 +41,13 @@ socket.on("chat.all", function(data)
|
||||
{
|
||||
$("#favicon").attr("href", "static/images/highlogo.png");
|
||||
blink_interval_exists = true;
|
||||
unseen = true;
|
||||
blink_interval = setInterval(chat_blink, 2000);
|
||||
}
|
||||
}else if(document.hidden)
|
||||
{
|
||||
$("#favicon").attr("href", "static/images/highlogo.png");
|
||||
unseen = true;
|
||||
}
|
||||
var color = intToARGB(hashCode(data.substring(0,8))).substring(0,6);
|
||||
$("#chatall").append("<li><span style='color:"+color+";'>"+data.substring(0,8)+"</span></li>");
|
||||
@@ -48,6 +56,15 @@ socket.on("chat.all", function(data)
|
||||
document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight
|
||||
});
|
||||
|
||||
$(window).focus(function(){
|
||||
if(unseen)
|
||||
{
|
||||
console.log("unseen");
|
||||
$("#favicon").attr("href", "static/images/favicon.png");
|
||||
unseen = false;
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("chat,"+chan.toLowerCase(), function(data)
|
||||
{
|
||||
if($("#chat-bar").position()["left"] != 0)
|
||||
|
||||
Reference in New Issue
Block a user