diff options
author | Ted Trask <ttrask01@yahoo.com> | 2009-07-20 13:42:58 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2009-07-20 13:42:58 +0000 |
commit | 33c6624e549c58755932fee74d8fa49f10fc3a79 (patch) | |
tree | ccc71d66ff6107177d54a4c90efb5730c424fa3e | |
parent | a48efa5083b88782b929cd3c32f80a911bdaca7c (diff) | |
download | acf-alpine-baselayout-33c6624e549c58755932fee74d8fa49f10fc3a79.tar.bz2 acf-alpine-baselayout-33c6624e549c58755932fee74d8fa49f10fc3a79.tar.xz |
Fixed minor logfiles tail bug in Firefox by using .val instead of .append. Only scroll on input.
-rw-r--r-- | logfiles-tail-html.lsp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/logfiles-tail-html.lsp b/logfiles-tail-html.lsp index 94bc4a8..af04da4 100644 --- a/logfiles-tail-html.lsp +++ b/logfiles-tail-html.lsp @@ -11,31 +11,32 @@ '<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action) %>', {name:'<% io.write(html.html_escape(form.value.filename.value)) if form.value.grep.value ~= "" then io.write("',grep:'"..html.html_escape(form.value.grep.value)) end %>', offset:currentoffset}, function(data) { - data.value.filecontent.value = data.value.filecontent.value.split("\n").join("<br>\n"); + if (currentoffset != data.value.filesize.value){ - /* 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; + /* 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); + $("#filecontent").val($("#filecontent").val() + data.value.filecontent.value); - /* Now, set the scroll. */ - if (scrollTop < currentHeight) - content.scrollTop = scrollTop; - else - content.scrollTop = content.scrollHeight; + /* 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); + currentoffset = data.value.filesize.value; + $("DT:contains('File size')").next().text(currentoffset); + }; } ); ID=window.setTimeout("Update();", 1000); |