diff options
author | Teddy Wing | 2015-05-23 16:48:45 -0400 |
---|---|---|
committer | Teddy Wing | 2015-05-23 16:48:45 -0400 |
commit | e8c2b483d0ac3540dad9374ee00a586db321e016 (patch) | |
tree | ed69b89b38d8dc3fc1ece4aa882f7a26f2f18795 | |
parent | 3a09e4dd09a6af3b228fcda68aa0709626b5ee51 (diff) | |
download | Peniquitous-e8c2b483d0ac3540dad9374ee00a586db321e016.tar.bz2 |
Add peniquitous.js, bind to input focus (WIP)
Work in progress.
Get all inputs on the page. Bind a callback to their focus event. The
intention is that when the input is focused, I attach a handler to
listen for Ctrl-N/P presses.
Now that I'm writing this and thinking about it though, I might as well
just bind the Ctrl-N/P listeners to all inputs to begin with an be done
with it. Kind of a brute-force way of dealing with it but then I
wouldn't have to keep track of whether or not I've bound those listeners
to an input that was already focused previously.
-rw-r--r-- | peniquitous.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/peniquitous.js b/peniquitous.js new file mode 100644 index 0000000..2c01232 --- /dev/null +++ b/peniquitous.js @@ -0,0 +1,15 @@ +(function() { + // Additional types: + // * email + // * number + // * search + // * tel + // * url + var all_inputs = document.querySelectorAll('input[type="text"]'); + + for (var i = 0; i < all_inputs.length; i++) { + all_inputs[i].addEventListener('focus', function() { + // Bind keyboard event + }); + } +})(); |