Keep footer snowdrifts as a visual easter egg

This commit is contained in:
nyan404 committed 2026-11-24 17:08:00 +03:00
1 parent 657ce50ec1
commit 5d476eb92d
6 files changed
+2 -14

No files matched your search

-9
View File
@@ -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) {