From 8166bc9b5b821df19675336d0835f1b4e91ee023 Mon Sep 17 00:00:00 2001 From: jamulix Date: Fri, 24 Oct 2025 19:55:07 +0200 Subject: [PATCH] =?UTF-8?q?Leistungseinstellungen=20f=C3=BCr=20Backspace?= =?UTF-8?q?=20und=20Pfeiltasten=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/script.js | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/static/js/script.js b/static/js/script.js index 6d8eaff..b7041f2 100644 --- a/static/js/script.js +++ b/static/js/script.js @@ -1,5 +1,6 @@ // Theme Management function initializeTheme() { + // Beim ersten Start Light-Modus, sonst gespeicherten Modus verwenden const savedTheme = localStorage.getItem('theme') || 'light'; document.body.setAttribute('data-bs-theme', savedTheme); updateThemeButton(savedTheme); @@ -111,46 +112,44 @@ document.addEventListener('DOMContentLoaded', function() { // Behandle Pfeiltasten if (event.key === 'ArrowLeft') { event.preventDefault(); - keyStrokeCount++; - if (!startTime) { - startTime = new Date(); - } if (currentCharIndex > 0) { + keyStrokeCount++; + if (!startTime) { + startTime = new Date(); + } currentCharIndex--; updateTextDisplay(); + updateStatistics(); } - updateStatistics(); return; } if (event.key === 'ArrowRight') { event.preventDefault(); - keyStrokeCount++; - if (!startTime) { - startTime = new Date(); - } if (currentCharIndex < userInput.length) { + keyStrokeCount++; + if (!startTime) { + startTime = new Date(); + } currentCharIndex++; updateTextDisplay(); + updateStatistics(); } - updateStatistics(); return; } // Behandle Backspace if (event.key === 'Backspace') { event.preventDefault(); - keyStrokeCount++; - if (!startTime) { - startTime = new Date(); - } if (userInput.length > 0 && currentCharIndex > 0) { + keyStrokeCount++; + if (!startTime) { + startTime = new Date(); + } userInput = userInput.slice(0, currentCharIndex - 1) + userInput.slice(currentCharIndex); currentCharIndex--; updateTextDisplay(); updateStatistics(); - } else { - updateStatistics(); } return; } @@ -500,8 +499,8 @@ document.addEventListener('DOMContentLoaded', function() { function initializeProgressStatsToggle() { const performanceBtn = document.getElementById('performance-btn'); - // Lade gespeicherten Zustand aus localStorage - const progressStatsVisible = localStorage.getItem('progressStatsVisible') !== 'false'; + // Beim ersten Start abgeschaltet, sonst gespeicherten Zustand verwenden + const progressStatsVisible = localStorage.getItem('progressStatsVisible') === 'true'; // Setze initialen Zustand setProgressStatsVisibility(progressStatsVisible);