tools:intervalltrainer2
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Beide Seiten, vorherige ÜberarbeitungVorherige Überarbeitung | |||
| tools:intervalltrainer2 [10/05/2025 18:33] – ↷ Seitename wurde von tools:intervalltrainer2 auf tools:intervalltrainer-pruefung geändert Eric Weber | tools:intervalltrainer2 [21/09/2025 16:11] (aktuell) – angelegt Eric Weber | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | < | ||
| + | <html lang=" | ||
| + | < | ||
| + | <meta charset=" | ||
| + | <meta name=" | ||
| + | < | ||
| + | < | ||
| + | /* Reset nur für die Anwendung - keine globalen Styles */ | ||
| + | .interval-training-app * { | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | box-sizing: border-box; | ||
| + | } | ||
| + | .interval-training-app { | ||
| + | font-family: | ||
| + | color: #2d3748; | ||
| + | max-width: 900px; | ||
| + | margin: 0 auto; | ||
| + | padding: 20px; | ||
| + | /* Kein Hintergrund - transparent */ | ||
| + | } | ||
| + | |||
| + | .interval-training-app h1 { | ||
| + | text-align: center; | ||
| + | color: #2d3748; | ||
| + | margin-bottom: | ||
| + | font-size: 2.5em; | ||
| + | text-shadow: | ||
| + | font-weight: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .card { | ||
| + | background: rgba(255, 255, 255, 0.95); | ||
| + | backdrop-filter: | ||
| + | border-radius: | ||
| + | padding: 25px; | ||
| + | margin-bottom: | ||
| + | box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15); | ||
| + | border: 2px solid rgba(45, 55, 72, 0.1); | ||
| + | } | ||
| + | |||
| + | .interval-training-app h2 { | ||
| + | color: #2d3748; | ||
| + | margin-bottom: | ||
| + | border-bottom: | ||
| + | padding-bottom: | ||
| + | font-size: 1.4em; | ||
| + | font-weight: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .section { | ||
| + | margin-bottom: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .checkbox-grid { | ||
| + | display: grid; | ||
| + | grid-template-columns: | ||
| + | gap: 10px; | ||
| + | margin-bottom: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .checkbox-item { | ||
| + | display: flex; | ||
| + | align-items: | ||
| + | padding: 10px 12px; | ||
| + | background: rgba(247, 250, 252, 0.9); | ||
| + | border-radius: | ||
| + | border: 1px solid #cbd5e0; | ||
| + | transition: all 0.2s; | ||
| + | cursor: pointer; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .checkbox-item: | ||
| + | background: rgba(237, 242, 247, 0.9); | ||
| + | transform: translateY(-1px); | ||
| + | border-color: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .checkbox-item input[type=" | ||
| + | margin-right: | ||
| + | transform: scale(1.2); | ||
| + | cursor: pointer; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .checkbox-item label { | ||
| + | cursor: pointer; | ||
| + | font-weight: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .control-buttons { | ||
| + | display: flex; | ||
| + | gap: 10px; | ||
| + | margin-bottom: | ||
| + | flex-wrap: wrap; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .btn { | ||
| + | padding: 12px 24px; | ||
| + | border: none; | ||
| + | border-radius: | ||
| + | cursor: pointer; | ||
| + | font-size: 16px; | ||
| + | font-weight: | ||
| + | transition: all 0.3s; | ||
| + | text-transform: | ||
| + | letter-spacing: | ||
| + | font-family: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .btn-primary { | ||
| + | background: linear-gradient(135deg, | ||
| + | color: white; | ||
| + | border: 2px solid transparent; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .btn-secondary { | ||
| + | background: #718096; | ||
| + | color: white; | ||
| + | border: 2px solid transparent; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .btn-success { | ||
| + | background: #48bb78; | ||
| + | color: white; | ||
| + | border: 2px solid transparent; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .btn-danger { | ||
| + | background: #f56565; | ||
| + | color: white; | ||
| + | border: 2px solid transparent; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .btn:hover { | ||
| + | transform: translateY(-2px); | ||
| + | box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); | ||
| + | } | ||
| + | |||
| + | .interval-training-app .btn: | ||
| + | opacity: 0.6; | ||
| + | cursor: not-allowed; | ||
| + | transform: none; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .radio-group { | ||
| + | display: flex; | ||
| + | flex-direction: | ||
| + | gap: 10px; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .radio-item { | ||
| + | display: flex; | ||
| + | align-items: | ||
| + | padding: 12px 15px; | ||
| + | background: rgba(247, 250, 252, 0.9); | ||
| + | border-radius: | ||
| + | border: 1px solid #cbd5e0; | ||
| + | cursor: pointer; | ||
| + | transition: all 0.2s; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .radio-item: | ||
| + | background: rgba(237, 242, 247, 0.9); | ||
| + | border-color: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .radio-item input[type=" | ||
| + | margin-right: | ||
| + | transform: scale(1.2); | ||
| + | cursor: pointer; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .radio-item label { | ||
| + | cursor: pointer; | ||
| + | font-weight: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .quiz-container { | ||
| + | display: none; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .question-info { | ||
| + | text-align: center; | ||
| + | margin-bottom: | ||
| + | font-size: 18px; | ||
| + | color: #4a5568; | ||
| + | font-weight: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .audio-controls { | ||
| + | text-align: center; | ||
| + | margin: 20px 0; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .play-btn { | ||
| + | background: linear-gradient(135deg, | ||
| + | color: white; | ||
| + | border: none; | ||
| + | border-radius: | ||
| + | width: 80px; | ||
| + | height: 80px; | ||
| + | font-size: 24px; | ||
| + | cursor: pointer; | ||
| + | transition: all 0.3s; | ||
| + | box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4); | ||
| + | } | ||
| + | |||
| + | .interval-training-app .play-btn: | ||
| + | transform: scale(1.1); | ||
| + | box-shadow: 0 6px 20px rgba(72, 187, 120, 0.6); | ||
| + | } | ||
| + | |||
| + | .interval-training-app .answer-options { | ||
| + | display: grid; | ||
| + | grid-template-columns: | ||
| + | gap: 10px; | ||
| + | margin: 20px 0; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .answer-btn { | ||
| + | padding: 15px 20px; | ||
| + | border: 2px solid #cbd5e0; | ||
| + | background: rgba(255, 255, 255, 0.9); | ||
| + | border-radius: | ||
| + | cursor: pointer; | ||
| + | font-size: 16px; | ||
| + | font-weight: | ||
| + | transition: all 0.3s; | ||
| + | font-family: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .answer-btn: | ||
| + | border-color: | ||
| + | transform: translateY(-2px); | ||
| + | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); | ||
| + | } | ||
| + | |||
| + | .interval-training-app .answer-btn.correct { | ||
| + | background: #48bb78; | ||
| + | color: white; | ||
| + | border-color: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .answer-btn.incorrect { | ||
| + | background: #f56565; | ||
| + | color: white; | ||
| + | border-color: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .results { | ||
| + | text-align: center; | ||
| + | padding: 30px; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .score { | ||
| + | font-size: 3em; | ||
| + | font-weight: | ||
| + | color: #4299e1; | ||
| + | margin-bottom: | ||
| + | } | ||
| + | |||
| + | .interval-training-app .progress-bar { | ||
| + | width: 100%; | ||
| + | height: 10px; | ||
| + | background: #e2e8f0; | ||
| + | border-radius: | ||
| + | overflow: hidden; | ||
| + | margin: 20px 0; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .progress-fill { | ||
| + | height: 100%; | ||
| + | background: linear-gradient(90deg, | ||
| + | transition: width 0.5s ease; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .hidden { | ||
| + | display: none !important; | ||
| + | } | ||
| + | |||
| + | /* Responsive Design */ | ||
| + | @media (max-width: 768px) { | ||
| + | .interval-training-app { | ||
| + | padding: 10px; | ||
| + | } | ||
| + | | ||
| + | .interval-training-app .checkbox-grid { | ||
| + | grid-template-columns: | ||
| + | } | ||
| + | | ||
| + | .interval-training-app h1 { | ||
| + | font-size: 2em; | ||
| + | } | ||
| + | |||
| + | .interval-training-app .control-buttons { | ||
| + | justify-content: | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | <div class=" | ||
| + | < | ||
| + | | ||
| + | <div id=" | ||
| + | <div class=" | ||
| + | < | ||
| + | <div class=" | ||
| + | <button class=" | ||
| + | <button class=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div class=" | ||
| + | < | ||
| + | <div class=" | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div class=" | ||
| + | < | ||
| + | <div class=" | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div class=" | ||
| + | < | ||
| + | <div class=" | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | <div class=" | ||
| + | <input type=" | ||
| + | <label for=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | <button class=" | ||
| + | 🎯 Prüfung starten | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div id=" | ||
| + | <div class=" | ||
| + | < | ||
| + | <div class=" | ||
| + | <div class=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div class=" | ||
| + | <button class=" | ||
| + | ▶️ | ||
| + | </ | ||
| + | <div style=" | ||
| + | <button class=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div id=" | ||
| + | <!-- Hier werden die Antwortoptionen eingefügt --> | ||
| + | </ | ||
| + | |||
| + | <div style=" | ||
| + | <button class=" | ||
| + | Noch einmal versuchen | ||
| + | </ | ||
| + | <button class=" | ||
| + | Lösung anzeigen | ||
| + | </ | ||
| + | <button class=" | ||
| + | Nächste Frage | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div id=" | ||
| + | <div class=" | ||
| + | < | ||
| + | <div class=" | ||
| + | <div id=" | ||
| + | <button class=" | ||
| + | Neue Prüfung starten | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | // Musikdaten mit den ursprünglichen MP3-URLs | ||
| + | const notes = { | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | }; | ||
| + | |||
| + | const intervals = { | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | }; | ||
| + | |||
| + | // Quiz-Status | ||
| + | let currentQuestion = 0; | ||
| + | let questions = []; | ||
| + | let score = 0; | ||
| + | let currentAnswer = null; | ||
| + | let answered = false; | ||
| + | |||
| + | function selectAllIntervals() { | ||
| + | const checkboxes = document.querySelectorAll('# | ||
| + | checkboxes.forEach(cb => cb.checked = true); | ||
| + | } | ||
| + | |||
| + | function deselectAllIntervals() { | ||
| + | const checkboxes = document.querySelectorAll('# | ||
| + | checkboxes.forEach(cb => cb.checked = false); | ||
| + | } | ||
| + | |||
| + | function getSelectedIntervals() { | ||
| + | const checkboxes = document.querySelectorAll('# | ||
| + | return Array.from(checkboxes).map(cb => cb.value); | ||
| + | } | ||
| + | |||
| + | function getRandomNote() { | ||
| + | const noteKeys = Object.keys(notes); | ||
| + | return noteKeys[Math.floor(Math.random() * noteKeys.length)]; | ||
| + | } | ||
| + | |||
| + | function getNoteByName(noteName) { | ||
| + | return Object.keys(notes).find(key => key === noteName); | ||
| + | } | ||
| + | |||
| + | function generateQuestions() { | ||
| + | const selectedIntervals = getSelectedIntervals(); | ||
| + | const difficulty = document.querySelector(' | ||
| + | const quizMode = document.querySelector(' | ||
| + | | ||
| + | if (selectedIntervals.length === 0) { | ||
| + | alert(' | ||
| + | return false; | ||
| + | } | ||
| + | |||
| + | questions = []; | ||
| + | const baseNote = ' | ||
| + | |||
| + | for (let i = 0; i < 10; i++) { | ||
| + | const intervalType = selectedIntervals[Math.floor(Math.random() * selectedIntervals.length)]; | ||
| + | const interval = intervals[intervalType]; | ||
| + | | ||
| + | let startNote; | ||
| + | if (difficulty === ' | ||
| + | startNote = baseNote; | ||
| + | } else { | ||
| + | // Für fortgeschrittenen Modus: zufälligen Startton wählen, der das Intervall ermöglicht | ||
| + | const noteKeys = Object.keys(notes); | ||
| + | const maxStartIndex = noteKeys.length - 1 - Math.ceil(interval.semitones / 12) * 12; | ||
| + | startNote = noteKeys[Math.floor(Math.random() * Math.max(1, maxStartIndex))]; | ||
| + | } | ||
| + | |||
| + | const startSemitones = notes[startNote].semitones; | ||
| + | let targetSemitones = startSemitones + interval.semitones; | ||
| + | | ||
| + | // Zielnote finden | ||
| + | const targetNote = Object.keys(notes).find(key => notes[key].semitones === targetSemitones); | ||
| + | | ||
| + | if (targetNote) { | ||
| + | const question = { | ||
| + | intervalType: | ||
| + | interval: interval, | ||
| + | startNote: startNote, | ||
| + | targetNote: targetNote, | ||
| + | quizMode: quizMode | ||
| + | }; | ||
| + | |||
| + | if (quizMode === ' | ||
| + | question.wrongAnswers = generateWrongAnswers(targetNote); | ||
| + | } | ||
| + | |||
| + | questions.push(question); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | return questions.length === 10; | ||
| + | } | ||
| + | |||
| + | function generateWrongAnswers(correctNote) { | ||
| + | const noteKeys = Object.keys(notes); | ||
| + | const wrongAnswers = []; | ||
| + | const correctIndex = noteKeys.indexOf(correctNote); | ||
| + | | ||
| + | while (wrongAnswers.length < 4) { | ||
| + | const randomIndex = Math.floor(Math.random() * noteKeys.length); | ||
| + | const randomNote = noteKeys[randomIndex]; | ||
| + | if (randomNote !== correctNote && !wrongAnswers.includes(randomNote)) { | ||
| + | wrongAnswers.push(randomNote); | ||
| + | } | ||
| + | } | ||
| + | | ||
| + | return wrongAnswers; | ||
| + | } | ||
| + | |||
| + | function startQuiz() { | ||
| + | if (!generateQuestions()) { | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | currentQuestion = 0; | ||
| + | score = 0; | ||
| + | | ||
| + | document.getElementById(' | ||
| + | document.getElementById(' | ||
| + | | ||
| + | showQuestion(); | ||
| + | } | ||
| + | |||
| + | function showQuestion() { | ||
| + | answered = false; | ||
| + | const question = questions[currentQuestion]; | ||
| + | | ||
| + | document.getElementById(' | ||
| + | document.getElementById(' | ||
| + | | ||
| + | const questionContent = document.getElementById(' | ||
| + | | ||
| + | if (question.quizMode === ' | ||
| + | const selectedIntervals = getSelectedIntervals(); | ||
| + | questionContent.innerHTML = ` | ||
| + | <h3 style=" | ||
| + | <div class=" | ||
| + | ${selectedIntervals.map(intervalType => | ||
| + | `<button class=" | ||
| + | ).join('' | ||
| + | </ | ||
| + | `; | ||
| + | } else { | ||
| + | const allAnswers = [question.targetNote, | ||
| + | shuffleArray(allAnswers); | ||
| + | | ||
| + | questionContent.innerHTML = ` | ||
| + | <h3 style=" | ||
| + | <h3 style=" | ||
| + | <div class=" | ||
| + | ${allAnswers.map(note => | ||
| + | `<button class=" | ||
| + | ).join('' | ||
| + | </ | ||
| + | `; | ||
| + | } | ||
| + | | ||
| + | document.getElementById(' | ||
| + | document.getElementById(' | ||
| + | document.getElementById(' | ||
| + | } | ||
| + | |||
| + | function shuffleArray(array) { | ||
| + | for (let i = array.length - 1; i > 0; i--) { | ||
| + | const j = Math.floor(Math.random() * (i + 1)); | ||
| + | [array[i], array[j]] = [array[j], array[i]]; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | function playInterval() { | ||
| + | const question = questions[currentQuestion]; | ||
| + | const playback = document.querySelector(' | ||
| + | | ||
| + | playIntervalNotes(question.startNote, | ||
| + | } | ||
| + | |||
| + | function playIntervalNotes(startNote, | ||
| + | if (playback === ' | ||
| + | // Beide Töne exakt gleichzeitig mit Promise.all | ||
| + | const audio1 = new Audio(notes[startNote].url); | ||
| + | const audio2 = new Audio(notes[targetNote].url); | ||
| + | | ||
| + | // Sicherstellen, | ||
| + | Promise.all([ | ||
| + | new Promise(resolve => { | ||
| + | audio1.addEventListener(' | ||
| + | audio1.load(); | ||
| + | }), | ||
| + | new Promise(resolve => { | ||
| + | audio2.addEventListener(' | ||
| + | audio2.load(); | ||
| + | }) | ||
| + | ]).then(() => { | ||
| + | // Exakt gleichzeitig starten | ||
| + | audio1.currentTime = 0; | ||
| + | audio2.currentTime = 0; | ||
| + | audio1.play().catch(e => console.log(' | ||
| + | audio2.play().catch(e => console.log(' | ||
| + | }).catch(e => { | ||
| + | console.log(' | ||
| + | // Fallback: einfaches gleichzeitiges Abspielen | ||
| + | playNote(startNote); | ||
| + | playNote(targetNote); | ||
| + | }); | ||
| + | } else if (playback === ' | ||
| + | playNote(startNote); | ||
| + | setTimeout(() => playNote(targetNote), | ||
| + | } else if (playback === ' | ||
| + | playNote(targetNote); | ||
| + | setTimeout(() => playNote(startNote), | ||
| + | } | ||
| + | } | ||
| + | |||
| + | function playNote(noteName) { | ||
| + | const audio = new Audio(notes[noteName].url); | ||
| + | audio.play().catch(e => console.log(' | ||
| + | return audio; | ||
| + | } | ||
| + | |||
| + | function selectAnswer(answer) { | ||
| + | if (answered) return; | ||
| + | | ||
| + | answered = true; | ||
| + | currentAnswer = answer; | ||
| + | | ||
| + | const question = questions[currentQuestion]; | ||
| + | let correctAnswer; | ||
| + | | ||
| + | if (question.quizMode === ' | ||
| + | correctAnswer = question.intervalType; | ||
| + | } else { | ||
| + | correctAnswer = question.targetNote; | ||
| + | } | ||
| + | | ||
| + | const answerButtons = document.querySelectorAll(' | ||
| + | | ||
| + | if (answer === correctAnswer) { | ||
| + | // Richtige Antwort | ||
| + | score++; | ||
| + | answerButtons.forEach(btn => { | ||
| + | if (btn.textContent === (question.quizMode === ' | ||
| + | intervals[answer].name : | ||
| + | notes[answer].german)) { | ||
| + | btn.classList.add(' | ||
| + | } | ||
| + | }); | ||
| + | | ||
| + | setTimeout(() => { | ||
| + | nextQuestion(); | ||
| + | }, 1500); | ||
| + | } else { | ||
| + | // Falsche Antwort - Button rot markieren | ||
| + | answerButtons.forEach(btn => { | ||
| + | if (btn.textContent === (question.quizMode === ' | ||
| + | intervals[answer].name : | ||
| + | notes[answer].german)) { | ||
| + | btn.classList.add(' | ||
| + | } | ||
| + | }); | ||
| + | | ||
| + | // Optionen nach falscher Antwort anzeigen | ||
| + | document.getElementById(' | ||
| + | document.getElementById(' | ||
| + | } | ||
| + | } | ||
| + | |||
| + | function retryAnswer() { | ||
| + | // Reset für neuen Versuch | ||
| + | answered = false; | ||
| + | currentAnswer = null; | ||
| + | | ||
| + | // Alle Button-Markierungen entfernen | ||
| + | const answerButtons = document.querySelectorAll(' | ||
| + | answerButtons.forEach(btn => { | ||
| + | btn.classList.remove(' | ||
| + | }); | ||
| + | | ||
| + | // Buttons wieder verstecken | ||
| + | document.getElementById(' | ||
| + | document.getElementById(' | ||
| + | } | ||
| + | |||
| + | function showCorrectAnswer() { | ||
| + | const question = questions[currentQuestion]; | ||
| + | let correctAnswer; | ||
| + | | ||
| + | if (question.quizMode === ' | ||
| + | correctAnswer = question.intervalType; | ||
| + | } else { | ||
| + | correctAnswer = question.targetNote; | ||
| + | } | ||
| + | | ||
| + | const answerButtons = document.querySelectorAll(' | ||
| + | answerButtons.forEach(btn => { | ||
| + | if (btn.textContent === (question.quizMode === ' | ||
| + | intervals[correctAnswer].name : | ||
| + | notes[correctAnswer].german)) { | ||
| + | btn.classList.add(' | ||
| + | } | ||
| + | }); | ||
| + | | ||
| + | document.getElementById(' | ||
| + | document.getElementById(' | ||
| + | document.getElementById(' | ||
| + | } | ||
| + | |||
| + | function nextQuestion() { | ||
| + | currentQuestion++; | ||
| + | | ||
| + | if (currentQuestion < 10) { | ||
| + | showQuestion(); | ||
| + | } else { | ||
| + | showResults(); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | function showResults() { | ||
| + | document.getElementById(' | ||
| + | document.getElementById(' | ||
| + | | ||
| + | const percentage = Math.round((score / 10) * 100); | ||
| + | document.getElementById(' | ||
| + | | ||
| + | let message; | ||
| + | if (percentage >= 90) { | ||
| + | message = " | ||
| + | } else if (percentage >= 70) { | ||
| + | message = "Sehr gut! Mit etwas mehr Übung werden Sie noch besser! 🎶"; | ||
| + | } else if (percentage >= 50) { | ||
| + | message = "Nicht schlecht! Weiter üben lohnt sich! 🎤"; | ||
| + | } else { | ||
| + | message = "Noch viel Raum für Verbesserung. Übung macht den Meister! 🎼"; | ||
| + | } | ||
| + | | ||
| + | document.getElementById(' | ||
| + | } | ||
| + | |||
| + | function resetQuiz() { | ||
| + | document.getElementById(' | ||
| + | document.getElementById(' | ||
| + | | ||
| + | // Reset all form values | ||
| + | currentQuestion = 0; | ||
| + | score = 0; | ||
| + | questions = []; | ||
| + | currentAnswer = null; | ||
| + | answered = false; | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
