Add button to clear logs
This commit is contained in:
parent
14fce40f9f
commit
e97cb6f8ed
2 changed files with 8 additions and 1 deletions
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue