Skip to content

Commit 25a996f

Browse files
authored
Create scripts.js
1 parent 4401d76 commit 25a996f

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

scripts.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const starSVG = `
2+
<svg class="icon-inline" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="white" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
3+
<path d="M12 .587l3.668 7.431L24 9.748l-6 5.848 1.42 8.284L12 19.771 4.58 23.88 6 15.596 0 9.748l8.332-1.73z"/>
4+
</svg>
5+
`;
6+
7+
const forkSVG = `
8+
<svg class="icon-inline" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
9+
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
10+
<path d="M12 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
11+
<path d="M7 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
12+
<path d="M17 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0" />
13+
<path d="M7 8v2a2 2 0 0 0 2 2h6a2 2 0 0 0 2 -2v-2" />
14+
<path d="M12 12l0 4" />
15+
</svg>
16+
`;
17+
18+
async function loadProjects() {
19+
const res = await fetch(
20+
"https://gh-pinned-repos-tsj7ta5xfhep.deno.dev/?username=the-oblyv"
21+
);
22+
const repos = await res.json();
23+
24+
const container = document.getElementById("projects");
25+
repos.forEach((repo) => {
26+
const repoName = repo.repo.trim(); // Trim extra spaces
27+
const card = document.createElement("div");
28+
29+
card.innerHTML = `
30+
<h3><a href="https://github.com/${repo.owner}/${repoName}" target="_blank" rel="noopener noreferrer">${repoName}</a></h3>
31+
<p>${repo.description || "No description"}</p>
32+
<p>
33+
${starSVG} ${repo.stars} &nbsp; ${forkSVG} ${repo.forks}
34+
</p>
35+
<p>
36+
<span style="color:${repo.languageColor}">●</span>
37+
${repo.language || "Unknown"}
38+
</p>
39+
`;
40+
41+
container.appendChild(card);
42+
});
43+
}
44+
45+
loadProjects();
46+

0 commit comments

Comments
 (0)