summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2009-01-05 19:03:31 +0000
committerTed Trask <ttrask01@yahoo.com>2009-01-05 19:03:31 +0000
commit6bd3da59930f2ccfdd143b265e7716b3decfe184 (patch)
tree1a752df3fbd98855ab3f7ca221e604033b312a37
parentb3122047c5b39ce2b01274bb4b14bfdb8d89f157 (diff)
downloadacf-alpine-baselayout-6bd3da59930f2ccfdd143b265e7716b3decfe184.tar.bz2
acf-alpine-baselayout-6bd3da59930f2ccfdd143b265e7716b3decfe184.tar.xz
Fixed logfiles tail bug on FireFox. Actually made it much better so scroll sticks.
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@1665 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--logfiles-tail-html.lsp23
1 files changed, 22 insertions, 1 deletions
diff --git a/logfiles-tail-html.lsp b/logfiles-tail-html.lsp
index 6bfe26d..72725ad 100644
--- a/logfiles-tail-html.lsp
+++ b/logfiles-tail-html.lsp
@@ -12,7 +12,28 @@
{name:'<% io.write(form.value.filename.value) if form.value.grep.value ~= "" then io.write("',grep:'"..form.value.grep.value) end %>', offset:currentoffset},
function(data) {
data.value.filecontent.value = data.value.filecontent.value.split("\n").join("<br>\n");
- $("#filecontent").append(data.value.filecontent.value).scrollTop(999999999);
+
+ /* Before updating content, determine where we're scrolled to. If we're within 25 pixels of
+ the bottom, we'll stick to the bottom. */
+ var content = $("#filecontent").get(0);
+ var currentHeight = 0;
+ var scrollTop = content.scrollTop;
+ if (content.scrollHeight > 0)
+ currentHeight = content.scrollHeight;
+ else
+ if (content.offsetHeight > 0)
+ currentHeight = content.offsetHeight;
+ if (currentHeight - scrollTop - ((content.style.pixelHeight) ? content.style.pixelHeight : content.offsetHeight) < 25)
+ scrollTop = currentHeight;
+
+ $("#filecontent").append(data.value.filecontent.value);
+
+ /* Now, set the scroll. */
+ if (scrollTop < currentHeight)
+ content.scrollTop = scrollTop;
+ else
+ content.scrollTop = content.scrollHeight;
+
currentoffset = data.value.filesize.value;
$("DT:contains('File size')").next().text(currentoffset);
}