Keep footer snowdrifts as a visual easter egg
This commit is contained in:
1 parent
657ce50ec1
commit
5d476eb92d
6 files changed
+2
-14
No files matched your search
@@ -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.
|
- 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.
|
- 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.
|
- `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.
|
- 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`.
|
- 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`.
|
||||||
|
|||||||
@@ -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.
|
- `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.
|
- 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.
|
- `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.
|
- 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.
|
- 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.
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,6 @@
|
|||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
<footer class="snow-footer">Беличья нора
|
<footer class="snow-footer">Беличья нора
|
||||||
<div class="snow-cover-caption"><a class="snow-cover-source" href="https://climate-energy.ru/weather/spravochnik/sndp/climate_sprav-sndp_260630687.php" target="_blank" rel="noopener noreferrer" hidden></a></div>
|
|
||||||
<div class="footer-snowdrift" aria-hidden="true"></div>
|
<div class="footer-snowdrift" aria-hidden="true"></div>
|
||||||
</footer>
|
</footer>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -291,7 +291,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<footer class="site-footer snow-footer">Proudly made by Nyan404 and Codex | <a href="https://git.nyan404.ru/nyan404/cwshed-clone">GitLab Page</a>
|
<footer class="site-footer snow-footer">Proudly made by Nyan404 and Codex | <a href="https://git.nyan404.ru/nyan404/cwshed-clone">GitLab Page</a>
|
||||||
<div class="snow-cover-caption"><a class="snow-cover-source" href="https://climate-energy.ru/weather/spravochnik/sndp/climate_sprav-sndp_260630687.php" target="_blank" rel="noopener noreferrer" hidden></a></div>
|
|
||||||
<div class="footer-snowdrift" aria-hidden="true"></div>
|
<div class="footer-snowdrift" aria-hidden="true"></div>
|
||||||
</footer>
|
</footer>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -53,7 +53,6 @@
|
|||||||
.snow-footer a { color: inherit; text-underline-offset: 3px; }
|
.snow-footer a { color: inherit; text-underline-offset: 3px; }
|
||||||
.snow-footer a:hover { color: var(--accent); }
|
.snow-footer a:hover { color: var(--accent); }
|
||||||
.snow-footer a:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
|
.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 {
|
.footer-snowdrift {
|
||||||
height: var(--snow-height, 0px);
|
height: var(--snow-height, 0px);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
const field = document.querySelector('.weather-field');
|
const field = document.querySelector('.weather-field');
|
||||||
if (!field) return;
|
if (!field) return;
|
||||||
const snowdrift = document.querySelector('.footer-snowdrift');
|
const snowdrift = document.querySelector('.footer-snowdrift');
|
||||||
const snowSource = document.querySelector('.snow-cover-source');
|
|
||||||
let lastSignature = '';
|
let lastSignature = '';
|
||||||
|
|
||||||
function buildSnowdrifts() {
|
function buildSnowdrifts() {
|
||||||
@@ -86,21 +85,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderSnowCover(cover) {
|
function renderSnowCover(cover) {
|
||||||
if (!snowdrift || !snowSource) return;
|
|
||||||
const depth = cover?.depth_cm;
|
const depth = cover?.depth_cm;
|
||||||
const stamp = cover?.observed_on;
|
const stamp = cover?.observed_on;
|
||||||
const available = cover?.available === true && typeof depth === 'number' && Number.isFinite(depth)
|
const available = cover?.available === true && typeof depth === 'number' && Number.isFinite(depth)
|
||||||
&& depth >= 0 && depth <= 500 && /^\d{4}-\d{2}-\d{2}$/.test(stamp);
|
&& depth >= 0 && depth <= 500 && /^\d{4}-\d{2}-\d{2}$/.test(stamp);
|
||||||
snowSource.hidden = !available;
|
|
||||||
snowdrift.dataset.depth = available ? String(depth) : '';
|
snowdrift.dataset.depth = available ? String(depth) : '';
|
||||||
// A visual scale, not centimetres rendered 1:1; keep the footer usable in deep snow.
|
// 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');
|
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) {
|
function poll(url, interval, update, fallback) {
|
||||||
|
|||||||
Reference in new issue
Block a user