36198-vm/assets/js/main.js
Flatlogic Bot 1b091db4ef v1
2025-11-24 11:37:10 +00:00

21 lines
796 B
JavaScript

document.addEventListener('DOMContentLoaded', () => {
const cards = document.querySelectorAll('.pecs-card');
const synth = window.speechSynthesis;
cards.forEach(card => {
card.addEventListener('click', () => {
// Remove active state from all other cards
cards.forEach(c => c.classList.remove('active'));
// Add active state to clicked card
card.classList.add('active');
const textToSpeak = card.querySelector('.card-title').textContent;
if (textToSpeak && synth) {
const utterance = new SpeechSynthesisUtterance(textToSpeak);
utterance.lang = 'pt-BR'; // Set language to Brazilian Portuguese
synth.speak(utterance);
}
});
});
});