-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
94 lines (92 loc) · 3.2 KB
/
index.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Maomy的Code網站</title>
<link rel="icon" href="icon.png" type="image/png" />
<meta name="description" content="快來白嫖我的免費軟體、免費程式、免費.....">
<meta property="og:image" content="/icon.png">
<style>
body {
background-color: #2e2e2e;
color: #f8f8f2;
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
margin: 0;
padding: 20px;
}
#repo-container {
width: 80%;
background-color: #1e1e1e;
border: 1px solid #555;
border-radius: 8px;
padding: 20px;
overflow-x: auto;
}
h1 {
color: #66d9ef;
}
a {
color: #66d9ef;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.repo {
margin-bottom: 15px;
padding: 10px;
background-color: #2a2a2a;
border-radius: 5px;
}
.repo-name {
font-size: 1.2em;
margin-bottom: 5px;
}
</style>
</head>
<body>
<h1>嗨,歡迎來到我的網站</h1>
<p>這裡會自動同步我在GitHub上的專案</p>
<p>點進入就可以查看了</p>
<div id="repo-container">載入中...</div>
<script>
async function fetchGitHubRepos(username) {
const url = `https://api.github.com/users/${username}/repos`;
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error('網路怪怪的 ' + response.statusText);
}
const repos = await response.json();
const container = document.getElementById('repo-container');
container.innerHTML = ''; // Clear the loading message
if (repos.length === 0) {
container.textContent = '未找到專案。';
} else {
repos.forEach(repo => {
const repoElement = document.createElement('div');
repoElement.className = 'repo';
repoElement.innerHTML = `
<div class="repo-name">${repo.name}</div>
<div><a href="${repo.html_url}" target="_blank">進入</a></div>
`;
container.appendChild(repoElement);
});
}
} catch (error) {
document.getElementById('repo-container').textContent = 'Error fetching repositories: ' + error;
}
}
// 使用你的GitHub用戶名
const username = 'SKY32K'; // Replace with your GitHub username
fetchGitHubRepos(username);
</script>
<a href="https://github.com/skywars-noob/code_web">使用SW Noob的開源網頁專案</a>
</body>
</html>