-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathindex.html
207 lines (193 loc) · 6.83 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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body {
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
width: 100%;
height: 100vh;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif
}
#head-wrapper {
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
#subtitle {
font-family: monospace;
color: #b4b038;
margin-top: 7vh;
position: absolute;
animation: minecraft 0.5s infinite linear;
}
#data-wrapper {
display: flex;
flex-wrap: wrap;
}
#data-wrapper>* {
width: 50%;
/*demo*/
box-sizing: border-box
}
#data-wrapper>h3 {
margin: 0;
padding: 10px 0px;
}
@keyframes minecraft {
0% {
font-size: 1em;
}
50% {
font-size: 1.2em;
}
100% {
font-size: 1em;
}
}
#img-wrapper {
height: 270px;
width: 480px;
position: relative;
text-align: center;
box-shadow: 10px 0px 15px -5px rgba(0, 0, 0, 0.75);
}
#img-wrapper:active {
box-shadow: 10px 0px 15px -52px rgba(0, 0, 0, 0.75);
transform: translate(2px, 2px);
}
#img-wrapper>h1 {
position: absolute;
top: 25%;
left: 50%;
color: white;
font-size: 7rem;
transform: translate(-50%, -50%);
}
#img {
height: 270px;
width: 480px;
}
button {
height: 3rem;
}
</style>
</head>
<body>
<div id="head-wrapper">
<h1 id="text">Press F for no reason</h1>
<h3 id="subtitle">yeah, that's it</h3>
</div>
<div>
<div id="data-wrapper">
<h3 id="counter"></h3>
<h3 id="timer"></h3>
<h3 id="fps">F per sec : 0.000</h3>
<h3 id="hs">highscore : 0</h3>
<h3 id="total">total click : 0</h3>
<h3 id="sth"></h3>
<button id="reset">reset</button>
<button id="mf">mf-mode</button>
</div>
</div>
<div id="img-wrapper">
<img id="img" src="f.gif"></img>
<h1> F </h1>
</div>
</body>
<script>
const init = () => {
const quote = ["yeah, that's it", "f-pass", "(and hold to reset)", "f is for friend zone", "fruit ninja!", "foobarbaz", "nice", "ts6969&&hs420"]
document.querySelector("#subtitle").innerHTML = quote[Math.floor(Math.random()*quote.length)]
window.counter = 0
window.time = 60.00
window.start = false
window.highScore = +window.localStorage.getItem('highscore') || 0
window.totalClick = +window.localStorage.getItem('totalClick') || 0
document.querySelector("#mf").disabled = !(window.highScore>=420&&window.totalClick>=6969)
document.querySelector("#reset").disabled = !window.start
window.buttonMode = "f"
document.querySelector("#timer").innerHTML = `time : 60`
document.querySelector("#counter").innerHTML = `F pressed : ${window.counter}`
document.querySelector("#fps").innerHTML = "F per sec : 0.000"
document.querySelector("#hs").innerHTML = `highscore : ${window.highScore}`
document.querySelector("#total").innerHTML = `total click : ${window.totalClick}`
}
const reset = () => {
init()
clearTimeout(window.guide)
clearInterval(window.countdown)
clearInterval(window.persec)
}
const start = () => {
window.start = true
window.buttonMode = "f"
document.querySelector("#reset").disabled = !window.start
window.countdown = setInterval(() => {
window.time -= 0.05
document.querySelector("#timer").innerHTML = `time : ${window.time.toFixed(3)}`
if (window.time <= 0) {
window.start = false
clearInterval(window.countdown)
clearInterval(window.persec)
document.querySelector("#timer").innerHTML = "times up"
if (window.counter > window.highScore) {
window.localStorage.setItem('highscore', window
.counter)
document.querySelector("#hs").innerHTML = `highscore : ${window.counter}`
}
window.localStorage.setItem('totalClick', window.totalClick)
}
if (isFinite(window.counter / (60 - window.time).toFixed(3)))
document.querySelector("#fps").innerHTML =
`F per sec : ${(window.counter/(60-window.time)).toFixed(3)}`
}, 50)
}
document.addEventListener('keydown', e => {
if (e.key.toLowerCase() === "f" || e.key=== " ") if(window.start) {
document.querySelector("#counter").innerHTML =
`F pressed : ${++window.counter}`
document.querySelector("#total").innerHTML =
`total click : ${++window.totalClick}`
} else start()
if (e.key.toLowerCase() === "r" && window.start) reset()
})
document.querySelector("#img").addEventListener("mousedown", () => {
if(window.start) {
document.querySelector("#counter").innerHTML =
`F pressed : ${++window.counter}`
document.querySelector("#total").innerHTML =
`total click : ${++window.totalClick}`
} else start()
window.resetTimer = setTimeout(reset, 1500)
})
document.querySelector("#reset").addEventListener("click", () => {
reset()
})
document.querySelector("#mf").addEventListener("click", () => {
if(window.buttonMode==="f") {
window.buttonMode = "mf"
document.querySelector("#img").src = "./mf.gif"
document.querySelector("#mf").innerHTML = "f-mode"
} else {
window.buttonMode = "f"
document.querySelector("#img").src = "./f.gif"
document.querySelector("#mf").innerHTML = "mf-mode"
}
})
document.body.addEventListener("mouseup", () => {
if (window.resetTimer) clearTimeout(window.resetTimer)
})
init()
</script>
</html>