aboutsummaryrefslogtreecommitdiff
path: root/web/public
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2014-09-14 18:25:57 +0200
committerJochen Topf <jochen@topf.org>2014-09-14 18:25:57 +0200
commitea7fe49446f06fdd810b153fe7bbb871959700b4 (patch)
tree2c9cf895168fd391c3cdd99213c38383d370a31e /web/public
parentca53117231f1f093c1f413aaa37fc0c15643a73a (diff)
downloadtaginfo-ea7fe49446f06fdd810b153fe7bbb871959700b4.tar
taginfo-ea7fe49446f06fdd810b153fe7bbb871959700b4.tar.gz
Hopefully make keyboard shortcuts behave better.
Use keypress instead of keyup events where possible. This might help with the problem sometimes seen that hitting CTRL-R will load the "relations" page, because it uses the "r" key as shortcut.
Diffstat (limited to 'web/public')
-rw-r--r--web/public/js/taginfo.js76
1 files changed, 43 insertions, 33 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js
index f859c86..242ee62 100644
--- a/web/public/js/taginfo.js
+++ b/web/public/js/taginfo.js
@@ -772,7 +772,7 @@ jQuery(document).ready(function() {
}
});
- jQuery(document).bind('keyup', function(event) {
+ jQuery(document).bind('keypress', function(event) {
if (event.ctrlKey || event.altKey || event.metaKey) {
return;
}
@@ -784,59 +784,69 @@ jQuery(document).ready(function() {
case 63: // ?
open_help();
break;
- case 67: // c
+ case 99: // c
window.location = comparison_list_url(get_comparison_list());
break;
- case 70: // f
+ case 102: // f
jQuery('input.qsbox').focus();
break;
- case 72: // h
+ case 104: // h
window.location = '/';
break;
- case 75: // k
+ case 107: // k
window.location = '/keys';
break;
- case 80: // p
+ case 112: // p
window.location = '/projects';
break;
- case 82: // r
+ case 114: // r
window.location = '/relations';
break;
- case 83: // s
+ case 115: // s
jQuery('input#search').focus();
break;
- case 84: // t
+ case 116: // t
window.location = '/tags';
break;
- case 36: // home
- jQuery('div.pFirst:visible').click();
- break;
- case 33: // page up
- jQuery('div.pPrev:visible').click();
- break;
- case 34: // page down
- jQuery('div.pNext:visible').click();
- break;
- case 35: // end
- jQuery('div.pLast:visible').click();
- break;
- case 37: // arrow left
- up();
- break;
- case 38: // arrow up
- table_up();
- break;
- case 39: // arrow right
- table_right();
- break;
- case 40: // arrow down
- table_down();
- break;
}
}
}
});
+ jQuery(document).bind('keyup', function(event) {
+ if (event.ctrlKey || event.altKey || event.metaKey) {
+ return;
+ }
+ if (event.target == document.body) {
+ switch (event.which) {
+ case 36: // home
+ jQuery('div.pFirst:visible').click();
+ break;
+ case 33: // page up
+ jQuery('div.pPrev:visible').click();
+ break;
+ case 34: // page down
+ jQuery('div.pNext:visible').click();
+ break;
+ case 35: // end
+ jQuery('div.pLast:visible').click();
+ break;
+ case 37: // arrow left
+ up();
+ break;
+ case 38: // arrow up
+ table_up();
+ break;
+ case 39: // arrow right
+ table_right();
+ break;
+ case 40: // arrow down
+ table_down();
+ break;
+ }
+ }
+ });
+
jQuery(document).bind('keydown', function(event) {
if (event.target == document.body && event.which == 9) {
jQuery('input#search').focus();