mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-29 05:21:01 +00:00
Removed some old functions and indented code
This commit is contained in:
@@ -4,33 +4,31 @@ var Chat = {
|
||||
all_received: 0,
|
||||
chat_help: [/*"/name <new name> to change name", "/removename to remove name"*/ "There are no commands.. As of now!"],
|
||||
|
||||
namechange: function(newName)
|
||||
{
|
||||
namechange: function(newName) {
|
||||
socket.emit("namechange", {name: newName, channel: chan.toLowerCase()});
|
||||
Crypt.set_name(newName);
|
||||
},
|
||||
|
||||
removename: function()
|
||||
{
|
||||
removename: function() {
|
||||
socket.emit("removename");
|
||||
Crypt.remove_name();
|
||||
},
|
||||
|
||||
chat: function(data)
|
||||
{
|
||||
chat: function(data) {
|
||||
if(data.value.length > 150)
|
||||
return;
|
||||
return;
|
||||
/*if(data.value.startsWith("/name ")){
|
||||
Chat.namechange(data.value.substring(6));
|
||||
} else */ if(data.value.startsWith("/help")){
|
||||
} else */
|
||||
if(data.value.startsWith("/help")) {
|
||||
if($(".chat-tab-li a.active").attr("href") == "#all_chat"){
|
||||
if($("#chatall").children().length > 100){
|
||||
if($("#chatall").children().length > 100) {
|
||||
$("#chatall").children()[0].remove()
|
||||
}
|
||||
for(var x = 0; x < Chat.chat_help.length; x++){
|
||||
for(var x = 0; x < Chat.chat_help.length; x++) {
|
||||
var color = Helper.intToARGB(Helper.hashCode("System"));
|
||||
if(color.length < 6) {
|
||||
for(x = color.length; x < 6; x++){
|
||||
for(x = color.length; x < 6; x++) {
|
||||
color = "0" + color;
|
||||
}
|
||||
}
|
||||
@@ -42,14 +40,14 @@ var Chat = {
|
||||
document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight;
|
||||
}
|
||||
} else {
|
||||
if($("#chatchannel").children().length > 100){
|
||||
if($("#chatchannel").children().length > 100) {
|
||||
$("#chatchannel").children()[0].remove()
|
||||
}
|
||||
for(var x = 0; x < Chat.chat_help.length; x++){
|
||||
for(var x = 0; x < Chat.chat_help.length; x++) {
|
||||
|
||||
var color = Helper.intToARGB(Helper.hashCode("System"));
|
||||
if(color.length < 6) {
|
||||
for(x = color.length; x < 6; x++){
|
||||
for(x = color.length; x < 6; x++) {
|
||||
color = "0" + color;
|
||||
}
|
||||
}
|
||||
@@ -60,26 +58,20 @@ var Chat = {
|
||||
$("#chatchannel li:last")[0].appendChild(in_text);
|
||||
document.getElementById("chatchannel").scrollTop = document.getElementById("chatchannel").scrollHeight;
|
||||
}
|
||||
|
||||
}
|
||||
} else if(data.value.startsWith("/removename")){
|
||||
} else if(data.value.startsWith("/removename")) {
|
||||
Chat.removename();
|
||||
} else if($(".chat-tab-li a.active").attr("href") == "#all_chat"){
|
||||
} else if($(".chat-tab-li a.active").attr("href") == "#all_chat") {
|
||||
socket.emit("all,chat", {channel: chan.toLowerCase(), data: data.value});
|
||||
} else {
|
||||
socket.emit("chat", {channel: chan.toLowerCase(), data: data.value, pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
||||
}
|
||||
data.value = "";
|
||||
|
||||
return;
|
||||
},
|
||||
|
||||
allchat: function(inp)
|
||||
{
|
||||
//$("#chat-btn").css("color", "grey");
|
||||
|
||||
if(inp.msg.substring(0,1) == ":" && !chat_active)
|
||||
{
|
||||
allchat: function(inp) {
|
||||
if(inp.msg.substring(0,1) == ":" && !chat_active) {
|
||||
Chat.all_received += 1;
|
||||
$("#favicon").attr("href", "/assets/images/highlogo.png");
|
||||
unseen = true;
|
||||
@@ -89,16 +81,13 @@ var Chat = {
|
||||
}
|
||||
var to_display = Chat.channel_received + Chat.all_received > 9 ? "9+" : Chat.channel_received + Chat.all_received;
|
||||
$(".chat-link span.badge.new.white").html(to_display);
|
||||
//if(!blinking) Chat.chat_blink();
|
||||
//blink_interval = setTimeout(Chat.chat_blink, 2000);
|
||||
}
|
||||
|
||||
if(document.hidden)
|
||||
{
|
||||
if(document.hidden) {
|
||||
$("#favicon").attr("href", "/assets/images/highlogo.png");
|
||||
}
|
||||
|
||||
if($("#chatall").children().length > 100){
|
||||
if($("#chatall").children().length > 100) {
|
||||
$("#chatall").children()[0].remove()
|
||||
}
|
||||
var color = Helper.intToARGB(Helper.hashCode(inp.from));
|
||||
@@ -115,29 +104,27 @@ var Chat = {
|
||||
document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight;
|
||||
},
|
||||
|
||||
channelchat: function(data)
|
||||
{
|
||||
if(data.msg.substring(0,1) == ":" && !chat_active)
|
||||
{
|
||||
channelchat: function(data) {
|
||||
if(data.msg.substring(0,1) == ":" && !chat_active) {
|
||||
$("#favicon").attr("href", "/assets/images/highlogo.png");
|
||||
unseen = true;
|
||||
chat_unseen = true;
|
||||
Chat.channel_received += 1;
|
||||
//blink_interval = setTimeout(Chat.chat_blink, 1000);
|
||||
if($(".chat-link span.badge.new.white").hasClass("hide")){
|
||||
if($(".chat-link span.badge.new.white").hasClass("hide")) {
|
||||
$(".chat-link span.badge.new.white").removeClass("hide");
|
||||
}
|
||||
var to_display = Chat.channel_received + Chat.all_received > 9 ? "9+" : Chat.channel_received + Chat.all_received;
|
||||
$(".chat-link span.badge.new.white").html(to_display);
|
||||
}
|
||||
|
||||
if($("#chatchannel").children().length > 100){
|
||||
if($("#chatchannel").children().length > 100) {
|
||||
$("#chatchannel").children()[0].remove()
|
||||
}
|
||||
|
||||
var color = Helper.intToARGB(Helper.hashCode(data.from));
|
||||
if(color.length < 6) {
|
||||
for(x = color.length; x < 6; x++){
|
||||
for(x = color.length; x < 6; x++) {
|
||||
color = "0" + color;
|
||||
}
|
||||
}
|
||||
@@ -159,5 +146,4 @@ var Chat = {
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user