2023-09-25 07:28:31 +00:00
|
|
|
import { Octokit } from "https://esm.sh/octokit";
|
2023-03-22 22:22:02 +00:00
|
|
|
|
|
|
|
window.addEventListener("DOMContentLoaded", init);
|
|
|
|
|
|
|
|
async function init () {
|
|
|
|
const octokit = new Octokit()
|
|
|
|
|
2023-04-02 02:48:58 +00:00
|
|
|
let repos = await octokit.request('GET /users/ltcptgeneral/starred', {
|
2023-03-22 22:22:02 +00:00
|
|
|
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)
|
|
|
|
});
|
|
|
|
}
|