ignore any key but shift in kb nav, can mess up browser navigation

This commit is contained in:
John Bintz 2008-12-13 16:03:25 -05:00
parent fff8636a25
commit a69a0a6ea2
3 changed files with 15 additions and 13 deletions

View File

@ -53,17 +53,19 @@ KeyboardNavigation.get_hrefs = function(fields, admin_mode) {
KeyboardNavigation.add_events = function(hrefs) {
Event.observe(document, 'keyup', function(e) {
var prop_to_use = null;
switch (e.keyCode) {
case 37:
prop_to_use = (e.shiftKey) ? "first" : "previous";
break;
case 39:
prop_to_use = (e.shiftKey) ? "last" : "next";
break;
}
if (prop_to_use) {
if (hrefs[prop_to_use]) { document.location.href = hrefs[prop_to_use]; }
if (!(e.ctrlKey || e.altKey || e.metaKey)) {
var prop_to_use = null;
switch (e.keyCode) {
case 37:
prop_to_use = (e.shiftKey) ? "first" : "previous";
break;
case 39:
prop_to_use = (e.shiftKey) ? "last" : "next";
break;
}
if (prop_to_use) {
if (hrefs[prop_to_use]) { document.location.href = hrefs[prop_to_use]; }
}
}
}, true);

View File

@ -3,7 +3,7 @@
Plugin Name: Keyboard Navigation
Plugin URI: http://www.coswellproductions.com/wordpress/keyboard-navigation/
Description: Attach keyboard navigation to blog entries.
Version: 0.2
Version: 0.3
Author: John Bintz
Author URI: http://www.coswellproductions.org/wordpress/

View File

@ -3,7 +3,7 @@ Contributors: johncoswell
Tags: comicpress, webcomics, posts, plugin, navigation
Requires at least: 2.6.3
Tested up to: 2.6.3
Stable tag: 0.2
Stable tag: 0.3
Keyboard Navigation easily adds JavaScript-based keyboard navigation to a WordPress site.