Spaces:
Running
Running
Update index.html
Browse files- index.html +99 -54
index.html
CHANGED
|
@@ -13,24 +13,32 @@
|
|
| 13 |
--border-color: #e0ddd5;
|
| 14 |
}
|
| 15 |
|
| 16 |
-
body { font-family: 'Pretendard', sans-serif; background-color: var(--bg-color); color: var(--primary-color); margin: 0; line-height: 1.6; }
|
| 17 |
nav { position: sticky; top: 0; background: rgba(249, 247, 242, 0.9); backdrop-filter: blur(10px); padding: 15px; text-align: center; border-bottom: 1px solid var(--border-color); z-index: 100; }
|
| 18 |
nav a { margin: 0 15px; text-decoration: none; color: var(--primary-color); font-weight: 600; cursor: pointer; }
|
| 19 |
header { text-align: center; padding: 40px 20px; }
|
| 20 |
h1 { font-weight: 300; letter-spacing: 8px; color: var(--accent-color); margin: 0; }
|
| 21 |
|
| 22 |
-
.container { max-width: 1000px; margin: 0 auto; padding: 20px; }
|
| 23 |
section { display: none; }
|
| 24 |
-
section.active { display: block; }
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
.table-wrapper { background: white; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
|
| 29 |
table { width: 100%; border-collapse: collapse; }
|
| 30 |
th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid #eee; }
|
| 31 |
-
th { background: #f1eee6; color: #777; font-size: 0.9rem; }
|
| 32 |
-
.word-cell { font-weight: bold; color: var(--accent-color); width:
|
| 33 |
-
.
|
|
|
|
| 34 |
|
| 35 |
.card { background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.02); }
|
| 36 |
</style>
|
|
@@ -44,19 +52,24 @@
|
|
| 44 |
|
| 45 |
<header>
|
| 46 |
<h1>HUIUCL</h1>
|
| 47 |
-
<div style="color:#999; font-size:0.8rem; margin-top:5px;">
|
| 48 |
</header>
|
| 49 |
|
| 50 |
<div class="container">
|
| 51 |
<section id="dictionary" class="active">
|
| 52 |
-
<input type="text" id="searchInput" class="search-box" placeholder="๋จ์ด, ๋ป, ํ์์ด
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
<div class="table-wrapper">
|
| 54 |
<table>
|
| 55 |
<thead>
|
| 56 |
<tr>
|
| 57 |
<th>๋จ์ด</th>
|
| 58 |
-
<th>์๋ฏธ
|
| 59 |
-
<th>
|
| 60 |
</tr>
|
| 61 |
</thead>
|
| 62 |
<tbody id="dictBody"></tbody>
|
|
@@ -66,99 +79,131 @@
|
|
| 66 |
|
| 67 |
<section id="grammar">
|
| 68 |
<div class="card" id="grammarBox">
|
| 69 |
-
<h2>Grammar
|
| 70 |
<div id="settingsContent">๋ฐ์ดํฐ๋ฅผ ๋ถ๋ฌ์ค๋ ์ค...</div>
|
| 71 |
</div>
|
| 72 |
</section>
|
| 73 |
</div>
|
| 74 |
|
| 75 |
<script>
|
| 76 |
-
let
|
|
|
|
| 77 |
|
| 78 |
function showSection(id) {
|
| 79 |
document.querySelectorAll('section').forEach(s => s.classList.remove('active'));
|
| 80 |
document.getElementById(id).classList.add('active');
|
| 81 |
}
|
| 82 |
|
| 83 |
-
// JSON ๋ก๋
|
| 84 |
window.onload = () => {
|
| 85 |
fetch('Huiucl.json')
|
| 86 |
.then(res => res.json())
|
| 87 |
.then(data => {
|
| 88 |
-
|
|
|
|
| 89 |
renderTable();
|
| 90 |
renderGrammar();
|
| 91 |
})
|
| 92 |
.catch(err => {
|
| 93 |
-
|
|
|
|
| 94 |
});
|
| 95 |
};
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
function renderTable() {
|
| 98 |
const query = document.getElementById('searchInput').value.toLowerCase();
|
| 99 |
const body = document.getElementById('dictBody');
|
| 100 |
body.innerHTML = '';
|
| 101 |
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
const kor = item.meaning_ko;
|
| 111 |
-
const eng = item.meaning_en || '';
|
| 112 |
-
|
| 113 |
-
// ๊ฒ์ ์กฐ๊ฑด ๋์กฐ
|
| 114 |
-
if (word.toLowerCase().includes(query) || kor.includes(query) || eng.toLowerCase().includes(query)) {
|
| 115 |
-
appendRow(word, kor, eng, false);
|
| 116 |
-
}
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
}
|
| 125 |
}
|
| 126 |
}
|
| 127 |
-
} else if (item && typeof item === 'object' && key !== "Settings") {
|
| 128 |
-
// ๋ ๊น์ ๊ณ์ธต์ด ์๋ค๋ฉด ๋ค์ ํ์
|
| 129 |
-
findEntries(item);
|
| 130 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
}
|
| 132 |
}
|
| 133 |
-
|
| 134 |
-
findEntries(rawData);
|
| 135 |
}
|
| 136 |
|
| 137 |
-
function appendRow(word,
|
| 138 |
const body = document.getElementById('dictBody');
|
| 139 |
const row = body.insertRow();
|
| 140 |
if (isSub) row.className = 'variation-row';
|
| 141 |
|
| 142 |
row.innerHTML = `
|
| 143 |
<td class="word-cell">${isSub ? 'โ ' : ''}${word}</td>
|
| 144 |
-
<td>${
|
| 145 |
-
<td
|
| 146 |
`;
|
| 147 |
}
|
| 148 |
|
| 149 |
function renderGrammar() {
|
| 150 |
const target = document.getElementById('settingsContent');
|
| 151 |
-
if (!
|
| 152 |
-
|
| 153 |
-
return;
|
| 154 |
-
}
|
| 155 |
-
const s = rawData.Settings;
|
| 156 |
target.innerHTML = `
|
| 157 |
<h3>Phonology</h3>
|
| 158 |
-
<p>Vowels: ${Object.keys(s.Phonology.Vowels).join(', ')}</p>
|
| 159 |
-
<p>Consonants: ${Object.keys(s.Phonology.Consonants).join(', ')}</p>
|
|
|
|
| 160 |
<h3>Syntax</h3>
|
| 161 |
-
<p>Order: ${s.Syntax.Word_Order.join('
|
| 162 |
<p>${s.Syntax.Imperative["2"]}</p>
|
| 163 |
`;
|
| 164 |
}
|
|
|
|
| 13 |
--border-color: #e0ddd5;
|
| 14 |
}
|
| 15 |
|
| 16 |
+
body { font-family: 'Pretendard', sans-serif; background-color: var(--bg-color); color: var(--primary-color); margin: 0; padding: 0; line-height: 1.6; }
|
| 17 |
nav { position: sticky; top: 0; background: rgba(249, 247, 242, 0.9); backdrop-filter: blur(10px); padding: 15px; text-align: center; border-bottom: 1px solid var(--border-color); z-index: 100; }
|
| 18 |
nav a { margin: 0 15px; text-decoration: none; color: var(--primary-color); font-weight: 600; cursor: pointer; }
|
| 19 |
header { text-align: center; padding: 40px 20px; }
|
| 20 |
h1 { font-weight: 300; letter-spacing: 8px; color: var(--accent-color); margin: 0; }
|
| 21 |
|
| 22 |
+
.container { max-width: 1000px; margin: 0 auto; padding: 0 20px 100px; }
|
| 23 |
section { display: none; }
|
| 24 |
+
section.active { display: block; animation: fadeIn 0.5s; }
|
| 25 |
|
| 26 |
+
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
|
| 27 |
+
|
| 28 |
+
/* ํํฐ ๋ฒํผ ์คํ์ผ */
|
| 29 |
+
.filter-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 25px; }
|
| 30 |
+
.filter-btn { background: var(--card-bg); border: 1px solid var(--border-color); padding: 8px 16px; cursor: pointer; border-radius: 20px; font-size: 0.85rem; transition: 0.2s; }
|
| 31 |
+
.filter-btn.active { background: var(--accent-color); color: white; border-color: var(--accent-color); }
|
| 32 |
+
|
| 33 |
+
/* ๊ฒ์ ๋ฐ ํ
์ด๋ธ ์คํ์ผ */
|
| 34 |
+
.search-box { width: 100%; padding: 15px 25px; border: 1px solid var(--border-color); border-radius: 30px; font-size: 1rem; margin-bottom: 20px; box-sizing: border-box; outline: none; }
|
| 35 |
.table-wrapper { background: white; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
|
| 36 |
table { width: 100%; border-collapse: collapse; }
|
| 37 |
th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid #eee; }
|
| 38 |
+
th { background: #f1eee6; color: #777; font-size: 0.9rem; font-weight: 500; }
|
| 39 |
+
.word-cell { font-weight: bold; color: var(--accent-color); width: 30%; }
|
| 40 |
+
.path-cell { font-size: 0.75rem; color: #ccc; width: 20%; }
|
| 41 |
+
.variation-row { background: #faf9f6; }
|
| 42 |
|
| 43 |
.card { background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.02); }
|
| 44 |
</style>
|
|
|
|
| 52 |
|
| 53 |
<header>
|
| 54 |
<h1>HUIUCL</h1>
|
| 55 |
+
<div style="color:#999; font-size:0.8rem; margin-top:5px;">v2.0 Revision - Database</div>
|
| 56 |
</header>
|
| 57 |
|
| 58 |
<div class="container">
|
| 59 |
<section id="dictionary" class="active">
|
| 60 |
+
<input type="text" id="searchInput" class="search-box" placeholder="๋จ์ด, ๋ป, ํ์์ด ๊ฒ์..." oninput="renderTable()">
|
| 61 |
+
|
| 62 |
+
<div class="filter-container" id="categoryButtons">
|
| 63 |
+
<button class="filter-btn active" onclick="filterCategory('๋ชจ๋', this)">๋ชจ๋ ๋ณด๊ธฐ</button>
|
| 64 |
+
</div>
|
| 65 |
+
|
| 66 |
<div class="table-wrapper">
|
| 67 |
<table>
|
| 68 |
<thead>
|
| 69 |
<tr>
|
| 70 |
<th>๋จ์ด</th>
|
| 71 |
+
<th>์๋ฏธ</th>
|
| 72 |
+
<th>๋ถ๋ฅ</th>
|
| 73 |
</tr>
|
| 74 |
</thead>
|
| 75 |
<tbody id="dictBody"></tbody>
|
|
|
|
| 79 |
|
| 80 |
<section id="grammar">
|
| 81 |
<div class="card" id="grammarBox">
|
| 82 |
+
<h2>Grammar & Phonology</h2>
|
| 83 |
<div id="settingsContent">๋ฐ์ดํฐ๋ฅผ ๋ถ๋ฌ์ค๋ ์ค...</div>
|
| 84 |
</div>
|
| 85 |
</section>
|
| 86 |
</div>
|
| 87 |
|
| 88 |
<script>
|
| 89 |
+
let conlangData = {};
|
| 90 |
+
let currentCategory = '๋ชจ๋';
|
| 91 |
|
| 92 |
function showSection(id) {
|
| 93 |
document.querySelectorAll('section').forEach(s => s.classList.remove('active'));
|
| 94 |
document.getElementById(id).classList.add('active');
|
| 95 |
}
|
| 96 |
|
|
|
|
| 97 |
window.onload = () => {
|
| 98 |
fetch('Huiucl.json')
|
| 99 |
.then(res => res.json())
|
| 100 |
.then(data => {
|
| 101 |
+
conlangData = data;
|
| 102 |
+
initFilterButtons();
|
| 103 |
renderTable();
|
| 104 |
renderGrammar();
|
| 105 |
})
|
| 106 |
.catch(err => {
|
| 107 |
+
console.error(err);
|
| 108 |
+
document.getElementById('dictBody').innerHTML = '<tr><td colspan="3">๋ฐ์ดํฐ ๋ก๋ ์คํจ (Huiucl.json ํ์ผ์ ํ์ธํ์ธ์)</td></tr>';
|
| 109 |
});
|
| 110 |
};
|
| 111 |
|
| 112 |
+
// ์๋จ ํ์ฌ/์นดํ
๊ณ ๋ฆฌ ๋ฒํผ ์์ฑ
|
| 113 |
+
function initFilterButtons() {
|
| 114 |
+
const btnContainer = document.getElementById('categoryButtons');
|
| 115 |
+
// JSON์ ์ต์์ ํค๋ค์ ๋ฒํผ์ผ๋ก ๋ง๋ฆ (Settings ์ ์ธ)
|
| 116 |
+
Object.keys(conlangData).forEach(key => {
|
| 117 |
+
if (key === "Settings") return;
|
| 118 |
+
const btn = document.createElement('button');
|
| 119 |
+
btn.className = 'filter-btn';
|
| 120 |
+
btn.innerText = key;
|
| 121 |
+
btn.onclick = (e) => filterCategory(key, e.target);
|
| 122 |
+
btnContainer.appendChild(btn);
|
| 123 |
+
});
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
function filterCategory(cat, btn) {
|
| 127 |
+
document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
|
| 128 |
+
btn.classList.add('active');
|
| 129 |
+
currentCategory = cat;
|
| 130 |
+
renderTable();
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
function renderTable() {
|
| 134 |
const query = document.getElementById('searchInput').value.toLowerCase();
|
| 135 |
const body = document.getElementById('dictBody');
|
| 136 |
body.innerHTML = '';
|
| 137 |
|
| 138 |
+
const categories = currentCategory === '๋ชจ๋'
|
| 139 |
+
? Object.keys(conlangData).filter(k => k !== "Settings")
|
| 140 |
+
: [currentCategory];
|
| 141 |
+
|
| 142 |
+
categories.forEach(cat => {
|
| 143 |
+
traverse(conlangData[cat], cat, query);
|
| 144 |
+
});
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
// ๋ฐ์ดํฐ๋ฅผ ๊น๊ฒ ํ์ํ๋ฉฐ ๋จ์ด๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 148 |
+
function traverse(obj, path, query) {
|
| 149 |
+
for (let key in obj) {
|
| 150 |
+
const item = obj[key];
|
| 151 |
+
|
| 152 |
+
// 1. ์ผ๋ฐ ๋จ์ด ๊ตฌ์กฐ (meaning_ko / ๋ป ํ๋ ์กด์ฌ ์)
|
| 153 |
+
if (item && typeof item === 'object' && (item.meaning_ko || item.๋ป)) {
|
| 154 |
+
const kor = item.meaning_ko || item.๋ป;
|
| 155 |
+
const eng = item.meaning_en || '';
|
| 156 |
|
| 157 |
+
if (key.toLowerCase().includes(query) || kor.toLowerCase().includes(query)) {
|
| 158 |
+
appendRow(key, kor, path, false);
|
| 159 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
+
// ํ์์ด ์ฒ๋ฆฌ (derivations ํค ํ์ธ)
|
| 162 |
+
if (item.derivations) {
|
| 163 |
+
for (let dKey in item.derivations) {
|
| 164 |
+
const dMean = item.derivations[dKey];
|
| 165 |
+
if (dKey.toLowerCase().includes(query) || dMean.toLowerCase().includes(query)) {
|
| 166 |
+
appendRow(dKey, dMean, path, true);
|
|
|
|
| 167 |
}
|
| 168 |
}
|
|
|
|
|
|
|
|
|
|
| 169 |
}
|
| 170 |
+
}
|
| 171 |
+
// 2. ํน์ ๋จ์ด (์กฐ์ฌ, ์ ์์ฌ ๋ฑ - ๋จ์ ํค-๊ฐ ์์ธ ๊ฒฝ์ฐ)
|
| 172 |
+
else if (typeof item === 'string') {
|
| 173 |
+
if (key.toLowerCase().includes(query) || item.toLowerCase().includes(query)) {
|
| 174 |
+
appendRow(key, item, path, false);
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
// 3. ํ์ ์นดํ
๊ณ ๋ฆฌ๊ฐ ๋ ์๋ ๊ฒฝ์ฐ (์ฌ๊ท ํ์)
|
| 178 |
+
else if (item && typeof item === 'object') {
|
| 179 |
+
traverse(item, path + " > " + key, query);
|
| 180 |
}
|
| 181 |
}
|
|
|
|
|
|
|
| 182 |
}
|
| 183 |
|
| 184 |
+
function appendRow(word, meaning, path, isSub) {
|
| 185 |
const body = document.getElementById('dictBody');
|
| 186 |
const row = body.insertRow();
|
| 187 |
if (isSub) row.className = 'variation-row';
|
| 188 |
|
| 189 |
row.innerHTML = `
|
| 190 |
<td class="word-cell">${isSub ? 'โ ' : ''}${word}</td>
|
| 191 |
+
<td>${meaning}</td>
|
| 192 |
+
<td class="path-cell">${path}</td>
|
| 193 |
`;
|
| 194 |
}
|
| 195 |
|
| 196 |
function renderGrammar() {
|
| 197 |
const target = document.getElementById('settingsContent');
|
| 198 |
+
if (!conlangData.Settings) return;
|
| 199 |
+
const s = conlangData.Settings;
|
|
|
|
|
|
|
|
|
|
| 200 |
target.innerHTML = `
|
| 201 |
<h3>Phonology</h3>
|
| 202 |
+
<p><strong>Vowels:</strong> ${Object.keys(s.Phonology.Vowels).join(', ')}</p>
|
| 203 |
+
<p><strong>Consonants:</strong> ${Object.keys(s.Phonology.Consonants).join(', ')}</p>
|
| 204 |
+
<hr>
|
| 205 |
<h3>Syntax</h3>
|
| 206 |
+
<p><strong>Word Order:</strong> ${s.Syntax.Word_Order.join(' / ')}</p>
|
| 207 |
<p>${s.Syntax.Imperative["2"]}</p>
|
| 208 |
`;
|
| 209 |
}
|