Skip to content

Commit e693c89

Browse files
committed
simplify rain bannerg
1 parent b7bca5d commit e693c89

3 files changed

Lines changed: 5 additions & 38 deletions

File tree

index.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -963,9 +963,7 @@
963963
</script>
964964
</header>
965965
<main>
966-
<div id="rain-banner">
967-
<div id="rain-banner-text"></div>
968-
</div>
966+
<div id="rain-banner"><center>IT IS CURRENTLY RAINING IN NEW YORK</center></div>
969967
<section style="display: flex; align-items: center; gap: 0.5ch; margin-left: 4px;" class="only-show-on-mobile">
970968
<a href="atom.xml">⚛&nbsp;&nbsp;atom.xml</a>
971969
󱠡
@@ -2217,7 +2215,7 @@ <h2>
22172215
style="font-family: 'hersheytimes', serif; font-size: 0.5em;">
22182216
Hershey Times Triplex Light
22192217
</a> that I have been unable to recover the source of (???).
2220-
ASCII font from <a href="https://patorjk.com/software/taag/">TAAG</a>".
2218+
ASCII font from <a href="https://patorjk.com/software/taag/">TAAG</a>.
22212219
Weather data from <a href="https://open-meteo.com/">Open-Meteo</a>. Dataviz with <a
22222220
href="https://observablehq.com/plot/">Observable Plot</a>.
22232221
Atmospheric rendering by <a href="https://github.com/dnlzro/horizon">Horizon</a>.

js/weather.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const low = document.getElementById('low');
1111
const high = document.getElementById('high');
1212
const rainDiv = document.getElementById('rain');
1313
const rainBanner = document.getElementById('rain-banner');
14-
const rainBannerText = document.getElementById('rain-banner-text');
1514

1615

1716
const setTime = () => {
@@ -73,36 +72,18 @@ const url = 'https://api.open-meteo.com/v1/forecast?'
7372

7473
const simulateRain = false;
7574

76-
function updateRainBannerText() {
77-
if (!rainBannerText) return;
78-
const chunk = 'IT IS CURRENTLY RAINING IN NEW YORK ⋅ ';
79-
const repeatCount = Math.max(3, Math.ceil(window.innerWidth / 325) + 2);
80-
rainBannerText.textContent = chunk.repeat(repeatCount);
81-
}
82-
8375
function setRainState(isRaining) {
8476
if (rainDiv) {
8577
rainDiv.style.display = isRaining ? 'block' : 'none';
8678
}
8779

8880
if (rainBanner) {
89-
rainBanner.style.display = isRaining ? 'block' : 'none';
90-
if (isRaining) {
91-
updateRainBannerText();
92-
} else if (rainBannerText) {
93-
rainBannerText.textContent = '';
94-
}
81+
rainBanner.style.visibility = isRaining ? 'visible' : 'hidden';
9582
}
9683
}
9784

9885
setRainState(false);
9986

100-
window.addEventListener('resize', () => {
101-
if (rainBanner && rainBanner.style.display === 'block') {
102-
updateRainBannerText();
103-
}
104-
});
105-
10687
fetch(url)
10788
.then(response => response.json())
10889
.then(data => {

stylesheets/weather.css

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,14 @@
99
}
1010

1111
#rain-banner {
12-
display: none;
12+
display: block;
13+
visibility: hidden;
1314
width: 100%;
1415
background: rgb(92, 96, 98);
15-
}
16-
17-
#rain-banner-text {
1816
color: #ffffff;
1917
padding: 0.5ch;
2018
white-space: nowrap;
2119
text-transform: uppercase;
22-
animation: rain-banner-text-blink 3s step-end infinite;
23-
}
24-
25-
@keyframes rain-banner-text-blink {
26-
0%, 66% {
27-
opacity: 1;
28-
}
29-
66%, 100% {
30-
opacity: 0;
31-
}
3220
}
3321

3422
#rain {

0 commit comments

Comments
 (0)