personal-site/scripts/projects.js
Arthur Lu 4bc432f66d only use starred repos
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
2023-04-01 19:48:58 -07:00

24 lines
843 B
JavaScript

import { Octokit } from "https://cdn.skypack.dev/@octokit/core";
window.addEventListener("DOMContentLoaded", init);
async function init () {
const octokit = new Octokit()
let repos = await octokit.request('GET /users/ltcptgeneral/starred', {
username: 'ltcptgeneral'
});
let container = document.querySelector("#projects");
repos.data.forEach((element) => {
let content = document.querySelector("#project-article").content.cloneNode(true);
content.querySelector("#project-name").innerText = element.name;
content.querySelector("#project-desc").innerText = element.description;
content.querySelector("#project-lang").innerText = element.language;
content.querySelector("article").addEventListener("click", () => {
window.location.assign(element.html_url);
});
container.append(content)
});
}