From cde67c3a518bc1fcae873703de6ffa23bbc9007d Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 30 Nov 2025 10:56:49 -0500 Subject: [PATCH] Add left/right chapter navigation in book drilldown --- kjvstudy_org/templates/book.html | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/kjvstudy_org/templates/book.html b/kjvstudy_org/templates/book.html index 739efe3..05e805f 100644 --- a/kjvstudy_org/templates/book.html +++ b/kjvstudy_org/templates/book.html @@ -595,16 +595,24 @@ document.addEventListener('DOMContentLoaded', function() { } } - // Left arrow: Previous book - if (e.key === 'ArrowLeft' && currentBookIndex > 0) { + // Left arrow: Previous chapter in drilldown, otherwise previous book + if (e.key === 'ArrowLeft') { e.preventDefault(); - window.location.href = '/book/' + encodeURIComponent(bibleBooks[currentBookIndex - 1]); + if (inChapterDrilldown && selectedChapterIndex > 0) { + selectChapter(selectedChapterIndex - 1); + } else if (!inChapterDrilldown && currentBookIndex > 0) { + window.location.href = '/book/' + encodeURIComponent(bibleBooks[currentBookIndex - 1]); + } } - // Right arrow: Next book - if (e.key === 'ArrowRight' && currentBookIndex < bibleBooks.length - 1) { + // Right arrow: Next chapter in drilldown, otherwise next book + if (e.key === 'ArrowRight') { e.preventDefault(); - window.location.href = '/book/' + encodeURIComponent(bibleBooks[currentBookIndex + 1]); + if (inChapterDrilldown && selectedChapterIndex < chapterLinks.length - 1) { + selectChapter(selectedChapterIndex + 1); + } else if (!inChapterDrilldown && currentBookIndex < bibleBooks.length - 1) { + window.location.href = '/book/' + encodeURIComponent(bibleBooks[currentBookIndex + 1]); + } } // p: Download PDF