diff --git a/lib/legacy.js b/lib/legacy.js index e82353c..87fb2ff 100644 --- a/lib/legacy.js +++ b/lib/legacy.js @@ -51,10 +51,9 @@ $(function() { const LEFTARROW = 37; const RIGHTARROW = 39; - const dirs = {LEFTARROW:-1, RIGHTARROW:+1}; $(document).on("keydown", function(event) { - const direction = dirs[event.which]; + const direction = event.which == LEFTARROW ? -1 : event.which == RIGHTARROW ? 1 : null if (direction && !$(event.target).is(":input")) { const pages = $('.page'); const newIndex = pages.index($('.active')) + direction; diff --git a/lib/pageHandler.js b/lib/pageHandler.js index 4e8b125..172ddb9 100644 --- a/lib/pageHandler.js +++ b/lib/pageHandler.js @@ -107,6 +107,7 @@ pageHandler.get = function({whenGotten,whenNotGotten,pageInformation} ) { if (localPage = pageFromLocalStorage(pageInformation.slug)) { if (pageInformation.rev) { localPage = revision.create(pageInformation.rev, localPage); } whenGotten(newPage( localPage, 'local' )); + return; } }