MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / createBox

Function createBox

assets/js/TextToSpeech.js:69–94  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

67
68// Create speech boxes
69function 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
96const message = new SpeechSynthesisUtterance();
97

Callers

nothing calls this directly

Calls 2

setTextMessageFunction · 0.85
speakTextFunction · 0.85

Tested by

no test coverage detected