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:
@@ -21,15 +21,22 @@ function showLogs(bottom) {
|
||||
var log = new Log();
|
||||
var logs = SERVER["log"]["log"];
|
||||
var div = document.getElementById("content_log");
|
||||
var wrapper = document.getElementById("box-wrapper");
|
||||
var shouldStickToBottom = bottom;
|
||||
div.innerHTML = "";
|
||||
if (wrapper != null && shouldStickToBottom == false) {
|
||||
var distanceToBottom = wrapper.scrollHeight - wrapper.scrollTop - wrapper.clientHeight;
|
||||
if (distanceToBottom < 80) {
|
||||
shouldStickToBottom = true;
|
||||
}
|
||||
}
|
||||
var keys = getObjKeys(logs);
|
||||
keys.forEach(function (logID) {
|
||||
var entry = log.createLog(logs[logID]);
|
||||
div.append(entry);
|
||||
});
|
||||
setTimeout(function () {
|
||||
if (bottom == true) {
|
||||
var wrapper = document.getElementById("box-wrapper");
|
||||
if (shouldStickToBottom == true && wrapper != null) {
|
||||
wrapper.scrollTop = wrapper.scrollHeight;
|
||||
}
|
||||
}, 10);
|
||||
|
||||
Reference in New Issue
Block a user