File tree Expand file tree Collapse file tree 2 files changed +13
-15
lines changed
Expand file tree Collapse file tree 2 files changed +13
-15
lines changed Original file line number Diff line number Diff line change 77 < link rel ="stylesheet " href ="styles.css ">
88</ head >
99< body >
10- <!-- Mobile menu button -->
1110 < button id ="mobile-menu " aria-label ="Toggle menu "> ☰</ button >
1211
1312 < div class ="container ">
@@ -19,12 +18,11 @@ <h2>Books</h2>
1918
2019 <!-- Right Content Area -->
2120 < main class ="main-content ">
22- < div class ="chapter-nav ">
23- < button id ="prevChapter " aria-label ="Previous chapter "> <</ button >
24- < div class ="chapters-wrapper ">
25- < div id ="chapter-numbers " class ="chapter-numbers "> </ div >
26- </ div >
27- < button id ="nextChapter " aria-label ="Next chapter "> ></ button >
21+ <!-- Add this navigation element -->
22+ < div id ="navigation " style ="display: none; ">
23+ < button id ="prevChapter "> <</ button >
24+ < div id ="chapter-numbers "> </ div >
25+ < button id ="nextChapter "> ></ button >
2826 </ div >
2927 < article id ="verses "> </ article >
3028 </ main >
Original file line number Diff line number Diff line change @@ -59,22 +59,22 @@ async function loadBook(bookFile) {
5959 try {
6060 bookData = await loadBookData ( bookFile ) ;
6161 if ( ! bookData ) throw new Error ( 'No book data received' ) ;
62-
62+
6363 currentBook = Object . keys ( bookData ) [ 0 ] ;
64- currentChapter = '1' ; // Force first chapter
65-
66- if ( ! bookData [ currentBook ] [ currentChapter ] ) {
67- currentChapter = Object . keys ( bookData [ currentBook ] ) [ 0 ] ;
68- }
64+ currentChapter = '1' ;
6965
66+ // Check if navigation element exists
67+ const navElement = document . getElementById ( 'navigation' ) ;
68+ if ( ! navElement ) throw new Error ( 'Navigation element not found' ) ;
69+
70+ navElement . style . display = 'flex' ; // Now safe to modify
7071 updateChapterNavigation ( ) ;
7172 loadChapter ( currentChapter ) ;
72- document . getElementById ( 'navigation' ) . style . display = 'flex' ;
7373
7474 } catch ( error ) {
7575 console . error ( "Book load failed:" , error ) ;
7676 document . getElementById ( 'verses' ) . innerHTML =
77- `<p class="error">Error loading book. Please try again. </p>` ;
77+ `<p class="error">${ error . message } </p>` ;
7878 }
7979}
8080
You can’t perform that action at this time.
0 commit comments