Skip to content

Commit b8d6ac6

Browse files
committed
Updated stats logic and image assets
1 parent 5d91aa1 commit b8d6ac6

File tree

5 files changed

+44
-1
lines changed

5 files changed

+44
-1
lines changed

.DS_Store

0 Bytes
Binary file not shown.

Images/.DS_Store

6 KB
Binary file not shown.

Images/KHC Logo.png

45 KB
Loading

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<title>Krypto Hashers Community</title>
8-
<link rel="icon" type="image/png" href="">
8+
<link rel="icon" type="image/png" href="./Images/KHC Logo.png">
99
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
1010
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
1111
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">

script.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const orgName = "Krypto-Hashers-Community";
2+
const apiUrl = `https://api.github.com/orgs/${orgName}/repos`;
3+
const membersApiUrl = `https://api.github.com/orgs/${orgName}/members`;
4+
5+
6+
fetch(apiUrl)
7+
.then(response => {
8+
if (!response.ok) {
9+
throw new Error("Network response for repos was not OK");
10+
}
11+
return response.json();
12+
})
13+
.then(repos => {
14+
let totalStars = 0;
15+
let totalForks = 0;
16+
17+
repos.forEach(repo => {
18+
totalStars += repo.stargazers_count;
19+
totalForks += repo.forks_count;
20+
});
21+
22+
document.getElementById("stars-count").textContent = totalStars;
23+
document.getElementById("forks-count").textContent = totalForks;
24+
})
25+
.catch(error => {
26+
console.error("Error fetching stars and forks:", error);
27+
});
28+
29+
30+
fetch(membersApiUrl)
31+
.then(response => {
32+
if (!response.ok) {
33+
throw new Error("Network response for members was not OK");
34+
}
35+
return response.json();
36+
})
37+
.then(members => {
38+
const totalMembers = members.length;
39+
document.getElementById("members-count").textContent = totalMembers;
40+
})
41+
.catch(error => {
42+
console.error("Error fetching members:", error);
43+
});

0 commit comments

Comments
 (0)