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

Upload 2 files

Browse files
Files changed (2) hide show
  1. Conlang_1.json +0 -0
  2. index.html +121 -19
Conlang_1.json ADDED
The diff for this file is too large to render. See raw diff
 
index.html CHANGED
@@ -1,19 +1,121 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </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
+ 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>