first commit

This commit is contained in:
Carsten Graf
2025-06-01 11:51:02 +02:00
commit 2d2ee0a41a
22 changed files with 3241 additions and 0 deletions

480
data/about.html Normal file
View File

@@ -0,0 +1,480 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Über NinjaCross Timer</title>
<style>
html {
overflow-x: hidden;
min-height: 100%;
width: 100%;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Arial", sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
width: 100vw;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
color: white;
position: relative;
box-sizing: border-box;
}
.back-btn {
position: fixed;
top: 20px;
right: 20px;
background: rgba(255, 255, 255, 0.2);
border: 2px solid rgba(255, 255, 255, 0.3);
color: white;
padding: 12px 20px;
border-radius: 25px;
text-decoration: none;
font-size: 1rem;
transition: all 0.3s ease;
z-index: 1000;
display: flex;
align-items: center;
gap: 8px;
font-weight: 500;
}
.back-btn:hover {
background: rgba(255, 255, 255, 0.3);
border-color: rgba(255, 255, 255, 0.5);
transform: translateY(-2px);
}
.header {
text-align: center;
margin-bottom: 3vh;
margin-top: 4vh;
flex-shrink: 0;
}
.header h1 {
font-size: clamp(2rem, 4vw, 3rem);
margin-bottom: 1vh;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.header p {
font-size: clamp(1rem, 2vw, 1.3rem);
opacity: 0.9;
}
.content-container {
width: 100%;
max-width: 1000px;
display: flex;
flex-direction: column;
gap: 2rem;
padding: 0 2vw;
}
.content-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border-radius: 20px;
padding: clamp(20px, 3vh, 30px);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.content-card:hover {
transform: translateY(-5px);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}
.content-card h2 {
font-size: clamp(1.3rem, 2.5vw, 1.8rem);
margin-bottom: 1rem;
color: #fff;
display: flex;
align-items: center;
gap: 10px;
}
.content-card h3 {
font-size: clamp(1.1rem, 2vw, 1.4rem);
margin: 1.5rem 0 0.8rem 0;
color: #ffc107;
}
.content-card p {
font-size: clamp(0.9rem, 1.8vw, 1.1rem);
line-height: 1.6;
margin-bottom: 1rem;
opacity: 0.95;
}
.content-card ul {
margin: 1rem 0;
padding-left: 1.5rem;
}
.content-card li {
font-size: clamp(0.9rem, 1.8vw, 1.1rem);
line-height: 1.6;
margin-bottom: 0.5rem;
opacity: 0.95;
}
.feature-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
margin-top: 1rem;
}
.feature-item {
background: rgba(255, 255, 255, 0.1);
padding: 1.5rem;
border-radius: 15px;
text-align: center;
border: 1px solid rgba(255, 255, 255, 0.15);
}
.feature-item h4 {
font-size: clamp(1rem, 2vw, 1.2rem);
margin-bottom: 0.8rem;
color: #3498db;
}
.feature-item p {
font-size: clamp(0.85rem, 1.6vw, 1rem);
opacity: 0.9;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 1rem;
margin-top: 1rem;
}
.stat-item {
background: rgba(46, 204, 113, 0.2);
border: 2px solid #2ecc71;
padding: 1.5rem;
border-radius: 15px;
text-align: center;
}
.stat-number {
font-size: clamp(1.8rem, 3vw, 2.5rem);
font-weight: bold;
color: #2ecc71;
display: block;
margin-bottom: 0.5rem;
}
.stat-label {
font-size: clamp(0.8rem, 1.5vw, 1rem);
opacity: 0.9;
}
.team-section {
text-align: center;
}
.team-member {
background: rgba(155, 89, 182, 0.2);
border: 2px solid #9b59b6;
padding: 1.5rem;
border-radius: 15px;
margin: 1rem 0;
}
.team-member h4 {
font-size: clamp(1.1rem, 2vw, 1.4rem);
color: #9b59b6;
margin-bottom: 0.5rem;
}
.team-member p {
font-size: clamp(0.9rem, 1.6vw, 1rem);
opacity: 0.9;
}
.cta-section {
background: rgba(52, 152, 219, 0.2);
border: 2px solid #3498db;
text-align: center;
position: relative;
overflow: hidden;
}
.cta-section::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
animation: shine 3s infinite;
}
@keyframes shine {
0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
}
.cta-content {
position: relative;
z-index: 1;
}
.cta-btn {
display: inline-block;
background: #3498db;
color: white;
padding: 12px 30px;
border-radius: 25px;
text-decoration: none;
font-weight: bold;
margin-top: 1rem;
transition: all 0.3s ease;
font-size: clamp(0.9rem, 1.8vw, 1.1rem);
}
.cta-btn:hover {
background: #2980b9;
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}
@media (max-width: 768px) {
.logo {
width: 40px;
height: 40px;
top: 10px;
left: 10px;
}
.back-btn {
top: 10px;
right: 10px;
padding: 8px 15px;
font-size: 0.9rem;
}
.content-container {
padding: 0 3vw;
gap: 1.5rem;
}
.feature-grid {
grid-template-columns: 1fr;
}
body {
padding: 10px;
}
}
@media (max-width: 480px) {
.logo {
width: 35px;
height: 35px;
top: 8px;
left: 8px;
}
.back-btn {
top: 8px;
right: 8px;
padding: 6px 12px;
font-size: 0.8rem;
}
.content-container {
padding: 0 2vw;
}
body {
padding: 8px;
}
}
</style>
</head>
<body>
<a href="/" class="back-btn">
← Zurück zum Timer
</a>
<div class="header">
<h1>🏊‍♀️ Über NinjaCross Timer</h1>
<p>Der professionelle Zeitmesser für Ninjacross Wettkämpfe</p>
</div>
<div class="content-container">
<div class="content-card">
<h2>🎯 Was ist NinjaCross?</h2>
<p>
NinjaCross ist ein aufregender Wassersport, der Geschwindigkeit, Technik und Athletik kombiniert.
Teilnehmer durchqueren Schwimmbahnen mit verschiedenen Hindernissen und Herausforderungen,
wobei Zeit und Präzision entscheidend sind.
</p>
<p>
Unser Timer-System wurde speziell entwickelt, um professionelle Wettkämpfe zu unterstützen
und präzise Zeitmessungen für bis zu zwei Bahnen gleichzeitig zu ermöglichen.
</p>
</div>
<div class="content-card">
<h2>⚡ Funktionen</h2>
<div class="feature-grid">
<div class="feature-item">
<h4>🎲 Dual-Timer</h4>
<p>Gleichzeitige Zeitmessung für zwei Bahnen mit präziser Synchronisation</p>
</div>
<div class="feature-item">
<h4>📱 Responsive Design</h4>
<p>Optimiert für alle Geräte - Desktop, Tablet und Smartphone</p>
</div>
<div class="feature-item">
<h4>🏆 Bestzeiten</h4>
<p>Automatische Verfolgung und Anzeige der besten Tageszeiten</p>
</div>
<div class="feature-item">
<h4>📚 Lernmodus</h4>
<p>Interaktiver Modus für Training und Schulungszwecke</p>
</div>
<div class="feature-item">
<h4>⚙️ Einfache Bedienung</h4>
<p>Intuitive Benutzeroberfläche für schnelle und fehlerfreie Bedienung</p>
</div>
<div class="feature-item">
<h4>🔄 Live-Sync</h4>
<p>Echtzeitaktualisierung aller Timer-Daten über Backend-Integration</p>
</div>
</div>
</div>
<div class="content-card">
<h2>📊 Technische Spezifikationen</h2>
<div class="stats-grid">
<div class="stat-item">
<span class="stat-number">0.01s</span>
<span class="stat-label">Präzision</span>
</div>
<div class="stat-item">
<span class="stat-number">2</span>
<span class="stat-label">Bahnen</span>
</div>
<div class="stat-item">
<span class="stat-number">50ms</span>
<span class="stat-label">Update-Rate</span>
</div>
<div class="stat-item">
<span class="stat-number">100%</span>
<span class="stat-label">Responsive</span>
</div>
</div>
<h3>🔧 Technologie-Stack</h3>
<ul>
<li><strong>Frontend:</strong> HTML5, CSS3, Vanilla JavaScript</li>
<li><strong>Design:</strong> Responsive Grid Layout, Glassmorphism</li>
<li><strong>Performance:</strong> Optimierte Render-Zyklen, Smooth Animations</li>
<li><strong>Kompatibilität:</strong> Alle modernen Browser, Mobile-First</li>
</ul>
</div>
<div class="content-card team-section">
<h2>👥 Entwicklung</h2>
<div class="team-member">
<h4>🚀 Entwickelt mit ❤️ von Carsten Graf</h4>
<p>
Dieses Projekt wurde mit Leidenschaft für den NinjaCross-Sport entwickelt,
um Wettkämpfe professioneller und spannender zu gestalten.
</p>
</div>
</div>
<div class="content-card">
<h2>🎮 Bedienung</h2>
<h3>Grundfunktionen</h3>
<ul>
<li><strong>Timer starten:</strong> Automatische Synchronisation mit Backend-System</li>
<li><strong>Live-Anzeige:</strong> Echtzeitaktualisierung aller Zeiten und Status</li>
<li><strong>Bestzeiten:</strong> Automatische Speicherung der Tagesrekorde</li>
<li><strong>Lernmodus:</strong> Interaktive Anweisungen für neue Benutzer</li>
</ul>
<h3>Status-Anzeigen</h3>
<ul>
<li><strong>Bereit (Blau):</strong> Timer ist startbereit</li>
<li><strong>Läuft (Grün):</strong> Aktive Zeitmessung mit Pulsation</li>
<li><strong>Beendet (Rot):</strong> Zeitmessung abgeschlossen</li>
</ul>
</div>
<div class="content-card cta-section">
<div class="cta-content">
<h2>🏁 Bereit für den Wettkampf?</h2>
<p>
Starten Sie jetzt mit dem professionellen NinjaCross Timer
und erleben Sie präzise Zeitmessung auf höchstem Niveau!
</p>
<a href="/" class="cta-btn">Timer starten 🚀</a>
</div>
</div>
</div>
<script>
// Smooth scroll animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, observerOptions);
// Initialize animations
document.addEventListener('DOMContentLoaded', () => {
const cards = document.querySelectorAll('.content-card');
cards.forEach(card => {
card.style.opacity = '0';
card.style.transform = 'translateY(30px)';
card.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
observer.observe(card);
});
});
// Add click effects
document.querySelectorAll('.content-card').forEach(card => {
card.addEventListener('click', function() {
this.style.transform = 'translateY(-5px) scale(1.02)';
setTimeout(() => {
this.style.transform = 'translateY(-5px) scale(1)';
}, 150);
});
});
</script>
</body>
</html>

453
data/index.html Normal file
View File

@@ -0,0 +1,453 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NinjaCross Timer</title>
<style>
html {
overflow: hidden;
height: 100%;
width: 100%;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Arial", sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
height: 100vh;
width: 100vw;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
color: white;
position: relative;
overflow: hidden;
box-sizing: border-box;
}
.logo {
position: fixed;
top: 20px;
left: 20px;
width: 200px;
height: 60px;
z-index: 1000;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
transition: transform 0.3s ease;
text-decoration: none;
display: block;
cursor: pointer;
padding-left: 5px;
padding-right: 5px;
}
.logo:hover {
transform: scale(1.1);
}
.logo img {
width: 100%;
height: 100%;
object-fit: contain;
border-radius: 10px;
}
.settings-btn {
position: fixed;
top: 20px;
right: 20px;
background: rgba(255, 255, 255, 0.2);
border: 2px solid rgba(255, 255, 255, 0.3);
color: white;
padding: 15px;
border-radius: 50%;
text-decoration: none;
font-size: 1.5rem;
transition: all 0.3s ease;
z-index: 1000;
width: 60px;
height: 60px;
display: flex;
align-items: center;
justify-content: center;
}
.settings-btn:hover {
background: rgba(255, 255, 255, 0.3);
border-color: rgba(255, 255, 255, 0.5);
transform: scale(1.1);
}
.header {
text-align: center;
margin-bottom: 2vh;
flex-shrink: 0;
}
.header h1 {
font-size: clamp(1.8rem, 4vw, 2.5rem);
margin-bottom: 0.5vh;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.header p {
font-size: clamp(0.8rem, 1.8vw, 1rem);
}
.timer-container {
display: grid;
grid-template-columns: 1fr 1fr;
gap: clamp(15px, 2vw, 30px);
width: 100%;
max-width: 100%;
flex-grow: 1;
padding: 0 2vw;
max-height: 60vh;
}
@media (max-width: 768px) {
.timer-container {
grid-template-columns: 1fr;
gap: clamp(15px, 3vw, 30px);
padding: 0 15px;
}
}
@media (max-width: 480px) {
.timer-container {
gap: 20px;
padding: 0 10px;
}
}
@media (min-width: 1400px) {
.timer-container {
max-width: 1400px;
padding: 0 60px;
}
}
.lane {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border-radius: 20px;
padding: clamp(15px, 2.5vh, 25px);
text-align: center;
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
display: flex;
flex-direction: column;
justify-content: center;
height: 100%;
overflow: hidden;
}
.lane h2 {
font-size: clamp(1.2rem, 2.5vw, 1.8rem);
margin-bottom: clamp(10px, 1vh, 15px);
color: #fff;
}
.time-display {
font-size: clamp(3rem, 9vw, 10rem);
font-weight: bold;
margin: clamp(10px, 1vh, 15px) 0;
font-family: "Courier New", monospace;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
line-height: 1;
}
.status {
font-size: clamp(3rem, 1.8vw, 1.2rem);
margin: clamp(8px, 1vh, 12px) 0;
padding: clamp(6px, 1vh, 10px) clamp(12px, 2vw, 18px);
border-radius: 20px;
display: inline-block;
font-weight: 600;
}
.status.ready {
background-color: rgba(52, 152, 219, 0.3);
border: 2px solid #3498db;
}
.status.running {
background-color: rgba(46, 204, 113, 0.3);
border: 2px solid #2ecc71;
animation: pulse 1s infinite;
}
.status.finished {
background-color: rgba(231, 76, 60, 0.3);
border: 2px solid #e74c3c;
}
@keyframes pulse {
0% {
opacity: 1;
}
50% {
opacity: 0.7;
}
100% {
opacity: 1;
}
}
.best-times {
background: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(10px);
border-radius: 15px;
padding: clamp(10px, 1.5vh, 15px);
margin: 1vh 0 0 0;
width: 50%;
max-width: 50%;
text-align: center;
border: 1px solid rgba(255, 255, 255, 0.2);
flex-shrink: 0;
align-self: center;
}
.best-times h3 {
font-size: clamp(0.9rem, 1.8vw, 1.1rem);
margin-bottom: clamp(5px, 0.5vh, 8px);
}
.best-time-row {
display: flex;
justify-content: space-between;
margin: clamp(3px, 0.5vh, 5px) 0;
font-size: clamp(0.8rem, 1.5vw, 1rem);
font-weight: 500;
background: rgba(255, 255, 255, 0.1);
padding: clamp(5px, 1vh, 8px) clamp(8px, 1.5vw, 12px);
border-radius: 8px;
}
.learning-mode {
background: rgba(255, 193, 7, 0.2);
border: 2px solid #ffc107;
border-radius: 15px;
padding: clamp(15px, 2vh, 20px);
margin: 2vh 0;
text-align: center;
animation: pulse 2s infinite;
width: 100%;
position: absolute;
top: 15vh;
left: 50%;
transform: translateX(-50%);
z-index: 100;
}
.learning-mode h3 {
color: #ffc107;
margin-bottom: 10px;
font-size: clamp(1rem, 2vw, 1.3rem);
}
.learning-mode p {
font-size: clamp(0.9rem, 1.8vw, 1.1rem);
}
@media (max-width: 768px) {
.timer-container {
grid-template-columns: 1fr;
gap: clamp(10px, 2vh, 15px);
padding: 0 3vw;
max-height: 55vh;
}
.settings-btn {
top: 10px;
right: 10px;
width: 40px;
height: 40px;
font-size: 1rem;
padding: 8px;
}
.header h1 {
font-size: clamp(1.5rem, 4vw, 2rem);
}
.header p {
font-size: clamp(0.7rem, 2vw, 0.9rem);
}
body {
padding: 10px;
}
}
@media (max-width: 480px) {
.settings-btn {
top: 8px;
right: 8px;
width: 35px;
height: 35px;
font-size: 0.9rem;
padding: 6px;
}
body {
padding: 8px;
}
.timer-container {
padding: 0 2vw;
}
}
</style>
</head>
<body>
<a href="/about" class="logo" title="Über NinjaCross Timer">
<img src="logo.png" alt="NinjaCross Logo" />
</a>
<a href="/settings" class="settings-btn">⚙️</a>
<div class="header">
<h1>🏊‍♀️ NinjaCross Timer</h1>
<p>Professioneller Zeitmesser für Ninjacross Wettkämpfe</p>
</div>
<div id="learning-display" class="learning-mode" style="display: none">
<h3>📚 Lernmodus aktiv</h3>
<p>
Bitte drücken Sie den Button für: <span id="learning-button"></span>
</p>
</div>
<div class="timer-container">
<div class="lane">
<h2>🏊‍♀️ Bahn 1</h2>
<div id="time1" class="time-display">00.00</div>
<div id="status1" class="status ready">Bereit</div>
</div>
<div class="lane">
<h2>🏊‍♂️ Bahn 2</h2>
<div id="time2" class="time-display">00.00</div>
<div id="status2" class="status ready">Bereit</div>
</div>
</div>
<div class="best-times">
<h3>🏆 Beste Zeiten des Tages</h3>
<div class="best-time-row">
<span>Bahn 1:</span>
<span id="best1">--.-</span>
</div>
<div class="best-time-row">
<span>Bahn 2:</span>
<span id="best2">--.-</span>
</div>
</div>
<script>
// State variables
let timer1 = 0;
let timer2 = 0;
let status1 = "ready";
let status2 = "ready";
let best1 = 0;
let best2 = 0;
let lastSync = Date.now();
let learningMode = false;
let learningButton = "";
function formatTime(seconds) {
if (seconds === 0) return "00.00";
return seconds.toFixed(2);
}
function updateDisplay() {
// Calculate elapsed time since last sync
const now = Date.now();
let display1 = timer1;
let display2 = timer2;
if (status1 === "running") {
display1 += (now - lastSync) / 1000;
}
if (status2 === "running") {
display2 += (now - lastSync) / 1000;
}
document.getElementById("time1").textContent = formatTime(display1);
const s1 = document.getElementById("status1");
s1.className = `status ${status1}`;
s1.textContent =
status1 === "ready"
? "Bereit"
: status1 === "running"
? "Läuft..."
: "Beendet";
document.getElementById("time2").textContent = formatTime(display2);
const s2 = document.getElementById("status2");
s2.className = `status ${status2}`;
s2.textContent =
status2 === "ready"
? "Bereit"
: status2 === "running"
? "Läuft..."
: "Beendet";
document.getElementById("best1").textContent =
best1 > 0 ? formatTime(best1) + "s" : "--.-";
document.getElementById("best2").textContent =
best2 > 0 ? formatTime(best2) + "s" : "--.-";
// Lernmodus
const learningDisplay = document.getElementById("learning-display");
if (learningMode) {
document.getElementById("learning-button").textContent = learningButton;
learningDisplay.style.display = "block";
} else {
learningDisplay.style.display = "none";
}
}
function syncFromBackend() {
fetch("/api/data")
.then((response) => response.json())
.then((data) => {
timer1 = data.time1;
timer2 = data.time2;
status1 = data.status1;
status2 = data.status2;
best1 = data.best1;
best2 = data.best2;
learningMode = data.learningMode;
learningButton = data.learningButton || "";
lastSync = Date.now();
updateDisplay();
})
.catch((error) =>
console.error("Fehler beim Laden der Daten:", error)
);
}
// Sync with backend every 2 seconds
setInterval(syncFromBackend, 2000);
// Smooth update every 50ms
setInterval(updateDisplay, 50);
// Initial load
syncFromBackend();
</script>
</body>
</html>

BIN
data/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

998
data/settings.html Normal file
View File

@@ -0,0 +1,998 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ninjacross Timer - Einstellungen</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 600px;
margin: 0 auto;
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
overflow: hidden;
backdrop-filter: blur(10px);
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
text-align: center;
position: relative;
}
.header::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><radialGradient id="a" cx="50%" cy="40%" r="50%"><stop offset="0%" stop-color="white" stop-opacity="0.1"/><stop offset="100%" stop-color="white" stop-opacity="0"/></radialGradient></defs><rect width="100" height="20" fill="url(%23a)"/></svg>');
opacity: 0.3;
}
.header h1 {
font-size: 2.5em;
margin-bottom: 10px;
position: relative;
z-index: 1;
}
.header p {
font-size: 1.1em;
opacity: 0.9;
position: relative;
z-index: 1;
}
.content {
padding: 40px;
}
.nav-buttons {
display: flex;
gap: 15px;
margin-bottom: 30px;
}
.nav-button {
flex: 1;
padding: 12px 20px;
background: #f8f9fa;
border: 2px solid #e9ecef;
border-radius: 10px;
color: #495057;
text-decoration: none;
text-align: center;
font-weight: 600;
transition: all 0.3s ease;
}
.nav-button:hover {
background: #667eea;
color: white;
border-color: #667eea;
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}
.section {
margin-bottom: 30px;
background: #f8f9fa;
border-radius: 15px;
padding: 25px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}
.section h2 {
color: #495057;
margin-bottom: 20px;
font-size: 1.4em;
display: flex;
align-items: center;
gap: 10px;
}
.section h2::before {
content: "";
width: 4px;
height: 25px;
background: linear-gradient(135deg, #667eea, #764ba2);
border-radius: 2px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 8px;
color: #495057;
font-weight: 600;
}
.form-group input {
width: 100%;
padding: 12px 15px;
border: 2px solid #e9ecef;
border-radius: 10px;
font-size: 16px;
transition: all 0.3s ease;
}
.form-group input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.time-row {
display: flex;
gap: 15px;
align-items: end;
}
.time-input {
flex: 1;
}
.current-time {
background: white;
padding: 15px;
border-radius: 10px;
text-align: center;
font-family: monospace;
font-size: 18px;
color: #495057;
border: 2px solid #e9ecef;
margin-bottom: 15px;
}
.button-group {
display: flex;
gap: 15px;
flex-wrap: wrap;
}
.btn {
padding: 15px 25px;
border: none;
border-radius: 12px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
display: inline-block;
text-align: center;
min-width: 150px;
}
.btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}
.btn-secondary {
background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
color: white;
}
.btn-secondary:hover {
transform: translateY(-2px);
box-shadow: 0 10px 25px rgba(116, 185, 255, 0.3);
}
.btn-warning {
background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
color: #d84315;
}
.btn-warning:hover {
transform: translateY(-2px);
box-shadow: 0 10px 25px rgba(252, 182, 159, 0.3);
}
.btn-danger {
background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
color: #c62828;
}
.btn-danger:hover {
transform: translateY(-2px);
box-shadow: 0 10px 25px rgba(255, 154, 158, 0.3);
}
.btn-disabled {
background: #e9ecef !important;
color: #6c757d !important;
cursor: not-allowed !important;
transform: none !important;
box-shadow: none !important;
}
.btn-disabled:hover {
transform: none !important;
box-shadow: none !important;
}
.restriction-notice {
background: #fff3cd;
color: #856404;
padding: 15px;
border-radius: 10px;
border: 2px solid #ffeaa7;
margin-bottom: 15px;
font-weight: 600;
text-align: center;
}
.status-message {
margin-top: 20px;
padding: 15px;
border-radius: 10px;
font-weight: 600;
text-align: center;
display: none;
}
.status-success {
background: #d4edda;
color: #155724;
border: 2px solid #c3e6cb;
}
.status-error {
background: #f8d7da;
color: #721c24;
border: 2px solid #f5c6cb;
}
.status-info {
background: #cce7ff;
color: #004085;
border: 2px solid #b3d9ff;
}
.learning-mode {
display: none;
text-align: center;
padding: 30px;
background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
border-radius: 15px;
margin-top: 20px;
}
.learning-mode h3 {
color: #d84315;
font-size: 1.5em;
margin-bottom: 15px;
}
.learning-mode p {
color: #bf360c;
font-size: 1.2em;
margin-bottom: 20px;
}
.pulse {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.05);
}
100% {
transform: scale(1);
}
}
@media (max-width: 600px) {
.container {
margin: 10px;
border-radius: 15px;
}
.content {
padding: 20px;
}
.nav-buttons {
flex-direction: column;
}
.button-group {
flex-direction: column;
}
.btn {
width: 100%;
}
.time-row {
flex-direction: column;
gap: 10px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>⏱️ Ninjacross Timer</h1>
<p>Einstellungen & Konfiguration</p>
</div>
<div class="content">
<div class="nav-buttons">
<a href="/" class="nav-button">🏠 Hauptseite</a>
<a
href="/settings"
class="nav-button"
style="background: #667eea; color: white; border-color: #667eea"
>⚙️ Einstellungen</a
>
</div>
<div id="statusMessage" class="status-message"></div>
<div class="section">
<h2>🕐 Datum & Uhrzeit</h2>
<div class="current-time" id="currentTime">
Aktuelle Zeit: Laden...
</div>
<form id="timeForm">
<div class="time-row">
<div class="form-group time-input">
<label for="currentDate">Datum:</label>
<input type="date" id="currentDate" name="currentDate" />
</div>
<div class="form-group time-input">
<label for="currentTimeInput">Uhrzeit:</label>
<input
type="time"
id="currentTimeInput"
name="currentTime"
step="1"
/>
</div>
</div>
<div class="button-group">
<button type="submit" class="btn btn-secondary">
🕐 Uhrzeit setzen
</button>
<button
type="button"
onclick="syncWithBrowserTime()"
class="btn btn-secondary"
>
💻 Browser-Zeit übernehmen
</button>
</div>
</form>
</div>
<div class="section">
<h2>🔧 Grundeinstellungen</h2>
<form id="settingsForm">
<div class="form-group">
<label for="maxTime">Maximale Zeit (Sekunden):</label>
<input
type="number"
id="maxTime"
name="maxTime"
min="10"
max="3600"
value="120"
title="Zeit nach der eine Bahn automatisch zurückgesetzt wird"
/>
</div>
<div class="form-group">
<label for="maxTimeDisplay"
>Wie lange bleibt die letzte Zeit stehen (Sekunden):</label
>
<input
type="number"
id="maxTimeDisplay"
name="maxTimeDisplay"
min="1"
max="3600"
value="20"
title="Zeit nach der die angezeigte Zeit zurückgesetzt wird"
/>
</div>
<div class="button-group">
<button type="submit" class="btn btn-primary">
💾 Einstellungen speichern
</button>
</div>
</form>
</div>
<div class="section">
<h2>🏆 Zeiten verwalten</h2>
<div class="button-group">
<button onclick="resetBestTimes()" class="btn btn-danger">
🔄 Beste Zeiten zurücksetzen
</button>
</div>
</div>
<div class="section">
<h2>📡 Button-Konfiguration</h2>
<div class="button-group">
<button onclick="startLearningMode()" class="btn btn-primary">
🎯 Anlernmodus starten
</button>
<button onclick="resetButtonAssign()" class="btn btn-danger">
❌ Buttons verlernen
</button>
<button onclick="showButtonStatus()" class="btn btn-primary">
📊 Button-Status anzeigen
</button>
</div>
<div id="learningMode" class="learning-mode">
<h3>🎯 Anlernmodus aktiv</h3>
<p id="learningInstruction" class="pulse">
Drücken Sie jetzt den Button für: <strong>Bahn 1 Start</strong>
</p>
<button onclick="cancelLearningMode()" class="btn btn-danger">
❌ Abbrechen
</button>
</div>
</div>
<div class="section">
<h2>🔄 OTA Update</h2>
<div id="otaRestrictionNotice" class="restriction-notice" style="display: none;">
🔒 OTA Updates sind nur mit Lizenz Level 2 oder höher verfügbar. Aktuelle Lizenz: Level <span id="currentLicenseLevel">0</span>
</div>
<div class="button-group">
<button
id="otaUpdateBtn"
onclick="performOTAUpdate()"
class="btn btn-danger"
>
🔄 Update durchführen
</button>
</div>
</div>
<div class="section">
<h2> System-Information</h2>
<div
id="systemInfo"
style="
background: white;
padding: 20px;
border-radius: 10px;
font-family: monospace;
font-size: 14px;
"
>
<div>IP-Adresse: <span id="ipAddress">Laden...</span></div>
<div>Kanal: <span id="channel">Laden...</span></div>
<div>MAC-Adresse: <span id="macAddress">Laden...</span></div>
<div>Freier Speicher: <span id="freeMemory">Laden...</span></div>
<div>Verbundene Buttons: <span id="connectedButtons">Laden...</span></div>
<div>Lizenz gültig: <span id="isLicenceValid">Laden...</span></div>
<div>Lizenz Level: <span id="licenceLevel">Laden...</span></div>
</div>
</div>
<div class="section">
<h2>🔧 Lizenz</h2>
<form id="licenceForm">
<div class="form-group">
<label for="licencekey">Lizensschlüssel:</label>
<input type="text" id="licencekey" name="licence" value="Key" />
</div>
<div class="button-group">
<button type="submit" class="btn btn-primary">
💾 Lizenz speichern
</button>
</div>
</form>
</div>
</div>
</div>
<script>
let learningStep = 0;
const learningSteps = [
"Bahn 1 Start",
"Bahn 1 Stop",
"Bahn 2 Start",
"Bahn 2 Stop",
];
// Einstellungen laden beim Seitenaufruf
window.onload = function () {
loadSettings();
loadSystemInfo();
loadCurrentTime();
updateCurrentTimeDisplay();
loadLicence()
};
// Aktuelle Zeit anzeigen (Live-Update)
function updateCurrentTimeDisplay() {
setInterval(() => {
fetch("/api/time")
.then((response) => response.json())
.then((data) => {
if (data.timestamp) {
const date = new Date(data.timestamp * 1000);
const timeString = date.toLocaleString("de-DE", {
weekday: "long",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
});
document.getElementById(
"currentTime"
).textContent = `System Zeit: ${timeString}`;
} else {
document.getElementById("currentTime").textContent =
"Aktuelle Zeit: Fehler beim Laden";
}
})
.catch((error) => {
document.getElementById("currentTime").textContent =
"Aktuelle Zeit: Fehler beim Laden";
});
}, 1000);
}
// Aktuelle Zeit vom Server laden
function loadCurrentTime() {
fetch("/api/time")
.then((response) => response.json())
.then((data) => {
if (data.timestamp) {
const date = new Date(data.timestamp * 1000);
document.getElementById("currentDate").value = date
.toISOString()
.split("T")[0];
document.getElementById("currentTimeInput").value = date
.toTimeString()
.split(" ")[0];
}
})
.catch((error) => {
console.log(
"Zeit konnte nicht geladen werden, verwende Browser-Zeit"
);
syncWithBrowserTime();
});
}
// Browser-Zeit in die Eingafelder übernehmen
function syncWithBrowserTime() {
const now = new Date();
document.getElementById("currentDate").value = now
.toISOString()
.split("T")[0];
document.getElementById("currentTimeInput").value = now
.toTimeString()
.split(" ")[0];
showMessage("Browser-Zeit übernommen", "info");
// Jetzt auch direkt an den Server senden:
const dateValue = document.getElementById("currentDate").value;
const timeValue = document.getElementById("currentTimeInput").value;
if (!dateValue || !timeValue) {
showMessage("Bitte Datum und Uhrzeit eingeben", "error");
return;
}
const datetime = new Date(`${dateValue}T${timeValue}`);
const timestamp = Math.floor(datetime.getTime() / 1000);
fetch("/api/set-time", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: "timestamp=" + encodeURIComponent(timestamp),
})
.then((response) => response.json())
.then((data) => {
if (data.success) {
showMessage("Uhrzeit erfolgreich gesetzt!", "success");
} else {
showMessage("Fehler beim Setzen der Uhrzeit", "error");
}
})
.catch((error) =>
showMessage("Verbindungsfehler beim Setzen der Zeit", "error")
);
}
// Zeit setzen
document.getElementById("timeForm")
.addEventListener("submit", function (e) {
e.preventDefault();
const dateValue = document.getElementById("currentDate").value;
const timeValue = document.getElementById("currentTimeInput").value;
if (!dateValue || !timeValue) {
showMessage("Bitte Datum und Uhrzeit eingeben", "error");
return;
}
const datetime = new Date(`${dateValue}T${timeValue}`);
const timestamp = Math.floor(datetime.getTime() / 1000);
fetch("/api/set-time", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: "timestamp=" + encodeURIComponent(timestamp),
})
.then((response) => response.json())
.then((data) => {
if (data.success) {
showMessage("Uhrzeit erfolgreich gesetzt!", "success");
} else {
showMessage("Fehler beim Setzen der Uhrzeit", "error");
}
})
.catch((error) =>
showMessage("Verbindungsfehler beim Setzen der Zeit", "error")
);
});
document.getElementById("licenceForm").addEventListener("submit", function(e) {
e.preventDefault();
saveLicence();
});
// Einstellungen laden
function loadSettings() {
fetch("/api/get-settings")
.then((response) => response.json())
.then((data) => {
document.getElementById("maxTime").value = data.maxTime || 300;
document.getElementById("maxTimeDisplay").value =
data.maxTimeDisplay || 20;
})
.catch((error) =>
showMessage("Fehler beim Laden der Einstellungen", "error")
);
}
// System-Informationen laden
function loadSystemInfo() {
fetch("/api/info")
.then((response) => response.json())
.then((data) => {
document.getElementById("ipAddress").textContent =
data.ip || "Unbekannt";
document.getElementById("channel").textContent =
data.channel || "Unbekannt";
document.getElementById("macAddress").textContent =
data.mac || "Unbekannt";
document.getElementById("freeMemory").textContent =
(data.freeMemory || 0) + " Bytes";
document.getElementById("connectedButtons").textContent =
data.connectedButtons || 0;
document.getElementById("isLicenceValid").textContent =
data.valid || "";
document.getElementById("licenceLevel").textContent =
data.tier || "";
// Check license level and update OTA button accordingly
updateOTAButtonAccess(data.tier || 0);
})
.catch((error) => console.log("Info konnte nicht geladen werden"));
}
function loadLicence() {
fetch("/api/get-licence")
.then((response) => response.json())
.then((data) => {
document.getElementById("licencekey").value = data.licence || "";
})
.catch((error) =>
showMessage("Fehler beim Laden der Lizenz", "error")
);
}
function saveLicence() {
const licence = document.getElementById("licencekey").value;
fetch("/api/set-licence", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: "licence=" + encodeURIComponent(licence),
})
.then((response) => response.json())
.then((data) => {
if (data.success) {
showMessage("Lizenz erfolgreich gespeichert!", "success");
// Reload system info to update license level and OTA access
setTimeout(() => {
loadSystemInfo();
}, 1000);
} else {
showMessage("Fehler beim Speichern der Lizenz", "error");
}
})
.catch((error) => showMessage("Verbindungsfehler", "error"));
}
// Update OTA button access based on license level
function updateOTAButtonAccess(licenseLevel) {
const otaButton = document.getElementById("otaUpdateBtn");
const restrictionNotice = document.getElementById("otaRestrictionNotice");
const currentLevelSpan = document.getElementById("currentLicenseLevel");
const level = parseInt(licenseLevel) || 0;
if (level >= 2) {
// License level 2 or higher - enable OTA
otaButton.classList.remove("btn-disabled");
otaButton.disabled = false;
restrictionNotice.style.display = "none";
} else {
// License level below 2 - disable OTA
otaButton.classList.add("btn-disabled");
otaButton.disabled = true;
restrictionNotice.style.display = "block";
currentLevelSpan.textContent = level;
}
}
// OTA Update function with license check
function performOTAUpdate() {
const otaButton = document.getElementById("otaUpdateBtn");
if (otaButton.disabled || otaButton.classList.contains("btn-disabled")) {
showMessage("OTA Update erfordert Lizenz Level 2 oder höher", "error");
return;
}
if (confirm("Möchten Sie wirklich ein OTA Update durchführen? Das Gerät wird während des Updates neu gestartet.")) {
window.location.href = '/update';
}
}
// Einstellungen speichern
document.getElementById("settingsForm")
.addEventListener("submit", function (e) {
e.preventDefault();
const maxTime = parseInt(document.getElementById("maxTime").value);
const maxTimeDisplay = parseInt(
document.getElementById("maxTimeDisplay").value
);
fetch("/api/set-max-time", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body:
"maxTime=" +
encodeURIComponent(maxTime) +
"&maxTimeDisplay=" +
encodeURIComponent(maxTimeDisplay),
})
.then((response) => response.json())
.then((data) => {
if (data.success) {
showMessage(
"Einstellungen erfolgreich gespeichert!",
"success"
);
} else {
showMessage("Fehler beim Speichern der Einstellungen", "error");
}
})
.catch((error) => showMessage("Verbindungsfehler", "error"));
});
// Beste Zeiten zurücksetzen
function resetBestTimes() {
if (confirm("Möchten Sie wirklich alle besten Zeiten zurücksetzen?")) {
fetch("/api/reset-best", { method: "POST" })
.then((response) => response.json())
.then((data) => {
if (data.success) {
showMessage(
"Beste Zeiten erfolgreich zurückgesetzt!",
"success"
);
} else {
showMessage("Fehler beim Zurücksetzen", "error");
}
})
.catch((error) => showMessage("Verbindungsfehler", "error"));
}
}
// Anlernmodus starten
function startLearningMode() {
learningStep = 0;
document.getElementById("learningMode").style.display = "block";
updateLearningInstruction();
fetch("/api/start-learning", { method: "POST" })
.then((response) => response.json())
.then((data) => {
if (data.success) {
showMessage("Anlernmodus gestartet", "info");
pollLearningStatus();
} else {
showMessage("Fehler beim Starten des Anlernmodus", "error");
cancelLearningMode();
}
})
.catch((error) => {
showMessage("Verbindungsfehler", "error");
cancelLearningMode();
});
}
// Anlernmodus abbrechen
function cancelLearningMode() {
document.getElementById("learningMode").style.display = "none";
fetch("/api/stop-learning", { method: "POST" })
.then((response) => response.json())
.then((data) => {
showMessage("Anlernmodus abgebrochen", "info");
})
.catch((error) => console.log("Fehler beim Abbrechen"));
}
// Anlern-Anweisung aktualisieren
function updateLearningInstruction() {
if (learningStep < learningSteps.length) {
document.getElementById(
"learningInstruction"
).innerHTML = `Drücken Sie jetzt den Button für: <strong>${learningSteps[learningStep]}</strong>`;
}
}
// Anlern-Status abfragen
function pollLearningStatus() {
const pollInterval = setInterval(() => {
fetch("/api/learn/status")
.then((response) => response.json())
.then((data) => {
if (!data.active) {
clearInterval(pollInterval);
document.getElementById("learningMode").style.display = "none";
if (data.completed) {
showMessage("Alle Buttons erfolgreich angelernt!", "success");
}
return;
}
if (data.step !== learningStep) {
learningStep = data.step;
updateLearningInstruction();
if (learningStep > 0) {
showMessage(
`${learningSteps[learningStep - 1]} erfolgreich angelernt!`,
"success"
);
}
}
})
.catch((error) => {
clearInterval(pollInterval);
cancelLearningMode();
});
}, 1000);
}
function resetButtonAssign() {
if (
confirm("Möchten Sie wirklich alle Button-Zuweisungen zurücksetzen?")
) {
fetch("/api/unlearn-button", { method: "POST" })
.then((response) => response.json())
.then((data) => {
if (data.success) {
showMessage(
"Button-Zuweisungen erfolgreich zurückgesetzt!",
"success"
);
loadSystemInfo();
} else {
showMessage(
"Fehler beim Zurücksetzen der Button-Zuweisungen",
"error"
);
}
})
.catch((error) => showMessage("Verbindungsfehler", "error"));
}
}
// Button-Status anzeigen
function showButtonStatus() {
fetch("/api/buttons/status")
.then((response) => response.json())
.then((data) => {
let statusText = "Button-Status:\n\n";
statusText += `Bahn 1 Start: ${
data.lane1Start ? "Konfiguriert" : "Nicht konfiguriert"
}\n`;
statusText += `Bahn 1 Stop: ${
data.lane1Stop ? "Konfiguriert" : "Nicht konfiguriert"
}\n`;
statusText += `Bahn 2 Start: ${
data.lane2Start ? "Konfiguriert" : "Nicht konfiguriert"
}\n`;
statusText += `Bahn 2 Stop: ${
data.lane2Stop ? "Konfiguriert" : "Nicht konfiguriert"
}\n`;
alert(statusText);
})
.catch((error) =>
showMessage("Fehler beim Laden des Button-Status", "error")
);
}
// Status-Nachricht anzeigen
function showMessage(message, type) {
const statusDiv = document.getElementById("statusMessage");
statusDiv.textContent = message;
statusDiv.className = `status-message status-${type}`;
statusDiv.style.display = "block";
setTimeout(() => {
statusDiv.style.display = "none";
}, 5000);
}
// System-Info alle 30 Sekunden aktualisieren
setInterval(loadSystemInfo, 30000);
</script>
</body>
</html>