Skip to content

Commit

Permalink
layout.js: when key "F" is pressed, focus to search field
Browse files Browse the repository at this point in the history
  • Loading branch information
paveljanda committed Mar 8, 2019
1 parent 179b711 commit 76b4a75
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions assets/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ var onHashChangeRouter = function() {

window.addEventListener("hashchange", onHashChangeRouter);

var input = document.getElementById("search-input");
var searchInput = document.getElementById("search-input");

input.addEventListener(
searchInput.addEventListener(
"keyup",
function() {
var phrase = this.value.toLowerCase();
Expand Down Expand Up @@ -118,3 +118,13 @@ input.addEventListener(
}
}
);

document.addEventListener(
"keyup",
function(e) {
if (e.keyCode === 70) {
searchInput.focus();
}
},
false
);

0 comments on commit 76b4a75

Please sign in to comment.