Files
duempelkas/src/Duempelkas.Desktop/wwwroot/index.html

132 lines
4.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<script>
(function () {
function getCookie(name) {
var parts = document.cookie ? document.cookie.split(';') : [];
for (var i = 0; i < parts.length; i++) {
var part = parts[i].trim();
if (part.indexOf(name + '=') === 0) {
return decodeURIComponent(part.substring(name.length + 1));
}
}
return null;
}
function setCookie(name, value) {
document.cookie = name + '=' + encodeURIComponent(value) + '; path=/; max-age=31536000; samesite=lax';
}
function getStoredTheme() {
try {
var fromStorage = localStorage.getItem('duempelkas-theme');
if (fromStorage === 'light' || fromStorage === 'dark') {
return fromStorage;
}
} catch (_) {
// Ignore storage access issues and fall back to cookies/system.
}
var fromCookie = getCookie('duempelkas-theme');
if (fromCookie === 'light' || fromCookie === 'dark') {
return fromCookie;
}
return null;
}
function detectSystemTheme() {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
return 'dark';
}
return 'light';
}
function normalizeTheme(value) {
return value === 'dark' ? 'dark' : 'light';
}
function applyTheme(theme, persist) {
var resolved = normalizeTheme(theme);
document.documentElement.setAttribute('data-ui-theme', resolved);
document.documentElement.setAttribute('data-bs-theme', resolved);
if (document.body) {
document.body.setAttribute('data-ui-theme', resolved);
document.body.setAttribute('data-bs-theme', resolved);
}
if (persist) {
try {
localStorage.setItem('duempelkas-theme', resolved);
} catch (_) {
// Ignore storage access issues and keep cookie as fallback.
}
setCookie('duempelkas-theme', resolved);
}
return resolved;
}
var initialTheme = getStoredTheme() || detectSystemTheme() || 'light';
applyTheme(initialTheme, false);
var duempelkasThemeGetCurrentTheme = function () {
var current = document.documentElement.getAttribute('data-ui-theme');
return normalizeTheme(current);
};
var duempelkasThemeSetTheme = function (theme) {
return applyTheme(theme, true);
};
var duempelkasThemeToggleTheme = function () {
var current = document.documentElement.getAttribute('data-ui-theme');
var next = current === 'dark' ? 'light' : 'dark';
return applyTheme(next, true);
};
globalThis.duempelkasThemeGetCurrentTheme = duempelkasThemeGetCurrentTheme;
globalThis.duempelkasThemeSetTheme = duempelkasThemeSetTheme;
globalThis.duempelkasThemeToggleTheme = duempelkasThemeToggleTheme;
window.duempelkasThemeGetCurrentTheme = duempelkasThemeGetCurrentTheme;
window.duempelkasThemeSetTheme = duempelkasThemeSetTheme;
window.duempelkasThemeToggleTheme = duempelkasThemeToggleTheme;
// Keep object-style API for compatibility with older calls.
window.duempelkasTheme = {
getCurrentTheme: duempelkasThemeGetCurrentTheme,
setTheme: duempelkasThemeSetTheme,
toggleTheme: duempelkasThemeToggleTheme
};
})();
</script>
<title>Dümpelkas Kassenbuch</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YcnS/1nDaGm7AT/+aIi56blBBJoSpcBx5Hn"
crossorigin="anonymous" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"
rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
</head>
<body>
<app>Laden...</app>
<div id="blazor-error-ui">
Ein unbehandelter Fehler ist aufgetreten.
<a href="" class="reload">Neu laden</a>
<a class="dismiss">×</a>
</div>
<script src="_framework/blazor.webview.js"></script>
</body>
</html>