-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
41 lines (35 loc) · 993 Bytes
/
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
<html>
<head>
<title>簡單抽獎小工具</title>
</head>
<body>
<script>
function rand(a, b) {
return 0.5-Math.random();
}
function shuffle(array) {
array.sort(rand);
return array;
}
function start() {
var candidates = document.getElementById("candidates").value;
candidates = candidates.split('\n');
shuffle(candidates);
alert(candidates.join("\n"));
}
function random_bg_color() {
var x = Math.floor(Math.random() * 256);
var y = Math.floor(Math.random() * 256);
var z = Math.floor(Math.random() * 256);
var bgColor = "rgb(" + x + "," + y + "," + z + ")";
document.body.style.background = bgColor;
}
random_bg_color();
window.setInterval(( () => random_bg_color() ), 500);
</script>
<textarea id="candidates" style="font-size: 24px; width: 100%; height: 70%;">
</textarea>
<hr>
<button onclick="start()" style="font-size: 60px; width: 100%; height: 20%;">抽抽抽!ヾ(•ω•`)o</button>
</body>
</html>