(item)
| 67 | |
| 68 | // Create speech boxes |
| 69 | function createBox(item) { |
| 70 | const box = document.createElement('div'); |
| 71 | |
| 72 | const { |
| 73 | image, |
| 74 | text |
| 75 | } = item; |
| 76 | |
| 77 | box.classList.add('box'); |
| 78 | |
| 79 | box.innerHTML = ` |
| 80 | <img src="${image}" alt="${text}" /> |
| 81 | <p class="info">${text}</p> |
| 82 | `; |
| 83 | |
| 84 | box.addEventListener('click', () => { |
| 85 | setTextMessage(text); |
| 86 | speakText(); |
| 87 | |
| 88 | // Add active effect |
| 89 | box.classList.add('active'); |
| 90 | setTimeout(() => box.classList.remove('active'), 800); |
| 91 | }); |
| 92 | |
| 93 | main.appendChild(box); |
| 94 | } |
| 95 | |
| 96 | const message = new SpeechSynthesisUtterance(); |
| 97 |
nothing calls this directly
no test coverage detected