Spaces:
Running
Running
Update index.html
Browse files- index.html +107 -148
index.html
CHANGED
|
@@ -2,191 +2,150 @@
|
|
| 2 |
<html lang="ko">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<
|
| 6 |
-
<title>HUIUCL Database v3.0</title>
|
| 7 |
<style>
|
| 8 |
-
:root { --bg: #
|
| 9 |
-
body { font-family:
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
.
|
| 18 |
-
.
|
| 19 |
-
.
|
| 20 |
-
.
|
| 21 |
-
.table-wrapper { background: white; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
|
| 22 |
-
table { width: 100%; border-collapse: collapse; }
|
| 23 |
-
th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid #eee; }
|
| 24 |
-
th { background: #f1eee6; color: #777; font-size: 0.85rem; }
|
| 25 |
-
.word-cell { font-weight: bold; color: var(--accent); width: 25%; font-size: 1.1rem; }
|
| 26 |
-
.meaning-cell { width: 55%; }
|
| 27 |
-
.path-cell { font-size: 0.7rem; color: #bbb; width: 20%; text-align: right; }
|
| 28 |
-
.desc-box { background: #fafafa; border-left: 3px solid var(--accent); padding: 8px 12px; margin-top: 10px; font-size: 0.85rem; color: #666; }
|
| 29 |
-
.tag { display: inline-block; background: #eee; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; margin-right: 5px; color: #555; }
|
| 30 |
</style>
|
| 31 |
</head>
|
| 32 |
<body>
|
| 33 |
|
| 34 |
-
<nav>
|
| 35 |
-
<a onclick="showSection('dictionary')">DICTIONARY</a>
|
| 36 |
-
<a onclick="showSection('grammar')">GRAMMAR</a>
|
| 37 |
-
</nav>
|
| 38 |
-
|
| 39 |
-
<header>
|
| 40 |
-
<h1>HUIUCL</h1>
|
| 41 |
-
<div style="color:#999; font-size:0.85rem; margin-top:5px;">DATABASE v3.0 FINAL REVISION</div>
|
| 42 |
-
</header>
|
| 43 |
-
|
| 44 |
<div class="container">
|
| 45 |
-
<
|
| 46 |
-
|
| 47 |
-
<
|
| 48 |
-
<
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
</section>
|
| 59 |
-
<section id="grammar"><div id="grammarContent"></div></section>
|
| 60 |
</div>
|
| 61 |
|
| 62 |
<script>
|
| 63 |
-
let
|
| 64 |
-
let currentCat = '๋ชจ๋';
|
| 65 |
-
|
| 66 |
-
function showSection(id) {
|
| 67 |
-
document.querySelectorAll('section').forEach(s => s.classList.remove('active'));
|
| 68 |
-
document.getElementById(id).classList.add('active');
|
| 69 |
-
}
|
| 70 |
|
| 71 |
window.onload = () => {
|
| 72 |
-
fetch('Huiucl.json')
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
};
|
| 79 |
|
| 80 |
-
function
|
| 81 |
-
const container = document.getElementById('categoryButtons');
|
| 82 |
-
Object.keys(db).forEach(key => {
|
| 83 |
-
if (key === "Settings") return;
|
| 84 |
-
const btn = document.createElement('button');
|
| 85 |
-
btn.className = 'filter-btn';
|
| 86 |
-
btn.innerText = key;
|
| 87 |
-
btn.onclick = (e) => {
|
| 88 |
-
document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
|
| 89 |
-
e.target.classList.add('active');
|
| 90 |
-
currentCat = key;
|
| 91 |
-
renderTable();
|
| 92 |
-
};
|
| 93 |
-
container.appendChild(btn);
|
| 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 |
-
function
|
| 107 |
if (path.includes("Grammar_Rules")) return;
|
| 108 |
|
| 109 |
-
for (
|
| 110 |
const val = obj[key];
|
| 111 |
if (!val) continue;
|
| 112 |
|
| 113 |
-
// 1.
|
| 114 |
-
if (typeof val === '
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
const note = val.usage || val.note || "";
|
| 118 |
-
|
| 119 |
-
if (key.toLowerCase().includes(query) || (typeof ko === 'string' && ko.includes(query))) {
|
| 120 |
-
addRow(key, ko, en, note, path);
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
if (val.derivations) {
|
| 124 |
-
for (let dKey in val.derivations) {
|
| 125 |
-
addRow(dKey, val.derivations[dKey], "", "", path, true);
|
| 126 |
-
}
|
| 127 |
}
|
| 128 |
-
if (val.tense_variants) parseData(val.tense_variants, path + " > " + key, query);
|
| 129 |
}
|
| 130 |
-
// 2.
|
| 131 |
-
else if (typeof val === '
|
| 132 |
-
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
}
|
| 135 |
}
|
| 136 |
-
// 3. ์ค์ฒฉ ๊ฐ์ฒด (์ฌ๊ท - ๋จ, ๋ฐ์ดํฐ์ฉ ํค๋ ์ ์ธ)
|
| 137 |
-
else if (typeof val === 'object' && !["usage", "note", "definition", "tense_variants"].includes(key)) {
|
| 138 |
-
parseData(val, path + " > " + key, query);
|
| 139 |
-
}
|
| 140 |
}
|
| 141 |
}
|
| 142 |
|
| 143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
const body = document.getElementById('dictBody');
|
| 145 |
const row = body.insertRow();
|
| 146 |
-
if (isSub) row.className = '
|
| 147 |
-
|
| 148 |
-
let meaningHtml = `<div
|
| 149 |
-
if (en) meaningHtml += `<div style="color:#
|
| 150 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
row.innerHTML = `
|
| 153 |
-
<td class="word-cell">${isSub ? '
|
| 154 |
-
<td
|
| 155 |
<td class="path-cell">${path}</td>
|
| 156 |
`;
|
| 157 |
}
|
| 158 |
-
|
| 159 |
-
function renderGrammar() {
|
| 160 |
-
const target = document.getElementById('grammarContent');
|
| 161 |
-
let html = "";
|
| 162 |
-
|
| 163 |
-
// Settings ์ถ๋ ฅ
|
| 164 |
-
if (db.Settings) {
|
| 165 |
-
html += `<div style="background:white; padding:30px; border-radius:15px; margin-bottom:20px; border:1px solid var(--border);">
|
| 166 |
-
<h2 style="margin-top:0; color:var(--accent);">Basic Phonology & Syntax</h2>
|
| 167 |
-
<p><strong>์ด์:</strong> ${db.Settings.Syntax.Word_Order.join(' / ')}</p>
|
| 168 |
-
<p><strong>Vowels:</strong> ${Object.keys(db.Settings.Phonology.Vowels).join(', ')}</p>
|
| 169 |
-
<p><strong>Consonants:</strong> ${Object.keys(db.Settings.Phonology.Consonants).join(', ')}</p>
|
| 170 |
-
</div>`;
|
| 171 |
-
}
|
| 172 |
-
|
| 173 |
-
function collectRules(obj, path) {
|
| 174 |
-
for (let k in obj) {
|
| 175 |
-
if (k === "Grammar_Rules") {
|
| 176 |
-
html += `<div style="background:white; padding:30px; border-radius:15px; margin-bottom:20px; border:1px solid var(--border);">
|
| 177 |
-
<h3 style="margin-top:0; color:var(--accent);">${path} Rules</h3>`;
|
| 178 |
-
for (let rule in obj[k]) {
|
| 179 |
-
html += `<p style="margin:8px 0; border-bottom:1px solid #f9f9f9; padding-bottom:5px;"><strong>${rule}:</strong> ${obj[k][rule]}</p>`;
|
| 180 |
-
}
|
| 181 |
-
html += `</div>`;
|
| 182 |
-
} else if (typeof obj[k] === 'object' && k !== "Settings") {
|
| 183 |
-
collectRules(obj[k], path ? path + " > " + k : k);
|
| 184 |
-
}
|
| 185 |
-
}
|
| 186 |
-
}
|
| 187 |
-
collectRules(db, "");
|
| 188 |
-
target.innerHTML = html;
|
| 189 |
-
}
|
| 190 |
</script>
|
|
|
|
| 191 |
</body>
|
| 192 |
</html>
|
|
|
|
| 2 |
<html lang="ko">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<title>HUIUCL Database Final</title>
|
|
|
|
| 6 |
<style>
|
| 7 |
+
:root { --bg: #f4f1ea; --card: #ffffff; --accent: #8b7355; --text: #333; }
|
| 8 |
+
body { font-family: sans-serif; background: var(--bg); color: var(--text); padding: 20px; }
|
| 9 |
+
.container { max-width: 1200px; margin: 0 auto; }
|
| 10 |
+
.search-box { width: 100%; padding: 15px; margin-bottom: 20px; border: 2px solid #ddd; border-radius: 8px; font-size: 1.1rem; }
|
| 11 |
+
.table-wrapper { background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); overflow: hidden; }
|
| 12 |
+
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
| 13 |
+
th, td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; word-break: break-all; }
|
| 14 |
+
th { background: #f8f8f8; font-weight: bold; border-bottom: 2px solid #ddd; }
|
| 15 |
+
.word-cell { font-weight: bold; color: var(--accent); width: 20%; font-size: 1.1rem; }
|
| 16 |
+
.path-cell { font-size: 0.8rem; color: #999; width: 20%; }
|
| 17 |
+
.usage-tag { background: #f0f0f0; padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; color: #666; display: block; margin-top: 5px; }
|
| 18 |
+
.meaning-item { margin-bottom: 4px; }
|
| 19 |
+
.sub-row { background: #fafafa; font-size: 0.9rem; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
</style>
|
| 21 |
</head>
|
| 22 |
<body>
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
<div class="container">
|
| 25 |
+
<input type="text" id="searchInput" class="search-box" placeholder="๋จ์ด, ๋ป, ๋ถ๋ฅ ๊ฒ์..." oninput="render()">
|
| 26 |
+
<div class="table-wrapper">
|
| 27 |
+
<table>
|
| 28 |
+
<thead>
|
| 29 |
+
<tr>
|
| 30 |
+
<th style="width:20%">๋จ์ด (Word)</th>
|
| 31 |
+
<th style="width:60%">์๋ฏธ ๋ฐ ์ฉ๋ฒ</th>
|
| 32 |
+
<th style="width:20%">๋ถ๋ฅ</th>
|
| 33 |
+
</tr>
|
| 34 |
+
</thead>
|
| 35 |
+
<tbody id="dictBody"></tbody>
|
| 36 |
+
</table>
|
| 37 |
+
</div>
|
|
|
|
|
|
|
| 38 |
</div>
|
| 39 |
|
| 40 |
<script>
|
| 41 |
+
let rawData = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
window.onload = () => {
|
| 44 |
+
fetch('Huiucl.json')
|
| 45 |
+
.then(res => res.json())
|
| 46 |
+
.then(data => {
|
| 47 |
+
rawData = data;
|
| 48 |
+
render();
|
| 49 |
+
});
|
| 50 |
};
|
| 51 |
|
| 52 |
+
function render() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
const query = document.getElementById('searchInput').value.toLowerCase();
|
| 54 |
const body = document.getElementById('dictBody');
|
| 55 |
body.innerHTML = '';
|
| 56 |
+
|
| 57 |
+
// ๋ชจ๋ ์นดํ
๊ณ ๋ฆฌ ์ํ (Settings ์ ์ธ)
|
| 58 |
+
for (const cat in rawData) {
|
| 59 |
+
if (cat === "Settings") continue;
|
| 60 |
+
extract(rawData[cat], cat, query);
|
| 61 |
+
}
|
| 62 |
}
|
| 63 |
|
| 64 |
+
function extract(obj, path, query) {
|
| 65 |
if (path.includes("Grammar_Rules")) return;
|
| 66 |
|
| 67 |
+
for (const key in obj) {
|
| 68 |
const val = obj[key];
|
| 69 |
if (!val) continue;
|
| 70 |
|
| 71 |
+
// 1. ๋ฌธ์์ด์ธ ๊ฒฝ์ฐ (๋จ์ ๋๋ช
์ฌ, ์ธ์ฌ๋ง ๋ฑ)
|
| 72 |
+
if (typeof val === 'string') {
|
| 73 |
+
if (isMatch(key, val, path, query)) {
|
| 74 |
+
appendRow(key, val, "", "", path);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
}
|
|
|
|
| 76 |
}
|
| 77 |
+
// 2. ๊ฐ์ฒด์ธ ๊ฒฝ์ฐ (๋จ์ด ์ ๋ณด ํฌํจ)
|
| 78 |
+
else if (typeof val === 'object') {
|
| 79 |
+
// ์ด ๊ฐ์ฒด๊ฐ '๋จ์ด ์ ๋ณด'๋ฅผ ๋ด๊ณ ์๋์ง ํ์ธ
|
| 80 |
+
const info = getWordInfo(val);
|
| 81 |
+
|
| 82 |
+
if (info.hasData) {
|
| 83 |
+
if (isMatch(key, info.ko + info.en + info.usage, path, query)) {
|
| 84 |
+
appendRow(key, info.ko, info.en, info.usage, path);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
// ํ์์ด ์ฒ๋ฆฌ
|
| 88 |
+
if (val.derivations) {
|
| 89 |
+
for (const dKey in val.derivations) {
|
| 90 |
+
appendRow(dKey, val.derivations[dKey], "", "", path, true);
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
// ์์ ๋ณํ ๋ฑ ํ์ ๋ฐ์ดํฐ๊ฐ ๋ ์๋ค๋ฉด ํ์ (๋จ, ๋ฐ์ดํฐ ํค๋ ์ ์ธ)
|
| 94 |
+
for (const subKey in val) {
|
| 95 |
+
if (!["meaning_ko", "meaning_en", "ko", "en", "definition", "usage", "note", "derivations"].includes(subKey)) {
|
| 96 |
+
extract({ [subKey]: val[subKey] }, path + " > " + key, query);
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
} else {
|
| 100 |
+
// ๋จ์ด ๋ฐ์ดํฐ๊ฐ ์๋๋ฉด ๋ ๊น๊ฒ ํ์
|
| 101 |
+
extract(val, path + " > " + key, query);
|
| 102 |
}
|
| 103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
}
|
| 105 |
}
|
| 106 |
|
| 107 |
+
// ๊ฐ์ฒด ์์์ ํ๊ธ ๋ป, ์์ด ๋ป, ์ฌ์ฉ๋ฒ์ ๊ธ์ด๋ชจ์ผ๋ ํจ์
|
| 108 |
+
function getWordInfo(obj) {
|
| 109 |
+
let info = {
|
| 110 |
+
ko: obj.meaning_ko || obj.ko || obj.๋ป || obj.definition || "",
|
| 111 |
+
en: obj.meaning_en || obj.en || "",
|
| 112 |
+
usage: obj.usage || obj.note || "",
|
| 113 |
+
hasData: false
|
| 114 |
+
};
|
| 115 |
+
|
| 116 |
+
// ko๋ definition์ด ๋ ๊ฐ์ฒด์ธ ๊ฒฝ์ฐ (์๋ฌ ๋ฐฉ์ง)
|
| 117 |
+
if (typeof info.ko === 'object') info.ko = info.ko.ko || info.ko.meaning_ko || JSON.stringify(info.ko);
|
| 118 |
+
if (typeof info.en === 'object') info.en = info.en.en || info.en.meaning_en || "";
|
| 119 |
+
|
| 120 |
+
if (info.ko || info.en || info.usage) info.hasData = true;
|
| 121 |
+
return info;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
function isMatch(word, content, path, query) {
|
| 125 |
+
const target = (word + content + path).toLowerCase();
|
| 126 |
+
return target.includes(query);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
function appendRow(word, ko, en, usage, path, isSub) {
|
| 130 |
const body = document.getElementById('dictBody');
|
| 131 |
const row = body.insertRow();
|
| 132 |
+
if (isSub) row.className = 'sub-row';
|
| 133 |
+
|
| 134 |
+
let meaningHtml = `<div class="meaning-item"><strong>${ko}</strong></div>`;
|
| 135 |
+
if (en) meaningHtml += `<div class="meaning-item" style="color: #666;">${en}</div>`;
|
| 136 |
+
if (usage) {
|
| 137 |
+
// usage๊ฐ ๊ฐ์ฒด์ธ ๊ฒฝ์ฐ ๋์
|
| 138 |
+
const usageText = typeof usage === 'object' ? JSON.stringify(usage) : usage;
|
| 139 |
+
meaningHtml += `<div class="usage-tag">โป ${usageText}</div>`;
|
| 140 |
+
}
|
| 141 |
|
| 142 |
row.innerHTML = `
|
| 143 |
+
<td class="word-cell">${isSub ? 'โ ' : ''}${word}</td>
|
| 144 |
+
<td>${meaningHtml}</td>
|
| 145 |
<td class="path-cell">${path}</td>
|
| 146 |
`;
|
| 147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
</script>
|
| 149 |
+
|
| 150 |
</body>
|
| 151 |
</html>
|