new folder structure / add de translation
This commit is contained in:
parent
8aba6f5129
commit
4a0a5bac3f
35 changed files with 696 additions and 1124 deletions
|
@ -1,51 +1,81 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ get_locale() }}" data-bs-theme="{{ theme }}">
|
||||
<html lang="{{ session.get('lang', 'en') }}" data-bs-theme="{{ theme }}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta name="description" content="Manage your Steam and GOG keys efficiently. Track redemption dates, share games, and export lists.">
|
||||
<meta name="theme-color" content="#212529">
|
||||
<link rel="manifest" href="{{ url_for('static', filename='manifest.json') }}">
|
||||
<title>{{ _('Game Key Manager') }}</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Preload Bootstrap CSS for better LCP -->
|
||||
<link rel="preload" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
||||
<noscript><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"></noscript>
|
||||
<!-- Eigene Styles -->
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
{# LCP-Optimierung: Preload für das erste Cover-Bild, falls vorhanden #}
|
||||
{% if games and games[0].steam_appid %}
|
||||
<link rel="preload"
|
||||
as="image"
|
||||
href="https://cdn.cloudflare.steamstatic.com/steam/apps/{{ games[0].steam_appid }}/header.jpg"
|
||||
imagesrcset="https://cdn.cloudflare.steamstatic.com/steam/apps/{{ games[0].steam_appid }}/header.jpg 368w"
|
||||
fetchpriority="high"
|
||||
type="image/jpeg">
|
||||
{% endif %}
|
||||
</head>
|
||||
<script>
|
||||
(function() {
|
||||
try {
|
||||
var theme = localStorage.getItem('theme');
|
||||
if (!theme) {
|
||||
// Systempräferenz als Fallback
|
||||
theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
}
|
||||
document.documentElement.setAttribute('data-bs-theme', theme);
|
||||
} catch(e) {}
|
||||
})();
|
||||
</script>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg bg-body-tertiary">
|
||||
<div class="container">
|
||||
<a class="navbar-brand d-flex align-items-center gap-2" href="/">
|
||||
<img src="{{ url_for('static', filename='logo_small.png') }}" alt="Logo" width="150" height="116" style="object-fit:contain; border-radius:8px;">
|
||||
<span>Game Key Manager</span>
|
||||
<img src="{{ url_for('static', filename='logo_small.webp') }}" alt="Logo" width="150" height="116" style="object-fit:contain; border-radius:8px;">
|
||||
<span>Game Key Manager</span>
|
||||
</a>
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<form class="d-flex" action="{{ url_for('index') }}" method="GET">
|
||||
<form class="d-flex" action="{{ url_for('index') }}" method="GET" role="search" aria-label="{{ _('Search games') }}">
|
||||
<label for="searchInput" class="visually-hidden">{{ _('Search') }}</label>
|
||||
<input class="form-control me-2"
|
||||
type="search"
|
||||
name="q"
|
||||
id="searchInput"
|
||||
placeholder="{{ _('Search') }}"
|
||||
value="{{ search_query }}">
|
||||
<button class="btn btn-outline-success" type="submit">🔍</button>
|
||||
<button class="btn btn-outline-success" type="submit" aria-label="{{ _('Search') }}">🔍</button>
|
||||
</form>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input"
|
||||
type="checkbox"
|
||||
<input class="form-check-input"
|
||||
type="checkbox"
|
||||
id="darkModeSwitch" {% if theme == 'dark' %}checked{% endif %}>
|
||||
<label class="form-check-label" for="darkModeSwitch">{{ _('Dark Mode') }}</label>
|
||||
</div>
|
||||
<div class="dropdown ms-3">
|
||||
<div hidden id="locale-debug" data-locale="{{ session.get('lang', 'en') }}"></div>
|
||||
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
{% if get_locale() == 'de' %} Deutsch {% elif get_locale() == 'en' %} English {% else %} Sprache {% endif %}
|
||||
{% if session.get('lang', 'en') == 'de' %} Deutsch {% elif session.get('lang', 'en') == 'en' %} English {% else %} Sprache {% endif %}
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item {% if get_locale() == 'de' %}active{% endif %}" href="{{ url_for('set_lang', lang='de') }}">Deutsch</a></li>
|
||||
<li><a class="dropdown-item {% if get_locale() == 'en' %}active{% endif %}" href="{{ url_for('set_lang', lang='en') }}">English</a></li>
|
||||
<li><a class="dropdown-item {% if session.get('lang', 'en') == 'de' %}active{% endif %}" href="{{ url_for('set_lang', lang='de') }}">Deutsch</a></li>
|
||||
<li><a class="dropdown-item {% if session.get('lang', 'en') == 'en' %}active{% endif %}" href="{{ url_for('set_lang', lang='en') }}">English</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% if current_user.is_authenticated %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('change_password') }}">🔒 {{ _('Passwort') }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('logout') }}">🚪 {{ _('Logout') }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('change_password') }}">🔒 {{ _('Password') }}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('logout') }}">🚪 {{ _('Logout') }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -65,16 +95,44 @@
|
|||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
// Service Worker Registration for PWA
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('{{ url_for("static", filename="serviceworker.js") }}', {scope: '/'})
|
||||
.then(registration => {
|
||||
console.log('ServiceWorker registered:', registration.scope);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('ServiceWorker registration failed:', error);
|
||||
});
|
||||
});
|
||||
}
|
||||
// Dark Mode Switch
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const toggle = document.getElementById('darkModeSwitch')
|
||||
const html = document.documentElement
|
||||
|
||||
toggle.addEventListener('change', function() {
|
||||
const theme = this.checked ? 'dark' : 'light'
|
||||
fetch('/set-theme/' + theme)
|
||||
.then(() => html.setAttribute('data-bs-theme', theme))
|
||||
})
|
||||
})
|
||||
const toggle = document.getElementById('darkModeSwitch');
|
||||
const html = document.documentElement;
|
||||
if (toggle) {
|
||||
toggle.checked = (html.getAttribute('data-bs-theme') === 'dark')
|
||||
toggle.addEventListener('change', function() {
|
||||
const theme = this.checked ? 'dark' : 'light';
|
||||
document.cookie = "theme=" + theme + ";path=/;max-age=31536000";
|
||||
html.setAttribute('data-bs-theme', theme);
|
||||
fetch('/set-theme/' + theme);
|
||||
});
|
||||
}
|
||||
// Set theme on page load
|
||||
function getThemeCookie() {
|
||||
const cookies = document.cookie.split(';');
|
||||
for (let cookie of cookies) {
|
||||
const [name, value] = cookie.trim().split('=');
|
||||
if (name === 'theme') return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const savedTheme = getThemeCookie() || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
||||
document.documentElement.setAttribute('data-bs-theme', savedTheme);
|
||||
});
|
||||
|
||||
</script>
|
||||
{% include "footer.html" %}
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue