Spaces:
Running
Running
Update index.html
Browse files- index.html +162 -198
index.html
CHANGED
|
@@ -2,234 +2,198 @@
|
|
| 2 |
<html lang="ko">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<title>
|
| 6 |
<style>
|
| 7 |
-
:root {
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
.nav-container { max-width: 1100px; margin: 0 auto; display: flex; justify-content: center; gap: 40px; }
|
| 21 |
-
nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 0.9rem; letter-spacing: 2px; cursor: pointer; opacity: 0.7; transition: 0.3s; }
|
| 22 |
-
nav a:hover, nav a.active { opacity: 1; color: var(--accent); }
|
| 23 |
-
|
| 24 |
-
/* Header */
|
| 25 |
-
header { background: #fff; padding: 60px 20px; text-align: center; border-bottom: 1px solid var(--border); }
|
| 26 |
-
h1 { margin: 0; letter-spacing: 12px; font-weight: 200; color: var(--primary); font-size: 2.5rem; }
|
| 27 |
-
.sub-header { color: var(--secondary); font-size: 0.8rem; margin-top: 15px; letter-spacing: 3px; text-transform: uppercase; }
|
| 28 |
-
|
| 29 |
-
.container { max-width: 1100px; margin: 40px auto; padding: 0 20px; }
|
| 30 |
|
| 31 |
-
|
| 32 |
-
.search-box { width: 100%; padding: 20px 30px; border: 1px solid var(--border); border-radius: 40px; font-size: 1.1rem; box-sizing: border-box; outline: none; background: #fff; box-shadow: 0 5px 20px rgba(0,0,0,0.03); transition: 0.3s; margin-bottom: 30px; }
|
| 33 |
-
.search-box:focus { border-color: var(--accent); box-shadow: 0 5px 25px rgba(166, 139, 106, 0.15); }
|
| 34 |
-
|
| 35 |
-
.table-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.04); border: 1px solid var(--border); }
|
| 36 |
-
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
| 37 |
-
th { background: #faf9f7; padding: 20px; text-align: left; font-size: 0.75rem; color: #999; letter-spacing: 1px; border-bottom: 2px solid var(--border); }
|
| 38 |
-
td { padding: 20px; border-bottom: 1px solid var(--border); vertical-align: top; word-break: break-all; }
|
| 39 |
-
|
| 40 |
-
.word-cell { width: 25%; font-size: 1.2rem; font-weight: 700; color: var(--primary); }
|
| 41 |
-
.meaning-cell { width: 55%; }
|
| 42 |
-
.path-cell { width: 20%; text-align: right; font-size: 0.7rem; color: #bbb; text-transform: uppercase; }
|
| 43 |
-
|
| 44 |
-
.ko-text { font-size: 1.1rem; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
|
| 45 |
-
.en-text { font-size: 0.95rem; color: var(--secondary); }
|
| 46 |
-
.usage-box { margin-top: 12px; padding: 12px; background: #fdfcfb; border: 1px solid #f0eee9; border-left: 4px solid var(--accent); font-size: 0.85rem; color: #555; }
|
| 47 |
|
| 48 |
-
|
| 49 |
-
.
|
| 50 |
-
.
|
| 51 |
-
|
| 52 |
-
.
|
| 53 |
-
.
|
| 54 |
-
.
|
| 55 |
-
|
| 56 |
-
section {
|
| 57 |
-
|
| 58 |
-
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
|
| 59 |
</style>
|
| 60 |
</head>
|
| 61 |
<body>
|
| 62 |
|
| 63 |
-
<
|
| 64 |
-
<div class="
|
| 65 |
-
<
|
| 66 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
</div>
|
| 68 |
-
</nav>
|
| 69 |
|
| 70 |
-
<
|
| 71 |
-
|
| 72 |
-
<
|
| 73 |
-
</header>
|
| 74 |
|
| 75 |
-
<div
|
| 76 |
-
<
|
| 77 |
-
<input type="text" id="searchInput" class="search-box" placeholder="Search words, meanings, or categories..." oninput="render()">
|
| 78 |
-
<div class="table-card">
|
| 79 |
-
<table>
|
| 80 |
-
<thead>
|
| 81 |
-
<tr>
|
| 82 |
-
<th>WORD</th>
|
| 83 |
-
<th>MEANING & USAGE</th>
|
| 84 |
-
<th style="text-align:right">CATEGORY</th>
|
| 85 |
-
</tr>
|
| 86 |
-
</thead>
|
| 87 |
-
<tbody id="dictBody"></tbody>
|
| 88 |
-
</table>
|
| 89 |
-
</div>
|
| 90 |
-
</section>
|
| 91 |
-
|
| 92 |
-
<section id="grammar">
|
| 93 |
-
<div id="grammarContent" class="grammar-grid">
|
| 94 |
-
</div>
|
| 95 |
-
</section>
|
| 96 |
</div>
|
| 97 |
|
| 98 |
<script>
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
.
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
const body = document.getElementById('dictBody');
|
| 122 |
-
body.innerHTML = '';
|
| 123 |
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
|
|
|
| 127 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
-
|
| 131 |
-
if (
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
const val = obj[key];
|
| 135 |
-
if (!val) continue;
|
| 136 |
-
|
| 137 |
-
const info = getInfo(key, val);
|
| 138 |
-
|
| 139 |
-
if (info.isWord) {
|
| 140 |
-
if ((info.word + info.ko + info.en + path).toLowerCase().includes(query)) {
|
| 141 |
-
appendRow(info, path);
|
| 142 |
-
}
|
| 143 |
-
// 파생어 처리
|
| 144 |
-
if (val.derivations) {
|
| 145 |
-
for (const dk in val.derivations) {
|
| 146 |
-
appendRow({ word: dk, ko: val.derivations[dk], en: "", usage: "" }, path, true);
|
| 147 |
-
}
|
| 148 |
-
}
|
| 149 |
-
// 시제 변형 등 내부 재귀
|
| 150 |
-
if (typeof val === 'object' && val.tense_variants) {
|
| 151 |
-
processCategory(val.tense_variants, path + " > " + key, query);
|
| 152 |
-
}
|
| 153 |
-
} else if (typeof val === 'object') {
|
| 154 |
-
processCategory(val, path + " > " + key, query);
|
| 155 |
-
}
|
| 156 |
}
|
| 157 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
res.isWord = true;
|
| 164 |
-
res.ko = val;
|
| 165 |
-
} else if (typeof val === 'object') {
|
| 166 |
-
// morpheme 키가 있으면 그것을 단어로 취급
|
| 167 |
-
if (val.morpheme) res.word = val.morpheme;
|
| 168 |
-
|
| 169 |
-
res.ko = val.meaning_ko || val.ko || val.뜻 || val.definition || "";
|
| 170 |
-
res.en = val.meaning_en || val.en || "";
|
| 171 |
-
res.usage = val.usage || val.note || "";
|
| 172 |
-
|
| 173 |
-
// 객체 안의 객체 에러 방지 (강제 문자열화)
|
| 174 |
-
const clean = (v) => (typeof v === 'object' ? (v.ko || v.meaning_ko || v.en || JSON.stringify(v)) : v);
|
| 175 |
-
res.ko = clean(res.ko);
|
| 176 |
-
res.en = clean(res.en);
|
| 177 |
-
res.usage = clean(res.usage);
|
| 178 |
-
|
| 179 |
-
if (res.ko || res.en) res.isWord = true;
|
| 180 |
}
|
| 181 |
-
return res;
|
| 182 |
}
|
| 183 |
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
if (isSub) row.style.background = "#fcfcfc";
|
| 188 |
-
|
| 189 |
-
let meaningHtml = `<div class="ko-text">${info.ko}</div>`;
|
| 190 |
-
if (info.en) meaningHtml += `<div class="en-text">${info.en}</div>`;
|
| 191 |
-
if (info.usage) meaningHtml += `<div class="usage-box"><strong>NOTE:</strong> ${info.usage}</div>`;
|
| 192 |
-
|
| 193 |
-
row.innerHTML = `
|
| 194 |
-
<td class="word-cell" style="${isSub ? 'padding-left:40px; font-size:1rem; opacity:0.7;' : ''}">
|
| 195 |
-
${isSub ? '↳ ' : ''}${info.word}
|
| 196 |
-
</td>
|
| 197 |
-
<td class="meaning-cell">${meaningHtml}</td>
|
| 198 |
-
<td class="path-cell">${path}</td>
|
| 199 |
-
`;
|
| 200 |
-
}
|
| 201 |
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
| 214 |
}
|
| 215 |
|
| 216 |
-
//
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
}
|
| 224 |
-
html += `</div>`;
|
| 225 |
-
} else if (typeof obj[key] === 'object' && key !== "Settings") {
|
| 226 |
-
collect(obj[key], path ? path + " > " + key : key);
|
| 227 |
-
}
|
| 228 |
-
}
|
| 229 |
}
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
</script>
|
| 234 |
</body>
|
| 235 |
</html>
|
|
|
|
| 2 |
<html lang="ko">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<title>Huiucl Precision Dictionary v2</title>
|
| 6 |
<style>
|
| 7 |
+
:root { --primary: #2c3e50; --accent: #e67e22; --bg: #f0f2f5; --card: #ffffff; }
|
| 8 |
+
body { font-family: 'Malgun Gothic', sans-serif; background: var(--bg); padding: 30px; color: var(--primary); line-height: 1.6; }
|
| 9 |
+
.container { max-width: 1000px; margin: 0 auto; }
|
| 10 |
+
|
| 11 |
+
/* 헤더 및 파일 로더 */
|
| 12 |
+
.header { background: var(--primary); color: white; padding: 20px; border-radius: 12px; margin-bottom: 20px; text-align: center; }
|
| 13 |
+
.file-upload { background: #fff; padding: 15px; border-radius: 8px; border: 2px dashed #bdc3c7; margin-bottom: 20px; text-align: center; }
|
| 14 |
+
|
| 15 |
+
/* 검색창 */
|
| 16 |
+
.search-area { position: sticky; top: 10px; z-index: 100; background: var(--bg); padding-bottom: 10px; }
|
| 17 |
+
.search-box { width: 100%; padding: 18px; font-size: 20px; border: 3px solid #ddd; border-radius: 10px; box-sizing: border-box; outline: none; transition: border-color 0.3s; }
|
| 18 |
+
.search-box:focus { border-color: var(--accent); }
|
| 19 |
+
.search-box:disabled { background: #eee; cursor: not-allowed; }
|
| 20 |
+
|
| 21 |
+
/* 결과 아이템 */
|
| 22 |
+
.result-item { background: var(--card); border-radius: 12px; padding: 30px; margin-bottom: 25px; box-shadow: 0 5px 15px rgba(0,0,0,0.08); position: relative; }
|
| 23 |
+
.exact-match { border: 3px solid var(--accent); }
|
| 24 |
+
.exact-badge { position: absolute; top: -15px; right: 20px; background: var(--accent); color: white; padding: 5px 15px; border-radius: 20px; font-weight: bold; font-size: 13px; }
|
| 25 |
|
| 26 |
+
.word-title { font-size: 28px; font-weight: 800; color: #2980b9; margin: 0 0 10px 0; border-bottom: 2px solid #eee; padding-bottom: 5px; }
|
| 27 |
+
.category { font-size: 13px; color: #7f8c8d; background: #ecf0f1; padding: 3px 10px; border-radius: 5px; margin-left: 10px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
.meaning-section { font-size: 19px; margin: 15px 0; font-weight: 500; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
|
| 32 |
+
.data-box { background: #f8f9fa; padding: 15px; border-radius: 8px; border: 1px solid #e9ecef; }
|
| 33 |
+
.box-title { font-weight: bold; font-size: 14px; color: #34495e; margin-bottom: 10px; border-left: 4px solid #3498db; padding-left: 8px; }
|
| 34 |
+
|
| 35 |
+
.info-list { list-style: none; padding: 0; margin: 0; font-size: 14px; }
|
| 36 |
+
.info-list li { margin-bottom: 5px; }
|
| 37 |
+
.key-text { font-weight: bold; color: #2c3e50; width: 100px; display: inline-block; }
|
| 38 |
+
|
| 39 |
+
.desc-section { margin-top: 15px; font-size: 14px; color: #555; border-top: 1px solid #eee; padding-top: 15px; }
|
| 40 |
+
.hidden-search-tag { display: none; } /* 검색엔 안걸리지만 보여주기만 함 */
|
|
|
|
| 41 |
</style>
|
| 42 |
</head>
|
| 43 |
<body>
|
| 44 |
|
| 45 |
+
<div class="container">
|
| 46 |
+
<div class="header">
|
| 47 |
+
<h1>Huiucl Precision Search Engine</h1>
|
| 48 |
+
<p>조사, 대명사, 파생어를 예문 간섭 없이 정밀하게 찾아줍니다.</p>
|
| 49 |
+
</div>
|
| 50 |
+
|
| 51 |
+
<div class="file-upload">
|
| 52 |
+
<strong>1. JSON 파일 로드:</strong>
|
| 53 |
+
<input type="file" id="fileInput" accept=".json">
|
| 54 |
</div>
|
|
|
|
| 55 |
|
| 56 |
+
<div class="search-area">
|
| 57 |
+
<input type="text" id="searchInput" class="search-box" placeholder="파일을 먼저 로드해주세요..." disabled onkeyup="doSearch()">
|
| 58 |
+
</div>
|
|
|
|
| 59 |
|
| 60 |
+
<div id="status" style="margin-bottom: 15px; font-weight: bold; color: #2980b9;"></div>
|
| 61 |
+
<div id="results"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
</div>
|
| 63 |
|
| 64 |
<script>
|
| 65 |
+
let lexicon = {};
|
| 66 |
+
|
| 67 |
+
// [로드 기능] 파일 읽기
|
| 68 |
+
document.getElementById('fileInput').addEventListener('change', function(e) {
|
| 69 |
+
const file = e.target.files[0];
|
| 70 |
+
if (!file) return;
|
| 71 |
+
|
| 72 |
+
const reader = new FileReader();
|
| 73 |
+
reader.onload = function(e) {
|
| 74 |
+
try {
|
| 75 |
+
const jsonData = JSON.parse(e.target.result);
|
| 76 |
+
processData(jsonData);
|
| 77 |
+
document.getElementById('searchInput').disabled = false;
|
| 78 |
+
document.getElementById('searchInput').placeholder = "단어 또는 뜻을 입력하세요 (예: su, a, 관찰)...";
|
| 79 |
+
document.getElementById('status').innerText = `✅ 로드 완료: ${Object.keys(lexicon).length}개의 항목을 인덱싱했습니다.`;
|
| 80 |
+
} catch (err) {
|
| 81 |
+
alert("JSON 파싱 중 오류가 발생했습니다: " + err.message);
|
| 82 |
+
}
|
| 83 |
};
|
| 84 |
+
reader.readAsText(file);
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
// [데이터 가공] 정밀 인덱싱
|
| 88 |
+
function processData(obj, parentKey = null, currentCat = null) {
|
| 89 |
+
if (typeof obj !== 'object' || obj === null) return;
|
| 90 |
+
|
| 91 |
+
// 대명사 섹션 특수 처리
|
| 92 |
+
const pronounSects = ["1st_Person", "2nd_Person", "3rd_Person", "Demonstratives"];
|
| 93 |
+
if (pronounSects.includes(parentKey)) {
|
| 94 |
+
for (const [pKey, pVal] of Object.entries(obj)) {
|
| 95 |
+
lexicon[pKey] = {
|
| 96 |
+
meaning_ko: pVal,
|
| 97 |
+
_category: `Pronouns (${parentKey})`,
|
| 98 |
+
_search_target: `${pKey} ${pVal}`.toLowerCase() // 단어와 뜻만 검색
|
| 99 |
+
};
|
| 100 |
+
}
|
| 101 |
+
return;
|
| 102 |
+
}
|
| 103 |
|
| 104 |
+
const meaningKeys = ['meaning_ko', 'ko', 'definition', 'morpheme', 'meaning_en', 'en'];
|
| 105 |
+
const hasMeaning = meaningKeys.some(k => k in obj);
|
|
|
|
|
|
|
| 106 |
|
| 107 |
+
if (hasMeaning && parentKey) {
|
| 108 |
+
let entry = { ...obj };
|
| 109 |
+
if (entry.definition && typeof entry.definition === 'object') {
|
| 110 |
+
Object.assign(entry, entry.definition);
|
| 111 |
}
|
| 112 |
+
|
| 113 |
+
// [정밀 검색 설정] 단어명과 뜻만 검색 대상에 포함 (usage, example 제외)
|
| 114 |
+
let searchParts = [parentKey];
|
| 115 |
+
meaningKeys.forEach(k => { if (entry[k]) searchParts.push(entry[k]); });
|
| 116 |
+
|
| 117 |
+
entry._category = currentCat;
|
| 118 |
+
entry._search_target = searchParts.join(" ").toLowerCase();
|
| 119 |
+
lexicon[parentKey] = entry;
|
| 120 |
}
|
| 121 |
|
| 122 |
+
for (const [k, v] of Object.entries(obj)) {
|
| 123 |
+
if (typeof v === 'object') {
|
| 124 |
+
const nextCat = (parentKey === null) ? k : currentCat;
|
| 125 |
+
if (k !== 'Settings') processData(v, k, nextCat);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
}
|
| 127 |
}
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
// [검색 기능] 정밀 매칭
|
| 131 |
+
function doSearch() {
|
| 132 |
+
const query = document.getElementById('searchInput').value.trim().toLowerCase();
|
| 133 |
+
const resultsArea = document.getElementById('results');
|
| 134 |
+
resultsArea.innerHTML = '';
|
| 135 |
+
|
| 136 |
+
if (!query) return;
|
| 137 |
+
|
| 138 |
+
let results = [];
|
| 139 |
+
// 한 글자 검색 시에도 정확도를 유지하기 위한 독립 단어 경계 체크용
|
| 140 |
+
const regex = new RegExp(`(^|[^a-zA-Z가-힣])${query}($|[^a-zA-Z가-힣])`, 'i');
|
| 141 |
+
|
| 142 |
+
for (const [word, info] of Object.entries(lexicon)) {
|
| 143 |
+
const wordLower = word.toLowerCase();
|
| 144 |
+
const searchTarget = info._search_target || "";
|
| 145 |
|
| 146 |
+
if (query === wordLower) {
|
| 147 |
+
results.push({ word, info, score: 2 }); // 완전 일치
|
| 148 |
+
} else if (regex.test(searchTarget) || (query.length > 1 && searchTarget.includes(query))) {
|
| 149 |
+
results.push({ word, info, score: 1 }); // 스마트 일치
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
}
|
|
|
|
| 151 |
}
|
| 152 |
|
| 153 |
+
results.sort((a, b) => b.score - a.score);
|
| 154 |
+
render(results);
|
| 155 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
+
function render(items) {
|
| 158 |
+
const area = document.getElementById('results');
|
| 159 |
+
items.forEach(item => {
|
| 160 |
+
const info = item.info;
|
| 161 |
+
const div = document.createElement('div');
|
| 162 |
+
div.className = `result-item ${item.score === 2 ? 'exact-match' : ''}`;
|
| 163 |
+
|
| 164 |
+
let subHtml = "";
|
| 165 |
+
|
| 166 |
+
// 파생어
|
| 167 |
+
const derivs = info.derivations || info.derivation;
|
| 168 |
+
if (derivs) {
|
| 169 |
+
subHtml += `<div class="data-box"><div class="box-title">📂 기록된 파생어</div><ul class="info-list">`;
|
| 170 |
+
for(const [dw, dm] of Object.entries(derivs)) subHtml += `<li><span class="deriv-word">${dw}</span> : ${dm}</li>`;
|
| 171 |
+
subHtml += `</ul></div>`;
|
| 172 |
}
|
| 173 |
|
| 174 |
+
// 변이형
|
| 175 |
+
let vars = {};
|
| 176 |
+
["tense_variants", "aspect_voice", "variants"].forEach(k => { if(info[k]) Object.assign(vars, info[k]); });
|
| 177 |
+
if (Object.keys(vars).length > 0) {
|
| 178 |
+
subHtml += `<div class="data-box"><div class="box-title">📂 시제 및 변이</div><ul class="info-list">`;
|
| 179 |
+
for(const [vw, vi] of Object.entries(vars)) subHtml += `<li><span class="deriv-word">${vw}</span> : ${vi.meaning_ko || vi.ko || ''}</li>`;
|
| 180 |
+
subHtml += `</ul></div>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
}
|
| 182 |
+
|
| 183 |
+
div.innerHTML = `
|
| 184 |
+
${item.score === 2 ? '<div class="exact-badge">정확한 일치</div>' : ''}
|
| 185 |
+
<h2 class="word-title">${item.word.toUpperCase()} <span class="category">${info._category}</span></h2>
|
| 186 |
+
<div class="meaning-section">${info.meaning_ko || info.ko || info.morpheme || ''} | <span style="color:#7f8c8d">${info.meaning_en || info.en || ''}</span></div>
|
| 187 |
+
<div class="data-grid">${subHtml}</div>
|
| 188 |
+
<div class="desc-section">
|
| 189 |
+
${info.usage ? `<div><span class="detail-label">📝 용법:</span> ${typeof info.usage === 'object' ? info.usage.ko : info.usage}</div>` : ''}
|
| 190 |
+
${info.note ? `<div><span class="detail-label">💡 참고:</span> ${info.note}</div>` : ''}
|
| 191 |
+
${info.example ? `<div style="margin-top:8px; color:#2980b9;"><span class="detail-label">📖 예문:</span> ${info.example}</div>` : ''}
|
| 192 |
+
</div>
|
| 193 |
+
`;
|
| 194 |
+
area.appendChild(div);
|
| 195 |
+
});
|
| 196 |
+
}
|
| 197 |
</script>
|
| 198 |
</body>
|
| 199 |
</html>
|