Skip to content

Commit

Permalink
Go to the root url after pressing escape
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Croak <dcroak@thoughtbot.com>
  • Loading branch information
Joe Ferris authored and Dan Croak committed Sep 24, 2009
1 parent d619c99 commit 4a1e57e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions templates/javascripts/slides.js
Expand Up @@ -69,16 +69,23 @@

var move = function(event) {
var DIRECTIONS = {
37: -1, // ARROW LEFT
39: 1, // ARROW RIGHT
32: 1, // SPACE BAR
13: 1, // RETURN
37: -1, // ARROW LEFT
39: 1, // ARROW RIGHT
32: 1, // SPACE BAR
13: 1, // RETURN
27: 'home', // ESCAPE
left: -1,
right: 1
}

if (dir = DIRECTIONS[event.which || event]) {
setIndex(getIndex() + dir);
if (dir == 'home') {
event.preventDefault();
event.stopPropagation();
location.href = '/';
} else {
setIndex(getIndex() + dir);
}
}
}

Expand All @@ -101,4 +108,4 @@
$('.notes').show();
}
});
})(jQuery);
})(jQuery);

0 comments on commit 4a1e57e

Please sign in to comment.