📚 Merge penpot/penpot-docs repository

This commit is contained in:
David Barragán Merino 2024-10-30 12:49:46 +01:00 committed by Andrey Antukh
parent 3932054ea6
commit 88296480ec
665 changed files with 17621 additions and 0 deletions

30
docs/js/github-star.js Normal file
View file

@ -0,0 +1,30 @@
(function (window, document) {
"use strict";
const getRepoStars = async () => {
try {
const response = await fetch("https://api.github.com/repos/penpot/penpot");
const data = await response.json();
return data.stargazers_count;
} catch (error) {
console.error("Error fetching repository data:", error);
return null;
}
};
const updateStarsCount = async () => {
const starsCount = await getRepoStars();
if (starsCount !== null) {
const starsEl = document.getElementById("repo-stars");
if (starsEl) {
starsEl.textContent = `${starsCount}`;
}
}
};
window.addEventListener('load', () => {
updateStarsCount();
});
})(window, document);