Spaces:
Running
Running
Update index.html
Browse files- index.html +69 -74
index.html
CHANGED
|
@@ -21,26 +21,21 @@
|
|
| 21 |
|
| 22 |
.container { max-width: 1000px; margin: 0 auto; padding: 0 20px 100px; }
|
| 23 |
section { display: none; }
|
| 24 |
-
section.active { display: block;
|
| 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;
|
| 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;
|
| 39 |
-
|
| 40 |
-
.
|
| 41 |
-
.
|
| 42 |
-
|
| 43 |
-
.card { background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.02); }
|
| 44 |
</style>
|
| 45 |
</head>
|
| 46 |
<body>
|
|
@@ -52,25 +47,19 @@
|
|
| 52 |
|
| 53 |
<header>
|
| 54 |
<h1>HUIUCL</h1>
|
| 55 |
-
<div style="color:#999; font-size:0.8rem; margin-top:5px;">v2.
|
| 56 |
</header>
|
| 57 |
|
| 58 |
<div class="container">
|
| 59 |
<section id="dictionary" class="active">
|
| 60 |
-
<input type="text" id="searchInput" class="search-box" placeholder="
|
| 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>
|
| 76 |
</table>
|
|
@@ -78,10 +67,7 @@
|
|
| 78 |
</section>
|
| 79 |
|
| 80 |
<section id="grammar">
|
| 81 |
-
<div
|
| 82 |
-
<h2>Grammar & Phonology</h2>
|
| 83 |
-
<div id="settingsContent">๋ฐ์ดํฐ๋ฅผ ๋ถ๋ฌ์ค๋ ์ค...</div>
|
| 84 |
-
</div>
|
| 85 |
</section>
|
| 86 |
</div>
|
| 87 |
|
|
@@ -101,18 +87,12 @@
|
|
| 101 |
conlangData = data;
|
| 102 |
initFilterButtons();
|
| 103 |
renderTable();
|
| 104 |
-
|
| 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');
|
|
@@ -140,43 +120,45 @@
|
|
| 140 |
: [currentCategory];
|
| 141 |
|
| 142 |
categories.forEach(cat => {
|
| 143 |
-
|
| 144 |
});
|
| 145 |
}
|
| 146 |
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
| 149 |
for (let key in obj) {
|
| 150 |
const item = obj[key];
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
const
|
| 156 |
-
|
| 157 |
-
if (key.toLowerCase().includes(query) ||
|
| 158 |
-
appendRow(key,
|
| 159 |
}
|
| 160 |
-
|
| 161 |
-
// ํ์์ด ์ฒ๋ฆฌ (derivations ํค ํ์ธ)
|
| 162 |
if (item.derivations) {
|
| 163 |
for (let dKey in item.derivations) {
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
appendRow(dKey, dMean, path, true);
|
| 167 |
}
|
| 168 |
}
|
| 169 |
}
|
| 170 |
}
|
| 171 |
-
// 2.
|
| 172 |
-
else if (
|
| 173 |
-
|
| 174 |
-
|
|
|
|
|
|
|
| 175 |
}
|
| 176 |
}
|
| 177 |
-
// 3.
|
| 178 |
-
else
|
| 179 |
-
|
| 180 |
}
|
| 181 |
}
|
| 182 |
}
|
|
@@ -185,27 +167,40 @@
|
|
| 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
|
| 197 |
-
const target = document.getElementById('
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
<
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
<
|
| 208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
}
|
| 210 |
</script>
|
| 211 |
</body>
|
|
|
|
| 21 |
|
| 22 |
.container { max-width: 1000px; margin: 0 auto; padding: 0 20px 100px; }
|
| 23 |
section { display: none; }
|
| 24 |
+
section.active { display: block; }
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
.filter-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 25px; }
|
| 27 |
+
.filter-btn { background: var(--card-bg); border: 1px solid var(--border-color); padding: 8px 16px; cursor: pointer; border-radius: 20px; font-size: 0.85rem; }
|
| 28 |
.filter-btn.active { background: var(--accent-color); color: white; border-color: var(--accent-color); }
|
| 29 |
|
|
|
|
| 30 |
.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; }
|
| 31 |
.table-wrapper { background: white; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
|
| 32 |
table { width: 100%; border-collapse: collapse; }
|
| 33 |
th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid #eee; }
|
| 34 |
+
th { background: #f1eee6; color: #777; font-size: 0.9rem; }
|
| 35 |
+
|
| 36 |
+
.word-cell { font-weight: bold; color: var(--accent-color); width: 25%; }
|
| 37 |
+
.path-cell { font-size: 0.7rem; color: #bbb; width: 20%; }
|
| 38 |
+
.variation-row { background: #faf9f6; color: #666; }
|
|
|
|
| 39 |
</style>
|
| 40 |
</head>
|
| 41 |
<body>
|
|
|
|
| 47 |
|
| 48 |
<header>
|
| 49 |
<h1>HUIUCL</h1>
|
| 50 |
+
<div style="color:#999; font-size:0.8rem; margin-top:5px;">DATABASE v2.1 (Fixed)</div>
|
| 51 |
</header>
|
| 52 |
|
| 53 |
<div class="container">
|
| 54 |
<section id="dictionary" class="active">
|
| 55 |
+
<input type="text" id="searchInput" class="search-box" placeholder="๊ฒ์์ด๋ฅผ ์
๋ ฅํ์ธ์..." oninput="renderTable()">
|
|
|
|
| 56 |
<div class="filter-container" id="categoryButtons">
|
| 57 |
<button class="filter-btn active" onclick="filterCategory('๋ชจ๋', this)">๋ชจ๋ ๋ณด๊ธฐ</button>
|
| 58 |
</div>
|
|
|
|
| 59 |
<div class="table-wrapper">
|
| 60 |
<table>
|
| 61 |
<thead>
|
| 62 |
+
<tr><th>๋จ์ด</th><th>์๋ฏธ (KO/EN)</th><th>๋ถ๋ฅ</th></tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
</thead>
|
| 64 |
<tbody id="dictBody"></tbody>
|
| 65 |
</table>
|
|
|
|
| 67 |
</section>
|
| 68 |
|
| 69 |
<section id="grammar">
|
| 70 |
+
<div id="grammarContent"></div>
|
|
|
|
|
|
|
|
|
|
| 71 |
</section>
|
| 72 |
</div>
|
| 73 |
|
|
|
|
| 87 |
conlangData = data;
|
| 88 |
initFilterButtons();
|
| 89 |
renderTable();
|
| 90 |
+
renderGrammarPage();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
});
|
| 92 |
};
|
| 93 |
|
|
|
|
| 94 |
function initFilterButtons() {
|
| 95 |
const btnContainer = document.getElementById('categoryButtons');
|
|
|
|
| 96 |
Object.keys(conlangData).forEach(key => {
|
| 97 |
if (key === "Settings") return;
|
| 98 |
const btn = document.createElement('button');
|
|
|
|
| 120 |
: [currentCategory];
|
| 121 |
|
| 122 |
categories.forEach(cat => {
|
| 123 |
+
extractWords(conlangData[cat], cat, query);
|
| 124 |
});
|
| 125 |
}
|
| 126 |
|
| 127 |
+
function extractWords(obj, path, query) {
|
| 128 |
+
// ๋ฌธ๋ฒ ๊ท์น(Grammar_Rules)์ ์ฌ์ ๋ก๋์์ ์ ์ธ
|
| 129 |
+
if (path.includes("Grammar_Rules")) return;
|
| 130 |
+
|
| 131 |
for (let key in obj) {
|
| 132 |
const item = obj[key];
|
| 133 |
+
if (!item || typeof item !== 'object') continue;
|
| 134 |
+
|
| 135 |
+
// 1. ํ์ค ๋จ์ด (meaning_ko ๊ฐ ์ง์ ์๋ ๊ฒฝ์ฐ)
|
| 136 |
+
if (item.meaning_ko || item.๋ป) {
|
| 137 |
+
const ko = item.meaning_ko || item.๋ป;
|
| 138 |
+
const en = item.meaning_en || "";
|
| 139 |
+
if (key.toLowerCase().includes(query) || ko.includes(query)) {
|
| 140 |
+
appendRow(key, `${ko} / ${en}`, path);
|
| 141 |
}
|
| 142 |
+
// ํ์์ด ์ฒ๋ฆฌ
|
|
|
|
| 143 |
if (item.derivations) {
|
| 144 |
for (let dKey in item.derivations) {
|
| 145 |
+
if (dKey.toLowerCase().includes(query) || item.derivations[dKey].includes(query)) {
|
| 146 |
+
appendRow(dKey, item.derivations[dKey], path, true);
|
|
|
|
| 147 |
}
|
| 148 |
}
|
| 149 |
}
|
| 150 |
}
|
| 151 |
+
// 2. ์กฐ๋์ฌ/์ ์์ฌ ๋ฑ ko, en ํค๊ฐ ํ์์ ์๋ ํน์ ๊ตฌ์กฐ
|
| 152 |
+
else if (item.ko || item.en) {
|
| 153 |
+
const ko = item.ko || "";
|
| 154 |
+
const en = item.en || "";
|
| 155 |
+
if (key.toLowerCase().includes(query) || ko.includes(query)) {
|
| 156 |
+
appendRow(key, `${ko} / ${en}`, path);
|
| 157 |
}
|
| 158 |
}
|
| 159 |
+
// 3. ๋ ๊น์ ๊ณ์ธต ํ์
|
| 160 |
+
else {
|
| 161 |
+
extractWords(item, path + " > " + key, query);
|
| 162 |
}
|
| 163 |
}
|
| 164 |
}
|
|
|
|
| 167 |
const body = document.getElementById('dictBody');
|
| 168 |
const row = body.insertRow();
|
| 169 |
if (isSub) row.className = 'variation-row';
|
| 170 |
+
row.innerHTML = `<td class="word-cell">${isSub ? 'โ ' : ''}${word}</td><td>${meaning}</td><td class="path-cell">${path}</td>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
}
|
| 172 |
|
| 173 |
+
function renderGrammarPage() {
|
| 174 |
+
const target = document.getElementById('grammarContent');
|
| 175 |
+
let html = "";
|
| 176 |
+
|
| 177 |
+
// Settings ๋ก๋
|
| 178 |
+
if (conlangData.Settings) {
|
| 179 |
+
const s = conlangData.Settings;
|
| 180 |
+
html += `<div style="background:white; padding:30px; border-radius:15px; margin-bottom:20px;">
|
| 181 |
+
<h2>Basic Settings</h2>
|
| 182 |
+
<p><strong>Order:</strong> ${s.Syntax.Word_Order.join(', ')}</p>
|
| 183 |
+
<p><strong>Imperative:</strong> ${s.Syntax.Imperative["2"]}</p>
|
| 184 |
+
</div>`;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// ์ฌ์ ์์ ์ ์ธ๋ Grammar_Rules๋ฅผ ์ฌ๊ธฐ์ ๋ฐ๋ก ์ถ๋ ฅ
|
| 188 |
+
function findRules(obj, path) {
|
| 189 |
+
for (let key in obj) {
|
| 190 |
+
if (key === "Grammar_Rules") {
|
| 191 |
+
html += `<div style="background:white; padding:30px; border-radius:15px; margin-bottom:20px;">
|
| 192 |
+
<h3>${path} Rules</h3>`;
|
| 193 |
+
for (let rKey in obj[key]) {
|
| 194 |
+
html += `<p><strong>${rKey}:</strong> ${obj[key][rKey]}</p>`;
|
| 195 |
+
}
|
| 196 |
+
html += `</div>`;
|
| 197 |
+
} else if (typeof obj[key] === 'object') {
|
| 198 |
+
findRules(obj[key], path + " > " + key);
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
}
|
| 202 |
+
findRules(conlangData, "");
|
| 203 |
+
target.innerHTML = html;
|
| 204 |
}
|
| 205 |
</script>
|
| 206 |
</body>
|