Spaces:
Running
Running
Update index.html
Browse files- index.html +84 -85
index.html
CHANGED
|
@@ -2,62 +2,57 @@
|
|
| 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',
|
| 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:
|
| 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:
|
| 21 |
-
.search-input:focus { border-color: var(--accent);
|
| 22 |
|
| 23 |
/* κ²°κ³Ό μΉ΄λ */
|
| 24 |
-
.card { background: var(--card); border-radius:
|
| 25 |
-
.card:hover { transform: scale(1.01); }
|
| 26 |
.card.exact { border-left-color: var(--accent); }
|
| 27 |
|
| 28 |
-
.
|
| 29 |
-
.badge
|
| 30 |
-
.badge-
|
|
|
|
| 31 |
|
| 32 |
-
.word-row { display: flex; align-items: baseline; gap:
|
| 33 |
-
.word-text { font-size:
|
| 34 |
-
.meaning-
|
| 35 |
-
.meaning-en { color: #
|
| 36 |
-
|
| 37 |
-
/*
|
| 38 |
-
.grid
|
| 39 |
-
.data-
|
| 40 |
-
.
|
| 41 |
-
.item-row { display: flex; font-size:
|
| 42 |
-
.item-key { font-weight: bold; width:
|
| 43 |
|
| 44 |
/* μμΈ μ 보 (κ²μ μ μΈ κ΅¬μ) */
|
| 45 |
-
.
|
| 46 |
-
.
|
| 47 |
-
.label { font-weight: bold; color: #
|
| 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
|
| 56 |
-
<
|
| 57 |
</div>
|
| 58 |
|
| 59 |
<div class="search-container">
|
| 60 |
-
<input type="text" id="query" class="search-input" placeholder="
|
| 61 |
</div>
|
| 62 |
|
| 63 |
<div id="results"></div>
|
|
@@ -66,119 +61,123 @@
|
|
| 66 |
<script>
|
| 67 |
let lexicon = {};
|
| 68 |
|
| 69 |
-
//
|
| 70 |
window.onload = async function() {
|
| 71 |
try {
|
| 72 |
-
const
|
| 73 |
-
if (!
|
| 74 |
-
const data = await
|
| 75 |
-
|
| 76 |
process(data);
|
| 77 |
-
|
| 78 |
-
document.getElementById('
|
| 79 |
-
|
| 80 |
} catch (err) {
|
| 81 |
-
document.getElementById('
|
| 82 |
}
|
| 83 |
};
|
| 84 |
|
|
|
|
| 85 |
function process(obj, parentKey = null, currentCat = null) {
|
| 86 |
if (typeof obj !== 'object' || obj === null) return;
|
| 87 |
|
| 88 |
-
//
|
| 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
|
| 95 |
_search_target: `${pk} ${pv}`.toLowerCase()
|
| 96 |
};
|
| 97 |
}
|
| 98 |
return;
|
| 99 |
}
|
| 100 |
|
| 101 |
-
//
|
| 102 |
-
const keys = ['
|
| 103 |
-
const
|
| 104 |
|
| 105 |
-
if (
|
| 106 |
let entry = { ...obj };
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
|
| 109 |
-
// [
|
| 110 |
-
|
| 111 |
-
keys.forEach(k => { if (entry[k]) targets.push(entry[k]); });
|
| 112 |
-
|
| 113 |
entry._category = currentCat;
|
| 114 |
-
entry.
|
|
|
|
|
|
|
|
|
|
| 115 |
lexicon[parentKey] = entry;
|
| 116 |
}
|
| 117 |
|
| 118 |
for (const [k, v] of Object.entries(obj)) {
|
| 119 |
-
if (typeof v === 'object') {
|
| 120 |
-
|
| 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
|
| 129 |
-
|
| 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,
|
| 145 |
const info = item.info;
|
| 146 |
const card = document.createElement('div');
|
| 147 |
card.className = `card ${item.score === 2 ? 'exact' : ''}`;
|
| 148 |
|
| 149 |
-
// νμμ΄/
|
| 150 |
-
let
|
| 151 |
-
const
|
| 152 |
-
if (
|
| 153 |
-
|
| 154 |
-
for(const [
|
| 155 |
-
|
| 156 |
}
|
| 157 |
-
|
| 158 |
-
let
|
| 159 |
-
[
|
| 160 |
-
if (Object.keys(
|
| 161 |
-
|
| 162 |
-
for(const [
|
| 163 |
-
|
| 164 |
}
|
| 165 |
|
| 166 |
card.innerHTML = `
|
| 167 |
-
<
|
| 168 |
-
|
|
|
|
|
|
|
| 169 |
<div class="word-row">
|
| 170 |
<span class="word-text">${item.word}</span>
|
| 171 |
-
<span class="meaning-
|
| 172 |
-
<span class="meaning-en">${info.
|
| 173 |
</div>
|
| 174 |
-
<div class="grid
|
| 175 |
-
<div class="
|
| 176 |
-
${info.usage ? `<div
|
| 177 |
-
${info.note ? `<div
|
| 178 |
-
${info.example ? `<div class="
|
| 179 |
</div>
|
| 180 |
`;
|
| 181 |
-
|
| 182 |
});
|
| 183 |
}
|
| 184 |
</script>
|
|
|
|
| 2 |
<html lang="ko">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<title>Huiucl Precision Dictionary v4</title>
|
| 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: 25px; border-radius: 15px; margin-bottom: 25px; text-align: center; }
|
|
|
|
| 13 |
|
| 14 |
/* κ²μμ°½ */
|
| 15 |
.search-container { position: sticky; top: 15px; z-index: 1000; margin-bottom: 30px; }
|
| 16 |
+
.search-input { width: 100%; padding: 18px 25px; font-size: 20px; border: 4px solid #ddd; border-radius: 50px; outline: none; box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
|
| 17 |
+
.search-input:focus { border-color: var(--accent); }
|
| 18 |
|
| 19 |
/* κ²°κ³Ό μΉ΄λ */
|
| 20 |
+
.card { background: var(--card); border-radius: 12px; padding: 25px; margin-bottom: 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); border-left: 8px solid #bdc3c7; }
|
|
|
|
| 21 |
.card.exact { border-left-color: var(--accent); }
|
| 22 |
|
| 23 |
+
.tag-row { margin-bottom: 10px; }
|
| 24 |
+
.badge { display: inline-block; padding: 3px 10px; border-radius: 5px; font-size: 11px; font-weight: bold; text-transform: uppercase; }
|
| 25 |
+
.badge-cat { background: #ebf5fb; color: #2980b9; }
|
| 26 |
+
.badge-exact { background: var(--accent); color: white; margin-left: 5px; }
|
| 27 |
|
| 28 |
+
.word-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
|
| 29 |
+
.word-text { font-size: 28px; font-weight: 900; color: #2c3e50; }
|
| 30 |
+
.meaning-ko { font-size: 22px; color: #e74c3c; font-weight: bold; }
|
| 31 |
+
.meaning-en { color: #7f8c8d; font-size: 16px; }
|
| 32 |
+
|
| 33 |
+
/* νμ/λ³μ΄ 그리λ */
|
| 34 |
+
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; margin-top: 15px; }
|
| 35 |
+
.data-box { background: #fcfcfc; border: 1px solid #efefef; border-radius: 8px; padding: 12px; }
|
| 36 |
+
.box-title { font-size: 13px; font-weight: bold; color: #34495e; margin-bottom: 8px; border-bottom: 1px solid #3498db; }
|
| 37 |
+
.item-row { display: flex; font-size: 13px; margin-bottom: 3px; }
|
| 38 |
+
.item-key { font-weight: bold; width: 100px; color: #d35400; }
|
| 39 |
|
| 40 |
/* μμΈ μ 보 (κ²μ μ μΈ κ΅¬μ) */
|
| 41 |
+
.extra { margin-top: 15px; padding-top: 10px; border-top: 1px dashed #eee; font-size: 13px; color: #666; }
|
| 42 |
+
.ex-box { color: #2980b9; background: #f0f7ff; padding: 10px; border-radius: 5px; margin-top: 5px; border-left: 3px solid #3498db; }
|
| 43 |
+
.label { font-weight: bold; color: #95a5a6; margin-right: 5px; }
|
|
|
|
| 44 |
</style>
|
| 45 |
</head>
|
| 46 |
<body>
|
| 47 |
|
| 48 |
<div class="container">
|
| 49 |
<div class="header-panel">
|
| 50 |
+
<h1 id="title">Huiucl Precision Dictionary</h1>
|
| 51 |
+
<p id="status">βοΈ λ°μ΄ν°λ₯Ό λΆλ¬μ€λ μ€...</p>
|
| 52 |
</div>
|
| 53 |
|
| 54 |
<div class="search-container">
|
| 55 |
+
<input type="text" id="query" class="search-input" placeholder="Huiucl.jsonμ κ°μ ν΄λμ λκ³ λ‘λλκΈΈ κΈ°λ€λ¦¬μΈμ..." disabled onkeyup="search()">
|
| 56 |
</div>
|
| 57 |
|
| 58 |
<div id="results"></div>
|
|
|
|
| 61 |
<script>
|
| 62 |
let lexicon = {};
|
| 63 |
|
| 64 |
+
// 1. νμΌ μλ λ‘λ
|
| 65 |
window.onload = async function() {
|
| 66 |
try {
|
| 67 |
+
const res = await fetch('Huiucl.json');
|
| 68 |
+
if (!res.ok) throw new Error('νμΌμ μ°Ύμ μ μμ΅λλ€.');
|
| 69 |
+
const data = await res.json();
|
|
|
|
| 70 |
process(data);
|
| 71 |
+
document.getElementById('status').innerText = `β
${Object.keys(lexicon).length}κ° λ¨μ΄ λ‘λ μλ£`;
|
| 72 |
+
document.getElementById('query').disabled = false;
|
| 73 |
+
document.getElementById('query').placeholder = "λ¨μ΄ λλ λ» κ²μ (su, a, muihi, κ΄μ°°...)";
|
| 74 |
} catch (err) {
|
| 75 |
+
document.getElementById('status').innerText = `β μ€λ₯: ${err.message}`;
|
| 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', 'meaning_ko', 'morpheme', 'en', 'meaning_en'];
|
| 98 |
+
const hasMeaning = keys.some(k => k in obj);
|
| 99 |
|
| 100 |
+
if (hasMeaning && parentKey) {
|
| 101 |
let entry = { ...obj };
|
| 102 |
+
// λ» μΆμΆ μ°μ μμ: νκ΅μ΄ λμμ΄(ko) -> μ€μ λ»(meaning_ko) -> ννμ μ 보(morpheme)
|
| 103 |
+
const koVal = entry.ko || entry.meaning_ko || entry.morpheme || "";
|
| 104 |
+
const enVal = entry.en || entry.meaning_en || "";
|
| 105 |
|
| 106 |
+
// [ν΅μ¬] κ²μ νκ²μμ μμ ν€(Nominative λ±) λ° μλ¬Έ/μ©λ² μ μΈ!
|
| 107 |
+
// μ€μ§ λ¨μ΄ μ΄λ¦κ³Ό μμμ μΆμΆν koVal, enValλ§ κ²μ λμ
|
|
|
|
|
|
|
| 108 |
entry._category = currentCat;
|
| 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' && k !== 'Settings') {
|
| 118 |
+
process(v, k, parentKey === null ? k : currentCat);
|
|
|
|
| 119 |
}
|
| 120 |
}
|
| 121 |
}
|
| 122 |
|
| 123 |
+
// 3. κ²μ λ° λ λλ§
|
| 124 |
function search() {
|
| 125 |
const q = document.getElementById('query').value.trim().toLowerCase();
|
| 126 |
+
const area = document.getElementById('results');
|
| 127 |
+
area.innerHTML = '';
|
| 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 subHtml = '';
|
| 148 |
+
const dr = info.derivations || info.derivation;
|
| 149 |
+
if (dr) {
|
| 150 |
+
subHtml += `<div class="data-box"><div class="box-title">π κΈ°λ‘λ νμμ΄</div>`;
|
| 151 |
+
for(const [k, v] of Object.entries(dr)) subHtml += `<div class="item-row"><span class="item-key">${k}</span><span>${v}</span></div>`;
|
| 152 |
+
subHtml += `</div>`;
|
| 153 |
}
|
| 154 |
+
|
| 155 |
+
let vr = {};
|
| 156 |
+
['tense_variants', 'aspect_voice', 'variants'].forEach(k => { if(info[k]) Object.assign(vr, info[k]); });
|
| 157 |
+
if (Object.keys(vr).length > 0) {
|
| 158 |
+
subHtml += `<div class="data-box"><div class="box-title">π μμ λ° λ³μ΄</div>`;
|
| 159 |
+
for(const [k, v] of Object.entries(vr)) subHtml += `<div class="item-row"><span class="item-key">${k}</span><span>${v.ko || v.meaning_ko || ''}</span></div>`;
|
| 160 |
+
subHtml += `</div>`;
|
| 161 |
}
|
| 162 |
|
| 163 |
card.innerHTML = `
|
| 164 |
+
<div class="tag-row">
|
| 165 |
+
<span class="badge badge-cat">${info._category}</span>
|
| 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-ko">${info._display_ko}</span>
|
| 171 |
+
<span class="meaning-en">${info._display_en}</span>
|
| 172 |
</div>
|
| 173 |
+
<div class="grid">${subHtml}</div>
|
| 174 |
+
<div class="extra">
|
| 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="ex-box"><span class="label">π μλ¬Έ:</span> ${info.example}</div>` : ''}
|
| 178 |
</div>
|
| 179 |
`;
|
| 180 |
+
area.appendChild(card);
|
| 181 |
});
|
| 182 |
}
|
| 183 |
</script>
|