Repository files navigation <style id="customStyle">
body {
background: #fafafa;
}
span[data-t]::after {
content: attr(data-t);
}
span[data-s]::before {
content: attr(data-s);
}
span[data-t] {
padding: 2px;
font-size: 80%;
color: white;
font-weight: 600;
}
span[data-stars] {
padding: 6px;
font-size: 80%;
}
span[data-stars]::after {
content: attr(data-stars) "★";
}
</style>
Some other miscellaneous scripts:
<script>
const Y1 = 32, D1 = Y1 / 370, D2 = (1296-Y1)/(1296-370);
const f = x => x >= 370 ? Y1+D2*(x-370) : D1*x;
const hue = w => Math.floor(360 * w.match(/..?/g).map(s => parseInt(s, 36)).reduce((t,v,i) => t + f(v)*1296**-(i+1), 0));
const tags = [...new Set(Array.from(document.querySelectorAll('span[data-t]'), el => el.dataset.t))];
customStyle.textContent += tags.map(tag => `span[data-t="${tag}"] {
background-color: hsla(${hue(tag)},100%,45%,.85);
}`).join('\n');
document.querySelector('h1 > a').href = '//github.com/caub/misc';
document.querySelectorAll('#some-projects + ul li').forEach(async li => {
const a = li.querySelector('a'), url = new URL(a.href);
const p = url.pathname.slice(1).split('/');
const r = await fetch(`https://api.github.com/repos/${p[p.length-2]||url.hostname.split('.',1)[0]}/${p[p.length-1]}`).then(r => r.json());
if (r.stargazers_count) {
const span = document.createElement('span');
span.dataset.stars = r.stargazers_count;
li.append(span);
}
});
</script>
You can’t perform that action at this time.