From 1213b8260ab4da97d465e7ef0e71fac2a2c20dbd Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Mon, 5 Mar 2012 19:27:26 +0100 Subject: [PATCH] Stop failing if there is no previous/next to go to --- mediagoblin/static/js/keyboard_navigation.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mediagoblin/static/js/keyboard_navigation.js b/mediagoblin/static/js/keyboard_navigation.js index 83d339ff..d4039a3c 100644 --- a/mediagoblin/static/js/keyboard_navigation.js +++ b/mediagoblin/static/js/keyboard_navigation.js @@ -19,10 +19,14 @@ $(document).keydown(function(event){ switch(event.which){ case 37: - window.location = $('.navigation_left').attr('href'); + if($('a.navigation_left').length) { + window.location = $('a.navigation_left').attr('href'); + } break; case 39: - window.location = $('.navigation_right').attr('href'); + if($('a.navigation_right').length) { + window.location = $('a.navigation_right').attr('href'); + } break; } }); -- 2.25.1