Spaces:
Running
Running
Upload 2 files
Browse files- Conlang_1.json +0 -0
- 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 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>
|