(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 += ` `; } if (repo.stargazers > 0) { html += ` `; } if (repo.forks > 0) { html += ` `; } html += ` `; 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); }); } })();