stuff
This commit is contained in:
+274
@@ -0,0 +1,274 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>awesome johnruina site</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@600;800;900&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
background: #0f0f0f;
|
||||
font-family: 'Inter', sans-serif;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.top-bar {
|
||||
position: fixed;
|
||||
top: 0; left: 0; right: 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 1rem 1.5rem;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.top-bar > * { pointer-events: auto; }
|
||||
|
||||
.back-btn {
|
||||
text-decoration: none;
|
||||
color: #888;
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.5px;
|
||||
text-transform: uppercase;
|
||||
transition: color 0.2s;
|
||||
background: rgba(15,15,15,0.7);
|
||||
padding: 0.4rem 0.8rem;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #333;
|
||||
}
|
||||
|
||||
.back-btn:hover { color: #fff; border-color: #555; }
|
||||
|
||||
#reactionArea {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
#reactionArea.waiting {
|
||||
background: #1a1a2e;
|
||||
}
|
||||
|
||||
#reactionArea.ready {
|
||||
background: #1a3a1a;
|
||||
}
|
||||
|
||||
#reactionArea.too-early {
|
||||
background: #3a1a1a;
|
||||
}
|
||||
|
||||
#reactionArea.result {
|
||||
background: #0f0f0f;
|
||||
}
|
||||
|
||||
#statusText {
|
||||
color: #ccc;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
#statusText .sub {
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
color: #666;
|
||||
margin-top: 0.5rem;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.results {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
margin-top: 2rem;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.result-box {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.result-box .value {
|
||||
color: #fff;
|
||||
font-size: 2rem;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.result-box .label {
|
||||
color: #666;
|
||||
font-size: 0.6rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.result-box .value.best {
|
||||
color: #4a4a8a;
|
||||
}
|
||||
|
||||
.play-again-btn {
|
||||
margin-top: 2rem;
|
||||
padding: 1rem 2.5rem;
|
||||
background: #1a1a2e;
|
||||
color: #e0e0e0;
|
||||
border: 1px solid #333;
|
||||
border-radius: 8px;
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-weight: 800;
|
||||
font-size: 0.85rem;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
letter-spacing: 0.5px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.play-again-btn:hover {
|
||||
background: #16213e;
|
||||
border-color: #4a4a8a;
|
||||
box-shadow: 0 0 20px rgba(74,74,138,0.3);
|
||||
transform: scale(1.03);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="top-bar">
|
||||
<a class="back-btn" href="index.html">← Back</a>
|
||||
</div>
|
||||
|
||||
<div id="reactionArea" class="waiting">
|
||||
<div id="statusText">
|
||||
Click to start
|
||||
<span class="sub">Wait for the screen to turn green, then click as fast as you can</span>
|
||||
</div>
|
||||
<div class="results" id="results" style="display:none">
|
||||
<div class="result-box">
|
||||
<div class="value" id="lastTime">0</div>
|
||||
<div class="label">Last (ms)</div>
|
||||
</div>
|
||||
<div class="result-box">
|
||||
<div class="value best" id="bestTime">0</div>
|
||||
<div class="label">Best (ms)</div>
|
||||
</div>
|
||||
<div class="result-box">
|
||||
<div class="value" id="avgTime">0</div>
|
||||
<div class="label">Average (ms)</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="play-again-btn" id="playAgainBtn" style="display:none">Play Again</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const area = document.getElementById('reactionArea');
|
||||
const statusText = document.getElementById('statusText');
|
||||
const results = document.getElementById('results');
|
||||
const lastTime = document.getElementById('lastTime');
|
||||
const bestTime = document.getElementById('bestTime');
|
||||
const avgTime = document.getElementById('avgTime');
|
||||
const playAgainBtn = document.getElementById('playAgainBtn');
|
||||
|
||||
const STATE = { WAITING: 'waiting', COUNTDOWN: 'countdown', READY: 'ready', TOO_EARLY: 'too-early', RESULT: 'result' };
|
||||
let state = STATE.WAITING;
|
||||
let timeoutId = null;
|
||||
let readyTimestamp = 0;
|
||||
let best = Infinity;
|
||||
let times = [];
|
||||
|
||||
function getDelay() {
|
||||
return 1000 + Math.random() * 3000;
|
||||
}
|
||||
|
||||
function reset() {
|
||||
if (timeoutId) { clearTimeout(timeoutId); timeoutId = null; }
|
||||
state = STATE.WAITING;
|
||||
area.className = 'waiting';
|
||||
statusText.innerHTML = 'Click to start<span class="sub">Wait for the screen to turn green, then click as fast as you can</span>';
|
||||
results.style.display = 'none';
|
||||
playAgainBtn.style.display = 'none';
|
||||
}
|
||||
|
||||
function startCountdown() {
|
||||
state = STATE.COUNTDOWN;
|
||||
area.className = 'waiting';
|
||||
statusText.textContent = 'Wait...';
|
||||
timeoutId = setTimeout(() => {
|
||||
state = STATE.READY;
|
||||
area.className = 'ready';
|
||||
statusText.textContent = 'Click NOW!';
|
||||
readyTimestamp = performance.now();
|
||||
}, getDelay());
|
||||
}
|
||||
|
||||
function handleClick() {
|
||||
if (state === STATE.WAITING) {
|
||||
startCountdown();
|
||||
return;
|
||||
}
|
||||
|
||||
if (state === STATE.COUNTDOWN) {
|
||||
if (timeoutId) { clearTimeout(timeoutId); timeoutId = null; }
|
||||
state = STATE.TOO_EARLY;
|
||||
area.className = 'too-early';
|
||||
statusText.innerHTML = 'Too early!<span class="sub">Click to try again</span>';
|
||||
return;
|
||||
}
|
||||
|
||||
if (state === STATE.TOO_EARLY) {
|
||||
startCountdown();
|
||||
return;
|
||||
}
|
||||
|
||||
if (state === STATE.READY) {
|
||||
const elapsed = performance.now() - readyTimestamp;
|
||||
times.push(elapsed);
|
||||
if (elapsed < best) best = elapsed;
|
||||
const avg = times.reduce((a, b) => a + b, 0) / times.length;
|
||||
|
||||
lastTime.textContent = elapsed.toFixed(0);
|
||||
bestTime.textContent = best.toFixed(0);
|
||||
avgTime.textContent = avg.toFixed(0);
|
||||
|
||||
state = STATE.RESULT;
|
||||
area.className = 'result';
|
||||
statusText.textContent = `${elapsed.toFixed(0)} ms`;
|
||||
results.style.display = 'flex';
|
||||
playAgainBtn.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
|
||||
if (state === STATE.RESULT) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function handleKeyDown(e) {
|
||||
if (e.key === 'Escape') { window.location.href = 'index.html'; return; }
|
||||
e.preventDefault();
|
||||
handleClick();
|
||||
}
|
||||
|
||||
area.addEventListener('click', handleClick);
|
||||
document.addEventListener('keydown', handleKeyDown);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user