From 62120eb0fea1033a0b557bf0360e7e066df8c0b5 Mon Sep 17 00:00:00 2001 From: SpeedPartner <376705740@qq.com> Date: Fri, 5 May 2023 00:17:52 +0800 Subject: [PATCH] Scroll to the bottom only once when get the log --- luci-app-alist/luasrc/view/alist/alist_log.htm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/luci-app-alist/luasrc/view/alist/alist_log.htm b/luci-app-alist/luasrc/view/alist/alist_log.htm index b77932e..737179e 100644 --- a/luci-app-alist/luasrc/view/alist/alist_log.htm +++ b/luci-app-alist/luasrc/view/alist/alist_log.htm @@ -12,12 +12,16 @@ } ); } + var scrolled = false; XHR.poll(2, '<%=url([[admin]], [[nas]], [[alist]], [[get_log]])%>', null, function(x, data) { if(x && x.status == 200) { var log_textarea = document.getElementById('log_textarea'); log_textarea.innerHTML = x.responseText; - log_textarea.scrollTop = log_textarea.scrollHeight; + if (!scrolled) { + log_textarea.scrollTop = log_textarea.scrollHeight; + scrolled = true; + } } } );