From a69a0a6ea2f790e16216ab0dabbec13fda143a2d Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sat, 13 Dec 2008 16:03:25 -0500 Subject: [PATCH] ignore any key but shift in kb nav, can mess up browser navigation --- keyboard_navigation.js | 24 +++++++++++++----------- keyboard_navigation.php | 2 +- readme.txt | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/keyboard_navigation.js b/keyboard_navigation.js index 4f0103b..f4cd059 100644 --- a/keyboard_navigation.js +++ b/keyboard_navigation.js @@ -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); diff --git a/keyboard_navigation.php b/keyboard_navigation.php index 4c3283b..080930e 100644 --- a/keyboard_navigation.php +++ b/keyboard_navigation.php @@ -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/ diff --git a/readme.txt b/readme.txt index a3da976..56f7ac9 100644 --- a/readme.txt +++ b/readme.txt @@ -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.