Welten: adaptive Abdunklung — Bildhelligkeit per Canvas messen, --wbg-dim dynamisch (hell→mehr, dunkel→wenig), Dark-Mode-Overlay berücksichtigt, SW v1130
This commit is contained in:
parent
fa1ecfa0fb
commit
ac5b26f767
6 changed files with 57 additions and 18 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
1129
|
1130
|
||||||
|
|
@ -86,14 +86,14 @@
|
||||||
<title>Ban Yaro</title>
|
<title>Ban Yaro</title>
|
||||||
|
|
||||||
<!-- Theme + theme-color Statusleiste vor CSS setzen -->
|
<!-- Theme + theme-color Statusleiste vor CSS setzen -->
|
||||||
<script src="/js/boot-early.js?v=1129"></script>
|
<script src="/js/boot-early.js?v=1130"></script>
|
||||||
|
|
||||||
<!-- CSS: Reihenfolge ist wichtig — ?v= zwingt Browser zur Neuladung -->
|
<!-- CSS: Reihenfolge ist wichtig — ?v= zwingt Browser zur Neuladung -->
|
||||||
<link rel="stylesheet" href="/css/design-system.css?v=1129">
|
<link rel="stylesheet" href="/css/design-system.css?v=1130">
|
||||||
<link rel="stylesheet" href="/css/layout.css?v=1129">
|
<link rel="stylesheet" href="/css/layout.css?v=1130">
|
||||||
<link rel="stylesheet" href="/css/components.css?v=1129">
|
<link rel="stylesheet" href="/css/components.css?v=1130">
|
||||||
<link rel="stylesheet" href="/css/utilities.css?v=1129">
|
<link rel="stylesheet" href="/css/utilities.css?v=1130">
|
||||||
<link rel="stylesheet" href="/css/lists.css?v=1129">
|
<link rel="stylesheet" href="/css/lists.css?v=1130">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
@ -617,11 +617,11 @@
|
||||||
<div id="modal-container"></div>
|
<div id="modal-container"></div>
|
||||||
|
|
||||||
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
|
<!-- JS: Reihenfolge ist wichtig — erst Basis, dann Features -->
|
||||||
<script src="/js/api.js?v=1129"></script>
|
<script src="/js/api.js?v=1130"></script>
|
||||||
<script src="/js/ui.js?v=1129"></script>
|
<script src="/js/ui.js?v=1130"></script>
|
||||||
<script src="/js/app.js?v=1129"></script>
|
<script src="/js/app.js?v=1130"></script>
|
||||||
<script src="/js/worlds.js?v=1129"></script>
|
<script src="/js/worlds.js?v=1130"></script>
|
||||||
<script src="/js/offline-indicator.js?v=1129"></script>
|
<script src="/js/offline-indicator.js?v=1130"></script>
|
||||||
|
|
||||||
<!-- Feature-Seiten werden lazy geladen -->
|
<!-- Feature-Seiten werden lazy geladen -->
|
||||||
|
|
||||||
|
|
@ -631,7 +631,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- Boot: Offline-Banner + SW-Registration (extrahiert für CSP) -->
|
<!-- Boot: Offline-Banner + SW-Registration (extrahiert für CSP) -->
|
||||||
<script src="/js/boot.js?v=1129"></script>
|
<script src="/js/boot.js?v=1130"></script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
Router, State-Management, Navigation, Initialisierung.
|
Router, State-Management, Navigation, Initialisierung.
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
const APP_VER = '1129'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
const APP_VER = '1130'; // ← bei jedem Deploy mit Frontend-Änderungen erhöhen
|
||||||
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
const APP_VERSION = '1.6.0'; // ← semantische Version, wird bei make release gesetzt
|
||||||
window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator)
|
window.APP_VER = APP_VER; // global verfügbar für andere Module (z.B. offline-indicator)
|
||||||
window.APP_VERSION = APP_VERSION;
|
window.APP_VERSION = APP_VERSION;
|
||||||
|
|
|
||||||
|
|
@ -981,6 +981,7 @@ window.Worlds = (() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
let _bgUrl = null; // aktuell gesetztes Hintergrundbild
|
let _bgUrl = null; // aktuell gesetztes Hintergrundbild
|
||||||
|
let _bgBrightness = null; // gemessene Roh-Helligkeit des Bildes (0–255) für adaptive Abdunklung
|
||||||
|
|
||||||
function _isDarkMode() {
|
function _isDarkMode() {
|
||||||
const t = document.documentElement.getAttribute('data-theme');
|
const t = document.documentElement.getAttribute('data-theme');
|
||||||
|
|
@ -1020,10 +1021,44 @@ window.Worlds = (() => {
|
||||||
// Orientierungswechsel → Bild neu setzen
|
// Orientierungswechsel → Bild neu setzen
|
||||||
window.matchMedia('(orientation: portrait)').addEventListener('change', _applyBgOrientation);
|
window.matchMedia('(orientation: portrait)').addEventListener('change', _applyBgOrientation);
|
||||||
|
|
||||||
// Theme-Wechsel → Overlay-Intensität anpassen
|
// Theme-Wechsel → Overlay-Intensität + adaptive Abdunklung neu anwenden
|
||||||
new MutationObserver(_applyBgOrientation)
|
new MutationObserver(() => { _applyBgOrientation(); _applyAdaptiveDim(); })
|
||||||
.observe(document.documentElement, { attributeFilter: ['data-theme'] });
|
.observe(document.documentElement, { attributeFilter: ['data-theme'] });
|
||||||
|
|
||||||
|
// Durchschnittliche Helligkeit (0–255) eines geladenen Bildes via Mini-Canvas.
|
||||||
|
// Gibt null zurück bei CORS-Tainting oder Fehler (→ Fallback-Abdunklung).
|
||||||
|
function _measureBrightness(img) {
|
||||||
|
try {
|
||||||
|
const c = document.createElement('canvas');
|
||||||
|
const w = c.width = 32, h = c.height = 32;
|
||||||
|
const ctx = c.getContext('2d', { willReadFrequently: true });
|
||||||
|
ctx.drawImage(img, 0, 0, w, h);
|
||||||
|
const data = ctx.getImageData(0, 0, w, h).data;
|
||||||
|
let sum = 0;
|
||||||
|
for (let i = 0; i < data.length; i += 4) {
|
||||||
|
sum += 0.299 * data[i] + 0.587 * data[i + 1] + 0.114 * data[i + 2];
|
||||||
|
}
|
||||||
|
return sum / (data.length / 4);
|
||||||
|
} catch { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setzt --wbg-dim adaptiv: helles Bild → mehr Abdunklung (Lesbarkeit),
|
||||||
|
// dunkles Bild → wenig. Im Dark Mode liegt zusätzlich ein 0.45-Overlay
|
||||||
|
// über dem Bild, daher wirkt es dort dunkler (effektive Helligkeit ↓).
|
||||||
|
function _applyAdaptiveDim() {
|
||||||
|
let b = _bgBrightness;
|
||||||
|
if (b == null) b = 110; // neutraler Default wenn Messung fehlschlug
|
||||||
|
if (_isDarkMode()) b *= 0.55; // 0.45-Bild-Overlay reduziert sichtbare Helligkeit
|
||||||
|
let dim;
|
||||||
|
if (b <= 90) dim = 0.14;
|
||||||
|
else if (b >= 190) dim = 0.48;
|
||||||
|
else dim = 0.14 + (b - 90) / 100 * (0.48 - 0.14);
|
||||||
|
const val = dim.toFixed(2);
|
||||||
|
['wp-jetzt', 'wp-hund', 'wp-welt'].forEach(id => {
|
||||||
|
document.getElementById(id)?.style.setProperty('--wbg-dim', val);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function _applyBgImage(url) {
|
function _applyBgImage(url) {
|
||||||
const ov = document.getElementById('worlds-overlay');
|
const ov = document.getElementById('worlds-overlay');
|
||||||
const track = document.getElementById('worlds-track');
|
const track = document.getElementById('worlds-track');
|
||||||
|
|
@ -1033,6 +1068,8 @@ window.Worlds = (() => {
|
||||||
toLoad.onload = () => {
|
toLoad.onload = () => {
|
||||||
_hasBgPhoto = true;
|
_hasBgPhoto = true;
|
||||||
_bgUrl = url;
|
_bgUrl = url;
|
||||||
|
_bgBrightness = _measureBrightness(toLoad);
|
||||||
|
_applyAdaptiveDim();
|
||||||
_applyBgOrientation();
|
_applyBgOrientation();
|
||||||
const hint = document.getElementById('wh-photo-hint');
|
const hint = document.getElementById('wh-photo-hint');
|
||||||
if (hint) {
|
if (hint) {
|
||||||
|
|
@ -1054,6 +1091,8 @@ window.Worlds = (() => {
|
||||||
} else {
|
} else {
|
||||||
_hasBgPhoto = false;
|
_hasBgPhoto = false;
|
||||||
_bgUrl = null;
|
_bgUrl = null;
|
||||||
|
_bgBrightness = 20; // dunkler Fallback-Gradient → minimale Abdunklung
|
||||||
|
_applyAdaptiveDim();
|
||||||
track.style.backgroundImage = '';
|
track.style.backgroundImage = '';
|
||||||
ov.style.backgroundImage = 'linear-gradient(160deg,#1a1f35 0%,#16213e 33%,#1a2535 67%,#0f1921 100%)';
|
ov.style.backgroundImage = 'linear-gradient(160deg,#1a1f35 0%,#16213e 33%,#1a2535 67%,#0f1921 100%)';
|
||||||
ov.style.backgroundSize = '100% 100%';
|
ov.style.backgroundSize = '100% 100%';
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="color-scheme" content="light dark">
|
<meta name="color-scheme" content="light dark">
|
||||||
<script src="/js/landing-init.js?v=1129"></script>
|
<script src="/js/landing-init.js?v=1130"></script>
|
||||||
<title>Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz</title>
|
<title>Ban Yaro — Die Hunde-App für Deutschland, Österreich & Schweiz</title>
|
||||||
<meta name="description" content="Ban Yaro: Die kostenlose All-in-One Hunde-App für DACH. Tagebuch, Giftköder-Alarm, Training mit KI, Forum, Wurfbörse, Stammbaum, Inzucht-Check — DSGVO-konform, offline-fähig, ohne App Store.">
|
<meta name="description" content="Ban Yaro: Die kostenlose All-in-One Hunde-App für DACH. Tagebuch, Giftköder-Alarm, Training mit KI, Forum, Wurfbörse, Stammbaum, Inzucht-Check — DSGVO-konform, offline-fähig, ohne App Store.">
|
||||||
<meta name="keywords" content="Hunde App, Hunde Community, Wurfbörse, Züchter, Welpen kaufen, Stammbaum Hund, Inzuchtkoeffizient, Hundezucht, Impfpass Hund, Giftköder Alarm, Gassi Community, Hundetraining App, Hunde Forum, Hunde KI, Hundefilm Datenbank, Welpen Marktplatz">
|
<meta name="keywords" content="Hunde App, Hunde Community, Wurfbörse, Züchter, Welpen kaufen, Stammbaum Hund, Inzuchtkoeffizient, Hundezucht, Impfpass Hund, Giftköder Alarm, Gassi Community, Hundetraining App, Hunde Forum, Hunde KI, Hundefilm Datenbank, Welpen Marktplatz">
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
// ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab
|
// ← EINZIGE Stelle für die Version — STATIC_ASSETS und CACHE_VERSION leiten sich ab
|
||||||
const VER = '1129';
|
const VER = '1130';
|
||||||
const CACHE_VERSION = `by-v${VER}`;
|
const CACHE_VERSION = `by-v${VER}`;
|
||||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||||
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
const CACHE_TILES = 'ban-yaro-tiles-v1'; // bleibt über SW-Updates erhalten
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue