OpenLab-NLP commited on
Commit
c37a8db
ยท
verified ยท
1 Parent(s): 77dd2ba

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +195 -120
index.html CHANGED
@@ -1,121 +1,196 @@
1
- <!DOCTYPE html>
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 Dictionary</title>
7
- <style>
8
- body { font-family: 'Malgun Gothic', sans-serif; background-color: #1a1a2e; color: #e2e2e2; padding: 20px; line-height: 1.6; }
9
- h1 { color: #4ecca3; text-align: center; }
10
- .filter-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 30px; }
11
- button {
12
- background: #16213e; border: 1px solid #4ecca3; color: #4ecca3;
13
- padding: 8px 16px; cursor: pointer; border-radius: 20px; transition: 0.3s;
14
- }
15
- button:hover, button.active { background: #4ecca3; color: #1a1a2e; }
16
- table { width: 100%; max-width: 1000px; margin: 0 auto; border-collapse: collapse; background: #0f3460; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
17
- th, td { padding: 12px; border: 1px solid #16213e; text-align: left; }
18
- th { background: #1a1a2e; color: #4ecca3; position: sticky; top: 0; }
19
- .cat-path { font-size: 0.8rem; color: #8892b0; }
20
- </style>
21
- </head>
22
- <body>
23
-
24
- <h1>Huiucl(ํ›„์ด์šฐํด) ์˜จ๋ผ์ธ ์‚ฌ์ „</h1>
25
- <div class="filter-container" id="categoryButtons">
26
- <button onclick="displayCategory('๋ชจ๋‘')" id="btn-all" class="active">๋ชจ๋‘ ๋ณด๊ธฐ</button>
27
- </div>
28
-
29
- <table id="dictTable">
30
- <thead>
31
- <tr>
32
- <th>๋‹จ์–ด (Huiucl)</th>
33
- <th>๋œป (ํ•œ๊ตญ์–ด)</th>
34
- <th>๋ถ„๋ฅ˜ ๊ฒฝ๋กœ</th>
35
- </tr>
36
- </thead>
37
- <tbody id="dictBody"></tbody>
38
- </table>
39
-
40
- <script>
41
- let conlangData = {};
42
-
43
- // 1. JSON ํŒŒ์ผ ์ง์ ‘ ๋กœ๋“œ
44
- fetch('Conlang_1.json')
45
- .then(response => {
46
- if (!response.ok) throw new Error("ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.");
47
- return response.json();
48
- })
49
- .then(data => {
50
- conlangData = data;
51
- createButtons();
52
- displayCategory('๋ชจ๋‘');
53
- })
54
- .catch(error => {
55
- console.error("Error:", error);
56
- document.getElementById('dictBody').innerHTML = `<tr><td colspan="3" style="text-align:center; color:red;">๋ฐ์ดํ„ฐ๋ฅผ ๋กœ๋“œํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. (์„œ๋ฒ„ ํ™˜๊ฒฝ์ด๋‚˜ ํŒŒ์ผ ๊ฒฝ๋กœ๋ฅผ ํ™•์ธํ•˜์„ธ์š”)</td></tr>`;
57
- });
58
-
59
- // 2. ์ตœ์ƒ์œ„ ์นดํ…Œ๊ณ ๋ฆฌ ๋ฒ„ํŠผ ์ƒ์„ฑ
60
- function createButtons() {
61
- const container = document.getElementById('categoryButtons');
62
- Object.keys(conlangData).forEach(key => {
63
- if (key === "์„ค์ •") return;
64
- const btn = document.createElement('button');
65
- btn.innerText = key;
66
- btn.onclick = (e) => {
67
- setActive(e.target);
68
- displayCategory(key);
69
- };
70
- container.appendChild(btn);
71
- });
72
- }
73
-
74
- // 3. ์นดํ…Œ๊ณ ๋ฆฌ๋ณ„ ๋ฐ์ดํ„ฐ ํ‘œ์‹œ (์žฌ๊ท€ ํƒ์ƒ‰)
75
- function displayCategory(category) {
76
- const body = document.getElementById('dictBody');
77
- body.innerHTML = '';
78
-
79
- if (category === '๋ชจ๋‘') {
80
- Object.keys(conlangData).forEach(cat => {
81
- if (cat !== "์„ค์ •") traverseData(conlangData[cat], cat);
82
- });
83
- } else {
84
- traverseData(conlangData[category], category);
85
- }
86
- }
87
-
88
- function traverseData(obj, path) {
89
- const body = document.getElementById('dictBody');
90
-
91
- for (const key in obj) {
92
- // "๋œป"์ด ์žˆ์œผ๋ฉด ๋‹จ์–ด ๋ฐ์ดํ„ฐ๋กœ ๊ฐ„์ฃผ
93
- if (typeof obj[key] === 'string') {
94
- addRow(key, obj[key], path);
95
- } else if (obj[key].hasOwnProperty('๋œป')) {
96
- addRow(key, obj[key].๋œป, path);
97
- } else if (typeof obj[key] === 'object' && key !== "๋ณ€ํ˜•" && key !== "์„ค์ •") {
98
- // ํ•˜์œ„ ์นดํ…Œ๊ณ ๋ฆฌ๊ฐ€ ์žˆ์œผ๋ฉด ๋” ๊นŠ์ด ๋“ค์–ด๊ฐ
99
- traverseData(obj[key], `${path} > ${key}`);
100
- }
101
- }
102
- }
103
-
104
- function addRow(word, meaning, path) {
105
- const body = document.getElementById('dictBody');
106
- const row = body.insertRow();
107
- row.innerHTML = `
108
- <td><strong>${word}</strong></td>
109
- <td>${meaning}</td>
110
- <td class="cat-path">${path}</td>
111
- `;
112
- }
113
-
114
- function setActive(target) {
115
- document.querySelectorAll('button').forEach(b => b.classList.remove('active'));
116
- target.classList.add('active');
117
- }
118
- </script>
119
-
120
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  </html>
 
1
+ <!DOCTYPE html>
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 Dictionary</title>
7
+ <style>
8
+ :root {
9
+ --bg-color: #f9f7f2; /* ๋ฉ”์ธ ๋ฒ ์ด์ง€ ๋ฐฐ๊ฒฝ */
10
+ --card-bg: #ffffff; /* ํ™”์ดํŠธ ์นด๋“œ */
11
+ --primary-color: #5d5b54; /* ์ง„ํ•œ ํšŒ๊ฐˆ์ƒ‰ (ํ…์ŠคํŠธ) */
12
+ --accent-color: #d4a373; /* ํฌ์ธํŠธ ์ปฌ๋Ÿฌ (๋ฒ ์ด์ง€ ๋ธŒ๋ผ์šด) */
13
+ --border-color: #e0ddd5;
14
+ }
15
+
16
+ body {
17
+ font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
18
+ background-color: var(--bg-color);
19
+ color: var(--primary-color);
20
+ margin: 0;
21
+ padding: 40px 20px;
22
+ line-height: 1.6;
23
+ }
24
+
25
+ header { text-align: center; margin-bottom: 40px; }
26
+ h1 { font-weight: 300; letter-spacing: 5px; color: var(--accent-color); margin-bottom: 10px; }
27
+ .sub-title { font-size: 0.9rem; color: #999; }
28
+
29
+ /* ๊ฒ€์ƒ‰์ฐฝ ์„น์…˜ */
30
+ .search-container {
31
+ max-width: 600px;
32
+ margin: 0 auto 30px auto;
33
+ display: flex;
34
+ gap: 10px;
35
+ }
36
+ input[type="text"] {
37
+ flex: 1;
38
+ padding: 12px 20px;
39
+ border: 1px solid var(--border-color);
40
+ border-radius: 30px;
41
+ outline: none;
42
+ background-color: var(--card-bg);
43
+ }
44
+ input[type="text"]:focus { border-color: var(--accent-color); }
45
+
46
+ /* ์นดํ…Œ๊ณ ๋ฆฌ ๋ฒ„ํŠผ */
47
+ .filter-container {
48
+ display: flex;
49
+ flex-wrap: wrap;
50
+ justify-content: center;
51
+ gap: 8px;
52
+ margin-bottom: 40px;
53
+ max-width: 800px;
54
+ margin-left: auto;
55
+ margin-right: auto;
56
+ }
57
+ button {
58
+ background: var(--card-bg);
59
+ border: 1px solid var(--border-color);
60
+ color: var(--primary-color);
61
+ padding: 6px 16px;
62
+ cursor: pointer;
63
+ border-radius: 20px;
64
+ font-size: 0.85rem;
65
+ transition: all 0.2s;
66
+ }
67
+ button:hover, button.active {
68
+ background: var(--accent-color);
69
+ color: white;
70
+ border-color: var(--accent-color);
71
+ }
72
+
73
+ /* ํ…Œ์ด๋ธ” ๋””์ž์ธ */
74
+ .table-wrapper {
75
+ max-width: 900px;
76
+ margin: 0 auto;
77
+ background: var(--card-bg);
78
+ border-radius: 15px;
79
+ overflow: hidden;
80
+ box-shadow: 0 10px 30px rgba(0,0,0,0.05);
81
+ }
82
+ table { width: 100%; border-collapse: collapse; }
83
+ th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid var(--bg-color); }
84
+ th { background: #f1eee6; font-weight: 600; font-size: 0.9rem; color: #777; }
85
+ tr:last-child td { border-bottom: none; }
86
+ tr:hover { background-color: #fafafa; }
87
+
88
+ .word-cell { font-weight: bold; color: var(--accent-color); font-size: 1.1rem; }
89
+ .path-cell { font-size: 0.75rem; color: #bbb; }
90
+ </style>
91
+ </head>
92
+ <body>
93
+
94
+ <header>
95
+ <h1>HUIUCL</h1>
96
+ <div class="sub-title">์ธ๊ณต์–ด ํ›„์ด์šฐํด ์˜จ๋ผ์ธ ์‚ฌ์ „ ์•„์นด์ด๋ธŒ</div>
97
+ </header>
98
+
99
+ <div class="search-container">
100
+ <input type="text" id="searchInput" placeholder="๋‹จ์–ด ๋˜๋Š” ๋œป์„ ๊ฒ€์ƒ‰ํ•˜์„ธ์š”..." onkeyup="filterData()">
101
+ </div>
102
+
103
+ <div class="filter-container" id="categoryButtons">
104
+ <button onclick="changeCategory('๋ชจ๋‘')" id="btn-all" class="active">๋ชจ๋‘ ๋ณด๊ธฐ</button>
105
+ </div>
106
+
107
+ <div class="table-wrapper">
108
+ <table>
109
+ <thead>
110
+ <tr>
111
+ <th style="width: 30%;">๋‹จ์–ด</th>
112
+ <th style="width: 40%;">์˜๋ฏธ</th>
113
+ <th style="width: 30%;">๋ถ„๋ฅ˜</th>
114
+ </tr>
115
+ </thead>
116
+ <tbody id="dictBody"></tbody>
117
+ </table>
118
+ </div>
119
+
120
+ <script>
121
+ let conlangData = {};
122
+ let currentCategory = '๋ชจ๋‘';
123
+
124
+ // 1. JSON ๋กœ๋“œ
125
+ fetch('Conlang_1.json')
126
+ .then(res => res.json())
127
+ .then(data => {
128
+ conlangData = data;
129
+ initButtons();
130
+ renderTable();
131
+ });
132
+
133
+ function initButtons() {
134
+ const container = document.getElementById('categoryButtons');
135
+ Object.keys(conlangData).forEach(key => {
136
+ if (key === "์„ค์ •") return;
137
+ const btn = document.createElement('button');
138
+ btn.innerText = key;
139
+ btn.onclick = (e) => {
140
+ document.querySelectorAll('button').forEach(b => b.classList.remove('active'));
141
+ e.target.classList.add('active');
142
+ currentCategory = key;
143
+ renderTable();
144
+ };
145
+ container.appendChild(btn);
146
+ });
147
+ }
148
+
149
+ // ๊ฒ€์ƒ‰ ๋ฐ ํ•„ํ„ฐ๋ง ํ•ต์‹ฌ ํ•จ์ˆ˜
150
+ function renderTable() {
151
+ const body = document.getElementById('dictBody');
152
+ const searchTerm = document.getElementById('searchInput').value.toLowerCase();
153
+ body.innerHTML = '';
154
+
155
+ const targets = currentCategory === '๋ชจ๋‘'
156
+ ? Object.keys(conlangData).filter(k => k !== "์„ค์ •")
157
+ : [currentCategory];
158
+
159
+ targets.forEach(cat => {
160
+ traverse(conlangData[cat], cat, searchTerm);
161
+ });
162
+ }
163
+
164
+ function traverse(obj, path, search) {
165
+ for (const key in obj) {
166
+ if (typeof obj[key] === 'string' || obj[key].hasOwnProperty('๋œป')) {
167
+ const word = key;
168
+ const meaning = typeof obj[key] === 'string' ? obj[key] : obj[key].๋œป;
169
+
170
+ // ๊ฒ€์ƒ‰์–ด ํ•„ํ„ฐ๋ง
171
+ if (word.toLowerCase().includes(search) || meaning.toLowerCase().includes(search)) {
172
+ addRow(word, meaning, path);
173
+ }
174
+ } else if (typeof obj[key] === 'object' && key !== "๋ณ€ํ˜•") {
175
+ traverse(obj[key], `${path} > ${key}`, search);
176
+ }
177
+ }
178
+ }
179
+
180
+ function addRow(word, meaning, path) {
181
+ const body = document.getElementById('dictBody');
182
+ const row = body.insertRow();
183
+ row.innerHTML = `
184
+ <td class="word-cell">${word}</td>
185
+ <td>${meaning}</td>
186
+ <td class="path-cell">${path}</td>
187
+ `;
188
+ }
189
+
190
+ function filterData() {
191
+ renderTable();
192
+ }
193
+ </script>
194
+
195
+ </body>
196
  </html>