document.addEventListener("DOMContentLoaded", function () { async function setCard(el, url, name, desc, labels, version, theme, authors) { const colorList = [ "A351FB", "FF4040", "FFA1A0", "FF7633", "FFB633", "D1D435", "4CFB12", "94CF1A", "40DE8A", "1B9640", "00D6C1", "2E9CAA", "00C4FF", "364797", "6675FF", "0019EF", "863AFF", "530087", "CD3AFF", "FF97CA", "FF39C9" ] let labelHTML = '' if (labels) { const labelArray = labels.split(',').map((label, index) => { const color = colorList[index % colorList.length] return `${label}` }) labelHTML = labelArray.join(' ') } const authorArray = authors.split(','); const authorDataArray = await Promise.all(authorArray.map(async (author) => { const response = await fetch(`https://api.github.com/users/${author.trim()}`); return await response.json(); })); let authorHTML = ''; authorDataArray.forEach((authorData, index) => { const marginLeft = index === 0 ? '0' : '-15px'; authorHTML += `
`; }); document.querySelectorAll('.author-container').forEach((container) => { const tooltip = container.querySelector('.tooltip'); container.addEventListener('mouseover', () => { tooltip.style.visibility = 'visible'; tooltip.style.opacity = '1'; }); container.addEventListener('mouseout', () => { tooltip.style.visibility = 'hidden'; tooltip.style.opacity = '0'; }); }); el.innerText = `
${name}
${desc}
${authorHTML}
  ${version}
  ${labelHTML}
` let sanitizedHTML = DOMPurify.sanitize(el.innerText); el.innerHTML = sanitizedHTML; } for (const el of document.querySelectorAll('.repo-card')) { const url = el.getAttribute('data-url'); const name = el.getAttribute('data-name'); const desc = el.getAttribute('data-desc'); const labels = el.getAttribute('data-labels'); const version = el.getAttribute('data-version'); const authors = el.getAttribute('data-author'); const palette = __md_get("__palette") if (palette && typeof palette.color === "object") { var theme = palette.color.scheme === "slate" ? "dark-theme" : "light-default" } else { var theme = "light-default" } setCard(el, url, name, desc, labels, version, theme, authors); } })