By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage and assist in our marketing efforts. More info
Cookie Settings
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage and assist in our marketing efforts. More info
tag)
document.addEventListener("DOMContentLoaded", () => {
// Get the element with the ID 'githubStars'
const starsElement = document.getElementById("githubStarsButton");
if (starsElement) {
// Get the current text content
const rawNumber = starsElement.textContent.trim();
// Remove any existing formatting (commas, spaces, etc.)
const cleanNumber = rawNumber.replace(/[,\s]/g, "");
// Convert to number and format with thousand separators
const number = parseFloat(cleanNumber);
if (!Number.isNaN(number)) {
// Format the number with commas (e.g., 1000 -> 1,000)
const formattedNumber = number.toLocaleString("en-US");
// Update the element with the formatted number
starsElement.textContent = formattedNumber;
}
}
// Handle responsive visibility for githubString
const githubString = document.getElementById("githubString");
if (githubString) {
function handleResize() {
if (window.innerWidth < 1200) {
githubString.style.display = "none";
} else {
githubString.style.display = "";
}
}
// Run on load
handleResize();
// Run on window resize
window.addEventListener("resize", handleResize);
}
});