summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--htdocs/static/js/navigation.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/htdocs/static/js/navigation.js b/htdocs/static/js/navigation.js
index 4919f8a..689eb30 100644
--- a/htdocs/static/js/navigation.js
+++ b/htdocs/static/js/navigation.js
@@ -2,6 +2,7 @@ var liSelected;
$(window).keydown(function(e) {
var li = $('#hostlist .list .thumbnail');
if (e.which === 40) {
+ // cursor down
if (liSelected) {
liSelected.removeClass('selected');
next = liSelected.next();
@@ -19,6 +20,7 @@ $(window).keydown(function(e) {
}
if (e.which === 38) {
+ // cursor up
if (liSelected) {
liSelected.removeClass('selected');
next = liSelected.prev();
@@ -36,9 +38,23 @@ $(window).keydown(function(e) {
}
if (e.which === 13) {
+ // enter
if (liSelected) {
window.location = liSelected.find('a').attr('href');
return false;
}
}
+
+ if (liSelected) {
+ liSelected.removeClass('selected');
+ liSelected = undefined;
+ }
+
+ if (e.which === 27) {
+ // esc
+ $('html').animate({scrollTop: 0}, 500);
+ return false;
+ }
+
+ $('input[type=search]').focus();
});