Spaces:
Running
Running
Update index.html
Browse files- index.html +41 -47
index.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
| 25 |
.word-cell { font-weight: bold; color: var(--accent-color); width: 25%; }
|
| 26 |
.meaning-cell { width: 55%; font-size: 0.95rem; }
|
| 27 |
.path-cell { font-size: 0.7rem; color: #bbb; width: 20%; text-align: right; }
|
| 28 |
-
.usage-
|
| 29 |
</style>
|
| 30 |
</head>
|
| 31 |
<body>
|
|
@@ -37,19 +37,19 @@
|
|
| 37 |
|
| 38 |
<header>
|
| 39 |
<h1>HUIUCL</h1>
|
| 40 |
-
<div style="color:#999; font-size:0.8rem; margin-top:5px;">DATABASE v2.
|
| 41 |
</header>
|
| 42 |
|
| 43 |
<div class="container">
|
| 44 |
<section id="dictionary" class="active">
|
| 45 |
-
<input type="text" id="searchInput" class="search-box" placeholder="๋จ์ด, ๋ป
|
| 46 |
<div class="filter-container" id="categoryButtons">
|
| 47 |
<button class="filter-btn active" onclick="filterCategory('๋ชจ๋', this)">๋ชจ๋ ๋ณด๊ธฐ</button>
|
| 48 |
</div>
|
| 49 |
<div class="table-wrapper">
|
| 50 |
<table>
|
| 51 |
<thead>
|
| 52 |
-
<tr><th>๋จ์ด</th><th>์๋ฏธ ๋ฐ ์ค๋ช
</th><th style="text-align:right;">๋ถ๋ฅ</th></tr>
|
| 53 |
</thead>
|
| 54 |
<tbody id="dictBody"></tbody>
|
| 55 |
</table>
|
|
@@ -99,60 +99,54 @@
|
|
| 99 |
const query = document.getElementById('searchInput').value.toLowerCase();
|
| 100 |
const body = document.getElementById('dictBody');
|
| 101 |
body.innerHTML = '';
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
? Object.keys(conlangData).filter(k => k !== "Settings")
|
| 105 |
-
: [currentCategory];
|
| 106 |
-
|
| 107 |
-
categories.forEach(cat => {
|
| 108 |
-
manualProcess(conlangData[cat], cat, query);
|
| 109 |
-
});
|
| 110 |
}
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
if (path.includes("Grammar_Rules")) return;
|
| 115 |
|
| 116 |
for (let key in obj) {
|
| 117 |
const val = obj[key];
|
| 118 |
if (!val) continue;
|
| 119 |
|
| 120 |
-
//
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
let kor = val.meaning_ko || val.ko || val.๋ป || val.definition || "";
|
| 124 |
-
let eng = val.meaning_en || val.en || "";
|
| 125 |
-
let extra = val.usage || val.note || "";
|
| 126 |
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
| 130 |
|
| 131 |
-
//
|
| 132 |
-
if (
|
| 133 |
-
|
| 134 |
-
appendRow(
|
| 135 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
}
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
if (val.tense_variants) {
|
| 140 |
-
manualProcess(val.tense_variants, path + " > " + key, query);
|
| 141 |
-
}
|
| 142 |
-
}
|
| 143 |
-
// 2. [๋จ์ ํค-๊ฐ] - ๋๋ช
์ฌ, ์ธ์ฌ๋ง ๋ฑ (key: "string")
|
| 144 |
else if (typeof val === 'string') {
|
| 145 |
if (key.toLowerCase().includes(query) || val.toLowerCase().includes(query)) {
|
| 146 |
appendRow(key, val, "", "", path);
|
| 147 |
}
|
| 148 |
}
|
| 149 |
-
// 3. [์กฐ์ฌ/์ ์ฌ ๊ตฌ์กฐ] - ํค ๋ด๋ถ์ ๋ ์ค๋ช
์ด ์๊ฑฐ๋, ๋ฌถ์ฌ ์๋ ๊ฒฝ์ฐ
|
| 150 |
-
else if (typeof val === 'object') {
|
| 151 |
-
// ํน์ ํค(usage, note, definition) ์์ฒด๊ฐ ๋จ์ด๋ก ๋จ์ง ์๋๋ก ํํฐ๋งํ๋ฉฐ ์ฌ๊ท ํ์
|
| 152 |
-
if (!["usage", "note", "definition", "tense_variants"].includes(key)) {
|
| 153 |
-
manualProcess(val, path + " > " + key, query);
|
| 154 |
-
}
|
| 155 |
-
}
|
| 156 |
}
|
| 157 |
}
|
| 158 |
|
|
@@ -161,13 +155,13 @@
|
|
| 161 |
const row = body.insertRow();
|
| 162 |
if (isSub) row.className = 'variation-row';
|
| 163 |
|
| 164 |
-
let
|
| 165 |
-
if (eng)
|
| 166 |
-
if (usage)
|
| 167 |
|
| 168 |
row.innerHTML = `
|
| 169 |
<td class="word-cell">${isSub ? 'โ ' : ''}${word}</td>
|
| 170 |
-
<td class="meaning-cell">${
|
| 171 |
<td class="path-cell">${path}</td>
|
| 172 |
`;
|
| 173 |
}
|
|
@@ -190,7 +184,7 @@
|
|
| 190 |
}
|
| 191 |
}
|
| 192 |
findRules(conlangData, "");
|
| 193 |
-
target.innerHTML = html
|
| 194 |
}
|
| 195 |
</script>
|
| 196 |
</body>
|
|
|
|
| 25 |
.word-cell { font-weight: bold; color: var(--accent-color); width: 25%; }
|
| 26 |
.meaning-cell { width: 55%; font-size: 0.95rem; }
|
| 27 |
.path-cell { font-size: 0.7rem; color: #bbb; width: 20%; text-align: right; }
|
| 28 |
+
.usage-text { font-size: 0.85rem; color: #7a7a7a; background: #fcfcfc; border-left: 3px solid var(--accent-color); padding: 5px 10px; margin-top: 8px; }
|
| 29 |
</style>
|
| 30 |
</head>
|
| 31 |
<body>
|
|
|
|
| 37 |
|
| 38 |
<header>
|
| 39 |
<h1>HUIUCL</h1>
|
| 40 |
+
<div style="color:#999; font-size:0.8rem; margin-top:5px;">DATABASE v2.8 (Strict Object Handing)</div>
|
| 41 |
</header>
|
| 42 |
|
| 43 |
<div class="container">
|
| 44 |
<section id="dictionary" class="active">
|
| 45 |
+
<input type="text" id="searchInput" class="search-box" placeholder="๋จ์ด, ๋ป ๊ฒ์..." oninput="renderTable()">
|
| 46 |
<div class="filter-container" id="categoryButtons">
|
| 47 |
<button class="filter-btn active" onclick="filterCategory('๋ชจ๋', this)">๋ชจ๋ ๋ณด๊ธฐ</button>
|
| 48 |
</div>
|
| 49 |
<div class="table-wrapper">
|
| 50 |
<table>
|
| 51 |
<thead>
|
| 52 |
+
<tr><th>๋จ์ด</th><th>์๋ฏธ ๋ฐ ์์ธ ์ค๋ช
</th><th style="text-align:right;">๋ถ๋ฅ</th></tr>
|
| 53 |
</thead>
|
| 54 |
<tbody id="dictBody"></tbody>
|
| 55 |
</table>
|
|
|
|
| 99 |
const query = document.getElementById('searchInput').value.toLowerCase();
|
| 100 |
const body = document.getElementById('dictBody');
|
| 101 |
body.innerHTML = '';
|
| 102 |
+
const cats = currentCategory === '๋ชจ๋' ? Object.keys(conlangData).filter(k => k !== "Settings") : [currentCategory];
|
| 103 |
+
cats.forEach(cat => strictProcess(conlangData[cat], cat, query));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
}
|
| 105 |
|
| 106 |
+
function strictProcess(obj, path, query) {
|
| 107 |
+
// ๋ฌธ๋ฒ ๊ท์น ์ ์ธ
|
| 108 |
+
if (path.includes("Grammar_Rules")) return;
|
| 109 |
|
| 110 |
for (let key in obj) {
|
| 111 |
const val = obj[key];
|
| 112 |
if (!val) continue;
|
| 113 |
|
| 114 |
+
// ์ถ๋ ฅ ์ ์ธ ์์ฝ์ด
|
| 115 |
+
const skipKeys = ["usage", "note", "definition", "tense_variants", "ko", "en"];
|
| 116 |
+
if (skipKeys.includes(key)) continue;
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
+
// 1. ๋จ์ด ์ ๋ณด๊ฐ ๋ด๊ธด ๊ฐ์ฒด์ธ ๊ฒฝ์ฐ
|
| 119 |
+
if (typeof val === 'object') {
|
| 120 |
+
const kor = val.meaning_ko || val.ko || val.๋ป || val.definition || "";
|
| 121 |
+
const eng = val.meaning_en || val.en || "";
|
| 122 |
+
const usage = val.usage || val.note || "";
|
| 123 |
|
| 124 |
+
// ํ๊ตญ์ด ๋ป์ด๋ ์๋ฌธ ํค์ ์ ๋ณด๊ฐ ์๋ '์ง์ง ๋จ์ด'์ธ ๊ฒฝ์ฐ ์ถ๋ ฅ
|
| 125 |
+
if (kor || eng) {
|
| 126 |
+
if (key.toLowerCase().includes(query) || (typeof kor === 'string' && kor.includes(query))) {
|
| 127 |
+
appendRow(key, kor, eng, usage, path);
|
| 128 |
}
|
| 129 |
+
|
| 130 |
+
// ํ์์ด ์ฒ๋ฆฌ
|
| 131 |
+
if (val.derivations) {
|
| 132 |
+
for (let dKey in val.derivations) {
|
| 133 |
+
appendRow(dKey, val.derivations[dKey], "", "", path, true);
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
// ์์ ๋ณํ์ด ์๋ค๋ฉด ๋ด๋ถ ํ์
|
| 137 |
+
if (val.tense_variants) strictProcess(val.tense_variants, path + " > " + key, query);
|
| 138 |
+
}
|
| 139 |
+
// ํ์ ๋ฐ์ดํฐ๊ฐ ๋ ์๋ค๋ฉด ์ฌ๊ท ํ์
|
| 140 |
+
else {
|
| 141 |
+
strictProcess(val, path + " > " + key, query);
|
| 142 |
}
|
| 143 |
+
}
|
| 144 |
+
// 2. ๋๋ช
์ฌ/์ธ์ฌ๋ง ๋ฑ ๋จ์ ๋ฌธ์์ด์ธ ๊ฒฝ์ฐ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
else if (typeof val === 'string') {
|
| 146 |
if (key.toLowerCase().includes(query) || val.toLowerCase().includes(query)) {
|
| 147 |
appendRow(key, val, "", "", path);
|
| 148 |
}
|
| 149 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
}
|
| 151 |
}
|
| 152 |
|
|
|
|
| 155 |
const row = body.insertRow();
|
| 156 |
if (isSub) row.className = 'variation-row';
|
| 157 |
|
| 158 |
+
let content = `<strong>${typeof kor === 'object' ? JSON.stringify(kor) : kor}</strong>`;
|
| 159 |
+
if (eng) content += ` <span style="color:#888;">(${eng})</span>`;
|
| 160 |
+
if (usage) content += `<div class="usage-text">โป ${usage}</div>`;
|
| 161 |
|
| 162 |
row.innerHTML = `
|
| 163 |
<td class="word-cell">${isSub ? 'โ ' : ''}${word}</td>
|
| 164 |
+
<td class="meaning-cell">${content}</td>
|
| 165 |
<td class="path-cell">${path}</td>
|
| 166 |
`;
|
| 167 |
}
|
|
|
|
| 184 |
}
|
| 185 |
}
|
| 186 |
findRules(conlangData, "");
|
| 187 |
+
target.innerHTML = html;
|
| 188 |
}
|
| 189 |
</script>
|
| 190 |
</body>
|