Skip to content

Commit

Permalink
More mindless refactoring.
Browse files Browse the repository at this point in the history
Missed this one…
  • Loading branch information
Michael Sisk committed Dec 3, 2013
1 parent 5699986 commit 0c22890
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions -/js/shortcuts.js
Expand Up @@ -3,25 +3,25 @@ jQuery( function( $ ) {
function webcomic_shortcut( target ) {
var $e;

if ( $( '[data-webcomic-shortcuts]' ).length ) {
$e = $( '[data-webcomic-shortcuts]:first ' + target + '[href]:first' );
if ( $( "[data-webcomic-shortcuts]" ).length ) {
$e = $( "[data-webcomic-shortcuts]:first " + target + "[href]:first" );
} else {
$e = $( target + '[href]:first' );
$e = $( target + "[href]:first" );
}

if ( $e.length ) {
if ( $.fn.webcomicDynamicNavigation && $e.closest( '[data-webcomic-container]' ).length ) {
$e.trigger( 'click' );
if ( $.fn.webcomicDynamicNavigation && $e.closest( "[data-webcomic-container]" ).length ) {
$e.trigger( "click" );
} else {
window.location.href = $e.attr( 'href' );
window.location.href = $e.attr( "href" );
}
}
}

$.hotkeys.add( 'right', function() { webcomic_shortcut( '.next-webcomic-link' ); } );
$.hotkeys.add( 'left', function() { webcomic_shortcut( '.previous-webcomic-link' ); } );
$.hotkeys.add( 'shift+right', function() { webcomic_shortcut( '.last-webcomic-link' ); } );
$.hotkeys.add( 'shift+left', function() { webcomic_shortcut( '.first-webcomic-link' ); } );
$.hotkeys.add( 'shift+up', function() { webcomic_shortcut( '.purchase-webcomic-link' ); } );
$.hotkeys.add( 'shift+down', function() { webcomic_shortcut( '.random-webcomic-link' ); } );
$.hotkeys.add( "right", function() { webcomic_shortcut( ".next-webcomic-link" ); } );
$.hotkeys.add( "left", function() { webcomic_shortcut( ".previous-webcomic-link" ); } );
$.hotkeys.add( "shift+right", function() { webcomic_shortcut( ".last-webcomic-link" ); } );
$.hotkeys.add( "shift+left", function() { webcomic_shortcut( ".first-webcomic-link" ); } );
$.hotkeys.add( "shift+up", function() { webcomic_shortcut( ".purchase-webcomic-link" ); } );
$.hotkeys.add( "shift+down", function() { webcomic_shortcut( ".random-webcomic-link" ); } );
} );

0 comments on commit 0c22890

Please sign in to comment.