Add PDF button and TOC shortcuts to resource index keyboard nav

- PDF button is now selectable via arrow navigation
- 'p' key downloads PDF directly
- 't' key jumps to TOC block

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-30 00:28:45 -05:00
parent 672a7a1d7b
commit 79d79b1a00
+11 -2
View File
@@ -301,8 +301,8 @@ document.addEventListener('DOMContentLoaded', function() {
// Two-section navigation: TOC block -> content elements
// Or when inside TOC: individual TOC entries
// Content elements include section titles (h3 with links), paragraphs, and verse items
const contentElements = Array.from(document.querySelectorAll('.intro-text, .resource-name, .resource-item-description p, .verse-item'));
// Content elements include PDF button, section titles (h3 with links), paragraphs, and verse items
const contentElements = Array.from(document.querySelectorAll('.resource-download-btn, .intro-text, .resource-name, .resource-item-description p, .verse-item'));
const tocItems = Array.from(tocList.querySelectorAll('li a'));
let currentSection = 'content'; // 'content' or 'toc'
@@ -431,6 +431,15 @@ document.addEventListener('DOMContentLoaded', function() {
currentSection = 'content';
selectedIndex = -1;
selectedTocIndex = -1;
} else if (e.key === 'p') {
// p: Download PDF
e.preventDefault();
var pdfBtn = document.querySelector('.resource-download-btn');
if (pdfBtn) window.location.href = pdfBtn.href;
} else if (e.key === 't') {
// t: Jump to TOC
e.preventDefault();
selectTocBlock();
}
});
});