3 ms·
https://github.com/dannytatom/speak-it https://github.com/dannytatom/speak-it Right now it turns any text input into a speech input, but I might change that la
by dannytatom 16y ago
https://github.com/dannytatom/speak-it https://github.com/dannytatom/speak-it
Right now it turns any text input into a speech input, but I might change that later. Or, at least, have an option to disable it on certain sites (have never created a chrome extension, no clue how long that'd take).
- seancron 16y agoShucks, you beat me to it, and with a better name too. Congratulations for being quick on the draw. I'm going to fork it and help work on it.
- dannytatom 16y agoHeh, I had nothing better to do on a Sunday afternoon. :P
- Sephr 16y ago<input x-webkit-speech> works for me, so you may want to just apply the attribute to all input elements regardless of type (and textarea elements for future support). I suspect that support for voice input on input types such as date may also be added eventually. Edit: More at the HTML5 speech input proposal at https://docs.google.com/View?id=dcfg79pz_5dhnp23f5#y1f9 https://docs.google.com/View?id=dcfg79pz_5dhnp23f5#y1f9 . It's apparent from this that you should also use the attribute on select elements too. I also can get x-webkit-speech working in current stable Chrome with an input type of speech.
- dannytatom 16y agoThanks for the link, I've went ahead and made it work on any input field and text area that isn't in the not allowed list.
- Sephr 16y agoDon't forget select elements too. An easier way for you to do your whole extension could be to use an XPath expression or `document.querySelectorAll('textarea, select, input:not([type="' + notAllowed.join('"]):not([type="') + '"])')` (results in `textarea, select, input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="image"]):not([type="reset"]):not([type="button"]))`). Also, may I ask why are you abstracting Array.indexOf away and extending the Array prototype with a non-standard method for such a simple problem?
- dannytatom 16y agoAlso, may I ask why are you abstracting Array.indexOf away and extending the Array prototype with a non-standard method for such a simple problem? Mostly a personal preference, I guess, haven't looked into the downsides of extending prototypes. Anywho, I'm fairly new at JS outside of jQuery, so thanks for your input and critiques. I'll look into the rest when I get back from dinner.
- evanrmurphy 16y agoYour line of code is so long it's causing this Hacker News comments page to have horizontal scrolling! I've never seen that before. :) In case you didn't know, HN will format code if you prefix it with two spaces like this: document.querySelectorAll('textarea, select, input:not([type="' + notAllowed.join('"]):not([type="') + '"])') (results in `textarea, select, input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="image"]):not([type="reset"]):not([type="button"]))`) It can preserve indentation too: document.querySelectorAll( 'textarea, select, input:not([type="' + notAllowed.join('"]):not([type="') + '"])')