OpenLab-NLP commited on
Commit
b40ee7e
ยท
verified ยท
1 Parent(s): 5d5546a

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +99 -54
index.html CHANGED
@@ -13,24 +13,32 @@
13
  --border-color: #e0ddd5;
14
  }
15
 
16
- body { font-family: 'Pretendard', sans-serif; background-color: var(--bg-color); color: var(--primary-color); margin: 0; line-height: 1.6; }
17
  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-color); z-index: 100; }
18
  nav a { margin: 0 15px; text-decoration: none; color: var(--primary-color); font-weight: 600; cursor: pointer; }
19
  header { text-align: center; padding: 40px 20px; }
20
  h1 { font-weight: 300; letter-spacing: 8px; color: var(--accent-color); margin: 0; }
21
 
22
- .container { max-width: 1000px; margin: 0 auto; padding: 20px; }
23
  section { display: none; }
24
- section.active { display: block; }
25
 
26
- /* ์‚ฌ์ „ ์Šคํƒ€์ผ */
27
- .search-box { width: 100%; padding: 15px 25px; border: 1px solid var(--border-color); border-radius: 30px; font-size: 1rem; margin-bottom: 25px; box-sizing: border-box; outline: none; box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
 
 
 
 
 
 
 
28
  .table-wrapper { background: white; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
29
  table { width: 100%; border-collapse: collapse; }
30
  th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid #eee; }
31
- th { background: #f1eee6; color: #777; font-size: 0.9rem; }
32
- .word-cell { font-weight: bold; color: var(--accent-color); width: 25%; }
33
- .variation-row { background: #faf9f6; font-size: 0.95rem; }
 
34
 
35
  .card { background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.02); }
36
  </style>
@@ -44,19 +52,24 @@
44
 
45
  <header>
46
  <h1>HUIUCL</h1>
47
- <div style="color:#999; font-size:0.8rem; margin-top:5px;">SYSTEM ARCHIVE v2.0</div>
48
  </header>
49
 
50
  <div class="container">
51
  <section id="dictionary" class="active">
52
- <input type="text" id="searchInput" class="search-box" placeholder="๋‹จ์–ด, ๋œป, ํŒŒ์ƒ์–ด๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”..." oninput="renderTable()">
 
 
 
 
 
53
  <div class="table-wrapper">
54
  <table>
55
  <thead>
56
  <tr>
57
  <th>๋‹จ์–ด</th>
58
- <th>์˜๋ฏธ (KO)</th>
59
- <th>Meaning (EN)</th>
60
  </tr>
61
  </thead>
62
  <tbody id="dictBody"></tbody>
@@ -66,99 +79,131 @@
66
 
67
  <section id="grammar">
68
  <div class="card" id="grammarBox">
69
- <h2>Grammar Settings</h2>
70
  <div id="settingsContent">๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘...</div>
71
  </div>
72
  </section>
73
  </div>
74
 
75
  <script>
76
- let rawData = {};
 
77
 
78
  function showSection(id) {
79
  document.querySelectorAll('section').forEach(s => s.classList.remove('active'));
80
  document.getElementById(id).classList.add('active');
81
  }
82
 
83
- // JSON ๋กœ๋“œ
84
  window.onload = () => {
85
  fetch('Huiucl.json')
86
  .then(res => res.json())
87
  .then(data => {
88
- rawData = data;
 
89
  renderTable();
90
  renderGrammar();
91
  })
92
  .catch(err => {
93
- document.getElementById('dictBody').innerHTML = '<tr><td colspan="3" style="text-align:center; padding:50px;">JSON ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. (Huiucl.json ํ™•์ธ)</td></tr>';
 
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
- // ์žฌ๊ท€์ ์œผ๋กœ ๋‹จ์–ด ๋ฐ์ดํ„ฐ๋ฅผ ์ฐพ๋Š” ํ•จ์ˆ˜
103
- function findEntries(obj) {
104
- for (let key in obj) {
105
- const item = obj[key];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
- // ๋‹จ์–ด ์—”ํŠธ๋ฆฌ ์กฐ๊ฑด: meaning_ko ํ•„๋“œ๊ฐ€ ์žˆ์„ ๋•Œ
108
- if (item && typeof item === 'object' && item.meaning_ko) {
109
- const word = key;
110
- const kor = item.meaning_ko;
111
- const eng = item.meaning_en || '';
112
-
113
- // ๊ฒ€์ƒ‰ ์กฐ๊ฑด ๋Œ€์กฐ
114
- if (word.toLowerCase().includes(query) || kor.includes(query) || eng.toLowerCase().includes(query)) {
115
- appendRow(word, kor, eng, false);
116
- }
117
 
118
- // ํŒŒ์ƒ์–ด(derivations) ์ˆœํšŒ
119
- if (item.derivations) {
120
- for (let dKey in item.derivations) {
121
- const dMean = item.derivations[dKey];
122
- if (dKey.toLowerCase().includes(query) || dMean.toLowerCase().includes(query)) {
123
- appendRow(dKey, dMean, '-', true);
124
- }
125
  }
126
  }
127
- } else if (item && typeof item === 'object' && key !== "Settings") {
128
- // ๋” ๊นŠ์€ ๊ณ„์ธต์ด ์žˆ๋‹ค๋ฉด ๋‹ค์‹œ ํƒ์ƒ‰
129
- findEntries(item);
130
  }
 
 
 
 
 
 
 
 
 
 
131
  }
132
  }
133
-
134
- findEntries(rawData);
135
  }
136
 
137
- function appendRow(word, kor, eng, isSub) {
138
  const body = document.getElementById('dictBody');
139
  const row = body.insertRow();
140
  if (isSub) row.className = 'variation-row';
141
 
142
  row.innerHTML = `
143
  <td class="word-cell">${isSub ? 'โ”” ' : ''}${word}</td>
144
- <td>${kor}</td>
145
- <td style="color:#aaa; font-size:0.85rem;">${eng}</td>
146
  `;
147
  }
148
 
149
  function renderGrammar() {
150
  const target = document.getElementById('settingsContent');
151
- if (!rawData.Settings) {
152
- target.innerHTML = "์„ค์ • ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.";
153
- return;
154
- }
155
- const s = rawData.Settings;
156
  target.innerHTML = `
157
  <h3>Phonology</h3>
158
- <p>Vowels: ${Object.keys(s.Phonology.Vowels).join(', ')}</p>
159
- <p>Consonants: ${Object.keys(s.Phonology.Consonants).join(', ')}</p>
 
160
  <h3>Syntax</h3>
161
- <p>Order: ${s.Syntax.Word_Order.join(', ')}</p>
162
  <p>${s.Syntax.Imperative["2"]}</p>
163
  `;
164
  }
 
13
  --border-color: #e0ddd5;
14
  }
15
 
16
+ body { font-family: 'Pretendard', sans-serif; background-color: var(--bg-color); color: var(--primary-color); margin: 0; padding: 0; line-height: 1.6; }
17
  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-color); z-index: 100; }
18
  nav a { margin: 0 15px; text-decoration: none; color: var(--primary-color); font-weight: 600; cursor: pointer; }
19
  header { text-align: center; padding: 40px 20px; }
20
  h1 { font-weight: 300; letter-spacing: 8px; color: var(--accent-color); margin: 0; }
21
 
22
+ .container { max-width: 1000px; margin: 0 auto; padding: 0 20px 100px; }
23
  section { display: none; }
24
+ section.active { display: block; animation: fadeIn 0.5s; }
25
 
26
+ @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
27
+
28
+ /* ํ•„ํ„ฐ ๋ฒ„ํŠผ ์Šคํƒ€์ผ */
29
+ .filter-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 25px; }
30
+ .filter-btn { background: var(--card-bg); border: 1px solid var(--border-color); padding: 8px 16px; cursor: pointer; border-radius: 20px; font-size: 0.85rem; transition: 0.2s; }
31
+ .filter-btn.active { background: var(--accent-color); color: white; border-color: var(--accent-color); }
32
+
33
+ /* ๊ฒ€์ƒ‰ ๋ฐ ํ…Œ์ด๋ธ” ์Šคํƒ€์ผ */
34
+ .search-box { width: 100%; padding: 15px 25px; border: 1px solid var(--border-color); border-radius: 30px; font-size: 1rem; margin-bottom: 20px; box-sizing: border-box; outline: none; }
35
  .table-wrapper { background: white; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
36
  table { width: 100%; border-collapse: collapse; }
37
  th, td { padding: 15px 20px; text-align: left; border-bottom: 1px solid #eee; }
38
+ th { background: #f1eee6; color: #777; font-size: 0.9rem; font-weight: 500; }
39
+ .word-cell { font-weight: bold; color: var(--accent-color); width: 30%; }
40
+ .path-cell { font-size: 0.75rem; color: #ccc; width: 20%; }
41
+ .variation-row { background: #faf9f6; }
42
 
43
  .card { background: white; padding: 30px; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.02); }
44
  </style>
 
52
 
53
  <header>
54
  <h1>HUIUCL</h1>
55
+ <div style="color:#999; font-size:0.8rem; margin-top:5px;">v2.0 Revision - Database</div>
56
  </header>
57
 
58
  <div class="container">
59
  <section id="dictionary" class="active">
60
+ <input type="text" id="searchInput" class="search-box" placeholder="๋‹จ์–ด, ๋œป, ํŒŒ์ƒ์–ด ๊ฒ€์ƒ‰..." oninput="renderTable()">
61
+
62
+ <div class="filter-container" id="categoryButtons">
63
+ <button class="filter-btn active" onclick="filterCategory('๋ชจ๋‘', this)">๋ชจ๋‘ ๋ณด๊ธฐ</button>
64
+ </div>
65
+
66
  <div class="table-wrapper">
67
  <table>
68
  <thead>
69
  <tr>
70
  <th>๋‹จ์–ด</th>
71
+ <th>์˜๋ฏธ</th>
72
+ <th>๋ถ„๋ฅ˜</th>
73
  </tr>
74
  </thead>
75
  <tbody id="dictBody"></tbody>
 
79
 
80
  <section id="grammar">
81
  <div class="card" id="grammarBox">
82
+ <h2>Grammar & Phonology</h2>
83
  <div id="settingsContent">๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘...</div>
84
  </div>
85
  </section>
86
  </div>
87
 
88
  <script>
89
+ let conlangData = {};
90
+ let currentCategory = '๋ชจ๋‘';
91
 
92
  function showSection(id) {
93
  document.querySelectorAll('section').forEach(s => s.classList.remove('active'));
94
  document.getElementById(id).classList.add('active');
95
  }
96
 
 
97
  window.onload = () => {
98
  fetch('Huiucl.json')
99
  .then(res => res.json())
100
  .then(data => {
101
+ conlangData = data;
102
+ initFilterButtons();
103
  renderTable();
104
  renderGrammar();
105
  })
106
  .catch(err => {
107
+ console.error(err);
108
+ document.getElementById('dictBody').innerHTML = '<tr><td colspan="3">๋ฐ์ดํ„ฐ ๋กœ๋“œ ์‹คํŒจ (Huiucl.json ํŒŒ์ผ์„ ํ™•์ธํ•˜์„ธ์š”)</td></tr>';
109
  });
110
  };
111
 
112
+ // ์ƒ๋‹จ ํ’ˆ์‚ฌ/์นดํ…Œ๊ณ ๋ฆฌ ๋ฒ„ํŠผ ์ƒ์„ฑ
113
+ function initFilterButtons() {
114
+ const btnContainer = document.getElementById('categoryButtons');
115
+ // JSON์˜ ์ตœ์ƒ์œ„ ํ‚ค๋“ค์„ ๋ฒ„ํŠผ์œผ๋กœ ๋งŒ๋“ฆ (Settings ์ œ์™ธ)
116
+ Object.keys(conlangData).forEach(key => {
117
+ if (key === "Settings") return;
118
+ const btn = document.createElement('button');
119
+ btn.className = 'filter-btn';
120
+ btn.innerText = key;
121
+ btn.onclick = (e) => filterCategory(key, e.target);
122
+ btnContainer.appendChild(btn);
123
+ });
124
+ }
125
+
126
+ function filterCategory(cat, btn) {
127
+ document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
128
+ btn.classList.add('active');
129
+ currentCategory = cat;
130
+ renderTable();
131
+ }
132
+
133
  function renderTable() {
134
  const query = document.getElementById('searchInput').value.toLowerCase();
135
  const body = document.getElementById('dictBody');
136
  body.innerHTML = '';
137
 
138
+ const categories = currentCategory === '๋ชจ๋‘'
139
+ ? Object.keys(conlangData).filter(k => k !== "Settings")
140
+ : [currentCategory];
141
+
142
+ categories.forEach(cat => {
143
+ traverse(conlangData[cat], cat, query);
144
+ });
145
+ }
146
+
147
+ // ๋ฐ์ดํ„ฐ๋ฅผ ๊นŠ๊ฒŒ ํƒ์ƒ‰ํ•˜๋ฉฐ ๋‹จ์–ด๋ฅผ ์ถ”์ถœํ•˜๋Š” ํ•จ์ˆ˜
148
+ function traverse(obj, path, query) {
149
+ for (let key in obj) {
150
+ const item = obj[key];
151
+
152
+ // 1. ์ผ๋ฐ˜ ๋‹จ์–ด ๊ตฌ์กฐ (meaning_ko / ๋œป ํ•„๋“œ ์กด์žฌ ์‹œ)
153
+ if (item && typeof item === 'object' && (item.meaning_ko || item.๋œป)) {
154
+ const kor = item.meaning_ko || item.๋œป;
155
+ const eng = item.meaning_en || '';
156
 
157
+ if (key.toLowerCase().includes(query) || kor.toLowerCase().includes(query)) {
158
+ appendRow(key, kor, path, false);
159
+ }
 
 
 
 
 
 
 
160
 
161
+ // ํŒŒ์ƒ์–ด ์ฒ˜๋ฆฌ (derivations ํ‚ค ํ™•์ธ)
162
+ if (item.derivations) {
163
+ for (let dKey in item.derivations) {
164
+ const dMean = item.derivations[dKey];
165
+ if (dKey.toLowerCase().includes(query) || dMean.toLowerCase().includes(query)) {
166
+ appendRow(dKey, dMean, path, true);
 
167
  }
168
  }
 
 
 
169
  }
170
+ }
171
+ // 2. ํŠน์ˆ˜ ๋‹จ์–ด (์กฐ์‚ฌ, ์ ‘์†์‚ฌ ๋“ฑ - ๋‹จ์ˆœ ํ‚ค-๊ฐ’ ์Œ์ธ ๊ฒฝ์šฐ)
172
+ else if (typeof item === 'string') {
173
+ if (key.toLowerCase().includes(query) || item.toLowerCase().includes(query)) {
174
+ appendRow(key, item, path, false);
175
+ }
176
+ }
177
+ // 3. ํ•˜์œ„ ์นดํ…Œ๊ณ ๋ฆฌ๊ฐ€ ๋” ์žˆ๋Š” ๊ฒฝ์šฐ (์žฌ๊ท€ ํƒ์ƒ‰)
178
+ else if (item && typeof item === 'object') {
179
+ traverse(item, path + " > " + key, query);
180
  }
181
  }
 
 
182
  }
183
 
184
+ function appendRow(word, meaning, path, isSub) {
185
  const body = document.getElementById('dictBody');
186
  const row = body.insertRow();
187
  if (isSub) row.className = 'variation-row';
188
 
189
  row.innerHTML = `
190
  <td class="word-cell">${isSub ? 'โ”” ' : ''}${word}</td>
191
+ <td>${meaning}</td>
192
+ <td class="path-cell">${path}</td>
193
  `;
194
  }
195
 
196
  function renderGrammar() {
197
  const target = document.getElementById('settingsContent');
198
+ if (!conlangData.Settings) return;
199
+ const s = conlangData.Settings;
 
 
 
200
  target.innerHTML = `
201
  <h3>Phonology</h3>
202
+ <p><strong>Vowels:</strong> ${Object.keys(s.Phonology.Vowels).join(', ')}</p>
203
+ <p><strong>Consonants:</strong> ${Object.keys(s.Phonology.Consonants).join(', ')}</p>
204
+ <hr>
205
  <h3>Syntax</h3>
206
+ <p><strong>Word Order:</strong> ${s.Syntax.Word_Order.join(' / ')}</p>
207
  <p>${s.Syntax.Imperative["2"]}</p>
208
  `;
209
  }