Init
This commit is contained in:
45
app/index.html
Normal file
45
app/index.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Team Manager - Bundesliga & Champions League</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1>⚽ Team Manager</h1>
|
||||
<p>Erstelle deine Teams für Bundesliga und Champions League</p>
|
||||
</header>
|
||||
|
||||
<div class="groups-container">
|
||||
<!-- Bundesliga -->
|
||||
<section class="group">
|
||||
<h2>🇩🇪 Bundesliga</h2>
|
||||
<div class="form-group">
|
||||
<input type="text" id="bundesliga-name" placeholder="Team Name" maxlength="50">
|
||||
<input type="text" id="bundesliga-chant" placeholder="Schlachtruf" maxlength="100">
|
||||
<button onclick="addTeam('bundesliga')">Team hinzufügen</button>
|
||||
</div>
|
||||
<div id="bundesliga-teams" class="teams-list"></div>
|
||||
</section>
|
||||
|
||||
<!-- Champions League -->
|
||||
<section class="group">
|
||||
<h2>🏆 Champions League</h2>
|
||||
<div class="form-group">
|
||||
<input type="text" id="championsleague-name" placeholder="Team Name" maxlength="50">
|
||||
<input type="text" id="championsleague-chant" placeholder="Schlachtruf" maxlength="100">
|
||||
<button onclick="addTeam('championsleague')">Team hinzufügen</button>
|
||||
</div>
|
||||
<div id="championsleague-teams" class="teams-list"></div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<button id="reset-btn" onclick="resetAll()" class="reset-button">Alle Teams löschen</button>
|
||||
</div>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
122
app/script.js
Normal file
122
app/script.js
Normal file
@@ -0,0 +1,122 @@
|
||||
// Teams Daten (im localStorage speichern für Session-Persistierung)
|
||||
const STORAGE_KEY = 'teamManagerData';
|
||||
|
||||
// Initialisieren
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
loadTeams();
|
||||
});
|
||||
|
||||
// Team hinzufügen
|
||||
function addTeam(group) {
|
||||
const nameInput = document.getElementById(`${group}-name`);
|
||||
const chantInput = document.getElementById(`${group}-chant`);
|
||||
|
||||
const name = nameInput.value.trim();
|
||||
const chant = chantInput.value.trim();
|
||||
|
||||
// Validierung
|
||||
if (!name) {
|
||||
alert('Bitte gib einen Team-Namen ein!');
|
||||
nameInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!chant) {
|
||||
alert('Bitte gib einen Schlachtruf ein!');
|
||||
chantInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// Daten laden
|
||||
const data = loadData();
|
||||
|
||||
// Neues Team erstellen
|
||||
const team = {
|
||||
id: Date.now(),
|
||||
name: name,
|
||||
chant: chant,
|
||||
createdAt: new Date().toLocaleString('de-DE')
|
||||
};
|
||||
|
||||
// Zum entsprechenden Gruppe hinzufügen
|
||||
if (!data[group]) {
|
||||
data[group] = [];
|
||||
}
|
||||
data[group].push(team);
|
||||
|
||||
// Speichern
|
||||
saveData(data);
|
||||
|
||||
// Eingabefelder leeren
|
||||
nameInput.value = '';
|
||||
chantInput.value = '';
|
||||
nameInput.focus();
|
||||
|
||||
// UI aktualisieren
|
||||
renderTeams(group);
|
||||
}
|
||||
|
||||
// Team löschen
|
||||
function deleteTeam(group, teamId) {
|
||||
if (!confirm('Möchtest du dieses Team wirklich löschen?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const data = loadData();
|
||||
data[group] = data[group].filter(team => team.id !== teamId);
|
||||
saveData(data);
|
||||
renderTeams(group);
|
||||
}
|
||||
|
||||
// Teams rendern
|
||||
function renderTeams(group) {
|
||||
const data = loadData();
|
||||
const container = document.getElementById(`${group}-teams`);
|
||||
const teams = data[group] || [];
|
||||
|
||||
if (teams.length === 0) {
|
||||
container.innerHTML = '<div class="empty-message">Noch keine Teams hinzugefügt</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
container.innerHTML = teams.map(team => `
|
||||
<div class="team-card">
|
||||
<h3>🎽 ${escapeHtml(team.name)}</h3>
|
||||
<p>"${escapeHtml(team.chant)}"</p>
|
||||
<button onclick="deleteTeam('${group}', ${team.id})">Löschen</button>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
// Alle Teams laden
|
||||
function loadTeams() {
|
||||
renderTeams('bundesliga');
|
||||
renderTeams('championsleague');
|
||||
}
|
||||
|
||||
// Alle Teams löschen
|
||||
function resetAll() {
|
||||
if (!confirm('Möchtest du wirklich ALLE Teams löschen?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
localStorage.removeItem(STORAGE_KEY);
|
||||
loadTeams();
|
||||
}
|
||||
|
||||
// LocalStorage Hilfsfunktionen
|
||||
function loadData() {
|
||||
const stored = localStorage.getItem(STORAGE_KEY);
|
||||
return stored ? JSON.parse(stored) : { bundesliga: [], championsleague: [] };
|
||||
}
|
||||
|
||||
function saveData(data) {
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
|
||||
}
|
||||
|
||||
// XSS-Schutz
|
||||
function escapeHtml(text) {
|
||||
const div = document.createElement('div');
|
||||
div.textContent = text;
|
||||
return div.innerHTML;
|
||||
}
|
||||
191
app/styles.css
Normal file
191
app/styles.css
Normal file
@@ -0,0 +1,191 @@
|
||||
* {
|
||||
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: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
header {
|
||||
text-align: center;
|
||||
color: white;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 2.5em;
|
||||
margin-bottom: 10px;
|
||||
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
header p {
|
||||
font-size: 1.1em;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.groups-container {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 30px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.group {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 30px;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
||||
animation: slideIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
@keyframes slideIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.group h2 {
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
font-size: 1.8em;
|
||||
border-bottom: 3px solid #667eea;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 12px;
|
||||
border: 2px solid #e0e0e0;
|
||||
border-radius: 6px;
|
||||
font-size: 1em;
|
||||
transition: border-color 0.3s;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 12px;
|
||||
background: #667eea;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: #764ba2;
|
||||
}
|
||||
|
||||
button:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.teams-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.team-card {
|
||||
background: #f5f5f5;
|
||||
border-left: 5px solid #667eea;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
animation: fadeIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
|
||||
.team-card h3 {
|
||||
color: #333;
|
||||
margin-bottom: 5px;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.team-card p {
|
||||
color: #666;
|
||||
font-size: 0.95em;
|
||||
font-style: italic;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.team-card button {
|
||||
background: #e74c3c;
|
||||
padding: 8px 15px;
|
||||
font-size: 0.9em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.team-card button:hover {
|
||||
background: #c0392b;
|
||||
}
|
||||
|
||||
.reset-button {
|
||||
width: 100%;
|
||||
background: #e74c3c;
|
||||
padding: 15px;
|
||||
font-size: 1.1em;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.reset-button:hover {
|
||||
background: #c0392b;
|
||||
}
|
||||
|
||||
.empty-message {
|
||||
color: #999;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.groups-container {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.group {
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user