-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
59 lines (58 loc) · 1.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!doctype html>
<html lang="en-GB">
<head>
<link href="style.css" rel="stylesheet" />
</head>
<body>
<header>
<input class="toggle" type="checkbox" onclick="toggleTheme()" />
<h1>Random Name Picker</h1>
<p>
<label for="nameInput"
>Add names individually or as a comma-separated list.<br />
Press <kbd>Enter</kbd> to add name(s). Names must be unique.
</label>
</p>
<input
type="text"
name="nameInput"
id="nameInput"
placeholder="Add names here..."
/>
<button id="addButton">Add</button>
<button id="clearButton">Clear</button>
</header>
<ul id="nameList"></ul>
<button id="spinButton" class="hidden"></button>
<div id="slotMachine">
<p id="resultDisplay"></p>
</div>
<footer>
<p>
Made by <a href="https://jakebeamish.com/" target="_blank">Jake</a> in
2025 ~ View repo on
<a
href="https://github.com/jakebeamish/random-name-picker"
target="_blank"
>GitHub</a
>
</p>
</footer>
<script src="src/main.js" type="module"></script>
<script>
const toggleTheme = () => {
const root = document.documentElement;
const newTheme =
root.getAttribute("data-theme") === "dark" ? "light" : "dark";
root.setAttribute("data-theme", newTheme);
localStorage.setItem("theme", newTheme);
};
const savedTheme = localStorage.getItem("theme");
if (savedTheme) {
document.documentElement.setAttribute("data-theme", savedTheme);
} else {
document.documentElement.setAttribute("data-theme", light);
}
</script>
</body>
</html>