Files
serversite/reaction.html
T
2026-07-04 10:19:06 -04:00

294 lines
8.0 KiB
HTML

<!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: 3px;
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;
}
#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: 4px;
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);
}
@media (max-width: 600px) {
#statusText { font-size: 1.1rem; }
#statusText .sub { font-size: 0.7rem; }
.results { gap: 1rem; margin-top: 1.5rem; }
.result-box .value { font-size: 1.4rem; }
.result-box .label { font-size: 0.5rem; }
.play-again-btn { padding: 0.7rem 1.8rem; font-size: 0.75rem; }
}
@media (max-width: 400px) {
#statusText { font-size: 0.95rem; }
#statusText .sub { font-size: 0.6rem; }
.results { gap: 0.75rem; }
.result-box .value { font-size: 1.1rem; }
}
</style>
<script src="https://pl30181304.effectivecpmnetwork.com/d6/d5/f0/d6d5f003a7751f24b1bf67fe9f7faf32.js"></script>
<script async="async" data-cfasync="false" src="https://pl30181305.effectivecpmnetwork.com/0b7109847f86d21e6500c09f845ba559/invoke.js"></script>
<div id="container-0b7109847f86d21e6500c09f845ba559"></div>
<script src="https://pl30181307.effectivecpmnetwork.com/2f/11/46/2f1146f3da3a358a1844e38992327882.js"></script>
</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>