From e8c2b483d0ac3540dad9374ee00a586db321e016 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 23 May 2015 16:48:45 -0400 Subject: 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. --- peniquitous.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 peniquitous.js 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 + }); + } +})(); -- cgit v1.2.3