mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	fixed issue with remove-button not hiding on switching from private mode to online-mode, and added help function in chat2
This commit is contained in:
		@@ -2,6 +2,7 @@ var Chat = {
 | 
			
		||||
 | 
			
		||||
  channel_received: 0,
 | 
			
		||||
  all_received: 0,
 | 
			
		||||
  chat_help: ["/name <new name> to change name", "/removename to remove name"],
 | 
			
		||||
 | 
			
		||||
  namechange: function(newName)
 | 
			
		||||
  {
 | 
			
		||||
@@ -21,7 +22,47 @@ var Chat = {
 | 
			
		||||
      return;
 | 
			
		||||
    if(data.value.startsWith("/name ")){
 | 
			
		||||
      Chat.namechange(data.value.substring(6));
 | 
			
		||||
    }else if(data.value.startsWith("/removename")){
 | 
			
		||||
    } else if(data.value.startsWith("/help")){
 | 
			
		||||
      if($(".chat-tab-li a.active").attr("href") == "#all_chat"){
 | 
			
		||||
        if($("#chatall").children().length > 100){
 | 
			
		||||
          $("#chatall").children()[0].remove()
 | 
			
		||||
        }
 | 
			
		||||
        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++){
 | 
			
		||||
              color = "0" + color;
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          color = Helper.hexToRgb(color.substring(0,6));
 | 
			
		||||
          var color_temp = Helper.rgbToHsl([color.r, color.g, color.b], false);
 | 
			
		||||
          $("#chatall").append("<li title='Zöff''><span style='color:"+color_temp+";'>System</span>: </li>");
 | 
			
		||||
          var in_text = document.createTextNode(Chat.chat_help[x]);
 | 
			
		||||
          $("#chatall li:last")[0].appendChild(in_text);
 | 
			
		||||
          document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight;
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
        if($("#chatchannel").children().length > 100){
 | 
			
		||||
          $("#chatchannel").children()[0].remove()
 | 
			
		||||
        }
 | 
			
		||||
        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++){
 | 
			
		||||
              color = "0" + color;
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          color = Helper.hexToRgb(color.substring(0,6));
 | 
			
		||||
          var color_temp = Helper.rgbToHsl([color.r, color.g, color.b], false);
 | 
			
		||||
          $("#chatchannel").append("<li><span style='color:"+color_temp+";'>System</span>: </li>");
 | 
			
		||||
          var in_text = document.createTextNode(Chat.chat_help[x]);
 | 
			
		||||
          $("#chatchannel li:last")[0].appendChild(in_text);
 | 
			
		||||
          document.getElementById("chatchannel").scrollTop = document.getElementById("chatchannel").scrollHeight;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
      }
 | 
			
		||||
    } else if(data.value.startsWith("/removename")){
 | 
			
		||||
      Chat.removename();
 | 
			
		||||
    }
 | 
			
		||||
    else if($(".chat-tab-li a.active").attr("href") == "#all_chat")
 | 
			
		||||
@@ -55,6 +96,10 @@ var Chat = {
 | 
			
		||||
    {
 | 
			
		||||
      $("#favicon").attr("href", "public/images/highlogo.png");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if($("#chatall").children().length > 100){
 | 
			
		||||
      $("#chatall").children()[0].remove()
 | 
			
		||||
    }
 | 
			
		||||
    var color = Helper.intToARGB(Helper.hashCode(inp.from));
 | 
			
		||||
    if(color.length < 6) {
 | 
			
		||||
      for(x = color.length; x < 6; x++){
 | 
			
		||||
@@ -85,6 +130,10 @@ var Chat = {
 | 
			
		||||
      $("span.badge.new.white").html(to_display);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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++){
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user