-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
84 lines (79 loc) · 2.19 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
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
<html>
<head>
<meta charset="utf-8"/>
<title>Speedfriending Fragengenerator</title>
<style>
.knopp {
width:50%;
background-color: #ff6600;
border:none;
border-radius:15px;
font-size:30;
padding:10px;
transition: 0.15s
}
.knopp:hover {
background-color: #ff4400;
}
.knopp:active {
background-color: #ff0066;
}
.listselect {
top:0px;
left:0px;
position:absolute;
background-color: #0066ff;
border:none;
border-radius:15px;
font-size:20;
padding:10px;
margin:15px;
transition: 0.15s
}
.listselect:hover {
background-color: #0044ff;
}
.listselect:active {
background-color: #6600ff;
}
.text {
transition: 1s;
}
.text.animationreset {
opacity:0;
transition: 0.5s;
}
</style>
<script type="text/javascript">
onload = function() {
let ls = document.getElementById("listselect");
let kys = Object.keys(QUESTIONS);
for (let k of kys) {
let op = document.createElement("option");
op.appendChild(document.createTextNode(k));
op.value = k;
ls.appendChild(op);
}
}
function randomQuestion() {
let list = document.getElementById("listselect").value;
let outpt = document.getElementById("outpt");
outpt.classList.add("animationreset");
let q = QUESTIONS[list][Math.floor(Math.random()*QUESTIONS[list].length)];
setTimeout(function() {
outpt.innerHTML = "";
outpt.classList.remove("animationreset");
outpt.appendChild(document.createTextNode(q));
},outpt.innerHTML == "" ? 10 : 500);
}
</script>
<script type="text/javascript" src="fragen.js"></script>
</head>
<body style="margin:0px; padding:0px; font-size:40">
<select class="listselect" id="listselect"></select>
<div style="max-width:100%; text-align:center; padding:20% 0 0 0; vertical-align: middle; ">
<input type="button" onclick="randomQuestion()" value="Zufällige Frage" class="knopp"/>
<p id="outpt" class="text"></p>
</div>
</body>
</html>