Leistungseinstellungen für Backspace und Pfeiltasten geändert
This commit is contained in:
parent
c9f6363fcb
commit
8166bc9b5b
1 changed files with 17 additions and 18 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue