OpenLab-NLP commited on
Commit
fbbed72
ยท
verified ยท
1 Parent(s): b1b25e4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +107 -148
index.html CHANGED
@@ -2,191 +2,150 @@
2
  <html lang="ko">
3
  <head>
4
  <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>HUIUCL Database v3.0</title>
7
  <style>
8
- :root { --bg: #f9f7f2; --card: #ffffff; --primary: #5d5b54; --accent: #d4a373; --border: #e0ddd5; }
9
- body { font-family: 'Pretendard', sans-serif; background: var(--bg); color: var(--primary); margin: 0; line-height: 1.6; }
10
- nav { position: sticky; top: 0; background: rgba(249, 247, 242, 0.9); backdrop-filter: blur(10px); padding: 15px; text-align: center; border-bottom: 1px solid var(--border); z-index: 100; }
11
- nav a { margin: 0 15px; text-decoration: none; color: var(--primary); font-weight: 600; cursor: pointer; }
12
- header { text-align: center; padding: 40px 20px; }
13
- h1 { font-weight: 300; letter-spacing: 8px; color: var(--accent); margin: 0; }
14
- .container { max-width: 1100px; margin: 0 auto; padding: 0 20px 100px; }
15
- section { display: none; }
16
- section.active { display: block; }
17
- .filter-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 25px; }
18
- .filter-btn { background: var(--card); border: 1px solid var(--border); padding: 8px 16px; cursor: pointer; border-radius: 20px; font-size: 0.85rem; }
19
- .filter-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
20
- .search-box { width: 100%; padding: 15px 25px; border: 1px solid var(--border); border-radius: 30px; font-size: 1rem; margin-bottom: 20px; box-sizing: border-box; outline: none; }
21
- .table-wrapper { background: white; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
22
- table { width: 100%; border-collapse: collapse; }
23
- th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid #eee; }
24
- th { background: #f1eee6; color: #777; font-size: 0.85rem; }
25
- .word-cell { font-weight: bold; color: var(--accent); width: 25%; font-size: 1.1rem; }
26
- .meaning-cell { width: 55%; }
27
- .path-cell { font-size: 0.7rem; color: #bbb; width: 20%; text-align: right; }
28
- .desc-box { background: #fafafa; border-left: 3px solid var(--accent); padding: 8px 12px; margin-top: 10px; font-size: 0.85rem; color: #666; }
29
- .tag { display: inline-block; background: #eee; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; margin-right: 5px; color: #555; }
30
  </style>
31
  </head>
32
  <body>
33
 
34
- <nav>
35
- <a onclick="showSection('dictionary')">DICTIONARY</a>
36
- <a onclick="showSection('grammar')">GRAMMAR</a>
37
- </nav>
38
-
39
- <header>
40
- <h1>HUIUCL</h1>
41
- <div style="color:#999; font-size:0.85rem; margin-top:5px;">DATABASE v3.0 FINAL REVISION</div>
42
- </header>
43
-
44
  <div class="container">
45
- <section id="dictionary" class="active">
46
- <input type="text" id="searchInput" class="search-box" placeholder="๋‹จ์–ด๋ช…, ํ•œ๊ตญ์–ด ์˜๋ฏธ, ์˜์–ด ์˜๋ฏธ ๊ฒ€์ƒ‰..." oninput="renderTable()">
47
- <div class="filter-container" id="categoryButtons">
48
- <button class="filter-btn active" onclick="filterCategory('๋ชจ๋‘', this)">๋ชจ๋‘ ๋ณด๊ธฐ</button>
49
- </div>
50
- <div class="table-wrapper">
51
- <table>
52
- <thead>
53
- <tr><th>๋‹จ์–ด (Word)</th><th>์˜๋ฏธ ๋ฐ ์šฉ๋ฒ• (Meaning/Usage)</th><th style="text-align:right;">๋ถ„๋ฅ˜</th></tr>
54
- </thead>
55
- <tbody id="dictBody"></tbody>
56
- </table>
57
- </div>
58
- </section>
59
- <section id="grammar"><div id="grammarContent"></div></section>
60
  </div>
61
 
62
  <script>
63
- let db = {};
64
- let currentCat = '๋ชจ๋‘';
65
-
66
- function showSection(id) {
67
- document.querySelectorAll('section').forEach(s => s.classList.remove('active'));
68
- document.getElementById(id).classList.add('active');
69
- }
70
 
71
  window.onload = () => {
72
- fetch('Huiucl.json').then(r => r.json()).then(data => {
73
- db = data;
74
- initUI();
75
- renderTable();
76
- renderGrammar();
77
- });
78
  };
79
 
80
- function initUI() {
81
- const container = document.getElementById('categoryButtons');
82
- Object.keys(db).forEach(key => {
83
- if (key === "Settings") return;
84
- const btn = document.createElement('button');
85
- btn.className = 'filter-btn';
86
- btn.innerText = key;
87
- btn.onclick = (e) => {
88
- document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
89
- e.target.classList.add('active');
90
- currentCat = key;
91
- renderTable();
92
- };
93
- container.appendChild(btn);
94
- });
95
- }
96
-
97
- function renderTable() {
98
  const query = document.getElementById('searchInput').value.toLowerCase();
99
  const body = document.getElementById('dictBody');
100
  body.innerHTML = '';
101
-
102
- const targets = currentCat === '๋ชจ๋‘' ? Object.keys(db).filter(k => k !== "Settings") : [currentCat];
103
- targets.forEach(cat => parseData(db[cat], cat, query));
 
 
 
104
  }
105
 
106
- function parseData(obj, path, query) {
107
  if (path.includes("Grammar_Rules")) return;
108
 
109
- for (let key in obj) {
110
  const val = obj[key];
111
  if (!val) continue;
112
 
113
- // 1. ๋‹จ์–ด ๊ฐ์ฒด (์˜๋ฏธ ์ •๋ณด ํฌํ•จ)
114
- if (typeof val === 'object' && (val.meaning_ko || val.ko || val.definition || val.๋œป)) {
115
- const ko = val.meaning_ko || val.ko || val.๋œป || val.definition || "";
116
- const en = val.meaning_en || val.en || "";
117
- const note = val.usage || val.note || "";
118
-
119
- if (key.toLowerCase().includes(query) || (typeof ko === 'string' && ko.includes(query))) {
120
- addRow(key, ko, en, note, path);
121
- }
122
-
123
- if (val.derivations) {
124
- for (let dKey in val.derivations) {
125
- addRow(dKey, val.derivations[dKey], "", "", path, true);
126
- }
127
  }
128
- if (val.tense_variants) parseData(val.tense_variants, path + " > " + key, query);
129
  }
130
- // 2. ๋‹จ์ˆœ ๋ฌธ์ž์—ด (๋Œ€๋ช…์‚ฌ, ์ธ์‚ฌ ๋“ฑ)
131
- else if (typeof val === 'string') {
132
- if (key.toLowerCase().includes(query) || val.toLowerCase().includes(query)) {
133
- addRow(key, val, "", "", path);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
135
  }
136
- // 3. ์ค‘์ฒฉ ๊ฐ์ฒด (์žฌ๊ท€ - ๋‹จ, ๋ฐ์ดํ„ฐ์šฉ ํ‚ค๋Š” ์ œ์™ธ)
137
- else if (typeof val === 'object' && !["usage", "note", "definition", "tense_variants"].includes(key)) {
138
- parseData(val, path + " > " + key, query);
139
- }
140
  }
141
  }
142
 
143
- function addRow(word, ko, en, note, path, isSub) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  const body = document.getElementById('dictBody');
145
  const row = body.insertRow();
146
- if (isSub) row.className = 'variation-row';
147
-
148
- let meaningHtml = `<div style="font-weight:600; font-size:1.05rem;">${ko}</div>`;
149
- if (en) meaningHtml += `<div style="color:#888; font-size:0.9rem;">${en}</div>`;
150
- if (note) meaningHtml += `<div class="desc-box"><span class="tag">USAGE</span>${note}</div>`;
 
 
 
 
151
 
152
  row.innerHTML = `
153
- <td class="word-cell">${isSub ? 'โ†ณ ' : ''}${word}</td>
154
- <td class="meaning-cell">${meaningHtml}</td>
155
  <td class="path-cell">${path}</td>
156
  `;
157
  }
158
-
159
- function renderGrammar() {
160
- const target = document.getElementById('grammarContent');
161
- let html = "";
162
-
163
- // Settings ์ถœ๋ ฅ
164
- if (db.Settings) {
165
- html += `<div style="background:white; padding:30px; border-radius:15px; margin-bottom:20px; border:1px solid var(--border);">
166
- <h2 style="margin-top:0; color:var(--accent);">Basic Phonology & Syntax</h2>
167
- <p><strong>์–ด์ˆœ:</strong> ${db.Settings.Syntax.Word_Order.join(' / ')}</p>
168
- <p><strong>Vowels:</strong> ${Object.keys(db.Settings.Phonology.Vowels).join(', ')}</p>
169
- <p><strong>Consonants:</strong> ${Object.keys(db.Settings.Phonology.Consonants).join(', ')}</p>
170
- </div>`;
171
- }
172
-
173
- function collectRules(obj, path) {
174
- for (let k in obj) {
175
- if (k === "Grammar_Rules") {
176
- html += `<div style="background:white; padding:30px; border-radius:15px; margin-bottom:20px; border:1px solid var(--border);">
177
- <h3 style="margin-top:0; color:var(--accent);">${path} Rules</h3>`;
178
- for (let rule in obj[k]) {
179
- html += `<p style="margin:8px 0; border-bottom:1px solid #f9f9f9; padding-bottom:5px;"><strong>${rule}:</strong> ${obj[k][rule]}</p>`;
180
- }
181
- html += `</div>`;
182
- } else if (typeof obj[k] === 'object' && k !== "Settings") {
183
- collectRules(obj[k], path ? path + " > " + k : k);
184
- }
185
- }
186
- }
187
- collectRules(db, "");
188
- target.innerHTML = html;
189
- }
190
  </script>
 
191
  </body>
192
  </html>
 
2
  <html lang="ko">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <title>HUIUCL Database Final</title>
 
6
  <style>
7
+ :root { --bg: #f4f1ea; --card: #ffffff; --accent: #8b7355; --text: #333; }
8
+ body { font-family: sans-serif; background: var(--bg); color: var(--text); padding: 20px; }
9
+ .container { max-width: 1200px; margin: 0 auto; }
10
+ .search-box { width: 100%; padding: 15px; margin-bottom: 20px; border: 2px solid #ddd; border-radius: 8px; font-size: 1.1rem; }
11
+ .table-wrapper { background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); overflow: hidden; }
12
+ table { width: 100%; border-collapse: collapse; table-layout: fixed; }
13
+ th, td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; word-break: break-all; }
14
+ th { background: #f8f8f8; font-weight: bold; border-bottom: 2px solid #ddd; }
15
+ .word-cell { font-weight: bold; color: var(--accent); width: 20%; font-size: 1.1rem; }
16
+ .path-cell { font-size: 0.8rem; color: #999; width: 20%; }
17
+ .usage-tag { background: #f0f0f0; padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; color: #666; display: block; margin-top: 5px; }
18
+ .meaning-item { margin-bottom: 4px; }
19
+ .sub-row { background: #fafafa; font-size: 0.9rem; }
 
 
 
 
 
 
 
 
 
20
  </style>
21
  </head>
22
  <body>
23
 
 
 
 
 
 
 
 
 
 
 
24
  <div class="container">
25
+ <input type="text" id="searchInput" class="search-box" placeholder="๋‹จ์–ด, ๋œป, ๋ถ„๋ฅ˜ ๊ฒ€์ƒ‰..." oninput="render()">
26
+ <div class="table-wrapper">
27
+ <table>
28
+ <thead>
29
+ <tr>
30
+ <th style="width:20%">๋‹จ์–ด (Word)</th>
31
+ <th style="width:60%">์˜๋ฏธ ๋ฐ ์šฉ๋ฒ•</th>
32
+ <th style="width:20%">๋ถ„๋ฅ˜</th>
33
+ </tr>
34
+ </thead>
35
+ <tbody id="dictBody"></tbody>
36
+ </table>
37
+ </div>
 
 
38
  </div>
39
 
40
  <script>
41
+ let rawData = {};
 
 
 
 
 
 
42
 
43
  window.onload = () => {
44
+ fetch('Huiucl.json')
45
+ .then(res => res.json())
46
+ .then(data => {
47
+ rawData = data;
48
+ render();
49
+ });
50
  };
51
 
52
+ function render() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  const query = document.getElementById('searchInput').value.toLowerCase();
54
  const body = document.getElementById('dictBody');
55
  body.innerHTML = '';
56
+
57
+ // ๋ชจ๋“  ์นดํ…Œ๊ณ ๋ฆฌ ์ˆœํšŒ (Settings ์ œ์™ธ)
58
+ for (const cat in rawData) {
59
+ if (cat === "Settings") continue;
60
+ extract(rawData[cat], cat, query);
61
+ }
62
  }
63
 
64
+ function extract(obj, path, query) {
65
  if (path.includes("Grammar_Rules")) return;
66
 
67
+ for (const key in obj) {
68
  const val = obj[key];
69
  if (!val) continue;
70
 
71
+ // 1. ๋ฌธ์ž์—ด์ธ ๊ฒฝ์šฐ (๋‹จ์ˆœ ๋Œ€๋ช…์‚ฌ, ์ธ์‚ฌ๋ง ๋“ฑ)
72
+ if (typeof val === 'string') {
73
+ if (isMatch(key, val, path, query)) {
74
+ appendRow(key, val, "", "", path);
 
 
 
 
 
 
 
 
 
 
75
  }
 
76
  }
77
+ // 2. ๊ฐ์ฒด์ธ ๊ฒฝ์šฐ (๋‹จ์–ด ์ •๋ณด ํฌํ•จ)
78
+ else if (typeof val === 'object') {
79
+ // ์ด ๊ฐ์ฒด๊ฐ€ '๋‹จ์–ด ์ •๋ณด'๋ฅผ ๋‹ด๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธ
80
+ const info = getWordInfo(val);
81
+
82
+ if (info.hasData) {
83
+ if (isMatch(key, info.ko + info.en + info.usage, path, query)) {
84
+ appendRow(key, info.ko, info.en, info.usage, path);
85
+ }
86
+
87
+ // ํŒŒ์ƒ์–ด ์ฒ˜๋ฆฌ
88
+ if (val.derivations) {
89
+ for (const dKey in val.derivations) {
90
+ appendRow(dKey, val.derivations[dKey], "", "", path, true);
91
+ }
92
+ }
93
+ // ์‹œ์ œ ๋ณ€ํ˜• ๋“ฑ ํ•˜์œ„ ๋ฐ์ดํ„ฐ๊ฐ€ ๋” ์žˆ๋‹ค๋ฉด ํƒ์ƒ‰ (๋‹จ, ๋ฐ์ดํ„ฐ ํ‚ค๋Š” ์ œ์™ธ)
94
+ for (const subKey in val) {
95
+ if (!["meaning_ko", "meaning_en", "ko", "en", "definition", "usage", "note", "derivations"].includes(subKey)) {
96
+ extract({ [subKey]: val[subKey] }, path + " > " + key, query);
97
+ }
98
+ }
99
+ } else {
100
+ // ๋‹จ์–ด ๋ฐ์ดํ„ฐ๊ฐ€ ์•„๋‹ˆ๋ฉด ๋” ๊นŠ๊ฒŒ ํƒ์ƒ‰
101
+ extract(val, path + " > " + key, query);
102
  }
103
  }
 
 
 
 
104
  }
105
  }
106
 
107
+ // ๊ฐ์ฒด ์•ˆ์—์„œ ํ•œ๊ธ€ ๋œป, ์˜์–ด ๋œป, ์‚ฌ์šฉ๋ฒ•์„ ๊ธ์–ด๋ชจ์œผ๋Š” ํ•จ์ˆ˜
108
+ function getWordInfo(obj) {
109
+ let info = {
110
+ ko: obj.meaning_ko || obj.ko || obj.๋œป || obj.definition || "",
111
+ en: obj.meaning_en || obj.en || "",
112
+ usage: obj.usage || obj.note || "",
113
+ hasData: false
114
+ };
115
+
116
+ // ko๋‚˜ definition์ด ๋˜ ๊ฐ์ฒด์ธ ๊ฒฝ์šฐ (์—๋Ÿฌ ๋ฐฉ์ง€)
117
+ if (typeof info.ko === 'object') info.ko = info.ko.ko || info.ko.meaning_ko || JSON.stringify(info.ko);
118
+ if (typeof info.en === 'object') info.en = info.en.en || info.en.meaning_en || "";
119
+
120
+ if (info.ko || info.en || info.usage) info.hasData = true;
121
+ return info;
122
+ }
123
+
124
+ function isMatch(word, content, path, query) {
125
+ const target = (word + content + path).toLowerCase();
126
+ return target.includes(query);
127
+ }
128
+
129
+ function appendRow(word, ko, en, usage, path, isSub) {
130
  const body = document.getElementById('dictBody');
131
  const row = body.insertRow();
132
+ if (isSub) row.className = 'sub-row';
133
+
134
+ let meaningHtml = `<div class="meaning-item"><strong>${ko}</strong></div>`;
135
+ if (en) meaningHtml += `<div class="meaning-item" style="color: #666;">${en}</div>`;
136
+ if (usage) {
137
+ // usage๊ฐ€ ๊ฐ์ฒด์ธ ๊ฒฝ์šฐ ๋Œ€์‘
138
+ const usageText = typeof usage === 'object' ? JSON.stringify(usage) : usage;
139
+ meaningHtml += `<div class="usage-tag">โ€ป ${usageText}</div>`;
140
+ }
141
 
142
  row.innerHTML = `
143
+ <td class="word-cell">${isSub ? 'โ”” ' : ''}${word}</td>
144
+ <td>${meaningHtml}</td>
145
  <td class="path-cell">${path}</td>
146
  `;
147
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  </script>
149
+
150
  </body>
151
  </html>