diff -r 346c88efed21 -r 5e2f62d02dcd wp/wp-content/themes/twentyfifteen/js/keyboard-image-navigation.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wp/wp-content/themes/twentyfifteen/js/keyboard-image-navigation.js Tue Jun 09 03:35:32 2015 +0200 @@ -0,0 +1,22 @@ +/** + * Twenty Fifteen keyboard support for image navigation. + */ + +( function( $ ) { + $( document ).on( 'keydown.twentyfifteen', function( e ) { + var url = false; + + // Left arrow key code. + if ( e.which === 37 ) { + url = $( '.nav-previous a' ).attr( 'href' ); + + // Right arrow key code. + } else if ( e.which === 39 ) { + url = $( '.nav-next a' ).attr( 'href' ); + } + + if ( url && ( ! $( 'textarea, input' ).is( ':focus' ) ) ) { + window.location = url; + } + } ); +} )( jQuery );