Enhance log display behavior and menu state management
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -29,9 +29,18 @@ function showLogs(bottom:boolean) {
|
||||
|
||||
var logs = SERVER["log"]["log"]
|
||||
var div = document.getElementById("content_log")
|
||||
var wrapper = document.getElementById("box-wrapper") as HTMLElement
|
||||
var shouldStickToBottom:boolean = bottom
|
||||
|
||||
div.innerHTML = ""
|
||||
|
||||
if (wrapper != null && shouldStickToBottom == false) {
|
||||
var distanceToBottom:number = wrapper.scrollHeight - wrapper.scrollTop - wrapper.clientHeight
|
||||
if (distanceToBottom < 80) {
|
||||
shouldStickToBottom = true
|
||||
}
|
||||
}
|
||||
|
||||
var keys = getObjKeys(logs)
|
||||
|
||||
keys.forEach(logID => {
|
||||
@@ -44,9 +53,8 @@ function showLogs(bottom:boolean) {
|
||||
|
||||
setTimeout(function(){
|
||||
|
||||
if (bottom == true) {
|
||||
if (shouldStickToBottom == true && wrapper != null) {
|
||||
|
||||
var wrapper = document.getElementById("box-wrapper");
|
||||
wrapper.scrollTop = wrapper.scrollHeight;
|
||||
|
||||
}
|
||||
@@ -62,4 +70,4 @@ function resetLogs() {
|
||||
var server:Server = new Server(cmd)
|
||||
server.request(data)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user