Routines
  
  
- Primero, escucha el audio: Presta atención a lo que se dice.
 
- Escribe los números en letras: Si escuchas algún número, asegúrate de escribirlo en letras.
 
- Escribe lo que escuchas y dale a “Submit”: Transcribe lo que escuchas en el campo de texto y presiona el botón “Submit”.
 
- Tres intentos incorrectos: Si tu respuesta es incorrecta tres veces, pasarás automáticamente a la siguiente pregunta.
 
- Al final, puedes ver todo el texto y escucharlo: Una vez que termines el quiz, podrás revisar todas las oraciones y escuchar los audios nuevamente.
 
¡Buena suerte con el quiz!
  🎧 Dictation Practice ✍️
  
  
  
  
    All Sentences
    
    
   
 
document.addEventListener(“DOMContentLoaded”, function () {
  const dictationData = [
    {
      sentence: “I am ten years old.”,
      image: “https://dimeloeningles.com/wp-content/uploads/2025/01/ten-yo.jpg”,
      audio: “https://dimeloeningles.com/wp-content/uploads/2025/01/ten-yo.mp3”,
    },
    {
      sentence: “my sister is twelve years old.”,
      image: “https://dimeloeningles.com/wp-content/uploads/2025/01/my-sisteris.jpg”,
      audio: “https://dimeloeningles.com/wp-content/uploads/2025/01/my-sister-is.mp3”,
    },
    {
      sentence: “My best friend is nine years old.”,
      image: “https://dimeloeningles.com/wp-content/uploads/2025/01/my-best-friend.jpg”,
      audio: “https://dimeloeningles.com/wp-content/uploads/2025/01/my-best-friend.mp3”,
    },
    {
      sentence: “My grandfather is seventy years old”,
      image: “https://dimeloeningles.com/wp-content/uploads/2025/01/my-grandpa1.jpg”,
      audio: “https://dimeloeningles.com/wp-content/uploads/2025/01/grandfather-is.mp3”,
    },
    {
      sentence: “My teacher is thirty five years old.”,
      image: “https://dimeloeningles.com/wp-content/uploads/2025/01/my-teacher.jpg”,
      audio: “https://dimeloeningles.com/wp-content/uploads/2025/01/teacher-is.mp3”,
    },
    {
      sentence: “My birthday is in July”,
      image: “https://dimeloeningles.com/wp-content/uploads/2025/01/my-birthday.jpg”,
      audio: “https://dimeloeningles.com/wp-content/uploads/2025/01/my-birthday-is.mp3”,
    },
    {
      sentence: “I am young but my parents are older.”,
      image: “https://dimeloeningles.com/wp-content/uploads/2025/01/young-older.jpg”,
      audio: “https://dimeloeningles.com/wp-content/uploads/2025/01/young-but.mp3”,
    },
  ];
  let currentIndex = 0;
  let attempts = 0;
  let currentAudio = null;
  const startButton = document.getElementById(“start-dictation”);
  const dictationContent = document.getElementById(“dictation-content”);
  const imageElement = document.getElementById(“dictation-image”);
  const answerInput = document.getElementById(“dictation-answer”);
  const submitButton = document.getElementById(“submit-answer”);
  const repeatAudioButton = document.getElementById(“repeat-audio”);
  const feedbackElement = document.getElementById(“feedback”);
  const reviewSection = document.getElementById(“final-review”);
  const reviewList = document.getElementById(“review-list”);
  const replayAllButton = document.getElementById(“replay-all”);
  startButton.addEventListener(“click”, () => {
    startButton.style.display = “none”;
    dictationContent.style.display = “block”;
    playAudio();
  });
  submitButton.addEventListener(“click”, () => {
    const userAnswer = answerInput.value.trim().toLowerCase().replace(/[^a-z0-9 ]/g, “”);
    const correctAnswer = dictationData[currentIndex].sentence.toLowerCase().replace(/[^a-z0-9 ]/g, “”);
    feedbackElement.textContent = “”;
    if (userAnswer === correctAnswer) {
      feedbackElement.textContent = “Correct!”;
      feedbackElement.className = “feedback correct”;
      nextSentence();
    } else {
      attempts++;
      feedbackElement.textContent = `Try again (${3 – attempts} attempts left)`;
      feedbackElement.className = “feedback incorrect”;
      if (attempts >= 3) {
        feedbackElement.textContent = `The correct answer is: “${dictationData[currentIndex].sentence}”`;
        nextSentence();
      }
    }
  });
  repeatAudioButton.addEventListener(“click”, () => {
    if (currentAudio) {
      currentAudio.play();
    }
  });
  function nextSentence() {
    attempts = 0;
    reviewList.innerHTML += `
${dictationData[currentIndex].sentence}`;
    currentIndex++;
    answerInput.value = “”;
    if (currentIndex < dictationData.length) {
      playAudio();
    } else {
      dictationContent.style.display = "none";
      reviewSection.style.display = "block";
    }
  }
  function playAudio() {
    const { image, audio } = dictationData[currentIndex];
    imageElement.src = image;
    currentAudio = new Audio(audio);
    currentAudio.play();
  }
  replayAllButton.addEventListener("click", () => {
    let index = 0;
    function playNextAudio() {
      if (index < dictationData.length) {
        const audioElement = new Audio(dictationData[index].audio);
        audioElement.play();
        audioElement.onended = () => {
          index++;
          playNextAudio();
        };
      }
    }
    playNextAudio();
  });
});