forked from ML-Fusion-Lab/ML-Fusion-Lab-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
contributor.js
32 lines (27 loc) · 1.07 KB
/
contributor.js
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
document.addEventListener("DOMContentLoaded", () => {
const contributorsContainer = document.getElementById("contributors");
async function fetchContributors() {
try {
const response = await fetch(
`https://api.github.com/repos/ML-Fusion-Lab/ML-Fusion-Lab-Website/contributors`
);
const contributors = await response.json();
contributorsContainer.innerHTML = "";
contributors.forEach((contributor) => {
const contributorCard = document.createElement("div");
contributorCard.className = "contributor-card";
contributorCard.innerHTML = `
<a href="${contributor.html_url}" target="_blank" rel="noopener noreferrer">
<img src="${contributor.avatar_url}" alt="${contributor.login}">
</a>
<h2>${contributor.login}</h2>
<p>Contributions: ${contributor.contributions}</p>
`;
contributorsContainer.appendChild(contributorCard);
});
} catch (error) {
console.error("Error fetching contributors:", error);
}
}
fetchContributors();
});