More descriptive about how many messages have appeared

This commit is contained in:
Kasper Rynning-Tønnesen
2017-02-10 11:27:27 +01:00
parent 0ccdda4815
commit 4a3cc246dc
6 changed files with 46 additions and 21 deletions

View File

@@ -1,5 +1,8 @@
var Chat = {
channel_received: 0,
all_received: 0,
namechange: function(newName)
{
socket.emit("namechange", newName);
@@ -33,13 +36,18 @@ var Chat = {
{
//$("#chat-btn").css("color", "grey");
if(!blink_interval_exists && inp.msg.substring(0,1) == ":" && !chat_active)
if(inp.msg.substring(0,1) == ":" && !chat_active)
{
Chat.all_received += 1;
$("#favicon").attr("href", "public/images/highlogo.png");
blink_interval_exists = true;
unseen = true;
chat_unseen = true;
if(!blinking) Chat.chat_blink();
if($("span.badge.new.white").hasClass("hide")){
$("span.badge.new.white").removeClass("hide");
}
var to_display = Chat.channel_received + Chat.all_received > 9 ? "9+" : Chat.channel_received + Chat.all_received;
$("span.badge.new.white").html(to_display);
//if(!blinking) Chat.chat_blink();
//blink_interval = setTimeout(Chat.chat_blink, 2000);
}
@@ -63,13 +71,18 @@ var Chat = {
channelchat: function(data)
{
if(!blink_interval_exists && data.msg.substring(0,1) == ":" && !chat_active)
if(data.msg.substring(0,1) == ":" && !chat_active)
{
$("#favicon").attr("href", "public/images/highlogo.png");
unseen = true;
chat_unseen = true;
if(!blinking) Chat.chat_blink();
Chat.channel_received += 1;
//blink_interval = setTimeout(Chat.chat_blink, 1000);
if($("span.badge.new.white").hasClass("hide")){
$("span.badge.new.white").removeClass("hide");
}
var to_display = Chat.channel_received + Chat.all_received > 9 ? "9+" : Chat.channel_received + Chat.all_received;
$("span.badge.new.white").html(to_display);
}
var color = Helper.intToARGB(Helper.hashCode(data.from));

View File

@@ -3,7 +3,6 @@ var w_p = true;
var hasadmin = 0;
var showToggle = true;
var list_html = $("#list-song-html").html();
var blink_interval_exists = false;
var unseen = false;
var api_key = "***REMOVED***";
var searching = false;
@@ -64,7 +63,6 @@ var timeout_search;
var id;
var full_playlist;
var conf;
var blink_interval;
var tag;
var firstScriptTag;
var title;
@@ -988,11 +986,16 @@ $(document).on("submit", "#remoteform", function(e) {
Mobile_remote.get_input($("#remote_channel").val());
});
$(document).on("click", "#chat-btn", function(){
$(document).on("click", ".chat-link", function(){
$("#text-chat-input").focus();
$("#chat-btn i").css("opacity", 1);
clearInterval(blink_interval);
blink_interval_exists = false;
//clearInterval(blink_interval);
//blink_interval_exists = false;
Chat.channel_received = 0;
Chat.all_received = 0;
if(!$("span.badge.new.white").hasClass("hide")){
$("span.badge.new.white").addClass("hide");
}
unseen = false;
$("#favicon").attr("href", "public/images/favicon.png");
});