Make keypresses focus the input field

This commit is contained in:
Neale Pickett 2014-11-01 09:51:48 -06:00
parent 99471345d3
commit b3dee85564
1 changed files with 5 additions and 0 deletions

View File

@ -75,6 +75,10 @@ function hideChannels(oEvent) {
} }
} }
function keyPress(oEvent) {
document.getElementById("input").focus();
}
function restore(items) { function restore(items) {
storedConnections = items["connections"]; storedConnections = items["connections"];
@ -89,6 +93,7 @@ function init() {
chrome.storage.sync.get(["connections"], restore); chrome.storage.sync.get(["connections"], restore);
document.getElementById("input").addEventListener("change", handleInput); document.getElementById("input").addEventListener("change", handleInput);
document.getElementById("hide-channels").addEventListener("click", hideChannels); document.getElementById("hide-channels").addEventListener("click", hideChannels);
window.addEventListener("keypress", keyPress);
templates = document.getElementById("templates"); templates = document.getElementById("templates");
rooms = document.getElementById("rooms-container").getElementsByClassName("rooms")[0]; rooms = document.getElementById("rooms-container").getElementsByClassName("rooms")[0];