OpenLab-NLP commited on
Commit
cc472d6
ยท
verified ยท
1 Parent(s): 94d5ad0

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +41 -47
index.html CHANGED
@@ -25,7 +25,7 @@
25
  .word-cell { font-weight: bold; color: var(--accent-color); width: 25%; }
26
  .meaning-cell { width: 55%; font-size: 0.95rem; }
27
  .path-cell { font-size: 0.7rem; color: #bbb; width: 20%; text-align: right; }
28
- .usage-tag { font-size: 0.8rem; color: #888; display: block; margin-top: 4px; border-top: 1px dashed #eee; padding-top: 4px; }
29
  </style>
30
  </head>
31
  <body>
@@ -37,19 +37,19 @@
37
 
38
  <header>
39
  <h1>HUIUCL</h1>
40
- <div style="color:#999; font-size:0.8rem; margin-top:5px;">DATABASE v2.7 (Manual Mapping)</div>
41
  </header>
42
 
43
  <div class="container">
44
  <section id="dictionary" class="active">
45
- <input type="text" id="searchInput" class="search-box" placeholder="๋‹จ์–ด, ๋œป, ์นดํ…Œ๊ณ ๋ฆฌ ๊ฒ€์ƒ‰..." oninput="renderTable()">
46
  <div class="filter-container" id="categoryButtons">
47
  <button class="filter-btn active" onclick="filterCategory('๋ชจ๋‘', this)">๋ชจ๋‘ ๋ณด๊ธฐ</button>
48
  </div>
49
  <div class="table-wrapper">
50
  <table>
51
  <thead>
52
- <tr><th>๋‹จ์–ด</th><th>์˜๋ฏธ ๋ฐ ์„ค๋ช…</th><th style="text-align:right;">๋ถ„๋ฅ˜</th></tr>
53
  </thead>
54
  <tbody id="dictBody"></tbody>
55
  </table>
@@ -99,60 +99,54 @@
99
  const query = document.getElementById('searchInput').value.toLowerCase();
100
  const body = document.getElementById('dictBody');
101
  body.innerHTML = '';
102
-
103
- const categories = currentCategory === '๋ชจ๋‘'
104
- ? Object.keys(conlangData).filter(k => k !== "Settings")
105
- : [currentCategory];
106
-
107
- categories.forEach(cat => {
108
- manualProcess(conlangData[cat], cat, query);
109
- });
110
  }
111
 
112
- // ํ•˜๋‚˜ํ•˜๋‚˜ ์„ฑ๊ฒฉ์— ๋งž์ถฐ ์ง€์ • ์ฒ˜๋ฆฌํ•˜๋Š” ์ˆ˜๋™ ๋งคํ•‘ ์—”์ง„
113
- function manualProcess(obj, path, query) {
114
- if (path.includes("Grammar_Rules")) return; // ๋ฌธ๋ฒ• ๊ทœ์น™์€ ์‚ฌ์ „์—์„œ ์ œ์™ธ
115
 
116
  for (let key in obj) {
117
  const val = obj[key];
118
  if (!val) continue;
119
 
120
- // 1. [๋‹จ์–ด ๊ฐ์ฒด] - meaning_ko, ko, definition ๋“ฑ์˜ ํ‚ค๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ
121
- if (typeof val === 'object' && (val.meaning_ko || val.ko || val.definition || val.๋œป)) {
122
- let mainWord = key;
123
- let kor = val.meaning_ko || val.ko || val.๋œป || val.definition || "";
124
- let eng = val.meaning_en || val.en || "";
125
- let extra = val.usage || val.note || "";
126
 
127
- if (mainWord.toLowerCase().includes(query) || kor.toLowerCase().includes(query)) {
128
- appendRow(mainWord, kor, eng, extra, path);
129
- }
 
 
130
 
131
- // ํ•˜์œ„ ํŒŒ์ƒ์–ด ์ฒ˜๋ฆฌ
132
- if (val.derivations) {
133
- for (let dKey in val.derivations) {
134
- appendRow(dKey, val.derivations[dKey], "", "", path, true);
135
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  }
137
-
138
- // ์กฐ๋™์‚ฌ ๋“ฑ ๋‚ด๋ถ€ ํ…์Šค ๋ณ€ํ˜•์ด ์žˆ๋Š” ๊ฒฝ์šฐ (acam, acac ๋“ฑ)
139
- if (val.tense_variants) {
140
- manualProcess(val.tense_variants, path + " > " + key, query);
141
- }
142
- }
143
- // 2. [๋‹จ์ˆœ ํ‚ค-๊ฐ’] - ๋Œ€๋ช…์‚ฌ, ์ธ์‚ฌ๋ง ๋“ฑ (key: "string")
144
  else if (typeof val === 'string') {
145
  if (key.toLowerCase().includes(query) || val.toLowerCase().includes(query)) {
146
  appendRow(key, val, "", "", path);
147
  }
148
  }
149
- // 3. [์กฐ์‚ฌ/์ ‘์‚ฌ ๊ตฌ์กฐ] - ํ‚ค ๋‚ด๋ถ€์— ๋˜ ์„ค๋ช…์ด ์žˆ๊ฑฐ๋‚˜, ๋ฌถ์—ฌ ์žˆ๋Š” ๊ฒฝ์šฐ
150
- else if (typeof val === 'object') {
151
- // ํŠน์ • ํ‚ค(usage, note, definition) ์ž์ฒด๊ฐ€ ๋‹จ์–ด๋กœ ๋œจ์ง€ ์•Š๋„๋ก ํ•„ํ„ฐ๋งํ•˜๋ฉฐ ์žฌ๊ท€ ํƒ์ƒ‰
152
- if (!["usage", "note", "definition", "tense_variants"].includes(key)) {
153
- manualProcess(val, path + " > " + key, query);
154
- }
155
- }
156
  }
157
  }
158
 
@@ -161,13 +155,13 @@
161
  const row = body.insertRow();
162
  if (isSub) row.className = 'variation-row';
163
 
164
- let meaningHtml = `<strong>${kor}</strong>`;
165
- if (eng) meaningHtml += ` <span style="color:#888;">(${eng})</span>`;
166
- if (usage) meaningHtml += `<span class="usage-tag">โ€ป ${usage}</span>`;
167
 
168
  row.innerHTML = `
169
  <td class="word-cell">${isSub ? 'โ”” ' : ''}${word}</td>
170
- <td class="meaning-cell">${meaningHtml}</td>
171
  <td class="path-cell">${path}</td>
172
  `;
173
  }
@@ -190,7 +184,7 @@
190
  }
191
  }
192
  findRules(conlangData, "");
193
- target.innerHTML = html || "<p>๋กœ๋“œ๋œ ๋ฌธ๋ฒ• ๊ทœ์น™์ด ์—†์Šต๋‹ˆ๋‹ค.</p>";
194
  }
195
  </script>
196
  </body>
 
25
  .word-cell { font-weight: bold; color: var(--accent-color); width: 25%; }
26
  .meaning-cell { width: 55%; font-size: 0.95rem; }
27
  .path-cell { font-size: 0.7rem; color: #bbb; width: 20%; text-align: right; }
28
+ .usage-text { font-size: 0.85rem; color: #7a7a7a; background: #fcfcfc; border-left: 3px solid var(--accent-color); padding: 5px 10px; margin-top: 8px; }
29
  </style>
30
  </head>
31
  <body>
 
37
 
38
  <header>
39
  <h1>HUIUCL</h1>
40
+ <div style="color:#999; font-size:0.8rem; margin-top:5px;">DATABASE v2.8 (Strict Object Handing)</div>
41
  </header>
42
 
43
  <div class="container">
44
  <section id="dictionary" class="active">
45
+ <input type="text" id="searchInput" class="search-box" placeholder="๋‹จ์–ด, ๋œป ๊ฒ€์ƒ‰..." oninput="renderTable()">
46
  <div class="filter-container" id="categoryButtons">
47
  <button class="filter-btn active" onclick="filterCategory('๋ชจ๋‘', this)">๋ชจ๋‘ ๋ณด๊ธฐ</button>
48
  </div>
49
  <div class="table-wrapper">
50
  <table>
51
  <thead>
52
+ <tr><th>๋‹จ์–ด</th><th>์˜๋ฏธ ๋ฐ ์ƒ์„ธ ์„ค๋ช…</th><th style="text-align:right;">๋ถ„๋ฅ˜</th></tr>
53
  </thead>
54
  <tbody id="dictBody"></tbody>
55
  </table>
 
99
  const query = document.getElementById('searchInput').value.toLowerCase();
100
  const body = document.getElementById('dictBody');
101
  body.innerHTML = '';
102
+ const cats = currentCategory === '๋ชจ๋‘' ? Object.keys(conlangData).filter(k => k !== "Settings") : [currentCategory];
103
+ cats.forEach(cat => strictProcess(conlangData[cat], cat, query));
 
 
 
 
 
 
104
  }
105
 
106
+ function strictProcess(obj, path, query) {
107
+ // ๋ฌธ๋ฒ• ๊ทœ์น™ ์ œ์™ธ
108
+ if (path.includes("Grammar_Rules")) return;
109
 
110
  for (let key in obj) {
111
  const val = obj[key];
112
  if (!val) continue;
113
 
114
+ // ์ถœ๋ ฅ ์ œ์™ธ ์˜ˆ์•ฝ์–ด
115
+ const skipKeys = ["usage", "note", "definition", "tense_variants", "ko", "en"];
116
+ if (skipKeys.includes(key)) continue;
 
 
 
117
 
118
+ // 1. ๋‹จ์–ด ์ •๋ณด๊ฐ€ ๋‹ด๊ธด ๊ฐ์ฒด์ธ ๊ฒฝ์šฐ
119
+ if (typeof val === 'object') {
120
+ const kor = val.meaning_ko || val.ko || val.๋œป || val.definition || "";
121
+ const eng = val.meaning_en || val.en || "";
122
+ const usage = val.usage || val.note || "";
123
 
124
+ // ํ•œ๊ตญ์–ด ๋œป์ด๋‚˜ ์˜๋ฌธ ํ‚ค์— ์ •๋ณด๊ฐ€ ์žˆ๋Š” '์ง„์งœ ๋‹จ์–ด'์ธ ๊ฒฝ์šฐ ์ถœ๋ ฅ
125
+ if (kor || eng) {
126
+ if (key.toLowerCase().includes(query) || (typeof kor === 'string' && kor.includes(query))) {
127
+ appendRow(key, kor, eng, usage, path);
128
  }
129
+
130
+ // ํŒŒ์ƒ์–ด ์ฒ˜๋ฆฌ
131
+ if (val.derivations) {
132
+ for (let dKey in val.derivations) {
133
+ appendRow(dKey, val.derivations[dKey], "", "", path, true);
134
+ }
135
+ }
136
+ // ์‹œ์ œ ๋ณ€ํ˜•์ด ์žˆ๋‹ค๋ฉด ๋‚ด๋ถ€ ํƒ์ƒ‰
137
+ if (val.tense_variants) strictProcess(val.tense_variants, path + " > " + key, query);
138
+ }
139
+ // ํ•˜์œ„ ๋ฐ์ดํ„ฐ๊ฐ€ ๋” ์žˆ๋‹ค๋ฉด ์žฌ๊ท€ ํƒ์ƒ‰
140
+ else {
141
+ strictProcess(val, path + " > " + key, query);
142
  }
143
+ }
144
+ // 2. ๋Œ€๋ช…์‚ฌ/์ธ์‚ฌ๋ง ๋“ฑ ๋‹จ์ˆœ ๋ฌธ์ž์—ด์ธ ๊ฒฝ์šฐ
 
 
 
 
 
145
  else if (typeof val === 'string') {
146
  if (key.toLowerCase().includes(query) || val.toLowerCase().includes(query)) {
147
  appendRow(key, val, "", "", path);
148
  }
149
  }
 
 
 
 
 
 
 
150
  }
151
  }
152
 
 
155
  const row = body.insertRow();
156
  if (isSub) row.className = 'variation-row';
157
 
158
+ let content = `<strong>${typeof kor === 'object' ? JSON.stringify(kor) : kor}</strong>`;
159
+ if (eng) content += ` <span style="color:#888;">(${eng})</span>`;
160
+ if (usage) content += `<div class="usage-text">โ€ป ${usage}</div>`;
161
 
162
  row.innerHTML = `
163
  <td class="word-cell">${isSub ? 'โ”” ' : ''}${word}</td>
164
+ <td class="meaning-cell">${content}</td>
165
  <td class="path-cell">${path}</td>
166
  `;
167
  }
 
184
  }
185
  }
186
  findRules(conlangData, "");
187
+ target.innerHTML = html;
188
  }
189
  </script>
190
  </body>