diff --git a/kjvstudy_org/templates/chapter.html b/kjvstudy_org/templates/chapter.html index cf9bbc7..b8dfe34 100644 --- a/kjvstudy_org/templates/chapter.html +++ b/kjvstudy_org/templates/chapter.html @@ -480,23 +480,35 @@ document.addEventListener('DOMContentLoaded', function() { if (link) window.location.href = link.href; } - // Left arrow: Previous chapter - if (e.key === 'ArrowLeft') { + // Left arrow or h: Previous chapter (when no verse selected, or at first verse) + if (e.key === 'ArrowLeft' || e.key === 'h') { + e.preventDefault(); const prevBtn = document.getElementById('prev-chapter'); if (prevBtn) { - e.preventDefault(); window.location.href = prevBtn.href; + } else { + // Go back to book page + window.location.href = '/book/{{ book }}'; } } - // Right arrow: Next chapter - if (e.key === 'ArrowRight') { + // Right arrow or l: Next chapter + if (e.key === 'ArrowRight' || e.key === 'l') { const nextBtn = document.getElementById('next-chapter'); if (nextBtn) { e.preventDefault(); window.location.href = nextBtn.href; } } + + // Escape: Clear selection + if (e.key === 'Escape') { + e.preventDefault(); + if (selectedVerseIndex >= 0 && selectedVerseIndex < verses.length) { + verses[selectedVerseIndex].classList.remove('selected'); + } + selectedVerseIndex = -1; + } }); // Click to select verse diff --git a/kjvstudy_org/templates/parable_detail.html b/kjvstudy_org/templates/parable_detail.html index d2b8cb7..7321ee8 100644 --- a/kjvstudy_org/templates/parable_detail.html +++ b/kjvstudy_org/templates/parable_detail.html @@ -151,6 +151,13 @@ e.preventDefault(); const link = verses[selectedIndex].querySelector('.verse-ref a'); if (link) window.location.href = link.href; + } else if (e.key === 'Escape') { + e.preventDefault(); + if (selectedIndex >= 0 && selectedIndex < verses.length) { + verses[selectedIndex].style.outline = ''; + verses[selectedIndex].style.outlineOffset = ''; + } + selectedIndex = -1; } }); })(); diff --git a/kjvstudy_org/templates/study_guide_detail.html b/kjvstudy_org/templates/study_guide_detail.html index 97771a5..0cd3b36 100644 --- a/kjvstudy_org/templates/study_guide_detail.html +++ b/kjvstudy_org/templates/study_guide_detail.html @@ -253,6 +253,17 @@ document.addEventListener('DOMContentLoaded', function() { } else if (e.key === 'ArrowLeft' || e.key === 'h') { e.preventDefault(); history.back(); + } else if (e.key === 'Enter' && selectedIndex >= 0) { + e.preventDefault(); + const link = sections[selectedIndex].querySelector('a'); + if (link) window.location.href = link.href; + } else if (e.key === 'Escape') { + e.preventDefault(); + if (selectedIndex >= 0 && selectedIndex < sections.length) { + sections[selectedIndex].style.outline = ''; + sections[selectedIndex].style.outlineOffset = ''; + } + selectedIndex = -1; } }); })(); diff --git a/kjvstudy_org/templates/topic_detail.html b/kjvstudy_org/templates/topic_detail.html index e8d0ccb..cf099f7 100644 --- a/kjvstudy_org/templates/topic_detail.html +++ b/kjvstudy_org/templates/topic_detail.html @@ -233,6 +233,13 @@ e.preventDefault(); const firstLink = sections[selectedIndex].querySelector('.verse-ref a'); if (firstLink) window.location.href = firstLink.href; + } else if (e.key === 'Escape') { + e.preventDefault(); + if (selectedIndex >= 0 && selectedIndex < sections.length) { + sections[selectedIndex].style.outline = ''; + sections[selectedIndex].style.outlineOffset = ''; + } + selectedIndex = -1; } }); })(); diff --git a/kjvstudy_org/templates/verse.html b/kjvstudy_org/templates/verse.html index e8dbe1b..ebe7722 100644 --- a/kjvstudy_org/templates/verse.html +++ b/kjvstudy_org/templates/verse.html @@ -812,63 +812,167 @@ {% endif %} {% endif %} - +