From e9e8b4239e799fee39c6c662dd0f3fe07f73ae91 Mon Sep 17 00:00:00 2001 From: "Istratov D. S" Date: Wed, 30 Dec 2015 16:09:48 +0300 Subject: [PATCH 1/2] add navigation by keyboard using alt + left/right arrows --- src/theme/book.js | 17 +++++++++++++++++ src/theme/index.hbs | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/theme/book.js b/src/theme/book.js index 58d8eed9..776b4f16 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -23,6 +23,23 @@ $( document ).ready(function() { hljs.highlightBlock(block); }); + var KEY_CODES = { + PREVIOUS_KEY: 37, + NEXT_KEY: 39 + }; + + $(document).on('keydown', function (e) { + if (e.altKey === true) { + switch (e.keyCode) { + case KEY_CODES.NEXT_KEY: + window.location.href = $('.nav-chapters.next').attr('href'); + break; + case KEY_CODES.PREV_KEY: + window.location.href = $('.nav-chapters.previous').attr('href'); + break; + } + } + }); // Interesting DOM Elements var html = $("html"); diff --git a/src/theme/index.hbs b/src/theme/index.hbs index a8fdae1e..f84bdb87 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -84,13 +84,13 @@ {{#previous}} - {{/previous}} {{#next}} - {{/next}} From f47d420811220ea24702717547b165d28dff56ae Mon Sep 17 00:00:00 2001 From: Mathieu David Date: Wed, 30 Dec 2015 14:38:00 +0100 Subject: [PATCH 2/2] Revert "Add navigation by keyboard using alt + left/right arrows" --- src/theme/book.js | 17 ----------------- src/theme/index.hbs | 4 ++-- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/theme/book.js b/src/theme/book.js index 776b4f16..58d8eed9 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -23,23 +23,6 @@ $( document ).ready(function() { hljs.highlightBlock(block); }); - var KEY_CODES = { - PREVIOUS_KEY: 37, - NEXT_KEY: 39 - }; - - $(document).on('keydown', function (e) { - if (e.altKey === true) { - switch (e.keyCode) { - case KEY_CODES.NEXT_KEY: - window.location.href = $('.nav-chapters.next').attr('href'); - break; - case KEY_CODES.PREV_KEY: - window.location.href = $('.nav-chapters.previous').attr('href'); - break; - } - } - }); // Interesting DOM Elements var html = $("html"); diff --git a/src/theme/index.hbs b/src/theme/index.hbs index f84bdb87..a8fdae1e 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -84,13 +84,13 @@ {{#previous}} - {{/previous}} {{#next}} - {{/next}}