Add button to clear logs

This commit is contained in:
redfast00 2022-01-25 21:29:21 +01:00
parent 14fce40f9f
commit e97cb6f8ed
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C
2 changed files with 8 additions and 1 deletions

View file

@ -95,6 +95,7 @@
<body>
<button onclick="toggle_logging()" id="toggle_button">Start</button>
<button onclick="clear_log()" id="clear_button">Clear</button>
<input type="checkbox" id="show_raw" name="show_raw" checked autocomplete="off" onchange="updateShowRaw()">
<label for="show_raw">Show raw address and payload</label>

View file

@ -87,7 +87,7 @@ function updateMessages() {
// delete children if there are too many :O
// -1 so we don't delete the header :)
for (let i = 0; i < messageTable.children.length - max_messages - 1; i++) {
while (messageTable.children.length - 1 > max_messages) {
messageTable.removeChild(messageTable.lastChild);
}
newest_message_index = data.newest_msg;
@ -109,4 +109,10 @@ function toggle_logging() {
}
}
function clear_log() {
while (messageTable.children.length > 1) {
messageTable.removeChild(messageTable.lastChild);
}
}
window.onload = toggle_logging;