Update public/index.html
Browse files- public/index.html +163 -127
public/index.html
CHANGED
|
@@ -2,50 +2,159 @@
|
|
| 2 |
<html lang="hu">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
|
|
|
|
|
|
| 5 |
<title>Theos ex Machina</title>
|
|
|
|
|
|
|
| 6 |
<style>
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
</style>
|
| 19 |
</head>
|
| 20 |
<body>
|
| 21 |
-
<
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
<
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
</div>
|
| 45 |
|
| 46 |
<script>
|
| 47 |
// ───────────────────────────────────────────────
|
| 48 |
-
// Könyvlista
|
| 49 |
const books = [
|
| 50 |
["Genesis","1Mózes"],["Exodus","2Mózes"],["Leviticus","3Mózes"],["Numbers","4Mózes"],["Deuteronomy","5Mózes"],
|
| 51 |
["Joshua","Józsué"],["Judges","Bírák"],["Ruth","Ruth"],
|
|
@@ -66,97 +175,24 @@ const books = [
|
|
| 66 |
["3 John","3János"],["Jude","Júdás"],["Revelation","Jelenések"]
|
| 67 |
];
|
| 68 |
|
| 69 |
-
// DOM
|
| 70 |
-
const bookSel
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
const
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
async function
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
const d = await r.json();
|
| 88 |
-
return d.chapters; // pl. [31,25,…]
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
// Select‑feltöltő segéd
|
| 92 |
-
function fill(sel, n){
|
| 93 |
-
sel.innerHTML = "";
|
| 94 |
-
for(let i=1;i<=n;i++){
|
| 95 |
-
sel.innerHTML += `<option value="${i}">${i}</option>`;
|
| 96 |
-
}
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
// Könyv‑ vagy fejezetváltás
|
| 100 |
-
async function refresh(){
|
| 101 |
-
generateBtn.disabled = randomBtn.disabled = true;
|
| 102 |
-
try{
|
| 103 |
-
window.chapterMap = await fetchChapterVerseCounts(bookSel.value);
|
| 104 |
-
fill(chapterSel, window.chapterMap.length);
|
| 105 |
-
fill(verseSel, window.chapterMap[0]);
|
| 106 |
-
}catch(e){
|
| 107 |
-
alert(e.message);
|
| 108 |
-
}finally{
|
| 109 |
-
generateBtn.disabled = randomBtn.disabled = false;
|
| 110 |
-
}
|
| 111 |
-
}
|
| 112 |
-
|
| 113 |
-
bookSel.addEventListener("change", refresh);
|
| 114 |
-
chapterSel.addEventListener("change", ()=>fill(verseSel, window.chapterMap[chapterSel.value-1]||1));
|
| 115 |
-
refresh(); // első betöltés
|
| 116 |
-
|
| 117 |
-
// Random gomb
|
| 118 |
-
randomBtn.addEventListener("click", ()=>{
|
| 119 |
-
const chIdx = Math.floor(Math.random()*window.chapterMap.length);
|
| 120 |
-
chapterSel.value = chIdx+1;
|
| 121 |
-
fill(verseSel, window.chapterMap[chIdx]);
|
| 122 |
-
verseSel.value = Math.floor(Math.random()*window.chapterMap[chIdx])+1;
|
| 123 |
-
});
|
| 124 |
-
|
| 125 |
-
// Elemzés lekérése
|
| 126 |
-
async function generate(){
|
| 127 |
-
const payload = {
|
| 128 |
-
book: bookSel.value, // angol KJV név
|
| 129 |
-
chapter: chapterSel.value,
|
| 130 |
-
verse: verseSel.value
|
| 131 |
-
};
|
| 132 |
-
|
| 133 |
-
generateBtn.disabled = true;
|
| 134 |
-
generateBtn.textContent = "⏳ Kérem…";
|
| 135 |
-
|
| 136 |
-
try{
|
| 137 |
-
const r = await fetch("/api/analyze",{
|
| 138 |
-
method:"POST",
|
| 139 |
-
headers:{ "Content-Type":"application/json" },
|
| 140 |
-
body: JSON.stringify(payload)
|
| 141 |
-
});
|
| 142 |
-
|
| 143 |
-
if(!r.ok){
|
| 144 |
-
const e = await r.json();
|
| 145 |
-
throw new Error(e.error);
|
| 146 |
-
}
|
| 147 |
-
|
| 148 |
-
const d = await r.json();
|
| 149 |
-
analysisEl.textContent = d.output; // magyar vers + AI‑kommentár
|
| 150 |
-
resultBox.style.display = "block";
|
| 151 |
-
}catch(e){
|
| 152 |
-
alert(e.message);
|
| 153 |
-
}finally{
|
| 154 |
-
generateBtn.disabled = false;
|
| 155 |
-
generateBtn.textContent = "📖 Elemzés";
|
| 156 |
-
}
|
| 157 |
-
}
|
| 158 |
-
|
| 159 |
-
generateBtn.addEventListener("click", generate);
|
| 160 |
</script>
|
| 161 |
</body>
|
| 162 |
-
</html>
|
|
|
|
| 2 |
<html lang="hu">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>Theos ex Machina</title>
|
| 8 |
+
<!-- Inter font – jól olvasható, tudományos hangulat -->
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap" rel="stylesheet" />
|
| 10 |
<style>
|
| 11 |
+
:root {
|
| 12 |
+
--c-bg: #fafafa;
|
| 13 |
+
--c-bg-panel: #ffffff;
|
| 14 |
+
--c-primary: #00684a;
|
| 15 |
+
--c-primary-dark: #004f38;
|
| 16 |
+
--c-border: #d0d7de;
|
| 17 |
+
--c-heading: #1a1a1a;
|
| 18 |
+
--c-text: #303030;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
* { box-sizing: border-box; }
|
| 22 |
+
body {
|
| 23 |
+
margin: 0;
|
| 24 |
+
font-family: "Inter", Arial, Helvetica, sans-serif;
|
| 25 |
+
background: var(--c-bg);
|
| 26 |
+
color: var(--c-text);
|
| 27 |
+
line-height: 1.6;
|
| 28 |
+
-webkit-font-smoothing: antialiased;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.wrapper {
|
| 32 |
+
max-width: 800px;
|
| 33 |
+
margin: 4rem auto;
|
| 34 |
+
padding: 0 1rem;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
h1 {
|
| 38 |
+
font-size: 2.2rem;
|
| 39 |
+
font-weight: 700;
|
| 40 |
+
color: var(--c-heading);
|
| 41 |
+
margin: 0 0 0.5rem;
|
| 42 |
+
}
|
| 43 |
+
h2 {
|
| 44 |
+
font-size: 1.4rem;
|
| 45 |
+
margin: 0.5rem 0 1rem;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
.panel {
|
| 49 |
+
background: var(--c-bg-panel);
|
| 50 |
+
border: 1px solid var(--c-border);
|
| 51 |
+
border-radius: 8px;
|
| 52 |
+
padding: 1.5rem 1.25rem;
|
| 53 |
+
box-shadow: 0 2px 6px rgba(0,0,0,0.04);
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
label {
|
| 57 |
+
display: block;
|
| 58 |
+
font-weight: 500;
|
| 59 |
+
margin-bottom: 0.25rem;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
select, button {
|
| 63 |
+
width: 100%;
|
| 64 |
+
font: inherit;
|
| 65 |
+
font-size: 1rem;
|
| 66 |
+
padding: 0.55rem 0.65rem;
|
| 67 |
+
border-radius: 6px;
|
| 68 |
+
border: 1px solid var(--c-border);
|
| 69 |
+
transition: border-color 0.15s ease;
|
| 70 |
+
background: #fff;
|
| 71 |
+
}
|
| 72 |
+
select:focus, button:focus {
|
| 73 |
+
outline: none;
|
| 74 |
+
border-color: var(--c-primary);
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
button {
|
| 78 |
+
display: flex;
|
| 79 |
+
align-items: center;
|
| 80 |
+
justify-content: center;
|
| 81 |
+
gap: 0.4rem;
|
| 82 |
+
font-weight: 600;
|
| 83 |
+
background: var(--c-primary);
|
| 84 |
+
color: #fff;
|
| 85 |
+
border: none;
|
| 86 |
+
cursor: pointer;
|
| 87 |
+
margin-top: 1rem;
|
| 88 |
+
transition: background 0.2s ease;
|
| 89 |
+
}
|
| 90 |
+
button:hover:not(:disabled) {
|
| 91 |
+
background: var(--c-primary-dark);
|
| 92 |
+
}
|
| 93 |
+
button:disabled {
|
| 94 |
+
opacity: 0.6;
|
| 95 |
+
cursor: not-allowed;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
.grid {
|
| 99 |
+
display: grid;
|
| 100 |
+
grid-template-columns: 1fr 1fr;
|
| 101 |
+
gap: 1rem;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
#result {
|
| 105 |
+
margin-top: 2.5rem;
|
| 106 |
+
display: none;
|
| 107 |
+
}
|
| 108 |
+
pre {
|
| 109 |
+
white-space: pre-wrap;
|
| 110 |
+
background: #f2f4f6;
|
| 111 |
+
padding: 1.25rem;
|
| 112 |
+
border-radius: 8px;
|
| 113 |
+
border: 1px solid var(--c-border);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
@media (max-width: 600px) {
|
| 117 |
+
.grid { grid-template-columns: 1fr; }
|
| 118 |
+
}
|
| 119 |
</style>
|
| 120 |
</head>
|
| 121 |
<body>
|
| 122 |
+
<div class="wrapper">
|
| 123 |
+
<header>
|
| 124 |
+
<h1>Theos ex Machina</h1>
|
| 125 |
+
<p class="panel" style="margin-bottom:1.5rem">Válassz könyvet, fejezetet és verset, vagy kattints a <strong>🎲 Random</strong> gombra!<br><small style="color:#555">Forrás: KJV → mesterséges intelligencia által fordított és értelmezett magyar szöveg</small></p>
|
| 126 |
+
</header>
|
| 127 |
+
|
| 128 |
+
<div class="panel">
|
| 129 |
+
<label for="book">Könyv</label>
|
| 130 |
+
<select id="book"></select>
|
| 131 |
+
|
| 132 |
+
<div class="grid" style="margin-top:1rem">
|
| 133 |
+
<div>
|
| 134 |
+
<label for="chapter">Fejezet</label>
|
| 135 |
+
<select id="chapter"></select>
|
| 136 |
+
</div>
|
| 137 |
+
<div>
|
| 138 |
+
<label for="verse">Vers</label>
|
| 139 |
+
<select id="verse"></select>
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
|
| 143 |
+
<div class="grid" style="margin-top:1.25rem">
|
| 144 |
+
<button id="randomBtn">🎲 Random vers</button>
|
| 145 |
+
<button id="generateBtn">📖 Elemzés</button>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
|
| 149 |
+
<section id="result">
|
| 150 |
+
<h2>Fordítás & AI‑elemzés</h2>
|
| 151 |
+
<pre id="analysis"></pre>
|
| 152 |
+
</section>
|
| 153 |
</div>
|
| 154 |
|
| 155 |
<script>
|
| 156 |
// ───────────────────────────────────────────────
|
| 157 |
+
// Könyvlista (value = angol KJV név, label = magyar név)
|
| 158 |
const books = [
|
| 159 |
["Genesis","1Mózes"],["Exodus","2Mózes"],["Leviticus","3Mózes"],["Numbers","4Mózes"],["Deuteronomy","5Mózes"],
|
| 160 |
["Joshua","Józsué"],["Judges","Bírák"],["Ruth","Ruth"],
|
|
|
|
| 175 |
["3 John","3János"],["Jude","Júdás"],["Revelation","Jelenések"]
|
| 176 |
];
|
| 177 |
|
| 178 |
+
// DOM elemek
|
| 179 |
+
const bookSel=document.getElementById("book"),chapterSel=document.getElementById("chapter"),verseSel=document.getElementById("verse"),generateBtn=document.getElementById("generateBtn"),randomBtn=document.getElementById("randomBtn"),analysisEl=document.getElementById("analysis"),resultBox=document.getElementById("result");
|
| 180 |
+
|
| 181 |
+
books.forEach(([val,label])=>{bookSel.insertAdjacentHTML("beforeend",`<option value="${val}">${label}</option>`)});
|
| 182 |
+
|
| 183 |
+
async function fetchChapterVerseCounts(book){const r=await fetch("/api/meta?book="+encodeURIComponent(book));if(!r.ok)throw new Error("Szerver meta hiba");return (await r.json()).chapters;}
|
| 184 |
+
function fill(sel,n){sel.innerHTML="";for(let i=1;i<=n;i++){sel.insertAdjacentHTML("beforeend",`<option value="${i}">${i}</option>`);} }
|
| 185 |
+
|
| 186 |
+
async function refresh(){generateBtn.disabled=randomBtn.disabled=true;try{window.chapterMap=await fetchChapterVerseCounts(bookSel.value);fill(chapterSel,window.chapterMap.length);fill(verseSel,window.chapterMap[0]);}catch(e){alert(e.message);}finally{generateBtn.disabled=randomBtn.disabled=false;}}
|
| 187 |
+
bookSel.addEventListener("change",refresh);
|
| 188 |
+
chapterSel.addEventListener("change",()=>fill(verseSel,window.chapterMap[chapterSel.value-1]||1));
|
| 189 |
+
refresh();
|
| 190 |
+
|
| 191 |
+
randomBtn.addEventListener("click",()=>{const chIdx=Math.floor(Math.random()*window.chapterMap.length);chapterSel.value=chIdx+1;fill(verseSel,window.chapterMap[chIdx]);verseSel.value=Math.floor(Math.random()*window.chapterMap[chIdx])+1;});
|
| 192 |
+
|
| 193 |
+
async function generate(){const payload={book:bookSel.value,chapter:chapterSel.value,verse:verseSel.value};generateBtn.disabled=true;generateBtn.textContent="⏳ Kérem…";try{const r=await fetch("/api/analyze",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payload)});if(!r.ok)throw new Error((await r.json()).error);const d=await r.json();analysisEl.textContent=d.output;resultBox.style.display="block";}catch(e){alert(e.message);}finally{generateBtn.disabled=false;generateBtn.textContent="📖 Elemzés";}}
|
| 194 |
+
|
| 195 |
+
generateBtn.addEventListener("click",generate);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
</script>
|
| 197 |
</body>
|
| 198 |
+
</html>
|