mirror of
https://github.com/acedanger/pokemon.git
synced 2025-12-05 22:50:13 -08:00
feat: implement voice search overlay with microphone icon
This commit is contained in:
11
index.js
11
index.js
@@ -177,6 +177,17 @@ pokemonNameInput.addEventListener("keypress", (event) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Show a dimmed overlay with a large microphone icon when the voice search button is clicked
|
||||
voiceSearchButton.addEventListener("click", () => {
|
||||
const voiceOverlay = document.getElementById("voiceOverlay");
|
||||
voiceOverlay.classList.remove("hidden");
|
||||
|
||||
// Simulate listening for 3 seconds, then hide the overlay
|
||||
setTimeout(() => {
|
||||
voiceOverlay.classList.add("hidden");
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
const SpeechRecognition =
|
||||
window.SpeechRecognition || window.webkitSpeechRecognition;
|
||||
let recognition;
|
||||
|
||||
Reference in New Issue
Block a user