random game button

This commit is contained in:
BluePotato102
2023-11-18 08:23:34 -06:00
parent d30ae4689c
commit f602dbf6b7
3 changed files with 24 additions and 2 deletions
+14 -2
View File
@@ -208,10 +208,22 @@ body.noscript {
margin-bottom: 5px; margin-bottom: 5px;
} }
.randgame {
cursor: pointer;
width: 15%;
border: none;
margin-left: 4px;
font-size: 100%;
font-family: var(--font-family);
color: var(--font-color);
background-color: var(--block-color);
}
#search { #search {
all: unset; all: unset;
margin-right: 4px; margin-right: 4px;
width: 100%; width: 70%;
padding: 1rem; padding: 1rem;
font-family: var(--font-family); font-family: var(--font-family);
color: var(--font-color); color: var(--font-color);
@@ -227,7 +239,7 @@ body.noscript {
font-size: 1rem; font-size: 1rem;
font-family: var(--font-family); font-family: var(--font-family);
padding: 1rem; padding: 1rem;
width: 20%; width: 15%;
} }
.keySlot{ .keySlot{
+1
View File
@@ -247,6 +247,7 @@
<option value="alphabetical">Alphabetical</option> <option value="alphabetical">Alphabetical</option>
<option value="reverse">Reverse Alphabetical</option> <option value="reverse">Reverse Alphabetical</option>
</select> </select>
<button class="randgame" onclick="randomGame()">Random Game</button>
</div> </div>
<ul id="gamesList"></ul> <ul id="gamesList"></ul>
</div> </div>
+9
View File
@@ -496,6 +496,15 @@ function restoreColorChanges() {
alert("Defaults Restored! Changes will take place upon reload"); alert("Defaults Restored! Changes will take place upon reload");
} }
function randomGame() {
const gameLinks = document.querySelectorAll('#gamesList li');
const randomIndex = Math.floor(Math.random() * gameLinks.length);
const randomGameLink = gameLinks[randomIndex];
window.location.href = randomGameLink.getAttribute('url');
;
}
const preferencesDefaults = { const preferencesDefaults = {
cloak: true, cloak: true,
cloakUrl: "https://classroom.google.com", cloakUrl: "https://classroom.google.com",