made game list sort games alphabetically

This commit is contained in:
Boof 2023-05-11 12:18:35 +02:00 committed by GitHub
parent 3c7687b948
commit 22e698cdad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -7,11 +7,11 @@
<link rel="stylesheet" href="/style.css" Type="text/css" media="all">
<script src="index.js"></script>
</HEAD>
<BODY class="animated-gradient">
<BODY onload="sortList('GameList')" class="animated-gradient">
<p>Here you can find a list of games. All games are hosted on this website.</p>
<h1><p><a style="font-size:2vw" href="/Games/Flash/">Flash games</a></p></h1>
<title>Bad website</title>
<div class="donationcompact">
<div class="donationcompact" id="GameList">
<a href="/Games/Terraria 1.0/">Terraria</a>
<a href="sm64/">Super mario 64</a>
<a href="/Games/Tic Tac Toe/">Tic Tac Toe</a><br>

7
Games/index.js Normal file
View File

@ -0,0 +1,7 @@
function sortList(ul) {
var ul = document.getElementById(ul);
Array.from(ul.getElementsByTagName("A"))
.sort((a, b) => a.textContent.localeCompare(b.textContent))
.forEach(li => ul.appendChild(li));
}