Attached Files |
0001-Webtiles-chat-now-only-scrolls-when-at-the-bottom-of.patch [^] (1,265 bytes) 2013-09-21 01:15 [Show Content] [Hide Content]From a2854f32e086e52cc10d8bcb042f3cdcfd913fb4 Mon Sep 17 00:00:00 2001
From: Nabalzbhf <NabalzbhfQri@gmail.com>
Date: Fri, 20 Sep 2013 19:06:23 -0400
Subject: [PATCH] Webtiles chat now only scrolls when at the bottom of the chatbox.
---
crawl-ref/source/webserver/static/scripts/chat.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/crawl-ref/source/webserver/static/scripts/chat.js b/crawl-ref/source/webserver/static/scripts/chat.js
index e353f4b..7b80b86 100644
--- a/crawl-ref/source/webserver/static/scripts/chat.js
+++ b/crawl-ref/source/webserver/static/scripts/chat.js
@@ -17,8 +17,11 @@ define(["jquery", "comm"], function ($, comm) {
function receive_message(data)
{
var msg = data.content;
+ var histcon = $('#chat_history_container');
+ var atBottom = (histcon[0].scrollHeight - histcon.scrollTop() == histcon.outerHeight());
$("#chat_history").append(msg + "<br>");
- $("#chat_history_container").scrollTop($("#chat_history").height());
+ if (atBottom)
+ $('#chat_history_container').scrollTop($('#chat_history_container')[0].scrollHeight);
if ($("#chat_body").css("display") === "none")
{
new_message_count++;
--
1.8.3-rc3
|