mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added all-chat
This commit is contained in:
@@ -5,7 +5,10 @@ function chat(data)
|
||||
{
|
||||
if(data.value.length > 150)
|
||||
return;
|
||||
socket.emit("chat", data.value);
|
||||
if($(".tab a.active").attr("href") == "#all_chat")
|
||||
socket.emit("all,chat", data.value);
|
||||
else
|
||||
socket.emit("chat", data.value);
|
||||
data.value = "";
|
||||
return;
|
||||
}
|
||||
@@ -20,6 +23,31 @@ document.getElementById("chat-btn").addEventListener("click", function(){
|
||||
$("#favicon").attr("href", "static/images/favicon.png");
|
||||
});
|
||||
|
||||
$(".chat-tab").click(function(){
|
||||
console.log("clik");
|
||||
$("#text-chat-input").focus();
|
||||
});
|
||||
|
||||
socket.on("chat.all", function(data)
|
||||
{
|
||||
console.log("chat.all");
|
||||
if($("#chat-bar").position()["left"] != 0)
|
||||
{
|
||||
//$("#chat-btn").css("color", "grey");
|
||||
if(!blink_interval_exists)
|
||||
{
|
||||
$("#favicon").attr("href", "static/images/highlogo.png");
|
||||
blink_interval_exists = true;
|
||||
blink_interval = setInterval(chat_blink, 2000);
|
||||
}
|
||||
}
|
||||
var color = intToARGB(hashCode(data.substring(0,8))).substring(0,6);
|
||||
$("#chatall").append("<li><span style='color:"+color+";'>"+data.substring(0,8)+"</span></li>");
|
||||
var in_text = document.createTextNode(data.substring(8));
|
||||
$("#chatall li:last")[0].appendChild(in_text);
|
||||
document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight
|
||||
});
|
||||
|
||||
socket.on("chat,"+chan.toLowerCase(), function(data)
|
||||
{
|
||||
if($("#chat-bar").position()["left"] != 0)
|
||||
@@ -33,10 +61,10 @@ socket.on("chat,"+chan.toLowerCase(), function(data)
|
||||
}
|
||||
}
|
||||
var color = intToARGB(hashCode(data.substring(0,8))).substring(0,6);
|
||||
$("#chat").append("<li><span style='color:"+color+";'>"+data.substring(0,8)+"</span></li>");
|
||||
$("#chatchannel").append("<li><span style='color:"+color+";'>"+data.substring(0,8)+"</span></li>");
|
||||
var in_text = document.createTextNode(data.substring(8));
|
||||
$("#chat li:last")[0].appendChild(in_text);
|
||||
document.getElementById("chat").scrollTop = document.getElementById("chat").scrollHeight
|
||||
$("#chatchannel li:last")[0].appendChild(in_text);
|
||||
document.getElementById("chatchannel").scrollTop = document.getElementById("chatchannel").scrollHeight
|
||||
});
|
||||
|
||||
function chat_blink()
|
||||
|
||||
@@ -83,7 +83,7 @@ $(document).ready(function()
|
||||
$("#chat-btn").sideNav({
|
||||
menuWidth: 272, // Default is 240
|
||||
edge: 'left', // Choose the horizontal origin
|
||||
closeOnClick: true // Closes side-nav on <a> clicks, useful for Angular/Meteor
|
||||
closeOnClick: false // Closes side-nav on <a> clicks, useful for Angular/Meteor
|
||||
});
|
||||
|
||||
$('#settings-close').sideNav('hide');
|
||||
|
||||
Reference in New Issue
Block a user