Spaces:
Running
Running
Update index.html
Browse files- index.html +85 -84
index.html
CHANGED
|
@@ -2,57 +2,62 @@
|
|
| 2 |
<html lang="ko">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<title>Huiucl
|
| 6 |
<style>
|
| 7 |
:root { --primary: #2c3e50; --accent: #e67e22; --bg: #f8f9fa; --card: #ffffff; }
|
| 8 |
-
body { font-family: 'Malgun Gothic', sans-serif; background: var(--bg); padding: 20px; color: var(--primary); }
|
| 9 |
.container { max-width: 900px; margin: 0 auto; }
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
/* ν€λ μΉμ
*/
|
| 12 |
-
.header-panel { background: var(--primary); color: white; padding:
|
|
|
|
| 13 |
|
| 14 |
/* κ²μμ°½ */
|
| 15 |
.search-container { position: sticky; top: 15px; z-index: 1000; margin-bottom: 30px; }
|
| 16 |
-
.search-input { width: 100%; padding:
|
| 17 |
-
.search-input:focus { border-color: var(--accent); }
|
| 18 |
|
| 19 |
/* κ²°κ³Ό μΉ΄λ */
|
| 20 |
-
.card { background: var(--card); border-radius:
|
|
|
|
| 21 |
.card.exact { border-left-color: var(--accent); }
|
| 22 |
|
| 23 |
-
.
|
| 24 |
-
.badge {
|
| 25 |
-
.badge-
|
| 26 |
-
.badge-exact { background: var(--accent); color: white; margin-left: 5px; }
|
| 27 |
|
| 28 |
-
.word-row { display: flex; align-items: baseline; gap:
|
| 29 |
-
.word-text { font-size:
|
| 30 |
-
.meaning-
|
| 31 |
-
.meaning-en { color: #
|
| 32 |
-
|
| 33 |
-
/*
|
| 34 |
-
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(
|
| 35 |
-
.data-
|
| 36 |
-
.
|
| 37 |
-
.item-row { display: flex; font-size:
|
| 38 |
-
.item-key { font-weight: bold; width:
|
| 39 |
|
| 40 |
/* μμΈ μ 보 (κ²μ μ μΈ κ΅¬μ) */
|
| 41 |
-
.
|
| 42 |
-
.
|
| 43 |
-
.label { font-weight: bold; color: #
|
|
|
|
| 44 |
</style>
|
| 45 |
</head>
|
| 46 |
<body>
|
| 47 |
|
| 48 |
<div class="container">
|
| 49 |
<div class="header-panel">
|
| 50 |
-
<h1
|
| 51 |
-
<
|
| 52 |
</div>
|
| 53 |
|
| 54 |
<div class="search-container">
|
| 55 |
-
<input type="text" id="query" class="search-input" placeholder="
|
| 56 |
</div>
|
| 57 |
|
| 58 |
<div id="results"></div>
|
|
@@ -61,123 +66,119 @@
|
|
| 61 |
<script>
|
| 62 |
let lexicon = {};
|
| 63 |
|
| 64 |
-
//
|
| 65 |
window.onload = async function() {
|
| 66 |
try {
|
| 67 |
-
const
|
| 68 |
-
if (!
|
| 69 |
-
const data = await
|
|
|
|
| 70 |
process(data);
|
| 71 |
-
|
| 72 |
-
document.getElementById('
|
| 73 |
-
document.getElementById('
|
| 74 |
} catch (err) {
|
| 75 |
-
document.getElementById('
|
| 76 |
}
|
| 77 |
};
|
| 78 |
|
| 79 |
-
// 2. λ°μ΄ν° μ²λ¦¬ (λ» μ°μ μμ λ° κ²μ νκ² μ λ°ν)
|
| 80 |
function process(obj, parentKey = null, currentCat = null) {
|
| 81 |
if (typeof obj !== 'object' || obj === null) return;
|
| 82 |
|
| 83 |
-
// λλͺ
μ¬
|
| 84 |
const pSects = ["1st_Person", "2nd_Person", "3rd_Person", "Demonstratives"];
|
| 85 |
if (pSects.includes(parentKey)) {
|
| 86 |
for (const [pk, pv] of Object.entries(obj)) {
|
| 87 |
lexicon[pk] = {
|
| 88 |
meaning_ko: pv,
|
| 89 |
-
_category: `Pronoun`,
|
| 90 |
_search_target: `${pk} ${pv}`.toLowerCase()
|
| 91 |
};
|
| 92 |
}
|
| 93 |
return;
|
| 94 |
}
|
| 95 |
|
| 96 |
-
//
|
| 97 |
-
const keys = ['ko', '
|
| 98 |
-
const
|
| 99 |
|
| 100 |
-
if (
|
| 101 |
let entry = { ...obj };
|
| 102 |
-
|
| 103 |
-
const koVal = entry.ko || entry.meaning_ko || entry.morpheme || "";
|
| 104 |
-
const enVal = entry.en || entry.meaning_en || "";
|
| 105 |
|
| 106 |
-
// [
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
entry._display_ko = koVal;
|
| 110 |
-
entry._display_en = enVal;
|
| 111 |
-
entry._search_target = `${parentKey} ${koVal} ${enVal}`.toLowerCase();
|
| 112 |
|
|
|
|
|
|
|
| 113 |
lexicon[parentKey] = entry;
|
| 114 |
}
|
| 115 |
|
| 116 |
for (const [k, v] of Object.entries(obj)) {
|
| 117 |
-
if (typeof v === 'object'
|
| 118 |
-
|
|
|
|
| 119 |
}
|
| 120 |
}
|
| 121 |
}
|
| 122 |
|
| 123 |
-
// 3. κ²μ λ° λ λλ§
|
| 124 |
function search() {
|
| 125 |
const q = document.getElementById('query').value.trim().toLowerCase();
|
| 126 |
-
const
|
| 127 |
-
|
| 128 |
if (!q) return;
|
| 129 |
|
| 130 |
let found = [];
|
|
|
|
| 131 |
const re = new RegExp(`(^|[^a-zA-Zκ°-ν£])${q}($|[^a-zA-Zκ°-ν£])`, 'i');
|
| 132 |
|
| 133 |
for (const [word, info] of Object.entries(lexicon)) {
|
| 134 |
const wordL = word.toLowerCase();
|
| 135 |
const target = info._search_target || "";
|
| 136 |
-
|
| 137 |
if (q === wordL) found.push({ word, info, score: 2 });
|
| 138 |
else if (re.test(target) || (q.length > 1 && target.includes(q))) found.push({ word, info, score: 1 });
|
| 139 |
}
|
| 140 |
|
| 141 |
-
found.sort((a,b) => b.score - a.score).forEach(item => {
|
| 142 |
const info = item.info;
|
| 143 |
const card = document.createElement('div');
|
| 144 |
card.className = `card ${item.score === 2 ? 'exact' : ''}`;
|
| 145 |
|
| 146 |
-
// νμμ΄/
|
| 147 |
-
let
|
| 148 |
-
const
|
| 149 |
-
if (
|
| 150 |
-
|
| 151 |
-
for(const [
|
| 152 |
-
|
| 153 |
}
|
| 154 |
-
|
| 155 |
-
let
|
| 156 |
-
[
|
| 157 |
-
if (Object.keys(
|
| 158 |
-
|
| 159 |
-
for(const [
|
| 160 |
-
|
| 161 |
}
|
| 162 |
|
| 163 |
card.innerHTML = `
|
| 164 |
-
<
|
| 165 |
-
|
| 166 |
-
${item.score === 2 ? '<span class="badge badge-exact">μ νν μΌμΉ</span>' : ''}
|
| 167 |
-
</div>
|
| 168 |
<div class="word-row">
|
| 169 |
<span class="word-text">${item.word}</span>
|
| 170 |
-
<span class="meaning-
|
| 171 |
-
<span class="meaning-en">${info.
|
| 172 |
</div>
|
| 173 |
-
<div class="grid">${
|
| 174 |
-
<div class="
|
| 175 |
-
${info.usage ? `<div><span class="label">π μ©λ²:</span> ${typeof info.usage === 'object' ? info.usage.ko : info.usage}</div>` : ''}
|
| 176 |
-
${info.note ? `<div><span class="label">π‘ μ°Έκ³ :</span> ${info.note}</div>` : ''}
|
| 177 |
-
${info.example ? `<div class="
|
| 178 |
</div>
|
| 179 |
`;
|
| 180 |
-
|
| 181 |
});
|
| 182 |
}
|
| 183 |
</script>
|
|
|
|
| 2 |
<html lang="ko">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<title>Huiucl Auto-Load Dictionary</title>
|
| 6 |
<style>
|
| 7 |
:root { --primary: #2c3e50; --accent: #e67e22; --bg: #f8f9fa; --card: #ffffff; }
|
| 8 |
+
body { font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif; background: var(--bg); padding: 20px; color: var(--primary); }
|
| 9 |
.container { max-width: 900px; margin: 0 auto; }
|
| 10 |
|
| 11 |
+
/* λ‘λ© μν νμ */
|
| 12 |
+
#loader { text-align: center; padding: 20px; font-weight: bold; color: #2980b9; }
|
| 13 |
+
|
| 14 |
/* ν€λ μΉμ
*/
|
| 15 |
+
.header-panel { background: var(--primary); color: white; padding: 30px; border-radius: 15px; margin-bottom: 25px; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
|
| 16 |
+
.header-panel h1 { margin: 0; font-size: 32px; letter-spacing: 1px; }
|
| 17 |
|
| 18 |
/* κ²μμ°½ */
|
| 19 |
.search-container { position: sticky; top: 15px; z-index: 1000; margin-bottom: 30px; }
|
| 20 |
+
.search-input { width: 100%; padding: 20px 25px; font-size: 22px; border: 4px solid #ddd; border-radius: 50px; box-sizing: border-box; outline: none; box-shadow: 0 10px 25px rgba(0,0,0,0.1); transition: all 0.3s ease; }
|
| 21 |
+
.search-input:focus { border-color: var(--accent); transform: translateY(-2px); }
|
| 22 |
|
| 23 |
/* κ²°κ³Ό μΉ΄λ */
|
| 24 |
+
.card { background: var(--card); border-radius: 15px; padding: 30px; margin-bottom: 25px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); border-left: 8px solid #dcdde1; transition: transform 0.2s; }
|
| 25 |
+
.card:hover { transform: scale(1.01); }
|
| 26 |
.card.exact { border-left-color: var(--accent); }
|
| 27 |
|
| 28 |
+
.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: bold; margin-bottom: 10px; }
|
| 29 |
+
.badge-cat { background: #f1f2f6; color: #7f8c8d; }
|
| 30 |
+
.badge-exact { background: var(--accent); color: white; margin-left: 10px; }
|
|
|
|
| 31 |
|
| 32 |
+
.word-row { display: flex; align-items: baseline; gap: 15px; flex-wrap: wrap; }
|
| 33 |
+
.word-text { font-size: 32px; font-weight: 900; color: #2980b9; text-transform: uppercase; }
|
| 34 |
+
.meaning-text { font-size: 20px; color: #2c3e50; font-weight: 600; }
|
| 35 |
+
.meaning-en { color: #95a5a6; font-size: 16px; font-style: italic; }
|
| 36 |
+
|
| 37 |
+
/* λ°μ΄ν° 그리λ (νμμ΄, λ³μ΄ν) */
|
| 38 |
+
.grid-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; margin-top: 20px; }
|
| 39 |
+
.data-list { background: #fdfdfd; border: 1px solid #f1f1f1; border-radius: 10px; padding: 15px; }
|
| 40 |
+
.list-title { font-size: 14px; font-weight: bold; color: #34495e; border-bottom: 2px solid #3498db; padding-bottom: 5px; margin-bottom: 10px; }
|
| 41 |
+
.item-row { display: flex; font-size: 14px; margin-bottom: 4px; }
|
| 42 |
+
.item-key { font-weight: bold; width: 110px; color: #e67e22; }
|
| 43 |
|
| 44 |
/* μμΈ μ 보 (κ²μ μ μΈ κ΅¬μ) */
|
| 45 |
+
.details { margin-top: 20px; padding-top: 15px; border-top: 1px dashed #eee; font-size: 14px; color: #555; }
|
| 46 |
+
.detail-item { margin-bottom: 5px; }
|
| 47 |
+
.label { font-weight: bold; color: #7f8c8d; margin-right: 5px; }
|
| 48 |
+
.example-box { color: #2980b9; background: #ebf5fb; padding: 10px; border-radius: 5px; margin-top: 5px; }
|
| 49 |
</style>
|
| 50 |
</head>
|
| 51 |
<body>
|
| 52 |
|
| 53 |
<div class="container">
|
| 54 |
<div class="header-panel">
|
| 55 |
+
<h1>Huiucl Engine <small style="font-size: 14px; opacity: 0.8;">v3.0 Auto-Load</small></h1>
|
| 56 |
+
<div id="loader">βοΈ λ°μ΄ν°λ₯Ό λΆλ¬μ€λ μ€...</div>
|
| 57 |
</div>
|
| 58 |
|
| 59 |
<div class="search-container">
|
| 60 |
+
<input type="text" id="query" class="search-input" placeholder="κ²μμ΄λ₯Ό μ
λ ₯νμΈμ (su, a, mi, μ μνλ€...)" onkeyup="search()">
|
| 61 |
</div>
|
| 62 |
|
| 63 |
<div id="results"></div>
|
|
|
|
| 66 |
<script>
|
| 67 |
let lexicon = {};
|
| 68 |
|
| 69 |
+
// [μλ λ‘λ] νμ΄μ§ λ‘λ μ Huiucl.json νμΌμ μ¦μ μ½μ΄μ΄
|
| 70 |
window.onload = async function() {
|
| 71 |
try {
|
| 72 |
+
const response = await fetch('Huiucl.json');
|
| 73 |
+
if (!response.ok) throw new Error('νμΌμ μ°Ύμ μ μμ΅λλ€.');
|
| 74 |
+
const data = await response.json();
|
| 75 |
+
|
| 76 |
process(data);
|
| 77 |
+
|
| 78 |
+
document.getElementById('loader').innerText = `β
${Object.keys(lexicon).length}κ° νλͺ© λ‘λ μλ£. λ°λ‘ κ²μ κ°λ₯ν©λλ€.`;
|
| 79 |
+
setTimeout(() => document.getElementById('loader').style.display = 'none', 3000);
|
| 80 |
} catch (err) {
|
| 81 |
+
document.getElementById('loader').innerHTML = `β μ€λ₯: ${err.message}<br><small>Huiucl.json νμΌμ΄ κ°μ ν΄λμ μλμ§ νμΈνμΈμ.</small>`;
|
| 82 |
}
|
| 83 |
};
|
| 84 |
|
|
|
|
| 85 |
function process(obj, parentKey = null, currentCat = null) {
|
| 86 |
if (typeof obj !== 'object' || obj === null) return;
|
| 87 |
|
| 88 |
+
// 1. λλͺ
μ¬ μΉμ
(a, i, u λ± ν κΈμ λλͺ
μ¬ μλ²½ λ‘λ)
|
| 89 |
const pSects = ["1st_Person", "2nd_Person", "3rd_Person", "Demonstratives"];
|
| 90 |
if (pSects.includes(parentKey)) {
|
| 91 |
for (const [pk, pv] of Object.entries(obj)) {
|
| 92 |
lexicon[pk] = {
|
| 93 |
meaning_ko: pv,
|
| 94 |
+
_category: `Pronoun (${parentKey})`,
|
| 95 |
_search_target: `${pk} ${pv}`.toLowerCase()
|
| 96 |
};
|
| 97 |
}
|
| 98 |
return;
|
| 99 |
}
|
| 100 |
|
| 101 |
+
// 2. μΌλ° λ¨μ΄ μ²λ¦¬
|
| 102 |
+
const keys = ['meaning_ko', 'ko', 'definition', 'morpheme', 'meaning_en', 'en'];
|
| 103 |
+
const hasInfo = keys.some(k => k in obj);
|
| 104 |
|
| 105 |
+
if (hasInfo && parentKey) {
|
| 106 |
let entry = { ...obj };
|
| 107 |
+
if (entry.definition && typeof entry.definition === 'object') Object.assign(entry, entry.definition);
|
|
|
|
|
|
|
| 108 |
|
| 109 |
+
// [μ€μ] κ²μ νκ²μμ usage, exampleμ μ κ±° (μ€λ‘μ§ λ¨μ΄λͺ
κ³Ό λ»λ§)
|
| 110 |
+
let targets = [parentKey];
|
| 111 |
+
keys.forEach(k => { if (entry[k]) targets.push(entry[k]); });
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
+
entry._category = currentCat;
|
| 114 |
+
entry._search_target = targets.join(" ").toLowerCase();
|
| 115 |
lexicon[parentKey] = entry;
|
| 116 |
}
|
| 117 |
|
| 118 |
for (const [k, v] of Object.entries(obj)) {
|
| 119 |
+
if (typeof v === 'object') {
|
| 120 |
+
const nextCat = (parentKey === null) ? k : currentCat;
|
| 121 |
+
if (k !== 'Settings') process(v, k, nextCat);
|
| 122 |
}
|
| 123 |
}
|
| 124 |
}
|
| 125 |
|
|
|
|
| 126 |
function search() {
|
| 127 |
const q = document.getElementById('query').value.trim().toLowerCase();
|
| 128 |
+
const resDiv = document.getElementById('results');
|
| 129 |
+
resDiv.innerHTML = '';
|
| 130 |
if (!q) return;
|
| 131 |
|
| 132 |
let found = [];
|
| 133 |
+
// μ νν λ
립 ννμ μΈμ§λ₯Ό μν μ κ·μ
|
| 134 |
const re = new RegExp(`(^|[^a-zA-Zκ°-ν£])${q}($|[^a-zA-Zκ°-ν£])`, 'i');
|
| 135 |
|
| 136 |
for (const [word, info] of Object.entries(lexicon)) {
|
| 137 |
const wordL = word.toLowerCase();
|
| 138 |
const target = info._search_target || "";
|
| 139 |
+
|
| 140 |
if (q === wordL) found.push({ word, info, score: 2 });
|
| 141 |
else if (re.test(target) || (q.length > 1 && target.includes(q))) found.push({ word, info, score: 1 });
|
| 142 |
}
|
| 143 |
|
| 144 |
+
found.sort((a, b) => b.score - a.score).forEach(item => {
|
| 145 |
const info = item.info;
|
| 146 |
const card = document.createElement('div');
|
| 147 |
card.className = `card ${item.score === 2 ? 'exact' : ''}`;
|
| 148 |
|
| 149 |
+
// νμμ΄/λ³μ΄ν 그리λ μμ±
|
| 150 |
+
let gridHtml = '';
|
| 151 |
+
const derivs = info.derivations || info.derivation;
|
| 152 |
+
if (derivs) {
|
| 153 |
+
gridHtml += `<div class="data-list"><div class="list-title">π κΈ°λ‘λ νμμ΄</div>`;
|
| 154 |
+
for(const [dw, dm] of Object.entries(derivs)) gridHtml += `<div class="item-row"><span class="item-key">${dw}</span> <span>${dm}</span></div>`;
|
| 155 |
+
gridHtml += `</div>`;
|
| 156 |
}
|
| 157 |
+
|
| 158 |
+
let vars = {};
|
| 159 |
+
["tense_variants", "aspect_voice", "variants"].forEach(k => { if(info[k]) Object.assign(vars, info[k]); });
|
| 160 |
+
if (Object.keys(vars).length > 0) {
|
| 161 |
+
gridHtml += `<div class="data-list"><div class="list-title">π μμ λ° λ³μ΄</div>`;
|
| 162 |
+
for(const [vw, vi] of Object.entries(vars)) gridHtml += `<div class="item-row"><span class="item-key">${vw}</span> <span>${vi.meaning_ko || vi.ko || ''}</span></div>`;
|
| 163 |
+
gridHtml += `</div>`;
|
| 164 |
}
|
| 165 |
|
| 166 |
card.innerHTML = `
|
| 167 |
+
<span class="badge badge-cat">${info._category}</span>
|
| 168 |
+
${item.score === 2 ? '<span class="badge badge-exact">μ νν μΌμΉ</span>' : ''}
|
|
|
|
|
|
|
| 169 |
<div class="word-row">
|
| 170 |
<span class="word-text">${item.word}</span>
|
| 171 |
+
<span class="meaning-text">${info.meaning_ko || info.ko || info.morpheme || ''}</span>
|
| 172 |
+
<span class="meaning-en">${info.meaning_en || info.en || ''}</span>
|
| 173 |
</div>
|
| 174 |
+
<div class="grid-container">${gridHtml}</div>
|
| 175 |
+
<div class="details">
|
| 176 |
+
${info.usage ? `<div class="detail-item"><span class="label">π μ©λ²:</span> ${typeof info.usage === 'object' ? info.usage.ko : info.usage}</div>` : ''}
|
| 177 |
+
${info.note ? `<div class="detail-item"><span class="label">π‘ μ°Έκ³ :</span> ${info.note}</div>` : ''}
|
| 178 |
+
${info.example ? `<div class="example-box"><span class="label">π μλ¬Έ:</span> ${info.example}</div>` : ''}
|
| 179 |
</div>
|
| 180 |
`;
|
| 181 |
+
resDiv.appendChild(card);
|
| 182 |
});
|
| 183 |
}
|
| 184 |
</script>
|