Spaces:
Running
Running
Update index.html
Browse files- index.html +105 -33
index.html
CHANGED
|
@@ -11,6 +11,7 @@
|
|
| 11 |
--primary-color: #5d5b54; /* ์งํ ํ๊ฐ์ (ํ
์คํธ) */
|
| 12 |
--accent-color: #d4a373; /* ํฌ์ธํธ ์ปฌ๋ฌ (๋ฒ ์ด์ง ๋ธ๋ผ์ด) */
|
| 13 |
--border-color: #e0ddd5;
|
|
|
|
| 14 |
}
|
| 15 |
|
| 16 |
body {
|
|
@@ -35,13 +36,15 @@
|
|
| 35 |
}
|
| 36 |
input[type="text"] {
|
| 37 |
flex: 1;
|
| 38 |
-
padding: 12px
|
| 39 |
border: 1px solid var(--border-color);
|
| 40 |
border-radius: 30px;
|
| 41 |
outline: none;
|
| 42 |
background-color: var(--card-bg);
|
|
|
|
|
|
|
| 43 |
}
|
| 44 |
-
input[type="text"]:focus { border-color: var(--accent-color); }
|
| 45 |
|
| 46 |
/* ์นดํ
๊ณ ๋ฆฌ ๋ฒํผ */
|
| 47 |
.filter-container {
|
|
@@ -50,7 +53,7 @@
|
|
| 50 |
justify-content: center;
|
| 51 |
gap: 8px;
|
| 52 |
margin-bottom: 40px;
|
| 53 |
-
max-width:
|
| 54 |
margin-left: auto;
|
| 55 |
margin-right: auto;
|
| 56 |
}
|
|
@@ -72,48 +75,53 @@
|
|
| 72 |
|
| 73 |
/* ํ
์ด๋ธ ๋์์ธ */
|
| 74 |
.table-wrapper {
|
| 75 |
-
max-width:
|
| 76 |
margin: 0 auto;
|
| 77 |
background: var(--card-bg);
|
| 78 |
border-radius: 15px;
|
| 79 |
overflow: hidden;
|
| 80 |
box-shadow: 0 10px 30px rgba(0,0,0,0.05);
|
| 81 |
}
|
| 82 |
-
table { width: 100%; border-collapse: collapse; }
|
| 83 |
-
th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid var(--bg-color); }
|
| 84 |
th { background: #f1eee6; font-weight: 600; font-size: 0.9rem; color: #777; }
|
| 85 |
tr:last-child td { border-bottom: none; }
|
| 86 |
-
tr:hover { background-color: #fafafa; }
|
| 87 |
|
| 88 |
.word-cell { font-weight: bold; color: var(--accent-color); font-size: 1.1rem; }
|
| 89 |
.path-cell { font-size: 0.75rem; color: #bbb; }
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
</style>
|
| 91 |
</head>
|
| 92 |
<body>
|
| 93 |
|
| 94 |
<header>
|
| 95 |
<h1>HUIUCL</h1>
|
| 96 |
-
<div class="sub-title">์ธ๊ณต์ด ํ์ด์ฐํด ์จ๋ผ์ธ ์ฌ์
|
| 97 |
</header>
|
| 98 |
|
| 99 |
<div class="search-container">
|
| 100 |
-
<input type="text" id="searchInput" placeholder="๋จ์ด
|
| 101 |
</div>
|
| 102 |
|
| 103 |
<div class="filter-container" id="categoryButtons">
|
| 104 |
-
<button onclick="changeCategory('๋ชจ๋')"
|
| 105 |
</div>
|
| 106 |
|
| 107 |
<div class="table-wrapper">
|
| 108 |
<table>
|
| 109 |
<thead>
|
| 110 |
<tr>
|
| 111 |
-
<th style="width:
|
| 112 |
-
<th style="width:
|
| 113 |
<th style="width: 30%;">๋ถ๋ฅ</th>
|
| 114 |
</tr>
|
| 115 |
</thead>
|
| 116 |
-
<tbody id="dictBody">
|
|
|
|
|
|
|
| 117 |
</table>
|
| 118 |
</div>
|
| 119 |
|
|
@@ -128,25 +136,36 @@
|
|
| 128 |
conlangData = data;
|
| 129 |
initButtons();
|
| 130 |
renderTable();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
});
|
| 132 |
|
| 133 |
function initButtons() {
|
| 134 |
const container = document.getElementById('categoryButtons');
|
|
|
|
| 135 |
Object.keys(conlangData).forEach(key => {
|
| 136 |
if (key === "์ค์ ") return;
|
| 137 |
const btn = document.createElement('button');
|
| 138 |
btn.innerText = key;
|
| 139 |
-
btn.onclick = (e) =>
|
| 140 |
-
document.querySelectorAll('button').forEach(b => b.classList.remove('active'));
|
| 141 |
-
e.target.classList.add('active');
|
| 142 |
-
currentCategory = key;
|
| 143 |
-
renderTable();
|
| 144 |
-
};
|
| 145 |
container.appendChild(btn);
|
| 146 |
});
|
| 147 |
}
|
| 148 |
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
function renderTable() {
|
| 151 |
const body = document.getElementById('dictBody');
|
| 152 |
const searchTerm = document.getElementById('searchInput').value.toLowerCase();
|
|
@@ -159,37 +178,90 @@
|
|
| 159 |
targets.forEach(cat => {
|
| 160 |
traverse(conlangData[cat], cat, searchTerm);
|
| 161 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
}
|
| 163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
function traverse(obj, path, search) {
|
| 165 |
for (const key in obj) {
|
| 166 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
const word = key;
|
| 168 |
-
const meaning =
|
| 169 |
|
| 170 |
-
// ๊ฒ์์ด ํํฐ๋ง
|
| 171 |
if (word.toLowerCase().includes(search) || meaning.toLowerCase().includes(search)) {
|
| 172 |
-
addRow(word, meaning, path);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
}
|
| 174 |
-
} else if (typeof obj[key] === 'object' && key !== "๋ณํ") {
|
| 175 |
-
traverse(obj[key], `${path} > ${key}`, search);
|
| 176 |
}
|
| 177 |
}
|
| 178 |
}
|
| 179 |
|
| 180 |
-
function addRow(word, meaning, path) {
|
| 181 |
const body = document.getElementById('dictBody');
|
| 182 |
const row = body.insertRow();
|
|
|
|
|
|
|
| 183 |
row.innerHTML = `
|
| 184 |
-
<td class="word-cell"
|
| 185 |
-
|
|
|
|
|
|
|
| 186 |
<td class="path-cell">${path}</td>
|
| 187 |
`;
|
| 188 |
}
|
| 189 |
-
|
| 190 |
-
function filterData() {
|
| 191 |
-
renderTable();
|
| 192 |
-
}
|
| 193 |
</script>
|
| 194 |
|
| 195 |
</body>
|
|
|
|
| 11 |
--primary-color: #5d5b54; /* ์งํ ํ๊ฐ์ (ํ
์คํธ) */
|
| 12 |
--accent-color: #d4a373; /* ํฌ์ธํธ ์ปฌ๋ฌ (๋ฒ ์ด์ง ๋ธ๋ผ์ด) */
|
| 13 |
--border-color: #e0ddd5;
|
| 14 |
+
--variation-bg: #faf9f6; /* ๋ณํ ๋จ์ด ๋ฐฐ๊ฒฝ์ */
|
| 15 |
}
|
| 16 |
|
| 17 |
body {
|
|
|
|
| 36 |
}
|
| 37 |
input[type="text"] {
|
| 38 |
flex: 1;
|
| 39 |
+
padding: 12px 24px;
|
| 40 |
border: 1px solid var(--border-color);
|
| 41 |
border-radius: 30px;
|
| 42 |
outline: none;
|
| 43 |
background-color: var(--card-bg);
|
| 44 |
+
font-size: 1rem;
|
| 45 |
+
box-shadow: 0 2px 5px rgba(0,0,0,0.02);
|
| 46 |
}
|
| 47 |
+
input[type="text"]:focus { border-color: var(--accent-color); box-shadow: 0 2px 10px rgba(212, 163, 115, 0.2); }
|
| 48 |
|
| 49 |
/* ์นดํ
๊ณ ๋ฆฌ ๋ฒํผ */
|
| 50 |
.filter-container {
|
|
|
|
| 53 |
justify-content: center;
|
| 54 |
gap: 8px;
|
| 55 |
margin-bottom: 40px;
|
| 56 |
+
max-width: 900px;
|
| 57 |
margin-left: auto;
|
| 58 |
margin-right: auto;
|
| 59 |
}
|
|
|
|
| 75 |
|
| 76 |
/* ํ
์ด๋ธ ๋์์ธ */
|
| 77 |
.table-wrapper {
|
| 78 |
+
max-width: 1000px;
|
| 79 |
margin: 0 auto;
|
| 80 |
background: var(--card-bg);
|
| 81 |
border-radius: 15px;
|
| 82 |
overflow: hidden;
|
| 83 |
box-shadow: 0 10px 30px rgba(0,0,0,0.05);
|
| 84 |
}
|
| 85 |
+
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
| 86 |
+
th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid var(--bg-color); overflow: hidden; text-overflow: ellipsis; }
|
| 87 |
th { background: #f1eee6; font-weight: 600; font-size: 0.9rem; color: #777; }
|
| 88 |
tr:last-child td { border-bottom: none; }
|
|
|
|
| 89 |
|
| 90 |
.word-cell { font-weight: bold; color: var(--accent-color); font-size: 1.1rem; }
|
| 91 |
.path-cell { font-size: 0.75rem; color: #bbb; }
|
| 92 |
+
|
| 93 |
+
/* ๋ณํ(Variation) ํ ์คํ์ผ */
|
| 94 |
+
.variation-row { background-color: var(--variation-bg); }
|
| 95 |
+
.variation-icon { color: #ccc; margin-right: 8px; font-weight: normal; }
|
| 96 |
</style>
|
| 97 |
</head>
|
| 98 |
<body>
|
| 99 |
|
| 100 |
<header>
|
| 101 |
<h1>HUIUCL</h1>
|
| 102 |
+
<div class="sub-title">์ธ๊ณต์ด ํ์ด์ฐํด ์จ๋ผ์ธ ์ฌ์ </div>
|
| 103 |
</header>
|
| 104 |
|
| 105 |
<div class="search-container">
|
| 106 |
+
<input type="text" id="searchInput" placeholder="์ฐพ๊ณ ์ถ์ ๋จ์ด๋ ๋ป์ ์
๋ ฅํ์ธ์..." onkeyup="filterData()">
|
| 107 |
</div>
|
| 108 |
|
| 109 |
<div class="filter-container" id="categoryButtons">
|
| 110 |
+
<button onclick="changeCategory('๋ชจ๋', this)" class="active">๋ชจ๋ ๋ณด๊ธฐ</button>
|
| 111 |
</div>
|
| 112 |
|
| 113 |
<div class="table-wrapper">
|
| 114 |
<table>
|
| 115 |
<thead>
|
| 116 |
<tr>
|
| 117 |
+
<th style="width: 35%;">๋จ์ด (Huiucl)</th>
|
| 118 |
+
<th style="width: 35%;">์๋ฏธ (Korean)</th>
|
| 119 |
<th style="width: 30%;">๋ถ๋ฅ</th>
|
| 120 |
</tr>
|
| 121 |
</thead>
|
| 122 |
+
<tbody id="dictBody">
|
| 123 |
+
<tr><td colspan="3" style="text-align:center; padding:50px; color:#ccc;">๋ฐ์ดํฐ๋ฅผ ๋ถ๋ฌ์ค๋ ์ค์
๋๋ค...</td></tr>
|
| 124 |
+
</tbody>
|
| 125 |
</table>
|
| 126 |
</div>
|
| 127 |
|
|
|
|
| 136 |
conlangData = data;
|
| 137 |
initButtons();
|
| 138 |
renderTable();
|
| 139 |
+
})
|
| 140 |
+
.catch(err => {
|
| 141 |
+
console.error("Error loading JSON:", err);
|
| 142 |
+
document.getElementById('dictBody').innerHTML = '<tr><td colspan="3" style="text-align:center; color:red; padding:50px;">๋ฐ์ดํฐ ๋ก๋ ์คํจ (CORS ์ ์ฑ
ํน์ ํ์ผ๋ช
์ ํ์ธํ์ธ์)</td></tr>';
|
| 143 |
});
|
| 144 |
|
| 145 |
function initButtons() {
|
| 146 |
const container = document.getElementById('categoryButtons');
|
| 147 |
+
// '์ค์ '์ ์ ์ธํ ์ต์์ ํค๋ค๋ก ๋ฒํผ ์์ฑ
|
| 148 |
Object.keys(conlangData).forEach(key => {
|
| 149 |
if (key === "์ค์ ") return;
|
| 150 |
const btn = document.createElement('button');
|
| 151 |
btn.innerText = key;
|
| 152 |
+
btn.onclick = (e) => changeCategory(key, e.target);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
container.appendChild(btn);
|
| 154 |
});
|
| 155 |
}
|
| 156 |
|
| 157 |
+
function changeCategory(key, target) {
|
| 158 |
+
document.querySelectorAll('button').forEach(b => b.classList.remove('active'));
|
| 159 |
+
target.classList.add('active');
|
| 160 |
+
currentCategory = key;
|
| 161 |
+
renderTable();
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
function filterData() {
|
| 165 |
+
renderTable();
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
// ํ
์ด๋ธ ๋ ๋๋ง ํจ์
|
| 169 |
function renderTable() {
|
| 170 |
const body = document.getElementById('dictBody');
|
| 171 |
const searchTerm = document.getElementById('searchInput').value.toLowerCase();
|
|
|
|
| 178 |
targets.forEach(cat => {
|
| 179 |
traverse(conlangData[cat], cat, searchTerm);
|
| 180 |
});
|
| 181 |
+
|
| 182 |
+
if (body.innerHTML === '') {
|
| 183 |
+
body.innerHTML = '<tr><td colspan="3" style="text-align:center; padding:50px; color:#999;">๊ฒ์ ๊ฒฐ๊ณผ๊ฐ ์์ต๋๋ค.</td></tr>';
|
| 184 |
+
}
|
| 185 |
}
|
| 186 |
|
| 187 |
+
/**
|
| 188 |
+
* ๋ฐ์ดํฐ๋ฅผ ์ฌ๊ท์ ์ผ๋ก ํ์ํ๋ ํจ์
|
| 189 |
+
* @param {Object} obj - ํ์ํ ๊ฐ์ฒด
|
| 190 |
+
* @param {String} path - ํ์ฌ ์นดํ
๊ณ ๋ฆฌ ๊ฒฝ๋ก
|
| 191 |
+
* @param {String} search - ๊ฒ์์ด
|
| 192 |
+
*/
|
| 193 |
function traverse(obj, path, search) {
|
| 194 |
for (const key in obj) {
|
| 195 |
+
if (key === "์ค์ " || key === "๋ณํ") continue;
|
| 196 |
+
|
| 197 |
+
const item = obj[key];
|
| 198 |
+
|
| 199 |
+
// Case A: ์ง์ "๋ป"์ ๊ฐ์ง ๊ฐ์ฒด์ธ ๊ฒฝ์ฐ
|
| 200 |
+
if (item && typeof item === 'object' && item.hasOwnProperty('๋ป')) {
|
| 201 |
const word = key;
|
| 202 |
+
const meaning = item.๋ป;
|
| 203 |
|
|
|
|
| 204 |
if (word.toLowerCase().includes(search) || meaning.toLowerCase().includes(search)) {
|
| 205 |
+
addRow(word, meaning, path, false);
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
// ๋จ์ด ๋ด๋ถ์ ๋์ผํ ์ด๋ฆ์ '๋ณํ ๊ฐ์ฒด'๊ฐ ์๋์ง ํ์ธ (์: sachi ์์ sachi)
|
| 209 |
+
if (item[key] && typeof item[key] === 'object') {
|
| 210 |
+
processVariations(item[key], `${path} > ${key}`, search);
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
// Case B: ๊ฐ์ด ๋จ์ ๋ฌธ์์ด์ธ ๊ฒฝ์ฐ (๋จ์ด: ๋ป)
|
| 214 |
+
else if (typeof item === 'string') {
|
| 215 |
+
if (key.toLowerCase().includes(search) || item.toLowerCase().includes(search)) {
|
| 216 |
+
addRow(key, item, path, false);
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
// Case C: ํ์ ์นดํ
๊ณ ๋ฆฌ ๊ฐ์ฒด์ธ ๊ฒฝ์ฐ (๋ป์ด ์๊ณ ๋ค๋ฅธ ๊ฐ์ฒด๋ค์ ํฌํจ)
|
| 220 |
+
else if (typeof item === 'object') {
|
| 221 |
+
traverse(item, `${path} > ${key}`, search);
|
| 222 |
+
}
|
| 223 |
+
}
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
/**
|
| 227 |
+
* ๋ณํ(Variation) ๋ฐ์ดํฐ๋ฅผ ์ฒ๋ฆฌํ๋ ํจ์ (์ค์ฒฉ๋ li henna ๋ฑ ๋์)
|
| 228 |
+
*/
|
| 229 |
+
function processVariations(vObj, path, search) {
|
| 230 |
+
for (const vKey in vObj) {
|
| 231 |
+
const vVal = vObj[vKey];
|
| 232 |
+
|
| 233 |
+
if (typeof vVal === 'string') {
|
| 234 |
+
if (vKey.toLowerCase().includes(search) || vVal.toLowerCase().includes(search)) {
|
| 235 |
+
addRow(vKey, vVal, path, true);
|
| 236 |
+
}
|
| 237 |
+
} else if (vVal && typeof vVal === 'object') {
|
| 238 |
+
// ๋ณํ ๋ด๋ถ์ ๋ ๋ป๊ณผ ๊ฐ์ฒด๊ฐ ์๋ ๊ฒฝ์ฐ (์: li henna)
|
| 239 |
+
if (vVal.๋ป) {
|
| 240 |
+
if (vKey.toLowerCase().includes(search) || vVal.๋ป.toLowerCase().includes(search)) {
|
| 241 |
+
addRow(vKey, vVal.๋ป, path, true);
|
| 242 |
+
}
|
| 243 |
+
// ๋ ๊น์ ๋ณํ์ด ์๋ค๋ฉด ์ฌ๊ท ํธ์ถ
|
| 244 |
+
if (vVal[vKey]) processVariations(vVal[vKey], `${path} > ${vKey}`, search);
|
| 245 |
+
} else {
|
| 246 |
+
processVariations(vVal, path, search);
|
| 247 |
}
|
|
|
|
|
|
|
| 248 |
}
|
| 249 |
}
|
| 250 |
}
|
| 251 |
|
| 252 |
+
function addRow(word, meaning, path, isVariation) {
|
| 253 |
const body = document.getElementById('dictBody');
|
| 254 |
const row = body.insertRow();
|
| 255 |
+
if (isVariation) row.className = 'variation-row';
|
| 256 |
+
|
| 257 |
row.innerHTML = `
|
| 258 |
+
<td class="word-cell" style="${isVariation ? 'padding-left: 40px; color: #999; font-size: 0.95rem;' : ''}">
|
| 259 |
+
${isVariation ? '<span class="variation-icon">โณ</span>' : ''}${word}
|
| 260 |
+
</td>
|
| 261 |
+
<td style="${isVariation ? 'color: #777;' : ''}">${meaning}</td>
|
| 262 |
<td class="path-cell">${path}</td>
|
| 263 |
`;
|
| 264 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
</script>
|
| 266 |
|
| 267 |
</body>
|