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) { KeyboardNavigation.add_events = function(hrefs) {
Event.observe(document, 'keyup', function(e) { Event.observe(document, 'keyup', function(e) {
var prop_to_use = null; if (!(e.ctrlKey || e.altKey || e.metaKey)) {
switch (e.keyCode) { var prop_to_use = null;
case 37: switch (e.keyCode) {
prop_to_use = (e.shiftKey) ? "first" : "previous"; case 37:
break; prop_to_use = (e.shiftKey) ? "first" : "previous";
case 39: break;
prop_to_use = (e.shiftKey) ? "last" : "next"; case 39:
break; 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 (prop_to_use) {
if (hrefs[prop_to_use]) { document.location.href = hrefs[prop_to_use]; }
}
} }
}, true); }, true);

View File

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

View File

@ -3,7 +3,7 @@ Contributors: johncoswell
Tags: comicpress, webcomics, posts, plugin, navigation Tags: comicpress, webcomics, posts, plugin, navigation
Requires at least: 2.6.3 Requires at least: 2.6.3
Tested up to: 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. Keyboard Navigation easily adds JavaScript-based keyboard navigation to a WordPress site.