diff --git a/kjvstudy_org/templates/biblical_angels.html b/kjvstudy_org/templates/biblical_angels.html index 51d46f1..a7a3bb7 100644 --- a/kjvstudy_org/templates/biblical_angels.html +++ b/kjvstudy_org/templates/biblical_angels.html @@ -272,6 +272,43 @@ document.addEventListener('DOMContentLoaded', function() { li.appendChild(a); tocList.appendChild(li); }); + + // Keyboard navigation + const entries = Array.from(document.querySelectorAll('.angel-entry')); + if (entries.length === 0) return; + + let selectedIndex = -1; + + function selectEntry(index) { + if (selectedIndex >= 0 && selectedIndex < entries.length) { + entries[selectedIndex].style.outline = ''; + entries[selectedIndex].style.outlineOffset = ''; + } + selectedIndex = Math.max(0, Math.min(index, entries.length - 1)); + entries[selectedIndex].style.outline = '2px solid #4a7c59'; + entries[selectedIndex].style.outlineOffset = '4px'; + entries[selectedIndex].scrollIntoView({ behavior: 'smooth', block: 'start' }); + } + + document.addEventListener('keydown', function(e) { + if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; + + if (e.key === 'ArrowDown' || e.key === 'j') { + e.preventDefault(); + selectEntry(selectedIndex < 0 ? 0 : selectedIndex + 1); + } else if (e.key === 'ArrowUp' || e.key === 'k') { + e.preventDefault(); + if (selectedIndex <= 0) selectEntry(0); + else selectEntry(selectedIndex - 1); + } else if (e.key === 'ArrowLeft' || e.key === 'h') { + e.preventDefault(); + history.back(); + } else if (e.key === 'Enter' && selectedIndex >= 0) { + e.preventDefault(); + const link = entries[selectedIndex].querySelector('.angel-name a'); + if (link) window.location.href = link.href; + } + }); }); {% endblock %} diff --git a/kjvstudy_org/templates/biblical_covenants.html b/kjvstudy_org/templates/biblical_covenants.html index 8783063..ff271ba 100644 --- a/kjvstudy_org/templates/biblical_covenants.html +++ b/kjvstudy_org/templates/biblical_covenants.html @@ -270,6 +270,43 @@ document.addEventListener('DOMContentLoaded', function() { li.appendChild(a); tocList.appendChild(li); }); + + // Keyboard navigation + const entries = Array.from(document.querySelectorAll('.covenant-entry')); + if (entries.length === 0) return; + + let selectedIndex = -1; + + function selectEntry(index) { + if (selectedIndex >= 0 && selectedIndex < entries.length) { + entries[selectedIndex].style.outline = ''; + entries[selectedIndex].style.outlineOffset = ''; + } + selectedIndex = Math.max(0, Math.min(index, entries.length - 1)); + entries[selectedIndex].style.outline = '2px solid #4a7c59'; + entries[selectedIndex].style.outlineOffset = '4px'; + entries[selectedIndex].scrollIntoView({ behavior: 'smooth', block: 'start' }); + } + + document.addEventListener('keydown', function(e) { + if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; + + if (e.key === 'ArrowDown' || e.key === 'j') { + e.preventDefault(); + selectEntry(selectedIndex < 0 ? 0 : selectedIndex + 1); + } else if (e.key === 'ArrowUp' || e.key === 'k') { + e.preventDefault(); + if (selectedIndex <= 0) selectEntry(0); + else selectEntry(selectedIndex - 1); + } else if (e.key === 'ArrowLeft' || e.key === 'h') { + e.preventDefault(); + history.back(); + } else if (e.key === 'Enter' && selectedIndex >= 0) { + e.preventDefault(); + const link = entries[selectedIndex].querySelector('.covenant-name a'); + if (link) window.location.href = link.href; + } + }); }); {% endblock %} diff --git a/kjvstudy_org/templates/biblical_festivals.html b/kjvstudy_org/templates/biblical_festivals.html index b51c29a..7416a24 100644 --- a/kjvstudy_org/templates/biblical_festivals.html +++ b/kjvstudy_org/templates/biblical_festivals.html @@ -270,6 +270,43 @@ document.addEventListener('DOMContentLoaded', function() { li.appendChild(a); tocList.appendChild(li); }); + + // Keyboard navigation + const entries = Array.from(document.querySelectorAll('.festival-entry')); + if (entries.length === 0) return; + + let selectedIndex = -1; + + function selectEntry(index) { + if (selectedIndex >= 0 && selectedIndex < entries.length) { + entries[selectedIndex].style.outline = ''; + entries[selectedIndex].style.outlineOffset = ''; + } + selectedIndex = Math.max(0, Math.min(index, entries.length - 1)); + entries[selectedIndex].style.outline = '2px solid #4a7c59'; + entries[selectedIndex].style.outlineOffset = '4px'; + entries[selectedIndex].scrollIntoView({ behavior: 'smooth', block: 'start' }); + } + + document.addEventListener('keydown', function(e) { + if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; + + if (e.key === 'ArrowDown' || e.key === 'j') { + e.preventDefault(); + selectEntry(selectedIndex < 0 ? 0 : selectedIndex + 1); + } else if (e.key === 'ArrowUp' || e.key === 'k') { + e.preventDefault(); + if (selectedIndex <= 0) selectEntry(0); + else selectEntry(selectedIndex - 1); + } else if (e.key === 'ArrowLeft' || e.key === 'h') { + e.preventDefault(); + history.back(); + } else if (e.key === 'Enter' && selectedIndex >= 0) { + e.preventDefault(); + const link = entries[selectedIndex].querySelector('.festival-name a'); + if (link) window.location.href = link.href; + } + }); }); {% endblock %} diff --git a/kjvstudy_org/templates/biblical_maps.html b/kjvstudy_org/templates/biblical_maps.html index 4f711c6..b82ced7 100644 --- a/kjvstudy_org/templates/biblical_maps.html +++ b/kjvstudy_org/templates/biblical_maps.html @@ -349,6 +349,45 @@ {% endblock %} diff --git a/kjvstudy_org/templates/names_of_god.html b/kjvstudy_org/templates/names_of_god.html index 58107c8..e17a650 100644 --- a/kjvstudy_org/templates/names_of_god.html +++ b/kjvstudy_org/templates/names_of_god.html @@ -268,6 +268,43 @@ document.addEventListener('DOMContentLoaded', function() { li.appendChild(a); tocList.appendChild(li); }); + + // Keyboard navigation + const entries = Array.from(document.querySelectorAll('.name-entry')); + if (entries.length === 0) return; + + let selectedIndex = -1; + + function selectEntry(index) { + if (selectedIndex >= 0 && selectedIndex < entries.length) { + entries[selectedIndex].style.outline = ''; + entries[selectedIndex].style.outlineOffset = ''; + } + selectedIndex = Math.max(0, Math.min(index, entries.length - 1)); + entries[selectedIndex].style.outline = '2px solid #4a7c59'; + entries[selectedIndex].style.outlineOffset = '4px'; + entries[selectedIndex].scrollIntoView({ behavior: 'smooth', block: 'start' }); + } + + document.addEventListener('keydown', function(e) { + if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; + + if (e.key === 'ArrowDown' || e.key === 'j') { + e.preventDefault(); + selectEntry(selectedIndex < 0 ? 0 : selectedIndex + 1); + } else if (e.key === 'ArrowUp' || e.key === 'k') { + e.preventDefault(); + if (selectedIndex <= 0) selectEntry(0); + else selectEntry(selectedIndex - 1); + } else if (e.key === 'ArrowLeft' || e.key === 'h') { + e.preventDefault(); + history.back(); + } else if (e.key === 'Enter' && selectedIndex >= 0) { + e.preventDefault(); + const link = entries[selectedIndex].querySelector('.name-name a'); + if (link) window.location.href = link.href; + } + }); }); {% endblock %} diff --git a/kjvstudy_org/templates/twelve_apostles.html b/kjvstudy_org/templates/twelve_apostles.html index fd27c45..16e9915 100644 --- a/kjvstudy_org/templates/twelve_apostles.html +++ b/kjvstudy_org/templates/twelve_apostles.html @@ -270,6 +270,43 @@ document.addEventListener('DOMContentLoaded', function() { li.appendChild(a); tocList.appendChild(li); }); + + // Keyboard navigation + const entries = Array.from(document.querySelectorAll('.apostle-entry')); + if (entries.length === 0) return; + + let selectedIndex = -1; + + function selectEntry(index) { + if (selectedIndex >= 0 && selectedIndex < entries.length) { + entries[selectedIndex].style.outline = ''; + entries[selectedIndex].style.outlineOffset = ''; + } + selectedIndex = Math.max(0, Math.min(index, entries.length - 1)); + entries[selectedIndex].style.outline = '2px solid #4a7c59'; + entries[selectedIndex].style.outlineOffset = '4px'; + entries[selectedIndex].scrollIntoView({ behavior: 'smooth', block: 'start' }); + } + + document.addEventListener('keydown', function(e) { + if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; + + if (e.key === 'ArrowDown' || e.key === 'j') { + e.preventDefault(); + selectEntry(selectedIndex < 0 ? 0 : selectedIndex + 1); + } else if (e.key === 'ArrowUp' || e.key === 'k') { + e.preventDefault(); + if (selectedIndex <= 0) selectEntry(0); + else selectEntry(selectedIndex - 1); + } else if (e.key === 'ArrowLeft' || e.key === 'h') { + e.preventDefault(); + history.back(); + } else if (e.key === 'Enter' && selectedIndex >= 0) { + e.preventDefault(); + const link = entries[selectedIndex].querySelector('.apostle-name a'); + if (link) window.location.href = link.href; + } + }); }); {% endblock %} diff --git a/kjvstudy_org/templates/women_of_the_bible.html b/kjvstudy_org/templates/women_of_the_bible.html index 459996d..2aeeb1f 100644 --- a/kjvstudy_org/templates/women_of_the_bible.html +++ b/kjvstudy_org/templates/women_of_the_bible.html @@ -270,6 +270,43 @@ document.addEventListener('DOMContentLoaded', function() { li.appendChild(a); tocList.appendChild(li); }); + + // Keyboard navigation + const entries = Array.from(document.querySelectorAll('.woman-entry')); + if (entries.length === 0) return; + + let selectedIndex = -1; + + function selectEntry(index) { + if (selectedIndex >= 0 && selectedIndex < entries.length) { + entries[selectedIndex].style.outline = ''; + entries[selectedIndex].style.outlineOffset = ''; + } + selectedIndex = Math.max(0, Math.min(index, entries.length - 1)); + entries[selectedIndex].style.outline = '2px solid #4a7c59'; + entries[selectedIndex].style.outlineOffset = '4px'; + entries[selectedIndex].scrollIntoView({ behavior: 'smooth', block: 'start' }); + } + + document.addEventListener('keydown', function(e) { + if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; + + if (e.key === 'ArrowDown' || e.key === 'j') { + e.preventDefault(); + selectEntry(selectedIndex < 0 ? 0 : selectedIndex + 1); + } else if (e.key === 'ArrowUp' || e.key === 'k') { + e.preventDefault(); + if (selectedIndex <= 0) selectEntry(0); + else selectEntry(selectedIndex - 1); + } else if (e.key === 'ArrowLeft' || e.key === 'h') { + e.preventDefault(); + history.back(); + } else if (e.key === 'Enter' && selectedIndex >= 0) { + e.preventDefault(); + const link = entries[selectedIndex].querySelector('.woman-name a'); + if (link) window.location.href = link.href; + } + }); }); {% endblock %}