From de70b0a8611cc23944f567bfa890a04a98d535a3 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Fri, 22 Mar 2024 17:08:12 +0300 Subject: [PATCH] some fixes --- www/log.html | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/www/log.html b/www/log.html index 7517bddd..42c1fcd8 100644 --- a/www/log.html +++ b/www/log.html @@ -54,7 +54,7 @@
- +

@@ -86,11 +86,18 @@ .replace(/\n/g, '
'); } + let reverseBtn = document.getElementById('reverse'); + let update = document.getElementById('update'); + let reverseOrder = false; + let autoUpdateEnabled = true; + + reverseBtn.textContent = `Reverse Log Order: ${reverseOrder ? 'ON' : 'OFF'}`; + update.textContent = `Auto Update: ${autoUpdateEnabled ? 'ON' : 'OFF'}`; function applyLogStyling(jsonlines) { const KEYS = ['time', 'level', 'message']; - const lines = JSON.parse('[' + jsonlines.trimEnd().replaceAll('\n', ',') + ']'); + let lines = JSON.parse('[' + jsonlines.trimEnd().replaceAll('\n', ',') + ']'); if (reverseOrder) { lines = lines.reverse(); } @@ -118,17 +125,14 @@ reload(); - // Handle auto-update switch - let autoUpdateEnabled = true; - - const update = document.getElementById('update'); + update.textContent = `Auto Update: ${autoUpdateEnabled ? 'ON' : 'OFF'}`; update.addEventListener('click', () => { autoUpdateEnabled = !autoUpdateEnabled; update.textContent = `Auto Update: ${autoUpdateEnabled ? 'ON' : 'OFF'}`; }); // Toggle log order - const reverseBtn = document.getElementById('reverse'); + reverseBtn.textContent = `Reverse Log Order: ${reverseOrder ? 'ON' : 'OFF'}`; reverseBtn.addEventListener('click', () => { reverseOrder = !reverseOrder; reverseBtn.textContent = `Reverse Log Order: ${reverseOrder ? 'ON' : 'OFF'}`;