From 5d476eb92db22f4c6d0c3d641acd6e3f9df652c2 Mon Sep 17 00:00:00 2001 From: Nyan404 Date: Tue, 24 Nov 2026 17:08:00 +0300 Subject: [PATCH] Keep footer snowdrifts as a visual easter egg --- MEMORY.md | 2 +- structure_and_data.md | 2 +- web/admin.html | 1 - web/calculator.html | 1 - web/weather-effect.css | 1 - web/weather-effect.js | 9 --------- 6 files changed, 2 insertions(+), 14 deletions(-) diff --git a/MEMORY.md b/MEMORY.md index 241ecb9..f128593 100644 --- a/MEMORY.md +++ b/MEMORY.md @@ -5,7 +5,7 @@ - Supersedes the October leaf fallback: clear weather, API failure and initial/no-JS markup are empty; ULLI still selects rain/snow/mixed and wind dynamics. - Owner explicitly selected **total snow depth for the latest dated day** from the fixed Climate Energy Saint Petersburg page, after clarification that “Свежевыпавший” is a density selector, not a daily snowfall measurement. - `snow_cover.py` and `/api/weather/snow-cover` are independent of METAR: 30-minute valid cache / 5-minute failure cache, 4s timeout, 3 MiB cap; named table/cell IDs and literal date assignments, no upstream JS execution. Explicit 0 is available; unknown/stale (>2 Moscow calendar days) is unavailable. Live read on 2026-11-24 was 0 cm for that date. -- Calculator/admin footer namyoty are procedural SVGs: 2–3 asymmetric wind-sculpted banks with randomized crests, slopes and lee shadows per page load. Preserve geometry between feed refreshes; only positive measured depth sets bounded visual height (max 144px). No snow when zero/unknown. Dated source link remains visible for an available zero. +- Calculator/admin footer snowdrifts are a visual easter egg without a caption or source link. The SVG generates 2–3 asymmetric wind-sculpted banks with randomized crests, slopes and lee shadows per page load. Preserve geometry between feed refreshes. Only positive measured depth sets bounded visual height (max 144px). Zero or unavailable depth hides the drifts. - Local source/HTTP/syntax checks and Chromium visual previews at 1280/390 px were performed; visible snowdrifts used a synthetic 16cm fixture. Project test suites were not run or expanded. No runtime dependencies, push or deployment. - 2026-11-22: `/trainer` now limits jumps to the eight cells adjoining the character, even along the safe starting strip. Each field chooses one exit from `x10 y2–y6` or `y6 x6–x10`; this replaces the unrestricted exit pool described below. The entrance remains `x1 y1`. diff --git a/structure_and_data.md b/structure_and_data.md index 9efe992..db898b4 100644 --- a/structure_and_data.md +++ b/structure_and_data.md @@ -6,7 +6,7 @@ - `app/belki/snow_cover.py` reads only [the owner's Climate Energy Saint Petersburg source](https://climate-energy.ru/weather/spravochnik/sndp/climate_sprav-sndp_260630687.php). The owner clarified that footer snow should use **total snow depth for the latest day**, not daily fresh snowfall. The source's “Свежевыпавший” option changes density for mass calculations; it does not report fresh snowfall. - The parser reads `tek_parametry`, dated `data_N` literals and `tek_klim_znachenN` centimetres without executing JavaScript. It accepts explicit zero, decimal centimetres and dates at most 2 Moscow calendar days old. Missing, future, stale, malformed or oversized data are unavailable, never silently zero. Date labels lack years; the nearest calendar year handles New Year boundaries. - `GET /api/weather/snow-cover` returns `{available, depth_cm, observed_on}`. The process cache is 30 minutes for valid data and 5 minutes after failure, with a nonblocking refresh lock, 4-second upstream timeout and 3 MiB cap. It is independent of METAR fetching; browser feeds also run independently, without credentials, and pause in hidden tabs. No database, runtime dependency, Docker or gateway change is needed. -- Both footers show a dated source link and white wind-sculpted snowdrifts. A DOM-created SVG generates 2–3 asymmetric banks, random widths/heights/crests and shaded lee faces once per page load. Polling preserves the silhouette; reload creates a new one. Visual height is `min(144, 20 + sqrt(depth_cm) * 20)` px for positive depth, otherwise zero. Particles/drifts never intercept pointer input; reduced motion stops precipitation. +- Both footers use white wind-sculpted snowdrifts as an easter egg, without a weather caption or source link. A DOM-created SVG generates 2–3 asymmetric banks, random widths/heights/crests and shaded lee faces once per page load. Polling preserves the silhouette; reload creates a new one. Visual height is `min(144, 20 + sqrt(depth_cm) * 20)` px for positive depth, otherwise zero. Particles/drifts never intercept pointer input; reduced motion stops precipitation. - Inspected the real source and isolated HTTP endpoint: on 2026-11-24 it returned **0 cm dated 2026-11-24**, correctly showing no drifts. Local Chromium previews at 1280/390 px used synthetic 16 cm for visible drifts; inspected changing profiles after reload, snow/rain and reduced motion. Python AST, page/asset JavaScript syntax and `git diff --check` passed. Project test suites were not run or expanded, per current instructions. No push/deployment or cluster change. Temporary preview venv, server, SQLite stores, browser and screenshots were kept outside Git and cleaned up. - This section supersedes the October leaf-fallback/no-JS notes below. The October production verification remains historical; the November implementation is local until separately deployed. diff --git a/web/admin.html b/web/admin.html index 18db102..223d828 100644 --- a/web/admin.html +++ b/web/admin.html @@ -166,7 +166,6 @@ diff --git a/web/calculator.html b/web/calculator.html index 97b356b..616b16f 100644 --- a/web/calculator.html +++ b/web/calculator.html @@ -291,7 +291,6 @@ diff --git a/web/weather-effect.css b/web/weather-effect.css index 9655efe..e823ea5 100644 --- a/web/weather-effect.css +++ b/web/weather-effect.css @@ -53,7 +53,6 @@ .snow-footer a { color: inherit; text-underline-offset: 3px; } .snow-footer a:hover { color: var(--accent); } .snow-footer a:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; } -.snow-cover-caption { min-height: 24px; margin-top: 8px; font-size: .8rem; line-height: 1.5; } .footer-snowdrift { height: var(--snow-height, 0px); width: 100%; diff --git a/web/weather-effect.js b/web/weather-effect.js index 4bd7b68..8576684 100644 --- a/web/weather-effect.js +++ b/web/weather-effect.js @@ -4,7 +4,6 @@ const field = document.querySelector('.weather-field'); if (!field) return; const snowdrift = document.querySelector('.footer-snowdrift'); - const snowSource = document.querySelector('.snow-cover-source'); let lastSignature = ''; function buildSnowdrifts() { @@ -86,21 +85,13 @@ } function renderSnowCover(cover) { - if (!snowdrift || !snowSource) return; const depth = cover?.depth_cm; const stamp = cover?.observed_on; const available = cover?.available === true && typeof depth === 'number' && Number.isFinite(depth) && depth >= 0 && depth <= 500 && /^\d{4}-\d{2}-\d{2}$/.test(stamp); - snowSource.hidden = !available; snowdrift.dataset.depth = available ? String(depth) : ''; // A visual scale, not centimetres rendered 1:1; keep the footer usable in deep snow. snowdrift.style.setProperty('--snow-height', available && depth > 0 ? `${Math.min(144, 20 + Math.sqrt(depth) * 20)}px` : '0px'); - if (available) { - const [year, month, day] = stamp.split('-'); - snowSource.textContent = `Снежный покров: ${depth.toLocaleString('ru-RU')} см · ${day}.${month}.${year}`; - } else { - snowSource.textContent = ''; - } } function poll(url, interval, update, fallback) {