From 54bb066b7e21b16086fcb08758e58559e79b1dba Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Mon, 20 May 2013 16:46:32 -0500 Subject: [PATCH] !data no longer breaks battle chat scrolling --- js/battle.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/battle.js b/js/battle.js index 961988668..5b975256a 100644 --- a/js/battle.js +++ b/js/battle.js @@ -851,12 +851,13 @@ function Battle(frame, logFrame, noPreload) { if (window.console && console.log) console.log(text); }; this.log = function (html, preempt) { + var willScroll = (self.logFrameElem.scrollTop() + 60 >= self.logElem.height() + self.logPreemptElem.height() - self.logFrameElem.height()); if (preempt) { self.logPreemptElem.append(html); } else { self.logElem.append(html); } - if (self.logFrameElem.scrollTop() + 60 >= self.logElem.height() + self.logPreemptElem.height() - self.logFrameElem.height()) { + if (willScroll) { self.logFrameElem.scrollTop(self.logElem.height() + self.logPreemptElem.height()); } };