Skip to content

Commit

Permalink
web: focus on searchbox for '/' keypress
Browse files Browse the repository at this point in the history
Change-Id: Idd9b88bac4371438e289bce8d6072e61381db9d0
  • Loading branch information
hanwen committed Apr 6, 2020
1 parent 77beb0f commit 983e877
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions web/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ var TemplateText = map[string]string{
</div>
</div>
</nav>
<script>
document.onkeydown=function(e){
var e = e || window.event;
if (e.key == "/") {
document.getElementById("navsearchbox").focus();
return false;
}
};
</script>
`,
// search box for the entry page.
"search": `
Expand Down

0 comments on commit 983e877

Please sign in to comment.