1/** 2 * WhatWeather.Today - Service Worker 3 * Version: 38.1.18 4 * Changelog 38.1.18: 5 * - Bump version to 38.1.18 6 * Changelog 38.1.17: 7 * Changelog 38.1.14: 8 * - Bump version to 38.1.14 9 * Changelog 38.1.11: 10 * Changelog 38.1.10: 11 * Changelog 38.1.8: 12 * Changelog 38.1.7: Unified visual satellite ground truth with urban albedo protection (Paris). 13 * Changelog 38.1.6: Unified visual satellite cloud cover truth for all devices worldwide, zero LibreWxr divergence. 14 * Changelog 38.1.4: Full consistency between Hero, cloud chart, and satellite calibration. 15 * Changelog 38.1.3: EUMETSAT stratus dT calculation fix and synchronization. 16 * Changelog 38.1.2: Weather apps tabs cleanup and iframe adjustments. 17 * Changelog 38.1.1: hero start spinner guarantee and satellite cloud floor harmonization. 18 * Changelog 38.1.0: contact.php endpoint bypass and site_free_note fallback. 19 * Changelog 38.0.0: Unified hero weather sync on time & weather page, fully localized footer free note, contact modal & api.php, new premium favicon.ico. 20 * CACHE v38.0.0. 21 * Version: 37.2.40 22 * Version: 37.2.37 23 * Changelog 37.2.37: Fix TDZ ReferenceError on startup. 24 * CACHE v37.2.37. 25 * Version: 37.2.36 26 * Changelog 37.2.36: Fix GOES overcast reference cap and opaque cloud protection. 27 * CACHE v37.2.36. 28 * Version: 37.2.35 29 * Changelog 37.2.35: StabilnoÅÄ lokalizacji przy odÅwieżaniu â brak przeÅÄ czania miejscowoÅci. 30 * CACHE v37.2.35. 31 * Version: 37.2.34 32 * Changelog 37.2.34: Automatyczne odÅwieżanie opadów i zachmurzenia co minutÄ (nowcast partial). 33 * CACHE v37.2.34. 34 * Version: 37.2.33 35 * Changelog 37.2.31: Ujednolicenie timestampów i eliminacja skoku 70%->95% dla wszystkich 3 satelitów. 36 * CACHE v37.2.31. 37 * Changelog 37.2.21: Ujednolicenie progów sÅownika satelitarnego (>=70% duże zachmurzenie) z tabelÄ pasm aplikacji (WW_CLOUD_BANDS). 38 * CACHE v37.2.21. 39 * Changelog 37.2.20: PÅynne Åadowanie Hero (spinner na wejÅciu czÅowieka -> wÅaÅciwa ikona i opis po zakoÅczeniu analizy satelitarnej). 40 * CACHE v37.2.20. 41 * Changelog 37.2.19: Analiza i optymalizacja LCP (SSR hero bez opóźnienia spinnera) i weryfikacja Bodzanowa. 42 * CACHE v37.2.19. 43 * Changelog 37.2.18: Przywrócenie oryginalnego style.css (37.2.14) bez minifikacji style.css. 44 * CACHE v37.2.18. 45 * Changelog 37.2.14: Optymalizacja LCP, eliminacja opóźnienia renderowania 3400 ms na .weather-description, podÅoga zachmurzenia dla mżawki ze stratusa (Overcast) i spinner Åadowania. 46 * CACHE v37.2.14. 47 * Changelog 37.2.12: Poprawka spójnoÅci ikon deszcz/mżawka, eliminacja duplikacji zdania ruchu chmur oraz peÅne zdania w tÅumaczu GOES/Himawari. 48 * CACHE v37.2.12. 49 * Changelog 37.2.11: Poprawka oscylacji opadów i ruchomej osi czasu radaru (Chicago). 50 * CACHE v37.2.11. 51 * Changelog 37.2.10: Poprawka ikony i detekcji nocy (Sydney / warianty nocne w SSR bez przeskakiwania po Åadowaniu). 52 * CACHE v37.2.10. 53 * Changelog 37.2.9: Synchronizacja zachmurzenia SSR i satelity dla GOES-West/East/Himawari (eliminacja zmiany ikony po chwili). 54 * CACHE v37.2.9. 55 * Changelog 37.2.8: PÅynny i nieprzerwany spinner Hero (Pogoda Teraz) do momentu zaÅadowania wÅaÅciwej pogody. 56 * CACHE v37.2.8. 57 * Changelog 37.2.7: Przycisk odÅwieżania sekcji opadów w peÅni zsynchronizowany z menu gÅównym (peÅne odÅwieżenie danych). 58 * CACHE v37.2.7. 59 * Changelog 37.2.6: Poprawka Åadowania tÅumacza satelitarnego dla GOES/Himawari (NASA GIBS) oraz fallback do AWS. 60 * CACHE v37.2.6. 61 * Changelog 37.2.5: Ikony 5-dniówki ze sÅoÅcem i chmurÄ , próg zachmurzenia maÅego 30%, eliminacja przeskakiwania po spinnerze. 62 * CACHE v37.2.5. 63 * Changelog 37.2.4: ObsÅuga PNG Color Type 4 (MTG VIS) w dekoderze SSR, eliminacja faÅszywego zachmurzenia caÅkowitego na starcie. 64 * CACHE v37.2.4. 65 * Changelog 37.2.3: Poprawka inicjalizacji i Åadowania tÅumacza satelitarnego. 66 * CACHE v37.2.3. 67 * Changelog 37.2.2: PeÅna synchronizacja punktu +30 min miÄdzy wykresem a tÅumaczem satelitarnym (eliminacja rozbieżnoÅci 24% vs 61%). 68 * CACHE v37.2.2. 69 * Changelog 37.2.1: Synchronizacja wykresu zachmurzenia z tÅumaczem satelitarnym (eliminacja rozbieżnoÅci 20% vs 42%). 70 * CACHE v37.2.1. 71 * Changelog 37.2.0: Synchronizacja trendu satelity (+30 min vs ruch), spinner Åadowania w hero przy zmianie miasta, ikony sÅoneczno-opadowe (ww-partly-*-day) w prognozie 5-dniowej. 72 * CACHE v37.2.0. 73 * Changelog 37.1.0: Stabilizacja czasowa nowcastu (bezwzglÄdny timestamp UTC, anchorAgeSec), pogrubiony komunikat trendu (.weather-description-more font-weight 700). 74 * CACHE v37.1.0. 75 * Changelog 37.0.0: Percepcja wizualna chmur w dzieÅ (wszystkie satelity), przyspieszenie search (cache), fix GPS (fallbacks + reverse non-blocking), fix desync nazwa/pogoda. 76 * CACHE v37.0.0. 77 * Changelog 36.2.17: Filadelfia 18.09 â podÅoga IR dla chmur nie-cirrus. 78 * CACHE v36.2.17. 79 * Changelog 36.2.16: FIX ?_sat=1 GOES/Himawari (HTTP 500 od 36.1.0). 80 * CACHE v36.2.16.
81 * Changelog 36.2.15: NYC 18.09 â GOES dzien percepcyjnie (thick+0.8*thin). 82 * CACHE v36.2.15. 83 * Changelog 36.2.14: forced reflow â meteogram w podwójnym rAF, paski via RO. 84 * CACHE v36.2.14. 85 * Changelog 36.2.13: forced reflow â meteogram w rAF, tb-scrollable bez mutacji. 86 * CACHE v36.2.13. 87 * Changelog 36.2.12: bump wymuszajacy pobranie plikow (bez zmian logiki). 88 * CACHE v36.2.12. 89 * Changelog 36.2.11: app.min.js po pierwszym paintcie (preload+bootstrap). 90 * CACHE v36.2.11. 91 * Changelog 36.2.10: LCP â .temp-value bez mutacji przy tej samej wartoÅci. 92 * CACHE v36.2.10. 93 * Changelog 36.2.9: sat/radar start po load+idle, idle-sloty per sekcja. 94 * CACHE v36.2.9. 95 * Changelog 36.2.8: LCP-split opisu hero (.weather-description-more) 96 * + pierwsze renderAll chunkowane (idle). CACHE v36.2.8. 97 * Changelog 36.2.7: app.min.js (terser) + poprawki tekstów PL i strzaÅek. 98 * CACHE v36.2.7. 99 * Changelog 36.2.6: app.js 36.2.6 â percepcyjna wartoÅÄ zachmurzenia 100 * w dzieÅ (gruba chmura 100%, zasÅona 80%, CLM póŠgÅosu). CACHE v36.2.6. 101 * Changelog 36.2.5: app.js 36.2.5 â detekcja mgÅy wg palety EUMETSAT 102 * (koniec faÅszywych alarmów przy bezchmurnym niebie). CACHE v36.2.5. 103 * Changelog 36.2.4: app.js 36.2.4 â prognoza +30 min w tÅumaczu z serii 104 * cloudNow (ta sama liczba co wykres). CACHE v36.2.4. 105 * Changelog 36.2.3: app.js 36.2.3 â trend w tÅumaczu satelitarnym z serii 106 * cloudNow (spójny z hero i wykresem). CACHE v36.2.3. 107 * Changelog 36.2.2: app.js 36.2.2 â BT wierzchoÅków chmur w °C/°F z UstawieÅ; 108 * bez etykiety wersji przy tytule panelu Satelita. CACHE v36.2.2. 109 * Changelog 36.2.1: app.js 36.2.1 â jednostki z UstawieÅ dziaÅajÄ na caÅej 110 * stronie (hero, karty, tÅumacz satelitarny: km/h / mph / m/s oraz °C/°F). 111 * CACHE v36.2.1. 112 * Changelog 36.2.0: app.js 36.2.0 â panel sat bez ex_plain, strzalki w hero, 113 * biala temperatura Jutra (tylko strzalki kolorowe), ikona slonce-z-chmurka przy 114 * zachmurzeniu umiarkowanym, szerszy opis 5-dniowy, zakladki radaru bez (6h)/(24h), 115 * sat_sub i sat_trend_* w 62 jezykach. CACHE v36.2.0. 116 * Changelog 36.1.1: app.js 36.1.1 â FIX: tabela tlumaczen znikala po kliknieciu 117 * zakladki âzachmurzenieâ (ReferenceError WW_MSAT_VIS w module sat). CACHE v36.1.1. 118 * Changelog 36.1.0: app.js 36.1.0 â dzien: MAX(IR,VIS[,CLM]) na wszystkich 119 * geostacjonarnych (EUMETSAT/MTG/GOES/Himawari); tlumacz z pelnymi zdaniami 120 * i strzalka kierunku; tick minutowy = twarde F5. CACHE v36.1.0. 121 * Changelog 36.0.0: WIZUALNA PRAWDA DNIA (app.js 36.0.0) â dzien: pokrycie 122 * = MAX(CLM, VIS006, IR bramkowane) w kotwicy hero i tlumaczu; noc bez 123 * zmian. CACHE_VERSION -> v36.0.0 (wymusza odswiezenie app.js u klientow). 124 * Changelog 31.0.0: klatki z &TIME= sa niezmienne â cache 6 h zamiast 5 min 125 * (reszta bez zmian) â cache v31.0.0 126 * Changelog 30.1.0: zachmurzenie â kanaÅ widzialny VIS006 w dzieÅ 127 * (kalibracja METAR: MAE 25,4 -> 19,8 pp); te same hosty WMS, cache bez zmian 128 * â cache v30.1.0 129 * Changelog 30.0.2: historia opadów â rawIntensity, mostek Åladowy dla luk 130 * w mokrym epizodzie, surowy dowód w guardzie 26.0.5, skala osi od 0,5 mm/h 131 * â cache v30.0.2 132 * Changelog 30.0.1: nowa domyÅlna kolejnoÅÄ warstw mapy radarowej, Hub bez 133 * Maptilera, opis âPogoda teraz" bez typu âMgÅa lub niskie chmury", trend 134 * zachmurzenia wyÅÄ cznie z dwóch kolejnych kroków 10-minutowych â cache v30.0.1 135 * Changelog 30.0.0: MAPA RADAROWA â trzecia zakÅadka sekcji Prognozy opadów 136 * (obok opadów i zachmurzenia), wÅasny przestawialny pasek warstw 137 * imweather.com i przyciski OdÅwież / PeÅny ekran dla caÅej sekcji; +9 kluczy 138 * lang.php w 62 jÄzykach â cache v30.0.0 139 * Changelog 28.5.0: KOREKTA CIRRUSU (spread p5-p95 > 25 K / > 40 gray = 140 * bimodalne = cienki cirrus, nie mgÅa) + opisy typów chmur bez nazw 141 * rodzajów + i18n 62 jÄzyki + pre-seed kotwicy typu z SSR â cache v28.5.0 142 * Changelog 28.0.3: TERAZ+1 â app.js 28.0.3 (hero/minuta 0 = nowcast nastÄpnej minuty, WW_NOW_LEAD_MIN=1; stempel zamyka wartoÅÄ z osi) â cache v28.0.3 143 * Changelog 28.0.3: FIX F5 #2 â app.js 28.0.3 (fakty chmur ze stemplu âTERAZâ z cloudLive=1; wygÅadzanie ogona -12â¦-1 pomija je przed sprawÄ estimated) â cache v28.0.3 144 * Changelog 28.0.3: FIX F5 HISTORIA â app.js 28.0.3 (wykres zachmurzenia po F5 zachowuje nagrane minuty z ksiÄgi;
144 wygÅadzanie ogona -12â¦-1 tylko dla dopeÅnieÅ â) â cache v28.0.3 145 * Changelog 28.0.3: FRESH ON ENTRY â po wejÅciu ZAWSZE bieÅ¼Ä ca minuta (serwer: wejÅcie omija cache 75s now/nowcast + meta >=10s, hero <45s; klient: brama ÅwieżoÅci â hero/karta Teraz/karty minutowe/oba wykresy na spinnerze do pierwszego Åwieżego odczytu, cache klienta tylko z bieÅ¼Ä cej minuty) â cache v28.0.3 146 * Changelog 28.0.3: FIX LIBREWXR â natychmiast Åwieże po wejÅciu â WW_HTML 10s + hero 120s + pierwsze wejÅcie omija cache (hard kasuje cache + SW bypass _hard) â cache v28.0.3 (hard omija cache) â cache v28.0.3 147 * Changelog 26.0.7: FIX LIBREWXR â skutecznoÅÄ po wpisaniu miejscowoÅci (3 próby meta, 5000ms kafelki) â cache v28.0.3 148 * Changelog 26.0.6: DAILY ACCORDION â zamrożone karty 5-dniowe (delegacja) â cache v26.0.6 149 * Changelog 26.0.5: HISTORIA OPADÃW â suche ledger pozostaje suche (guard liveStamp 0.05â0.10) â cache v26.0.5 150 * Changelog 26.0.4: OSTRÃDA fix â Bezchmurnieâumiarkowane â cache v26.0.4 151 * Changelog 26.0.3: RESTORE 26.0.1 â rollback 26.0.2 â cache v26.0.3 152 * Changelog 26.0.1: SYNC fix â offset 20â60 + clamp heroâwykres â cache v26.0.1 153 * Changelog 26.0.0: BIAÅYSTOK fix â PHP define() + IR-only fallback, dekoder IR bez zmian â cache v26.0.0 154 * Changelog 25.0.4: ELIPSA METAR 30km + wiatr 850/700 + cache 100k â cache v25.0.4 155 * Changelog 25.0.3: Calp â cienkie chmury / jasne podÅoże fix (okno 25Ã25, p90 168, welona cap 62) â cache v25.0.3 156 * Changelog 25.0.3: AI SEKUNDOWE â 1s już uczy â cache v25.0.3 157 * Changelog 25.0.1: AI OFFLINE-LEARNING â 30d, shared 1 plik PHP, tydzieÅ/miesiÄ c â cache v25.0.1 158 * Changelog 25.0.0: AI BROWSER-ONLY â bez limitów/kluczy, tylko PHP, 159 * trenuje WYÅÄCZNIE LibreWXR (IR+radar) â tiny MLP per miasto w 160 * localStorage, korekta zachmurzenia ±18 pp i opadów 0.6-1.4Ã, 161 * trening online pending 10/30/60 min â real â cache v25.0.3. 162 * Changelog 24.9.5: FIX BARRIERA TERAZ â usuniÄty proximity boost 163 * (schodek -1â0), ciÄ gÅoÅÄ Teraz, index.htmlâindex.php â cache v24.9.5. 164 * Changelog 24.9.3: cache v24.9.3 â proximity boost w serii (sync Teraz = 165 * wykres), wygaszanie 15 min, brak duplikacji. 166 * app.js 24.9.3; index.php/template/style/sw bez zmian logiki. 167 * Changelog 24.9.2: cache v24.9.2 â ring sampling, gradient detection, 168 * directional probe, proximity boost w hero, 3 nowe klucze lang.php. 169 * app.js 24.9.2; index.php/template/style/sw bez zmian logiki. 170 * Changelog 24.9.1: cache v24.9.1 â srvCurve zawsze dostÄpne (opady ciÄ gÅe), 171 * cloud floor w hero (sync chmuryâopady), srvCurve fallback w timeline. 172 * app.js 24.9.1; index.php/template/style/sw bez zmian logiki. 173 * Changelog 24.5.2: cache v24.5.2 (przebudowany dekoder satelitarny 174 * frakcji pikseli w app.js/index.php + historia zachmurzenia z SSR 175 * (wwLibreNow.cloudSamples) i hold 150 min â wszystkie zasoby statyczne 176 * musza zostac pobrane ponownie, bo zmieniaja sie liczby, nie layout). 177 * Changelog 24.5.0: cache v24.5.0 â przesuwajÄ ca siÄ historia chmur, 178 * strzaÅka temperatury wg staÅego komfortu, astronomiczna pora roku 179 * z póÅkulÄ , karta âDziÅ" z reszty dnia, spinner zamiast âBrak danych" 180 * i oba przyciski âOdÅwież" jako F5. app.js, index.php, style.css 181 * i template.html musza zostac pobrane ponownie. lang.php BEZ ZMIAN. 182 * Changelog 24.0.2: nowy cache assetów po naprawie osi, chmur i kart. 183 * Start aplikacji: index.php. Historia i próbki v2 sÄ odrÄbne od SW. 184 * Changelog 24.0.1: cache v24.0.1 (CZYSTOSC ZRODLA + NIEZMIENNA HISTORIA â 185 * zachmurzenie/opady tylko z pomiaru LibreWxR, ksiega faktow w localStorage 186 * per miasto, przycisk Odswiez przy wykresie nowcastu; app.js, index.php, 187 * style.css i template.html musza zostac pobrane ponownie. lang.php BEZ ZMIAN.) 188 * Changelog 24.0.0: cache v24.0.0 (PASMA ZACHMURZENIA â nowe progi 189 * 0-10/11-30/31-60/61-85/86-100%, nowe opisy i ikony; app.js, index.php, 190 * lang.php, style.css i template.html musza zostac pobrane ponownie). 191 * Hotfix 19.0.1: cache v19.0.1 (companion app.js 19.0.1 â boot TDZ fix; 192 * bez zmian logiki SW). 193 194 * Changelog 19.5.1: cache v19.5.1 (przestawialne zakladki nowcastu, 195 * fix pustego wykresu zachmurzenia, strzalki w Poradniku dnia). 196 * Changelog 19.5.0: cache v19.5.0 (stabilny hero po F5 + wykres 197 * zachmurzenia; nowy app.js/style.css/template.html). 198 * Changelog 19.4.0: cache v19.4.0 (poprawki wykresu opadow i prognozy 199 * minutowej â nowy app.js musi zostac pobrany ponownie). 200 * Changelog 19.3.5: cache v19.3.5 (Mapa pogody nad Meteogramem â nowy 201 * template.html i app.js musza zostac pobrane ponownie). 202 * Changelog 19.3.2: cache v19.3.2 (komplet ikon mieszanych slonce+chmura+opad; 203 * NOWY icons-premium.svg musi zostac pobrany ponownie). 204 * Changelog 19.3.0: cache v19.3.0 (19.3.0: (1) Prognoza 5-dniowa â opis dnia sklada sie teraz z FAZ ("Bezchmurnie / Pochmurno / Deszcz"), kazdy stan raz, chronologicznie; opad zawsze widoczny, 3 h slonca juz nie znika. (2) Jaskrawsza czerwien: linia temperatury w meteogramie i "jutro gorzej" w Poradniku (#dc2626/#ef4444 -> #ff2d2d, wariant #e11d1d dla jasnego motywu). (3) Poradnik dnia PRZED prognoza 5-dniowa + dodany do menedzera ukladu.)
205 * Changelog 19.2.2: cache v19.2.2 (19.2.2: FIX â wykres opadow przepisywal HISTORIE przy kazdym auto-odswiezeniu. Minuty ujemne nie byly pamietane, tylko liczone od nowa przez ekstrapolacje pola adwekcyjnego (curvePast), a wektor ruchu zmienia sie co tick. Dodana ksiega przeszlosci: minuta raz miniona jest zapisywana pod absolutnym znacznikiem czasu i odtwarzana, nigdy przeliczana. Przyszlosc nadal sie aktualizuje.) 206 * Changelog 19.2.1: cache v19.2.1 (19.2.1: (1) Ikony 5-dniowe pokazuja SLONCE, gdy niebo jest pogodne â nowe symbole mieszane ww-partly-drizzle/rain/snow/thunder (dzien+noc) zamiast samej chmury z kropelkami. (2) Prog promocji opadu podniesiony: 35% szansy i 0,1 mm nie robi juz z pogodnego dnia "Mzawki". (3) FIX wwTipsSkyIsDry â 1001/1102 (pochmurno) bylo liczone jako "sucho niebo". Test na zywo: 10 miast x 5 dni, 0 rozjazdow.) 207 * Changelog 19.2.0: cache v19.2.0 (19.2.0: (1) FIX REGRESJI: karty pokazywaly "pada teraz" przy Bezchmurnie â Number(null)===0 dawalo true dla rainStartsIn=null (brak opadu). (2) Kazda karta Poradnika podaje RAMY CZASOWE: "teraz (do HH:MM)" albo "HH:MM-HH:MM". (3) FIX strzalek Dzis vs Jutro: identyczne wartosci = zawsze "-" (koniec czerwonej strzalki przy "komfortowo/komfortowo"). Nowe klucze i18n: tip_now, tip_until, tip_best_window (62 jezyki).) 208 * Changelog 19.1.3: cache v19.1.3 (19.1.3: (1) SYNC hero<->wykres: krzywa nowcastu probkowana co 1 min (bylo 5) i rainStartsIn/rainEndsIn liczone WPROST z osi minuteSeries, ktora rysuje slupki â k
208oniec "za 5 minut" obok mokrego slupka w 1. min. (2) icons-premium.svg 19.1.3: #ww-mostly-clear-night i #ww-cloudy-night rysowane wprost â koniec DWOCH Ksiezycow. (3) Poradnik dnia czyta RADAR (minutely), nie tylko model godzinowy: Mycie auta/Pranie/Obserwacja nieba nie moga byc zielone, gdy pada. Nowe klucze i18n tip_raining_now + tip_precip_in_min w 62 jezykach.) 209 * Changelog 19.1.2: cache v19.1.2 (companion app.js 19.1.2 â Poradnik dnia 210 * respektuje jednostki i format godziny z Ustawien glownych). 211 * 212 * Changelog 19.1.1: cache v19.1.1 (companion app.js/style.css/lang.php 19.1.1 â 213 * tabela "Dzis vs Jutro" ze strzalkami; fix ciaglosci wykresu w minucie 0). 214 * 215 * Changelog 19.1.0: cache v19.1.0 (companion app.js 19.1.0 â nowcast radarowy 216 * z adwekcji pola + rozbudowany kafelek "Dzis vs Jutro"; lang.php +50 kluczy). 217 * 218 * Changelog 19.0.2: cache v19.0.2 (companion app.js/style.css/template 19.0.2 â 219 * kafelek "Dzis vs jutro" zamiast "Wczoraj vs dzis" + fix "Obserwacja nieba"). 220 * 221 * Changelog 19.0.0: cache v19.0.0 (companion: app.js 19.0.0 Poradnik 222 * dnia + ETA, style.css 19.0.0, lang/index 19.0.0; bez zmian logiki SW). 223 224 * Changelog 18.3.1: cache v18.3.1 (companion: style.css 18.3.1 225 * â kaskada zakÅadek; bez zmian logiki SW). 226 227 * Changelog 18.3.0: cache v18.3.0 (companion: app.js 18.3.0 228 * + style.css 18.3.0; bez zmian logiki SW). 229 230 * Changelog 18.2.6: cache v18.2.6 (companion: app.js 18.2.6 231 * â paleta Viper HD na sÅupkach wykresu; bez zmian logiki SW). 232 233 * Changelog 18.2.5: cache v18.2.5 (companion: app.js 18.2.5 234 * â paleta kolorów sÅupków zgodna z mapÄ ; bez zmian logiki SW). 235 236 * Changelog 18.2.4: cache v18.2.4 (refresh â bez zmian 237 * logiki SW; wymusza odswiezenie assetow po 18.2.3). 238 239 * Changelog 18.2.3: cache v18.2.3 (companion: app.js 18.2.3; bez zmian logiki SW). 240 241 * Changelog 18.2.2: cache v18.2.2 (companion: app.js 18.2.2; bez zmian logiki SW). 242 243 * Changelog 18.2.1: cache v18.2.1 (companion: app.js 18.2.1; bez zmian logiki SW). 244 245 * Changelog 18.2.0: cache v18.2.0 (companion: app.js 18.2.0 â 246 * geokodowanie z przegladarek; bez zmian logiki SW). 247 248 * Changelog 18.1.0: cache v18.1.0 (companion: index.php 18.1.0 â 249 * CAMS bez limitu; bez zmian logiki SW). 250 251 252* 253 254C 255h 256a 257n 258g 259e 260l 261o 262g 263 2641 2658 266. 2670 268. 2693 270: 271 272c 273a 274c 275h 276e 277 278v 2791 2808 281. 2820 283. 2843 285 286( 287c 288o 289m 290p 291a 292n 293i 294o 295n 296: 297 298a 299p 300p 301. 302j 303s 304 3051 3068 307. 3080 309. 3103 311; 312 313b 314e 315z 316 317z 318m 319i 320a 321n 322 323l 324o 325g 326i 327k 328i 329 330S 331W 332) 333. 334 335 * Changelog 18.0.2: cache v18.0.2 (companion: app.js 18.0.2 + 336 * lang.php 18.0.2 + template 18.0.2; bez zmian logiki SW). 337 338 * Changelog 18.0.1: cache v18.0.1 (companion: app.js 18.0.1 â AQI 339 * jedna skala (US/EU), stabilna ramka Google; bez zmian logiki SW). 340 341 * Changelog 18.0.0: cache v18.0.0 (companion: app.js 18.0.0 + 342 * icons-premium.svg 18.0.0; bez zmian logiki SW). 343 344 * Changelog 17.7.4: cache v17.7.4 (companion: app.js 17.7.4 â sync 345 * âteraz" hero z wykresem radaru; bez zmian logiki SW). 346 * 347 * Changelog 17.7.3: cache v17.7.3 (companion: app.js 17.7.3 â guard 348 * lokalizacji w partialach po zmianie miasta; bez zmian logiki SW). 349 * 350 * Changelog 17.7.2: cache v17.7.2 (companion: app.js 17.7.2 â stabilnosc 351 * "Pogoda teraz" i historii radaru; bez zmian logiki SW). 352 * 353 * Changelog 17.7.1: cache v17.7.1 (companion: index.php 17.7.1 â karta 354 * "Dzis" z godzin od teraz; bez zmian logiki SW). 355 * 356 * Changelog 17.7.0: cache v17.7.0 (companion: app.js/index.php 17.7.0 â 357 * pole satelity 3Ã3 + 3 klatki + krzywa 0-60 min + watch 30 s; meta 358 * i kafelki pobierane wylacznie z przegladarek â SW bez zmian logiki). 359 * 360 * Changelog 17.6.1: cache v17.6.1 (companion: app.js/lang.php 17.6.1 â 361 * frazy trendu zachmurzenia w 62 jezykach z lang.php). 362 * 363 * Changelog 17.6.0: cache v17.6.0 (companion: app.js 17.6.0 â adwekcja 364 * chmur, blend zachmurzenia, trend; kafelki satelity cache-first jak 365 * dotad w IMAGE_CACHE â klatki godzinowe sa niezmienne). 366 * 367 * Changelog 17.5.0: cache v17.5.0 + BYPASS ?_librewxr_meta=1 (meta JSON 368 * wczesniej wpadal w stale-while-revalidate â zamrozone ramki radaru). 369 * Companion: app.js 17.5.0 (cache-buster 45 s na meta omija STARE SW). 370 * 371 * Changelog 17.4.8: cache v17.4.8 (companion: index.php/app.js/template.html 372 * 17.4.1). Asset list bez ?v= (klucz cache normalizowany do sciezki), wiec 373 * podbicie CACHE_VERSION wymusza odswiezenie wszystkich zasobow po SW update. 374 * 375 * Changelog 17.3.0: cache v17.3.0, asset ?v=17.3.0 (LibreWXR z przegladarki). 376 * 377 * Changelog 13.1.1: 378 * - CACHE_VERSION bumped to v13.0.3 (from v13.0.2) so any 379 * browser still holding a v13.0.2 cache is forced through 380 * the activate handler to drop the old entries and refetch 381 * the new index.php / template.html / app.js / time.php / 382 * lang.php / time_lang.php with the swapped-button and 383 * canonical-redirect fixes. 384 * 385 * Changelog 13.0.2: 386 * - CACHE_VERSION bumped to v13.0.2 (from v13.0.0) so any 387 * browser still holding a v13.0.0 cache is forced through 388 * the activate handler to drop the old entries and refetch 389 * the new template.html / style.css / app.js / index.php / 390 * lang.php / time.php / time_lang.php / icons-premium.svg. 391 * The 13.0.2 fix is the Weather/Time swap button now 392 * rendered server-side (visible on first paint) instead of 393 * being injected client-side from app.js (which left the 394 * toolbar without the toggle until JS ran). 395 * - Wersja: 13.0.0 â 13.0.2 (asset ?v=13.0.2, sprite key 396 * ww_sprite_v1715). 397 * 398 * Changelog 13.0.0: 399 * - CACHE_VERSION bumped to v13.0.0 (from v12.0.3) so any 400 * browser still holding a v12.0.3 cache is forced through 401 * the activate handler to drop the old entries and refetch 402 * the new template.html / style.css / app.js / index.php / 403 * lang.php / time.php / time_lang.php / icons-premium.svg. 404 * The 13.0.0 source adds the new time.php (premium current- 405 * time page) and time_lang.php (62-language time i18n), the 406 * Weather/Time swap button in the top bar, the analog 407 * clock + world clocks on the time page, and the shared
408 * GPS/favorites/settings state between the two pages. 409 * - Wersja: 12.0.3 â 13.0.0 (asset ?v=13.0.0, sprite key 410 * ww_sprite_v1300). 411 * 412 * Changelog 12.0.3: 413 * - CACHE_VERSION bumped to v12.0.2 (from v12.0.1) so any 414 * browser still holding a v12.0.1 cache is forced through 415 * the activate handler to drop the old entries and refetch 416 * the new template.html / style.css / app.js / index.php / 417 * lang.php / icons-premium.svg. The 12.0.2 source adds 418 * atmospheric refraction to the day-length formula in 419 * template.html (12.0.1 was ~3-6 min short at mid-lat). 420 * - Wersja: 12.0.1 â 12.0.2 (asset ?v=12.0.2, sprite key 421 * ww_sprite_v1202). 422 * 423 * Changelog 12.0.1: 424 * - CACHE_VERSION bumped to v12.0.1 (from v12.0.0) so any 425 * browser still holding a v12.0.0 cache is forced through 426 * the activate handler to drop the old entries and refetch 427 * the new template.html / style.css / app.js / index.php / 428 * lang.php / icons-premium.svg. The 12.0.1 source fixes 429 * the day-length factor in template.html. 430 * - Wersja: 12.0.0 â 12.0.1 (asset ?v=12.0.1, sprite key 431 * ww_sprite_v1201). 432 * 433 * Changelog 12.0.0: 434 * - ROLLBACK TO 10.3.3 + DAY-LENGTH CARDS. Struktura 435 * plików wróciÅa do 10.3.3. CACHE_VERSION bumped to 436 * v12.0.0 (z v10.3.3 w 10.3.3) â każda przeglÄ darka z 437 * 10.3.3 cache jest zmuszona przez activate handler do 438 * wyrzucenia starych wpisów i pobrania nowego 439 * template.html / style.css / app.js / index.php / 440 * lang.php / icons-premium.svg. SW routes bez zmian. 441 * 442 * Changelog 10.3.3: 443 * - Cache namespace bumped to v10.3.3 so browsers drop any cached 444 * 10.3.x copies of app.js/style.css and immediately render the 445 * index.php 10.3.3 fix: the current panel is now reconciled with 446 * the 1m nowcast (no more "bezchmurnie" hero next to a rain wall 447 * starting at +1 min on the minute chart). 448 * 449 * Changelog 10.3.2: 450 * - Cache namespace bumped to v10.3.2 (owner re-requested the 10.3.1 451 * FA iframe polish + same-instance shim fix as 10.3.2) so browsers 452 * drop any cached 10.3.x copies of app.js/style.css. 453 * 454 * Changelog 10.3.1: 455 * - Cache namespace bumped to v10.3.1 so browsers pick up the FA iframe 456 * attrs (scrolling no, 1500 px) and the index.php same-instance shim 457 * fix (region-aware GeoNames snap + per-page distance gate). 458 * 459 * Changelog 10.3.0: 460 * - Version renumber only (per owner request) â feature-identical to 461 * 10.2.7 r2. Cache namespace moved to v10.3.0 so browsers drop any 462 * cached 10.2.7/10.2.7r2 copies of app.js/style.css and pick up the 463 * renumbered assets (?v=10.3.0). 464 * 465 * Changelog 10.2.7: 466 * - Cache namespace bumped to v10.2.7 so browsers pick up the new 467 * ForecastAdvisor hub tab (same-origin ?_fa=1 shim URL, per-city 468 * resolution, °C/°F sync from Settings). 469 * - (r2) Namespace v10.2.7r2: ships the new ww-mostly-cloudy-day 470 * icon mapping for code 1102 ("Przeważnie pochmurno") â without it 471 * a stale cached app.js would keep showing the plain cloud. 472 * 473 * Changelog 10.1.5: 474 * - Cache namespace bumped to v10.1.5 so browsers pick up the HUB 475 * invisibility fix (app.js hubRevealFrames() + the map/hub flags 476 * finally separated). Without this bump a stale cached app.js could 477 * keep #hubFrames hidden forever â the exact bug being fixed. 478 * 479 * Changelog 10.1.4: 480 * - Cache namespace bumped to v10.1.4: refresh-button astro rebuild 481 * (once per city/day change), reliable HUB iframes, fullscreen 482 * Zamknij top bar, lowered below-horizon caption, smaller alerts 483 * source caption. 484 * 485 * Changelog 10.1.3: 486 * - Cache namespace bumped to v10.1.3 so browsers pick up the new 487 * app.js/style.css (meteogram plot-only drag + touch-action:pan-y, 488 * sunrise/sunset moments rows, dayline captions, wider Moon gap). 489 * 490 * Changelog 10.1.2: 491 * - Cache namespace bumped to v10.1.2 so browsers drop cached app.js 492 * 10.1.1 â delivers the fix that rebuilds the premium astro 493 * ribbon/moments immediately after a city search (stale 494 * Sunrise-Sunset.org data until F5 bug). 495 * 496 * Changelog 10.1.1: 497 * - Cache namespace bumped to v10.1.1 so browsers drop cached 498 * app.js/style.css 8.0.0 â delivers the grip-less layout (top-bar
499 * modal only), the dots-only dayline + ordered astro moments list, 500 * the fixed "Dni 6â15" extended label, the extra Moon gap and the 501 * normal-weight "below horizon" caption. 502 * 503 * Changelog 8.0.0 (version number per owner's spec): 504 * - Cache namespace bumped to v8.0.0 so browsers drop cached 505 * app.js/style.css 10.0.1 â delivers the premium polish pack 506 * (section-styled statistics, two-row dayline, frameless chips, 507 * consistent grips, drag snap-back, extended days 6â15). 508 * 509 * Changelog 10.0.1: 510 * - Cache namespace bumped to v10.0.1 so browsers drop cached app.js 511 * 10.0.0 â delivers the client-side premium astro fallback (chart 512 * renders even when the server cannot reach api.sunrise-sunset.org). 513 * 514 * Changelog 10.0.0: 515 * - Cache namespace bumped to v10.0.0 so browsers drop the 5.7.0 516 * copies of app.js / style.css (astro chart gate fix + section 517 * layout personalization). 518 * 519 * Changelog 5.7.0: 520 * - Cache namespace bumped to v5.7.0 so browsers drop the 5.6.5 copies 521 * of app.js / style.css (Sunrise-Sunset.org v2 astro card, restored 522 * amber Hub iframe tabs, reorder coachmark, hardened tab gestures). 523 * 524 * Changelog 5.6.5: 525 * - Cache namespace bumped to v5.6.5 so browsers drop the 5.6.4 copies 526 * of app.js / style.css (English language switch reload fix). 527 * 528 * Changelog 5.6.4: 529 * - Cache namespace bumped to v5.6.4 so browsers drop the 5.6.3 copies 530 * of app.js / style.css (extended-forecast retry + unified tabs). 531 * 532 * Changelog 5.6.3: 533 * - Cache namespace bumped to v5.6.3 so browsers drop the 5.6.2 copies 534 * of app.js / style.css (long-press reorder live-activation fix). 535 * 536 * Changelog 5.6.2: 537 * - Cache namespace bumped to v5.6.2 so browsers drop stale copies of 538 * app.js / style.css (tab-bar drag-scroll + long-press reorder, 539 * weather alerts fix). 540 * 541 * Changelog 5.6.1: 542 * - Cache namespace bumped to v5.6.1 so browsers drop stale copies of 543 * style.css / app.js / the old icons-addon-560.svg loader from 5.6.0. 544 * The sprite add-on file was merged into icons-premium.svg. 545 * 546 * Changelog 5.6.0: 547 * - Cache namespace bumped to v5.6.0 so browsers drop stale copies of 548 * style.css / app.js from before the fullscreen-bar, alerts-section, 549 * LibreWXR map tabs and 1100-icon changes. HTML pages are still never 550 * served from cache, so the new librewxr-map.html is always fresh. 551 * 552 * Key fix: 553 * - Previously SW used fetch(url.toString()) for bypass routes (_data/_ajax/etc), 554 * which DROPPED custom headers (e.g. X-WW-App: 1) -> backend rate-limit 429. 555 * - Now SW uses fetch(new Request(request, ...)) so headers are preserved. 556 * 557 * Goals: 558 * - NEVER serve HTML pages from cache 559 * - ALWAYS bypass cache for dynamic params: _force/_refresh/lat/lon/_ip/_src/_ajax/_data 560 * - Cache images 561 * - For critical static assets (style.css/app.js/manifest/sw): network-first + cache fallback, 562 * BUT cache key is normalized (ignores query string), so updates always apply. 563 */ 564 565// 34.1.5: translator wbudowany w app.js â brak osobnego Å¼Ä dania sat-translator.js + produkty L2 z AWS przez sat-l2.php (?_satl2=1) + proxy 566// obrazow WMS (?_satpx=1) + korekta opoznienia radaru (WW_RADAR_SCAN_LAG_MIN) 567// + opis "Pogoda teraz" bez "Welonu lodowego" i "Rozwoju burzowego". 568const CACHE_VERSION = 'v38.1.18'; // 38.1.18: Gate of Truth atomic hero reveal, night fog microphysics, split-window cirrus 569const STATIC_CACHE = `whatweather-static-${CACHE_VERSION}`; 570const IMAGE_CACHE = `whatweather-images-${CACHE_VERSION}`; 571const LIBREWXR_CACHE = `whatweather-librewxr-${CACHE_VERSION}`; // 28.0.5 multi-sat 5min (EUMETSAT/GOES/Himawari + LibreWXR) 572 573const BASE_PATH = ''; 574 575// Keep precache minimal and WITHOUT query-strings (so it never goes stale) 576const STATIC_ASSETS = [ 577 `${BASE_PATH}/manifest.json`, 578]; 579 580const CRITICAL_PATHS = new Set([ 581 `${BASE_PATH}/style.css`, 582 `${BASE_PATH}/app.js`, 583 `${BASE_PATH}/manifest.json`, 584 `${BASE_PATH}/sw.js`, 585]); 586 587function isBypassRequest(url) { 588 return ( 589 // 38.0.0: api.php endpoint kontaktu â nigdy z cache SW 590 url.pathname.endsWith('/contact.php') || url.pathname.endsWith('/api.php') || 591 url.searchParams.has('action') || 592 // 17.5.0: meta LibreWXR tozywy JSON API â NIGDY z cache SW 593 // (stale-while-revalidate zamrazal ramki radaru do F5). 594 // 28.0.3: _hard=1 to twardy refresh â nigdy z cache SW (wykres zawsze swiezy) 595 url.searchParams.has('_librewxr_meta') || 596 url.searchParams.has('_hard') || 597 url.searchParams.has('_force') || 598 url.searchParams.has('_refresh') || 599 url.searchParams.has('lat') || 600 url.searchParams.has('lon') || 601 url.searchParams.has('_ip') || 602 url.searchParams.has('_src') || 603 url.searchParams.has('_ajax') || 604 url.searchParams.has('_data') 605 ); 606} 607 608function isInScope(url) { 609 return url.pathname === BASE_PATH || url.pathname.startsWith(`${BASE_PATH}/`); 610} 611 612/** Normalize cache key: ignore query string completely */ 613function normalizedKey(url) { 614 // store under pathname only (no ?v=...)
615 return new Request(url.origin + url.pathname, { method: 'GET' }); 616} 617 618function noStoreRequest(originalRequest) { 619 // IMPORTANT: this preserves headers (e.g. X-WW-App) unlike fetch(url.toString()) 620 return new Request(originalRequest, { cache: 'no-store' }); 621} 622 623self.addEventListener('install', (event) => { 624 event.waitUntil((async () => { 625 const cache = await caches.open(STATIC_CACHE); 626 try { 627 await cache.addAll(STATIC_ASSETS); 628 } catch (e) { 629 // don't fail install 630 } 631 await self.skipWaiting(); 632 })()); 633}); 634 635self.addEventListener('activate', (event) => { 636 event.waitUntil((async () => { 637 const keys = await caches.keys(); 638 await Promise.all( 639 keys 640 .filter((k) => k.startsWith('whatweather-') && k !== STATIC_CACHE && k !== IMAGE_CACHE) 641 .map((k) => caches.delete(k)) 642 ); 643 await self.clients.claim(); 644 })()); 645}); 646 647self.addEventListener('message', (event) => { 648 if (event?.data === 'SKIP_WAITING') self.skipWaiting(); 649}); 650 651self.addEventListener('fetch', (event) => { 652 const { request } = event; 653 if (!request || request.method !== 'GET') return; 654 655 let url; 656 try { url = new URL(request.url); } catch { return; } 657 658 if (!url.protocol.startsWith('http')) return; 659 // 28.0.5 MULTI-SAT: cross-origin WMS (EUMETSAT / GIBS) + kafelki LibreWXR â 660 // obslugiwane PRZED bramka same-origin. Cache 5 min zdejmuje ruch z EUMETSAT, 661 // ktory limituje 20 zapytan/s i 8 rownoleglych na uzytkownika. 662 if (url.hostname === 'api.librewxr.net' || url.hostname === 'view.eumetsat.int' || url.hostname.endsWith('earthdata.nasa.gov') || url.hostname === 'gibs.earthdata.nasa.gov' || url.hostname === 'map1.vis.earthdata.nasa.gov') { 663 event.respondWith(handleLibreWxr(request)); 664 return; 665 } 666 if (url.origin !== self.location.origin) return; 667 if (!isInScope(url)) return; 668 669 // Bypass anything dynamic / refresh / data mode 670 // FIX: use original request to preserve headers (X-WW-App etc.) 671 if (isBypassRequest(url)) { 672 event.respondWith(fetch(noStoreRequest(request))); 673 return; 674 } 675 676 const dest = request.destination; // 'document', 'style', 'script', 'image', ... 677 const accept = request.headers.get('Accept') || ''; 678 679 // NEVER cache/serve HTML from cache 680 // (Tu dokÅadnie blok, o który prosisz) 681 if (request.mode === 'navigate' || dest === 'document' || accept.includes('text/html')) { 682 event.respondWith( 683 fetch(noStoreRequest(request)).catch(async () => { 684 try { 685 return await fetch(request); 686 } catch (e) { 687 throw e; 688 } 689 }) 690 ); 691 return; 692 } 693 694 // 28.0.3 MULTI-SAT handled above (cross-origin) â same-origin path continues 695 // Images: cache-first 696 if (dest === 'image' || accept.includes('image') || /\.(png|jpg|jpeg|gif|webp|svg|ico)$/i.test(url.pathname)) { 697 event.respondWith(handleImage(request)); 698 return; 699 } 700 701 // DEV/SAFE MODE: never cache CSS/JS (always take from network) 702 if (dest === 'style' || dest === 'script') { 703 event.respondWith(fetch(noStoreRequest(request))); 704 return; 705 } 706 707 // Critical assets: network-first + cache fallback, cache key ignores query (?v=...) 708 if (CRITICAL_PATHS.has(url.pathname)) { 709 event.respondWith(handleCriticalStatic(url)); 710 return; 711 } 712 713 // Other static: stale-while-revalidate 714 event.respondWith(handleStatic(request)); 715}); 716 717async function handleCriticalStatic(url) { 718 const cache = await caches.open(STATIC_CACHE); 719 const key = normalizedKey(url); 720 721 try { 722 // 'reload' is important: it forces revalidation better than default in some browsers 723 const res = await fetch(url.toString(), { cache: 'reload' }); 724 if (res && res.ok) await cache.put(key, res.clone()); 725 return res; 726 } catch (e) { 727 const cached = await cache.match(key); 728 return cached || new Response('Offline', { status: 503, headers: { 'Content-Type': 'text/plain' } }); 729 } 730} 731 732async function handleStatic(request) { 733 const cache = await caches.open(STATIC_CACHE); 734 const cached = await cache.match(request); 735 736 const netPromise = fetch(request) 737 .then(async (res) => { 738 if (res && res.ok) await cache.put(request, res.clone()); 739 return res; 740 }) 741 .catch(() => null); 742 743 if (cached) return cached; 744 745 const net = await netPromise; 746 return net || new Response('Not found', { status: 404, headers: { 'Content-Type': 'text/plain' } }); 747} 748 749async function handleLibreWxr(request) { 750 // 34.1.5: wczeÅniej używano niezdefiniowanej zmiennej `url`, co mogÅo 751 // przerwaÄ obsÅugÄ klatki i zostawiÄ stronÄ przy starym zasobie. 752 const url = new URL(request.url); 753 const cache = await caches.open(LIBREWXR_CACHE); 754 const cached = await cache.match(request); 755 if (cached) { 756 const age = Date.now() - new Date(cached.headers.get('date')||0).getTime(); 757 // 31.0.0: URL z TIME= to KONKRETNA klatka â po publikacji jest niezmienna, 758 // wiec moze zyc w cache 6 h zamiast 5 min. Bez TIME= zostaje 5 min. 759 const slotUrl = url.searchParams && url.searchParams.has('TIME'); 760 if (age < (slotUrl ? 21600000 : 300000)) return cached; 761 } 762 try { 763 const res = await fetch(request); 764 if (res && res.ok) await cache.put(request, res.clone()); 765 return res; 766 } catch (e) { 767 return cached || new Response('', { status: 404 }); 768 } 769} 770async function handleImage(request) { 771 const cache = await caches.open(IMAGE_CACHE); 772 const cached = await cache.match(request); 773 if (cached) return cached; 774 775 try { 776 const res = await fetch(request); 777 if (res && res.ok) await cache.put(request, res.clone()); 778 return res; 779 } catch (e) { 780 return new Response('', { status: 404 }); 781 } 782}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.