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
@@ -166,7 +166,6 @@
|
||||
</section>
|
||||
</section>
|
||||
<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>
|
||||
</footer>
|
||||
</main>
|
||||
|
||||
@@ -291,7 +291,6 @@
|
||||
</div>
|
||||
</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>
|
||||
<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>
|
||||
</footer>
|
||||
</main>
|
||||
|
||||
@@ -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%;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user