forked from lazygyu/roulette
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
129 lines (116 loc) · 3.13 KB
/
index.html
File metadata and controls
129 lines (116 loc) · 3.13 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Marble Roulette</title>
<style>
* {
box-sizing: border-box;
}
canvas {
position: fixed;
inset: 0;
width: 100%;
height: 100%;
}
.settings {
position: absolute;
inset: 1rem;
max-width: 50%;
top: auto;
padding: 1rem;
border-radius: 0.75em;
box-shadow: inset 0 0 6rem 4px green;
border: 2px solid lightgreen;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(10px);
color: #fff;
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 1.25rem;
font-weight: bold;
transition: all 0.15s;
z-index: 10;
}
.settings:focus-within {
box-shadow: inset 0 0 2rem 4px green;
}
.settings textarea {
width: 100%;
min-height: 4rem;
background-color: transparent;
border: none;
outline: none;
font: inherit;
color: inherit;
}
.settings .settings-actions {
text-align: right;
}
.settings p {
font-size: 1rem;
font-weight: normal;
color: lightgreen;
}
</style>
</head>
<body>
<script type="module" src="./src/index.ts"></script>
<script type="text/javascript">
function getNames() {
const value = document.querySelector('#in_names').value.trim();
return value.split(/[,\r\n]/g).map(v => v.trim()).filter(v => !!v);
}
let ready = false;
document.addEventListener('DOMContentLoaded', () => {
document.querySelector('#in_names').addEventListener('input', () => {
const names = getNames();
window.roullete.setMarbles(names);
if (names.length > 0) {
ready = true;
}
});
document.querySelector('#btnShuffle').addEventListener('click', () => {
const names = getNames();
window.roullete.setMarbles(names);
if (names.length > 0) {
ready = true;
}
});
document.querySelector('#btnStop').addEventListener('click', () => {
window.roullete.reset();
ready = false;
});
document.querySelector('#btnStart').addEventListener('click', () => {
if (!ready) return;
window.roullete.start();
document.querySelector('#settings').style.display = 'none';
});
document.querySelector('#chkSkill').addEventListener('change', (e) => {
window.options.useSkills =e.target.matches(':checked');
});
window.roullete.addEventListener('goal', () => {
ready = false;
document.querySelector('#settings').style.display = 'block';
});
document.querySelector('#btnShuffle').click();
});
</script>
<div id="settings" class="settings">
<p>
You can set weight values for each member by putting a number after each name with a slash. (ex: Tom/2, Jane/5)
</p>
<textarea id="in_names" placeholder="Input names saparated by commas or line feed here">짱구/5, 철수/4, 맹구/3, 흰둥이/2, 훈이, 유리, 신형만, 봉미선, 짱아</textarea>
<div class="settings-actions">
<label>
<input type="checkbox" id="chkSkill" checked />
Using skills
</label>
<button id="btnStop">Stop</button>
<button id="btnStart">Start</button>
<button id="btnShuffle">Shuffle</button>
</div>
</div>
</body>
</html>