p='modele.html'; s=open(p,encoding='utf-8').read() def sub(a,b): global s assert s.count(a)==1, a[:60]; s=s.replace(a,b) # ---- pied de page sombre, avec contact et SIRET comme sur gastinel.me ---- i=s.index('',i)+9 s=s[:i]+''''''+s[j:] a=s.index('.pied{max-width:1080px'); b=s.index('.pied a{color:var(--sapin)}')+len('.pied a{color:var(--sapin)}') s=s[:a]+""".pied{background:#303336;color:#d1d3d6;padding:34px 28px 22px;font-size:13px;line-height:1.7;border-top:4px solid #1c1d1f} .pied-grille{max-width:1080px;margin:0 auto;display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:34px} .pied p{margin:6px 0} .pied h4{margin:0 0 8px;font-family:var(--texte);font-size:11.5px;font-weight:600;letter-spacing:.12em;text-transform:uppercase;color:#fff;border-bottom:1px solid #4a4d51;padding-bottom:7px} .pied ul{list-style:none;margin:0;padding:0} .pied .accroche{font-family:var(--titre);font-style:italic;font-size:17px;color:#fff} .pied a{color:#b9c2cc;text-decoration:none;font-weight:500} .pied a:hover{color:#fff;text-decoration:underline} .pied-bas{max-width:1080px;margin:26px auto 0!important;padding-top:14px;border-top:1px solid #45484c;font-size:12px;color:#8e9298}"""+s[b:] sub(" .pied{padding:18px 16px 36px}"," .pied{padding:26px 16px 30px}\n .pied-grille{grid-template-columns:1fr;gap:22px}") # ---- mise en avant (record) : saisonnière, réglable ---- a=s.index("function phraseDuJour(){"); b=s.index("\n}\n",a)+3 s=s[:a]+"""let RECORD = 'auto'; try { RECORD = localStorage.getItem('vm-record') || 'auto'; } catch (e) {} // saisons météorologiques : hiver = décembre à février, été = juin à août function saisonMeteo(){ const m = parseInt(new Intl.DateTimeFormat('fr-FR', {month: 'numeric', timeZone: 'Europe/Paris'}).format(new Date()), 10); return m === 12 || m <= 2 ? 'hiver' : m >= 6 && m <= 8 ? 'ete' : 'entre'; } function phraseDuJour(){ const toutes = Object.values(STATIONS), reelles = toutes.filter(x => x.t != null); if (!reelles.length) { document.getElementById('phrase').textContent = 'Relevés en cours de chargement…'; document.getElementById('reseau').textContent = `${toutes.length} stations dans le massif`; return; } const l = [...reelles].sort((a, b) => a.t - b.t), f = l[0], c = l[l.length - 1], deg = t => fmt(t).replace('°', ' °C'); const sais = saisonMeteo(), mode = RECORD !== 'auto' ? RECORD : sais === 'hiver' ? 'froid' : sais === 'ete' ? 'chaud' : 'ecart'; const mom = MOMENT(heureParis()); let s; if (mode === 'chaud') s = `${mom}, ${deg(c.t)} à ${court(c.nom)}, le point le plus chaud du massif en ce moment.`; else if (mode === 'ecart') s = `${mom}, de ${deg(f.t)} à ${court(f.nom)} à ${deg(c.t)} à ${court(c.nom)} : le plus froid et le plus chaud du massif.`; else if (mode === 'vent') { const v = toutes.filter(x => x.vent != null && capteur(Object.keys(STATIONS).find(k => STATIONS[k] === x), 'vent')).sort((a, b) => b.vent - a.vent)[0]; s = v ? `${mom}, ${Math.round(v.vent)} km/h à ${court(v.nom)}, le vent moyen le plus fort du massif.` : `${mom}, aucun vent mesuré pour l'instant.`; } else if (mode === 'pluie') { const r = toutes.filter(x => x.pluie != null && x.pluie > 0).sort((a, b) => b.pluie - a.pluie)[0]; s = r ? `${mom}, ${nb1(r.pluie)} mm en une heure à ${court(r.nom)}, la pluie la plus forte du massif.` : `${mom}, pas de pluie mesurée dans le massif.`; } else { s = `${mom}, ${deg(f.t)} à ${court(f.nom)}, le point le plus froid du massif en ce moment.`; const h = l.filter(x => x.alt - f.alt >= 300 && x.t - f.t >= 3).sort((a, b) => b.alt - a.alt)[0]; if (h) s += ` ${h.alt - f.alt} m plus haut, ${court(h.nom)} : ${deg(h.t)}. L'air froid est resté au fond.`; } document.getElementById('phrase').innerHTML = s; document.getElementById('reseau').textContent = `${reelles.length} stations en direct sur ${toutes.length} · Météo-France, Infoclimat, station Gastinel`; } """+s[b:] sub('\n

','''

''') sub(".compte{margin:10px 0 0;",".record{flex:0 0 100%;font-size:11.5px;color:var(--gris)}\n.record select{font:inherit;font-size:11.5px;color:var(--sapin);background:#fff;border:1px solid var(--pierre);border-radius:0;padding:3px 4px;margin-left:4px}\n.compte{margin:10px 0 0;") sub("['rech', 'modes'].forEach(","""const selRecord = document.getElementById('record'); selRecord.value = RECORD; selRecord.addEventListener('change', () => { RECORD = selRecord.value; try { localStorage.setItem('vm-record', RECORD); } catch (e) {} phraseDuJour(); }); ['rech', 'modes'].forEach(""") sub("if (ev.target.closest('a, button, input, .rech') || carte.clientWidth >= 720) return;","if (ev.target.closest('a, button, input, select, label, .rech') || carte.clientWidth >= 720) return;") open(p,'w',encoding='utf-8').write(s)