Leistungseinstellungen für Backspace und Pfeiltasten geändert

This commit is contained in:
jamulix 2025-10-24 19:55:07 +02:00 committed by jamulix (aider)
commit 8166bc9b5b

View file

@ -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);