From 3cbca7ec1e7dd3b5c0d2f44ba1318ef4d07de011 Mon Sep 17 00:00:00 2001 From: Fabian Date: Wed, 21 Apr 2021 20:03:54 +0200 Subject: [PATCH] =?UTF-8?q?fix=20chat=20scroll,=20luke=20ist=20daf=C3=BCr?= =?UTF-8?q?=20verantwortlich?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ReallifeGamemode.Client/assets/js/chat/main.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ReallifeGamemode.Client/assets/js/chat/main.js b/ReallifeGamemode.Client/assets/js/chat/main.js index 50619991..f9ebd0aa 100644 --- a/ReallifeGamemode.Client/assets/js/chat/main.js +++ b/ReallifeGamemode.Client/assets/js/chat/main.js @@ -23,7 +23,8 @@ function enableChatInput(enable) { if (enable) { chat.input = $("#chat").append('
').children(":last"); chat.input.children("input").focus(); - } else { + } + else { chat.input.fadeOut('fast', function () { chat.input.remove(); chat.input = null; @@ -64,14 +65,12 @@ var chatAPI = var today = new Date(); if (chatElement === "
  • ") { - var time = today.toLocaleTimeString('de-DE'); - chat.container.append("
  • " + "[" + time + "] " + text + "
  • "); - if (chat.input == null || elmnt.scrollTop == elmnt.scrollHeight - elmnt.clientHeight) { + chat.container.append("
  • " + "[" + today.toLocaleTimeString('de-DE') + "] " + text + "
  • "); elmnt.scrollTop = elmnt.scrollHeight - elmnt.clientHeight; + } else { + chat.container.append("
  • " + "[" + today.toLocaleTimeString('de-DE') + "] " + text + "
  • "); } - - // if (!chat.enabled) { elmnt.scrollTo(0, elmnt.scrollHeight); } } else { chat.container.append(chatElement); }