@@ -11,7 +11,6 @@ const low = document.getElementById('low');
1111const high = document . getElementById ( 'high' ) ;
1212const rainDiv = document . getElementById ( 'rain' ) ;
1313const rainBanner = document . getElementById ( 'rain-banner' ) ;
14- const rainBannerText = document . getElementById ( 'rain-banner-text' ) ;
1514
1615
1716const setTime = ( ) => {
@@ -73,36 +72,18 @@ const url = 'https://api.open-meteo.com/v1/forecast?'
7372
7473const 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-
8375function 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
9885setRainState ( false ) ;
9986
100- window . addEventListener ( 'resize' , ( ) => {
101- if ( rainBanner && rainBanner . style . display === 'block' ) {
102- updateRainBannerText ( ) ;
103- }
104- } ) ;
105-
10687fetch ( url )
10788 . then ( response => response . json ( ) )
10889 . then ( data => {
0 commit comments