Skip to content

Commit 50ec3d3

Browse files
commit
1 parent 157d046 commit 50ec3d3

File tree

5 files changed

+158
-0
lines changed

5 files changed

+158
-0
lines changed

bible/data/books/enoch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"1 Enoch": {
3+
"1": {
4+
"1": "The words of the blessing of Enoch...",
5+
"2": "And he took up his parable and said..."
6+
},
7+
"2": {
8+
"1": "And behold! He comes with ten thousands of His holy ones..."
9+
}
10+
}
11+
}

bible/data/books/genesis.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"Genesis": {
3+
"1": {
4+
"1": "In the beginning, God created the heavens and the earth...",
5+
"2": "The earth was formless and void..."
6+
},
7+
"2": {
8+
"1": "Thus the heavens and the earth were completed..."
9+
}
10+
}
11+
}

bible/index.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Bible & Pseudepigrapha</title>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="styles.css">
8+
</head>
9+
<body>
10+
<div class="container">
11+
<!-- Left Sidebar -->
12+
<div class="sidebar">
13+
<h2>Books</h2>
14+
<div id="book-list"></div>
15+
</div>
16+
17+
<!-- Right Content Area -->
18+
<div class="main-content">
19+
<div id="chapters-section" style="display:none;">
20+
<button onclick="showBooks()">← Back to Books</button>
21+
<div id="chapters"></div>
22+
</div>
23+
<div id="verses-section" style="display:none;">
24+
<button onclick="showChapters()">← Back to Chapters</button>
25+
<div id="verses"></div>
26+
</div>
27+
</div>
28+
</div>
29+
30+
<script src="script.js"></script>
31+
</body>
32+
</html>

bible/script.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
const bookManifest = [
2+
{ name: "Genesis", file: "genesis.json" },
3+
{ name: "1 Enoch", file: "enoch.json" }
4+
];
5+
6+
let currentBookData = null; // To store the loaded book data
7+
8+
// Fetch book data
9+
async function loadBookData(bookFile) {
10+
try {
11+
const response = await fetch(`data/books/${bookFile}`);
12+
const data = await response.json();
13+
return data;
14+
} catch (error) {
15+
console.error("Error loading book:", error);
16+
}
17+
}
18+
19+
// Display book list
20+
function showBooks() {
21+
const bookList = document.getElementById('book-list');
22+
bookList.innerHTML = bookManifest.map(book => `
23+
<button onclick="handleBookClick('${book.file}')">
24+
${book.name}
25+
</button>
26+
`).join('');
27+
}
28+
29+
// Handle book click
30+
async function handleBookClick(bookFile) {
31+
currentBookData = await loadBookData(bookFile);
32+
if (!currentBookData) return;
33+
34+
const bookName = Object.keys(currentBookData)[0]; // e.g., "1 Enoch"
35+
const chapters = Object.keys(currentBookData[bookName]);
36+
37+
// Show chapters
38+
document.getElementById('chapters-section').style.display = 'block';
39+
document.getElementById('verses-section').style.display = 'none';
40+
41+
const chaptersDiv = document.getElementById('chapters');
42+
chaptersDiv.innerHTML = chapters.map(chapter => `
43+
<button class="chapter-btn" onclick="handleChapterClick('${chapter}')">
44+
Chapter ${chapter}
45+
</button>
46+
`).join('');
47+
}
48+
49+
// Handle chapter click
50+
function handleChapterClick(chapter) {
51+
const bookName = Object.keys(currentBookData)[0];
52+
const verses = currentBookData[bookName][chapter];
53+
54+
document.getElementById('verses-section').style.display = 'block';
55+
const versesDiv = document.getElementById('verses');
56+
versesDiv.innerHTML = Object.entries(verses).map(([verse, text]) => `
57+
<p><b>${verse}:</b> ${text}</p>
58+
`).join('');
59+
}
60+
61+
// Back buttons
62+
function showChapters() {
63+
document.getElementById('verses-section').style.display = 'none';
64+
}
65+
66+
// Initialize
67+
showBooks();

bible/styles.css

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
body {
2+
margin: 0;
3+
font-family: Arial, sans-serif;
4+
}
5+
6+
.container {
7+
display: flex;
8+
height: 100vh;
9+
}
10+
11+
.sidebar {
12+
width: 250px;
13+
background: #f5f5f5;
14+
padding: 20px;
15+
overflow-y: auto;
16+
}
17+
18+
.main-content {
19+
flex: 1;
20+
padding: 20px;
21+
overflow-y: auto;
22+
}
23+
24+
#book-list button {
25+
display: block;
26+
width: 100%;
27+
padding: 10px;
28+
margin: 5px 0;
29+
text-align: left;
30+
cursor: pointer;
31+
}
32+
33+
.chapter-btn {
34+
padding: 8px;
35+
margin: 4px 0;
36+
cursor: pointer;
37+
}

0 commit comments

Comments
 (0)