Repository navigation
Expand file tree
/
Copy pathcontributors.html
More file actions
168 lines (156 loc) · 5.5 KB
/
Copy pathcontributors.html
File metadata and controls
168 lines (156 loc) · 5.5 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Contributors List</title>
<script
src="https://kit.fontawesome.com/9ce43fc1dc.js"
crossorigin="anonymous"
></script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&family=Alegreya+Sans&family=Barlow:ital,wght@1,600&family=Berkshire+Swash&family=Dosis&family=Exo+2:wght@300&family=Josefin+Sans&family=Kanit&family=Lato&family=Poppins:wght@300&family=Roboto+Condensed:wght@300&family=Rubik&family=Staatliches&family=Ubuntu&family=Varela+Round&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="css/contri-styles.css" />
</head>
<body>
<!-- Navbar Code -->
<nav>
<div>
<div
style="
display: flex;
gap: 0.5rem;
align-items: center;
padding-left: 1.5rem;
padding-right: 1rem;
"
>
<i style="scale: 3" class="fa-brands fa-python"></i>
<h2 style="font-family: outfit; font-weight: 700; padding-left: 1rem">
DSA In Python Blogs
</h2>
</div>
<hr style="height: 1px; border: none; background: rgba(0, 0, 0, 0.2)" />
</div>
</nav>
<!-- Navbar Code -->
<div class="admin-card">
<!-- Admin Card -->
<div class="card">
<a href="https://github.com/adityaInnovates">
<div class="card-body">
<div class="left">
<div class="card-img">
<img
width="64"
height="64"
border-radius="50%"
style="object-fit: cover;scale: 1.3;border-radius: 50%;border: 1px solid black;padding: 0.1rem;"
src="https://aditya.appambient.com/images/aditya/adityaAiTransparent.png"
alt="external-boy-children-avatar-victoruler-linear-colour-victoruler-1"
/>
</div>
<div class="card-text">
<h2>Aditya Innovates</h2>
<p>Project Lead and Repository Maintainer</p>
</div>
</div>
</div>
</a>
</div>
</div>
<div
class="heading"
style="margin-top: 70px; text-decoration: underline; margin-bottom: 30px"
>
<center><h1>All Contributors</h1></center>
</div>
<div class="content" id="cards"></div>
<div class="back">
<a href="./" class="button bottom-btn">BACK</a>
</div>
<!-- scroll to top button -->
<a href="#top" class="to-top">
<i class="fa-solid fa-arrow-up"></i>
</a>
<!-- Footer Code -->
<div
style="
padding: 1rem;
display: flex;
align-items: center;
justify-content: center;
"
>
Made with ❤️ By <a style="margin-left: 0.3rem" href="#">Contributors</a>
</div>
<!-- Footer Code -->
<script>
// GitHub API URL for the repository contributors
const repoOwner = "AdityaInnovates"; // Replace with your repo owner
const repoName = "SimpleBlogApp"; // Replace with your repository name
const apiUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/contributors`;
// Function to fetch contributors and display them
async function fetchContributors() {
try {
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error("Failed to fetch contributors.");
}
const contributors = await response.json();
displayContributors(contributors);
} catch (error) {
console.error("Error:", error);
document.getElementById("cards").innerHTML =
"<p>Failed to load contributors.</p>";
}
}
// Function to display contributors
function displayContributors(contributors) {
const cardsContainer = document.getElementById("cards");
contributors.forEach((contributor) => {
const contributorCard = `
<div class="card">
<a href="${contributor.html_url}" target="_blank">
<div class="card-body">
<div class="left">
<div class="card-img">
<img class="img"
width="80"
height="80"
src="${contributor.avatar_url}"
alt="${contributor.login}"
/>
</div>
<div class="card-text">
<h2>${contributor.login}</h2>
<p>Contributed <strong>${contributor.contributions} time(s)</strong> to this project</p>
</div>
</div>
<div class="right">
</div>
</div>
</a>
</div>
`;
cardsContainer.innerHTML += contributorCard;
});
}
// Fetch contributors when the page loads
document.addEventListener("DOMContentLoaded", fetchContributors);
//scroll to top
var toTop = document.querySelector(".to-top");
window.addEventListener("scroll", function () {
if (window.pageYOffset > 100) {
toTop.classList.add("active");
} else {
toTop.classList.remove("active");
}
});
</script>
</body>
</html>