-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.html
More file actions
51 lines (46 loc) · 1.77 KB
/
index.html
File metadata and controls
51 lines (46 loc) · 1.77 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="style.css" />
<title>Basic Layout Web</title>
</head>
<body>
<h1>Hello Ges</h1>
<p>Task 1 SCC 2020</p>
<div class="contributors-section">
<h2>Contributors</h2>
<div class="contributors" id="contributors"></div>
</div>
<script>
async function fetchContributors() {
try {
const response = await fetch(
'https://api.github.com/repos/rafiudd/basic-layout-web/contributors'
);
if (!response.ok) throw new Error('Failed to fetch contributors');
const contributors = await response.json();
const container = document.getElementById('contributors');
container.innerHTML = ""; // Clear previous content
contributors.forEach(({ login, avatar_url, html_url }) => {
const contributor = document.createElement('div');
contributor.className = 'contributor';
contributor.innerHTML = `
<a href="${html_url}" target="_blank" rel="noopener noreferrer" title="${login}">
<img src="${avatar_url}" alt="${login}'s avatar" width="80" height="80" style="border-radius:50%;" />
<div>${login}</div>
</a>
`;
container.appendChild(contributor);
});
} catch (error) {
document.getElementById('contributors').textContent = "Could not load contributors.";
console.error(error);
}
}
window.addEventListener('DOMContentLoaded', fetchContributors);
</script>
</body>
</html>