-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
43 lines (34 loc) · 1.73 KB
/
Copy pathscript.js
File metadata and controls
43 lines (34 loc) · 1.73 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
const GITHUB_ORG = 'ExpansionPak';
async function fetchGitHubProjects() {
const container = document.getElementById('github-projects');
try {
// Fetch public repositories (sorted by last updated)
const response = await fetch(`https://api.github.com/orgs/${GITHUB_ORG}/repos?sort=updated&per_page=10`);
if (!response.ok) throw new Error('Failed to fetch repositories');
const repos = await response.json();
container.innerHTML = ''; // Clear loading text
// We do have forks mate!
// const sourceRepos = repos.filter(repo => !repo.fork);
repos.forEach(repo => {
const card = document.createElement('div');
card.className = 'project-card';
card.innerHTML = `
<div>
<h4><a href="${repo.html_url}" target="_blank" rel="noopener noreferrer">${repo.name}</a></h4>
<p class="project-desc">${repo.description || 'No description provided.'}</p>
</div>
<div class="project-stats">
${repo.language ? `<span class="stat-item">🏷️ ${repo.language}</span>` : ''}
<span class="stat-item">⭐ ${repo.stargazers_count}</span>
<span class="stat-item">🍴 ${repo.forks_count}</span>
<span class="stat-item">❗ ${repo.open_issues_count}</span>
</div>
`;
container.appendChild(card);
});
} catch (error) {
console.error(error);
container.innerHTML = '<p class="error">Unable to load projects right now.</p>';
}
}
document.addEventListener('DOMContentLoaded', fetchGitHubProjects);