More chat improvements

This commit is contained in:
Kasper Rynning-Tønnesen
2016-04-19 21:39:49 +02:00
parent 5c2b421585
commit 5142ae0ce9
4 changed files with 26 additions and 24 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -34,18 +34,20 @@ var Chat = {
socket.on("chat.all", function(inp)
{
if($("#chat-bar").position()["left"] != 0)
{
//$("#chat-btn").css("color", "grey");
if(!blink_interval_exists && inp.indexOf("changed name to") < 0)
{
$("#favicon").attr("href", "static/images/highlogo.png");
blink_interval_exists = true;
unseen = true;
blink_interval = setInterval(Chat.chat_blink, 2000);
}
}else if(document.hidden)
//$("#chat-btn").css("color", "grey");
console.log(inp.indexOf("changed name to"));
if(!blink_interval_exists && inp.indexOf("changed name to") < 0 && !chat_active)
{
$("#favicon").attr("href", "static/images/highlogo.png");
blink_interval_exists = true;
unseen = true;
blink_interval = setInterval(Chat.chat_blink, 2000);
}
if(document.hidden)
{
$("#favicon").attr("href", "static/images/highlogo.png");
unseen = true;
@@ -69,18 +71,13 @@ var Chat = {
{
socket.on("chat", function(data)
{
if($("#chat-bar").position()["left"] != 0)
if(!blink_interval_exists && data.indexOf("changed name to") < 0 && !chat_active)
{
if(data[1].indexOf(":") >= 0){
//$("#chat-btn").css("color", "grey");
if(!blink_interval_exists && data.indexOf("changed name to") < 0)
{
$("#favicon").attr("href", "static/images/highlogo.png");
blink_interval_exists = true;
blink_interval = setInterval(Chat.chat_blink, 2000);
}
}
$("#favicon").attr("href", "static/images/highlogo.png");
blink_interval_exists = true;
blink_interval = setInterval(Chat.chat_blink, 2000);
}
var color = Helper.intToARGB(Helper.hashCode(data[0]));
if(color.length < 6) {
for(x = color.length; x < 6; x++){

View File

@@ -28,6 +28,7 @@ var lazy_load = true;
var embed = false;
var autoplay = true;
var durationBegun = false;
var chat_active = false;
var mobile_beginning;
var timeout_search;
@@ -321,6 +322,8 @@ $(document).on("submit", "#adminForm", function(e){
});
$(document).on("click", ".chat-link", function(e){
chat_active = true;
$("#favicon").attr("href", "static/images/favicon.png");
$("#chatPlaylist").css("display", "block");
$("#wrapper").css("display", "none");
$("#suggestions").css("display", "none");
@@ -328,12 +331,14 @@ $(document).on("click", ".chat-link", function(e){
});
$(document).on("click", ".playlist-link", function(e){
chat_active = false;
$("#chatPlaylist").css("display", "none");
$("#wrapper").css("display", "block");
$("#suggestions").css("display", "none");
});
$(document).on("click", ".suggested-link", function(e){
chat_active = false;
$("#chatPlaylist").css("display", "none");
$("#wrapper").css("display", "none");
$("#suggestions").css("display", "block");