Skip to content

Commit 5022811

Browse files
commit
1 parent 1d1c867 commit 5022811

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

bible/script.js

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ async function loadBookData(bookFile) {
2929
}
3030

3131
async function loadBook(bookFile) {
32-
bookData = await loadBookData(bookFile);
33-
currentBook = Object.keys(bookData)[0];
34-
currentChapter = Object.keys(bookData[currentBook])[0];
35-
36-
document.getElementById('navigation').style.display = 'flex';
37-
updateChapterNavigation();
38-
loadChapter(currentChapter);
32+
try {
33+
bookData = await loadBookData(bookFile);
34+
currentBook = Object.keys(bookData)[0];
35+
currentChapter = Object.keys(bookData[currentBook])[0];
36+
37+
document.getElementById('navigation').style.display = 'flex';
38+
updateChapterNavigation();
39+
loadChapter(currentChapter);
40+
} catch (error) {
41+
console.error("Failed to load book:", error);
42+
}
3943
}
4044

4145
function updateChapterNavigation() {
@@ -102,5 +106,31 @@ window.addEventListener('resize', () => {
102106
}
103107
});
104108

105-
// Initialize the app
106-
initBooks(); // Critical missing line added
109+
// Load Genesis by default
110+
window.addEventListener('DOMContentLoaded', async () => {
111+
// Find Genesis in book manifest
112+
const genesisBook = bookManifest.find(b => b.name === "Genesis");
113+
114+
if (genesisBook) {
115+
await loadBook(genesisBook.file);
116+
117+
// Close mobile sidebar after loading
118+
if (window.innerWidth < 768) {
119+
document.getElementById('sidebar').style.left = '-100%';
120+
}
121+
}
122+
});
123+
124+
// Initialize books and load Genesis
125+
function initApp() {
126+
initBooks();
127+
128+
// Load Genesis after slight delay to ensure DOM is ready
129+
setTimeout(async () => {
130+
const genesis = bookManifest.find(b => b.name === "Genesis");
131+
if (genesis) await loadBook(genesis.file);
132+
}, 100);
133+
}
134+
135+
// Start the app
136+
initApp();

bible/styles.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ body {
1818
-webkit-tap-highlight-color: transparent;
1919
}
2020

21+
@media (max-width: 767px) {
22+
.main-content {
23+
padding-top: 20px !important;
24+
}
25+
26+
#mobile-menu {
27+
top: 4px;
28+
left: 4px;
29+
padding: 6px 12px;
30+
}
31+
}
32+
2133
#mobile-menu {
2234
display: block;
2335
position: fixed;

0 commit comments

Comments
 (0)