-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
71 lines (67 loc) · 2.4 KB
/
index.html
File metadata and controls
71 lines (67 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="google-site-verification" content="Ro-bPUXhIMvyD-1BmLmSajKG8l-sAoyIhaZN1F3rGDA" />
<title>Ryota Miyagi / 宮城 竜大</title>
<link rel="icon" href="media/logo-64x64_whiteback.png" type="image/png">
<link rel="stylesheet" id="turtle-css" href="turtle.css?ver=1.0.0" type="text/css" media="all">
<style>
.language-switch {
position: absolute;
top: 10px;
right: 10px;
display: flex;
gap: 10px;
}
.language-switch button {
margin: 0;
padding: 8px 12px;
font-size: 14px;
cursor: pointer;
border: 1px solid #ccc;
background-color: #f9f9f9;
border-radius: 5px;
min-width: 80px;
text-align: center;
}
</style>
</head>
<body>
<div class="site">
<div class="language-switch">
<button onclick="toggleLanguage('en')">English</button>
<button onclick="toggleLanguage('jp')">日本語</button>
</div>
<div class="site-content" id="content"></div>
<footer>
<p>Copyright © Ryota Miyagi</p>
</footer>
</div>
<script>
async function loadContent(language) {
try {
const response = await fetch(`content/${language}/file-list.json`);
const files = await response.json();
let contentHTML = "";
for (const file of files) {
const fileContent = await fetch(`content/${language}/` + file).then(res => res.text());
contentHTML += fileContent;
}
document.getElementById('content').innerHTML = contentHTML;
localStorage.setItem('preferredLanguage', language);
} catch (error) {
console.error('Error loading content:', error);
}
}
function toggleLanguage(language) {
loadContent(language);
}
document.addEventListener("DOMContentLoaded", async () => {
const savedLanguage = localStorage.getItem('preferredLanguage') || 'jp';
await loadContent(savedLanguage);
});
</script>
</body>
</html>