Skip to content

Commit ecbed67

Browse files
authored
sort latest
1 parent 3d91164 commit ecbed67

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

latest.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
return res.json();
1717
})
1818
.then(data => {
19+
data.sort((a, b) => {
20+
b1 = !a.includes("beta"); b2 = !b.includes("beta")
21+
if (b1 ^ b2) return b2 - b1 // boolean subtraction
22+
return b.split("_").at(-1).substring(1) - a.split("_").at(-1).substring(1) // string subtraction
23+
})
1924
pdf_url = "https://rawcdn.githack.com/Minecraft-Java-Edition-Speedrunning/rules/main/pub/pdf/" + data.at(-1).name
2025
link = document.getElementById("githack")
2126
link.href = link.innerText = pdf_url
@@ -32,3 +37,4 @@ <h2 id="js">This site requires JavaScript!</h2>
3237

3338
</html>
3439

40+

0 commit comments

Comments
 (0)