Skip to content

Commit a3b93fe

Browse files
Update script.js
1 parent 5d1b128 commit a3b93fe

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Website/js/script.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,37 @@ document.addEventListener('DOMContentLoaded', function() {
112112
fetchRepoStats();
113113
toggleStatsSection();
114114
});
115+
116+
document.addEventListener("DOMContentLoaded", function() {
117+
fetchContributors();
118+
119+
function fetchContributors() {
120+
const repoOwner = 'recodehive'; // Replace with your repository owner
121+
const repoName = 'machine-learning-repos'; // Replace with your repository name
122+
const apiUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/contributors`;
123+
124+
fetch(apiUrl)
125+
.then(response => response.json())
126+
.then(contributors => {
127+
const contributorsGrid = document.getElementById('contributors-grid');
128+
129+
contributors.forEach(contributor => {
130+
const contributorDiv = document.createElement('div');
131+
contributorDiv.className = 'contributor';
132+
133+
contributorDiv.innerHTML = `
134+
<img src="${contributor.avatar_url}" alt="${contributor.login}" class="contributor-image">
135+
<div class="contributor-info">
136+
<a href="${contributor.html_url}" target="_blank" class="contributor-github">GitHub Profile</a>
137+
</div>
138+
`;
139+
140+
contributorsGrid.appendChild(contributorDiv);
141+
});
142+
})
143+
.catch(error => {
144+
console.error('Error fetching contributors:', error);
145+
});
146+
}
147+
});
148+

0 commit comments

Comments
 (0)