Skip to content

Commit 6dafc7f

Browse files
committed
make the headings in archive categories linkable.
1 parent 063f033 commit 6dafc7f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: index.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ <h1>CHIP-8 Archive</h1>
2828

2929
<script>
3030
dc=(c,x)=>`<div class='${c}'>${x}</div>`
31+
an=x=>`<a name="${x}" href="#${x}">${x}</a>`
3132
send=(u,t)=>{let r=new XMLHttpRequest();return r.open('GET',u),r.responseType=t,r.send(),r}
3233
ajax=(u,t,f)=>{let r=send(u,t);r.onreadystatechange=_=>r.readyState==4&&f(r.response)}
3334

@@ -45,7 +46,7 @@ <h1>CHIP-8 Archive</h1>
4546
if (sort == 'alpha') c={'Sorted Alphabetically':flat()}
4647
const k = sort=='event'?Object.keys(c):Object.keys(c).sort()
4748
document.querySelector('#categories').innerHTML = k.map(x=>
48-
dc('category',dc('heading',x)+dc('entries',c[x].map(
49+
dc('category',dc('heading',an(x))+dc('entries',c[x].map(
4950
x=>`<div class='entry'>
5051
<a href='play.html?p=${x.slug}'>
5152
<div class='title'>${x.title}</div>

0 commit comments

Comments
 (0)