@@ -285,4 +285,46 @@ async function fetchSubdirectoryCounts() {
285
285
fetchRepoStats ( ) ;
286
286
toggleStatsSection ( ) ;
287
287
} ) ;
288
+ document . addEventListener ( "DOMContentLoaded" , function ( ) {
289
+ fetchContributors ( ) ;
290
+
291
+ function fetchContributors ( ) {
292
+ const repoOwner = 'recodehive' ; // Replace with your repository owner
293
+ const repoName = 'machine-learning-repos' ; // Replace with your repository name
294
+ const apiUrl = `https://api.github.com/repos/${ repoOwner } /${ repoName } /contributors` ;
295
+
296
+ fetch ( apiUrl )
297
+ . then ( response => response . json ( ) )
298
+ . then ( contributors => {
299
+ const contributorsGrid = document . getElementById ( 'contributors-grid' ) ;
300
+
301
+ contributors . forEach ( contributor => {
302
+ const contributorDiv = document . createElement ( 'div' ) ;
303
+ contributorDiv . className = 'contributor' ;
304
+
305
+ contributorDiv . innerHTML = `
306
+ <img src="${ contributor . avatar_url } " alt="${ contributor . login } " class="contributor-image">
307
+ <div class="contributor-info">
308
+ <a href="${ contributor . html_url } " target="_blank" class="contributor-github">GitHub Profile</a>
309
+ </div>
310
+ ` ;
311
+
312
+ contributorsGrid . appendChild ( contributorDiv ) ;
313
+ } ) ;
314
+ } )
315
+ . catch ( error => {
316
+ console . error ( 'Error fetching contributors:' , error ) ;
317
+ } ) ;
318
+ }
319
+ } ) ;
320
+
321
+ const toggleDarkModeButton = document . getElementById ( 'toggle-dark-mode' ) ;
322
+ const body = document . body ;
288
323
324
+ toggleDarkModeButton . addEventListener ( 'click' , ( ) => {
325
+ body . classList . toggle ( 'dark-mode' ) ;
326
+ // Change icon based on dark mode status
327
+ const icon = toggleDarkModeButton . querySelector ( 'i' ) ;
328
+ icon . classList . toggle ( 'fa-moon' ) ;
329
+ icon . classList . toggle ( 'fa-sun' ) ;
330
+ } ) ;
0 commit comments