Initial commit
This commit is contained in:
@@ -0,0 +1,383 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>skyevouchers</title>
|
||||
<style>
|
||||
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap');
|
||||
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
:root {
|
||||
--bg: #07080f;
|
||||
--surface: #0e1018;
|
||||
--border: #1e2133;
|
||||
--accent: #5b6cff;
|
||||
--accent2: #a78bfa;
|
||||
--glow: rgba(91,108,255,.35);
|
||||
--text: #e8eaf6;
|
||||
--muted: #5a5e7a;
|
||||
--code-bg: #12152a;
|
||||
--success: #4ade80;
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: 'Space Grotesk', sans-serif;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Background grid */
|
||||
body::before {
|
||||
content: '';
|
||||
position: fixed; inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(91,108,255,.04) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(91,108,255,.04) 1px, transparent 1px);
|
||||
background-size: 48px 48px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Ambient glow */
|
||||
body::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: -20%; left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 700px; height: 500px;
|
||||
background: radial-gradient(ellipse, rgba(91,108,255,.12) 0%, transparent 70%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.stage {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
/* Logo / wordmark */
|
||||
.wordmark {
|
||||
font-family: 'Space Mono', monospace;
|
||||
font-size: .85rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: .05em;
|
||||
color: var(--muted);
|
||||
margin-bottom: 2rem;
|
||||
position: relative;
|
||||
}
|
||||
.wordmark span { color: var(--accent); }
|
||||
|
||||
/* Card */
|
||||
.card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 24px;
|
||||
padding: 2rem 1.5rem;
|
||||
width: 100%;
|
||||
max-width: 480px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 2rem;
|
||||
box-shadow: 0 0 60px rgba(0,0,0,.5), 0 0 120px var(--glow);
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.card-label {
|
||||
font-size: .7rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: .2em;
|
||||
text-transform: uppercase;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
/* Slot display */
|
||||
.slot-wrap {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.slot-display {
|
||||
background: var(--code-bg);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
padding: 1.2rem 1rem;
|
||||
font-family: 'Space Mono', monospace;
|
||||
font-size: clamp(1.1rem, 5.5vw, 2rem);
|
||||
font-weight: 700;
|
||||
letter-spacing: .08em;
|
||||
color: var(--text);
|
||||
text-align: center;
|
||||
min-height: 80px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
transition: border-color .3s, box-shadow .3s;
|
||||
}
|
||||
|
||||
.slot-display.rolling {
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 24px var(--glow);
|
||||
}
|
||||
|
||||
.slot-display.done {
|
||||
border-color: var(--success);
|
||||
box-shadow: 0 0 24px rgba(74,222,128,.25);
|
||||
}
|
||||
|
||||
/* Rolling characters */
|
||||
.slot-chars {
|
||||
display: flex;
|
||||
gap: .1em;
|
||||
align-items: center;
|
||||
}
|
||||
.slot-char {
|
||||
display: inline-block;
|
||||
transition: none;
|
||||
}
|
||||
.slot-char.rolling {
|
||||
animation: charRoll .06s linear infinite;
|
||||
}
|
||||
@keyframes charRoll {
|
||||
0% { transform: translateY(0); opacity: 1; }
|
||||
50% { transform: translateY(-4px); opacity: .5; }
|
||||
100% { transform: translateY(0); opacity: 1; }
|
||||
}
|
||||
|
||||
.placeholder-text { color: var(--muted); font-size: 1rem; letter-spacing: .1em; }
|
||||
|
||||
/* Buttons */
|
||||
.btn-primary {
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
background: linear-gradient(135deg, var(--accent), var(--accent2));
|
||||
color: #fff;
|
||||
font-family: 'Space Grotesk', sans-serif;
|
||||
font-size: .95rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: .05em;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
cursor: pointer;
|
||||
transition: opacity .2s, transform .1s, box-shadow .2s;
|
||||
box-shadow: 0 0 30px rgba(91,108,255,.3);
|
||||
}
|
||||
.btn-primary:hover { opacity: .9; box-shadow: 0 0 40px rgba(91,108,255,.5); }
|
||||
.btn-primary:active { transform: scale(.98); }
|
||||
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }
|
||||
|
||||
.btn-copy {
|
||||
width: 100%;
|
||||
padding: .85rem;
|
||||
background: transparent;
|
||||
color: var(--accent2);
|
||||
font-family: 'Space Grotesk', sans-serif;
|
||||
font-size: .9rem;
|
||||
font-weight: 500;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
cursor: pointer;
|
||||
transition: background .2s, border-color .2s, color .2s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: .5rem;
|
||||
}
|
||||
.btn-copy:hover { background: rgba(167,139,250,.08); border-color: var(--accent2); }
|
||||
.btn-copy.copied { color: var(--success); border-color: var(--success); background: rgba(74,222,128,.06); }
|
||||
|
||||
.actions { width: 100%; display: flex; flex-direction: column; gap: .75rem; }
|
||||
|
||||
.error-msg {
|
||||
font-size: .85rem;
|
||||
color: #f87171;
|
||||
text-align: center;
|
||||
padding: .75rem 1rem;
|
||||
background: rgba(248,113,113,.08);
|
||||
border: 1px solid rgba(248,113,113,.2);
|
||||
border-radius: 10px;
|
||||
width: 100%;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
.footer {
|
||||
margin-top: 2.5rem;
|
||||
font-size: .7rem;
|
||||
color: var(--muted);
|
||||
letter-spacing: .05em;
|
||||
opacity: .5;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="stage">
|
||||
<div class="wordmark">sky<span>e</span>vouchers.</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-label">WLAN-Zugangscode</div>
|
||||
|
||||
<div class="slot-wrap">
|
||||
<div class="slot-display" id="slotDisplay">
|
||||
<span class="placeholder-text" id="placeholder">— — — — —</span>
|
||||
<div class="slot-chars" id="slotChars" style="display:none"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error-msg" id="errorMsg"></div>
|
||||
|
||||
<div class="actions">
|
||||
<button class="btn-primary" id="btnGet">Voucher generieren</button>
|
||||
<button class="btn-copy" id="btnCopy" style="display:none">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
|
||||
<span id="copyLabel">Code kopieren</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">Einmaliger Zugangscode · Für WLAN-Authentifizierung</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
let currentCode = null;
|
||||
let isRolling = false;
|
||||
|
||||
const slotDisplay = document.getElementById('slotDisplay');
|
||||
const slotChars = document.getElementById('slotChars');
|
||||
const placeholder = document.getElementById('placeholder');
|
||||
const btnGet = document.getElementById('btnGet');
|
||||
const btnCopy = document.getElementById('btnCopy');
|
||||
const copyLabel = document.getElementById('copyLabel');
|
||||
const errorMsg = document.getElementById('errorMsg');
|
||||
|
||||
function showError(msg) {
|
||||
errorMsg.textContent = msg;
|
||||
errorMsg.style.display = 'block';
|
||||
}
|
||||
function hideError() {
|
||||
errorMsg.style.display = 'none';
|
||||
}
|
||||
|
||||
function buildSlotChars(code) {
|
||||
slotChars.innerHTML = '';
|
||||
for (const ch of code) {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'slot-char';
|
||||
span.textContent = ch === '-' ? '-' : ch;
|
||||
if (ch !== '-') span.dataset.final = ch;
|
||||
slotChars.appendChild(span);
|
||||
}
|
||||
}
|
||||
|
||||
function randomChar() {
|
||||
return CHARS[Math.floor(Math.random() * CHARS.length)];
|
||||
}
|
||||
|
||||
function animateSlot(finalCode, duration = 1400) {
|
||||
return new Promise(resolve => {
|
||||
placeholder.style.display = 'none';
|
||||
slotChars.style.display = 'flex';
|
||||
buildSlotChars(finalCode);
|
||||
|
||||
const spans = [...slotChars.querySelectorAll('.slot-char[data-final]')];
|
||||
slotDisplay.classList.add('rolling');
|
||||
|
||||
// Start all spinning
|
||||
spans.forEach(s => {
|
||||
s.classList.add('rolling');
|
||||
s.textContent = randomChar();
|
||||
});
|
||||
|
||||
const interval = setInterval(() => {
|
||||
spans.forEach(s => {
|
||||
if (s.classList.contains('rolling')) s.textContent = randomChar();
|
||||
});
|
||||
}, 60);
|
||||
|
||||
// Stop characters one by one with stagger
|
||||
const stagger = duration / (spans.length + 2);
|
||||
spans.forEach((s, i) => {
|
||||
const delay = stagger * (i + 1) + 200;
|
||||
setTimeout(() => {
|
||||
s.classList.remove('rolling');
|
||||
s.textContent = s.dataset.final;
|
||||
}, delay);
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
clearInterval(interval);
|
||||
slotDisplay.classList.remove('rolling');
|
||||
slotDisplay.classList.add('done');
|
||||
resolve();
|
||||
}, duration + 300);
|
||||
});
|
||||
}
|
||||
|
||||
btnGet.addEventListener('click', async () => {
|
||||
if (isRolling) return;
|
||||
isRolling = true;
|
||||
hideError();
|
||||
btnGet.disabled = true;
|
||||
btnCopy.style.display = 'none';
|
||||
slotDisplay.classList.remove('done');
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/get-voucher', { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (!res.ok) throw new Error(data.error || 'Fehler');
|
||||
|
||||
currentCode = data.code;
|
||||
await animateSlot(currentCode);
|
||||
|
||||
btnGet.style.display = 'none';
|
||||
btnCopy.style.display = 'flex';
|
||||
} catch (e) {
|
||||
showError(e.message);
|
||||
btnGet.disabled = false;
|
||||
placeholder.style.display = 'flex';
|
||||
slotChars.style.display = 'none';
|
||||
} finally {
|
||||
isRolling = false;
|
||||
}
|
||||
});
|
||||
|
||||
btnCopy.addEventListener('click', () => {
|
||||
if (!currentCode) return;
|
||||
function onCopied() {
|
||||
copyLabel.textContent = 'Kopiert!';
|
||||
btnCopy.classList.add('copied');
|
||||
setTimeout(() => {
|
||||
copyLabel.textContent = 'Code kopieren';
|
||||
btnCopy.classList.remove('copied');
|
||||
}, 2000);
|
||||
}
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText(currentCode).then(onCopied).catch(() => fallbackCopy());
|
||||
} else {
|
||||
fallbackCopy();
|
||||
}
|
||||
function fallbackCopy() {
|
||||
const ta = document.createElement('textarea');
|
||||
ta.value = currentCode;
|
||||
ta.style.cssText = 'position:fixed;opacity:0;top:0;left:0';
|
||||
document.body.appendChild(ta);
|
||||
ta.focus(); ta.select();
|
||||
try { document.execCommand('copy'); onCopied(); } catch(e) {}
|
||||
document.body.removeChild(ta);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user