Skip to content

Commit 3d91164

Browse files
authored
sort index
1 parent cb25913 commit 3d91164

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
return res.json();
1717
})
1818
.then(data => {
19-
data.reverse()
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+
})
2024
quicklink = document.getElementById("quicklink")
2125
newest = data[0]
2226
quicklink.href = "https://rawcdn.githack.com/Minecraft-Java-Edition-Speedrunning/rules/main/pub/pdf/" + newest.name
@@ -45,3 +49,4 @@ <h3 id="rules">Past releases:</h3>
4549

4650
</html>
4751

52+

0 commit comments

Comments
 (0)