Skip to content

Commit

Permalink
jump to search when tab is pressed
Browse files Browse the repository at this point in the history
by pressing tab, the search square opens and the input field gets focus
  • Loading branch information
etacarinaea committed Jul 17, 2014
1 parent e08522d commit 556e3b3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 3 additions & 2 deletions startpage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@
<div class="sqr">
<span>anime</span>
<div class="content">
<a href="http://kissanime.com/">kissanime</a><br>
<a href="http://horriblesubs.info/">horriblesubs</a><br>
<a href="http://myanimelist.net/">myanimelist</a><br>
<a href="http://anichart.net/">anichart</a><br>
<a href="http://anidb.net/">anidb</a><br>
<a href="http://nyaa.se/">nyaa.se</a><br>
<a href="http://bakabt.me/‎">bakabt</a>
</div>
</div>
<div class="sqr">
<div class="sqr" id="search_sqr">
<span>search</span>
<div class="content">
<input id="searchinput" type="text" autocomplete="off">
Expand Down
15 changes: 15 additions & 0 deletions startpage/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ window.onload = function(){
}
}
});

document.addEventListener("keypress", function search(a){
var key = a.keyCode;
if(key == 9){
var search_sqr = document.getElementById("search_sqr")
search_sqr.style.height=300+37+"px";
search_sqr.style.borderTop= cfg[9] + " solid " + cfg[8];
search_sqr.style.borderBottom= cfg[9] + " solid " + cfg[8];
document.getElementById("searchinput").focus();
}

if([9].indexOf(key) > -1) {
a.preventDefault();
}
});
}

document.addEventListener("DOMContentLoaded", function() {
Expand Down

0 comments on commit 556e3b3

Please sign in to comment.