Skip to content

Instantly share code, notes, and snippets.

@DaveVoyles
Created March 10, 2015 01:29
Show Gist options
  • Save DaveVoyles/0d4e23790b49a468a52d to your computer and use it in GitHub Desktop.
Save DaveVoyles/0d4e23790b49a468a52d to your computer and use it in GitHub Desktop.
main.js polymer
(function (pokemonApp) {
// Grab inputs and button for speech-to-text
var form = document.querySelector('#player-form'),
input = document.querySelector('#player-input'),
playerElement = document.querySelector('#player-element'),
xPokemon = document.querySelector('#x-pokemon'),
btnChangeAccent = document.querySelector('#btn-change-accent'),
radialButtonTemplate = document.querySelector("#radial-button-template"),
playerAccent = playerElement.getAttribute("accent");
// Take text from input & set it as the text that the speaker will say.
// Set the name of the pokemon, which angular will then grab from the pokemon DB
input.addEventListener('input', function (e) {
playerElement.setAttribute('text', input.value);
xPokemon.name = input.value;
});
// Say the text when button is pressed
form.addEventListener('submit', function (e) {
e.preventDefault();
playerElement.speak();
var btn = document.querySelector("x-radial-buttons");
btn.getFirstElement();
});
}(window.pokemonApp = window.pokemonApp || {}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment