(function () { // don't continue if there isn't a span#meta-hits element on this page var wrapper = document.getElementById("github-cards"); if (wrapper) { fetch("/api/projects?top") .then((response) => response.json()) .then((data) => { data.forEach((repo) => { var html = ` ${repo.name}

${repo.description}

`; if (repo.primaryLanguage !== null) { html += `
${repo.primaryLanguage.name}
`; } if (repo.stargazerCount > 0) { html += `
${repo.stargazerCount_pretty}
`; } if (repo.forkCount > 0) { html += `
${repo.forkCount_pretty}
`; } html += `
Updated ${repo.pushedAt_relative}
`; var div = document.createElement("div"); div.classList.add("github-card"); div.innerHTML = html; wrapper.appendChild(div); }); }) .catch((error) => { // something went horribly wrong, initiate coverup wrapper.style.display = "none"; console.error(error); }); } })();