Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
313 lignes
18 KiB
JavaScript
313 lignes
18 KiB
JavaScript
'use strict';
|
||
const $ = (s) => document.querySelector(s);
|
||
const el = (t, c, txt) => { const e = document.createElement(t); if (c) e.className = c; if (txt != null) e.textContent = txt; return e; };
|
||
const num = (v) => (v === null || v === undefined || v === '' || isNaN(+v)) ? null : +v;
|
||
const fmt = (v, u, d = 1) => v === null ? '—' : v.toFixed(d).replace('.', ',') + (u ? ' ' + u : '');
|
||
const utc = (s) => new Date(s.replace(' ', 'T') + 'Z');
|
||
const heure = (d) => d.toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' });
|
||
const age = (m) => m < 60 ? m + ' min' : Math.floor(m / 60) + ' h ' + String(m % 60).padStart(2, '0');
|
||
const POINTS = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSO', 'SO', 'OSO', 'O', 'ONO', 'NO', 'NNO'];
|
||
const cardinal = (d) => POINTS[Math.round(d / 22.5) % 16];
|
||
|
||
const couleurT = () => 'var(--texte)';
|
||
|
||
const SEUIL_HORS_MIN = 90;
|
||
let donnees = null, tri = 'altitude', couche = 'temperature', choisie = null, carte = null, marqueurs = {}, cadrage = false;
|
||
|
||
function stations() {
|
||
if (!donnees) return [];
|
||
return Object.entries(donnees.stations).map(([id, s]) => {
|
||
const meta = (donnees.metadonnees || {})[id] || {};
|
||
const rel = s.releves || [];
|
||
const der = rel[rel.length - 1] || {};
|
||
// valeur d'il y a environ 1 h pour la tendance
|
||
let avant = null;
|
||
if (der.dh_utc) {
|
||
const cible = utc(der.dh_utc) - 3600e3;
|
||
for (const r of rel) if (utc(r.dh_utc) <= cible) avant = r;
|
||
}
|
||
const hors = !der.dh_utc || s.hors_ligne === true || (Date.now() - utc(der.dh_utc)) > SEUIL_HORS_MIN * 60000;
|
||
return { id, nom: s.nom, meta, rel, der, avant, hors, exemple: s.exemple === true, source: s.source || '', t: hors ? null : num(der.temperature) };
|
||
});
|
||
}
|
||
|
||
function valeurCouche(s) {
|
||
if (s.hors) return null;
|
||
const d = s.der;
|
||
switch (couche) {
|
||
case 'vent': { const v = num(d.vent_moyen); return v === null ? null : fmt(v, '', 0) + (num(d.vent_direction) !== null ? ' ' + cardinal(+d.vent_direction) : ''); }
|
||
case 'humidite': { const v = num(d.humidite); return v === null ? null : fmt(v, '%', 0); }
|
||
case 'pluie': { const v = num(d.pluie_cumul_0h); return v === null ? null : fmt(v, 'mm', 1); }
|
||
case 'pression': { const v = num(d.pression); return v === null ? null : fmt(v, '', 0); }
|
||
default: return s.t === null ? null : fmt(s.t, '°', 1);
|
||
}
|
||
}
|
||
|
||
function initCarte() {
|
||
carte = L.map('carte', { zoomControl: false, attributionControl: true }).setView([45.05, 5.5], 9);
|
||
const plan = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 18, attribution: '© OpenStreetMap' });
|
||
const relief = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', { maxZoom: 16, attribution: '© OpenStreetMap, © OpenTopoMap' });
|
||
relief.addTo(carte);
|
||
L.control.layers({ 'Relief': relief, 'Plan': plan }, null, { position: 'topright' }).addTo(carte);
|
||
L.control.zoom({ position: 'bottomright' }).addTo(carte);
|
||
}
|
||
|
||
function majCarte(liste) {
|
||
for (const s of liste) {
|
||
if (s.meta.lat == null || s.meta.lon == null) continue;
|
||
const v = valeurCouche(s);
|
||
const b = el('span', 'bulle' + (s.id === choisie ? ' choisie' : ''), v === null ? '—' : v);
|
||
if (s.hors) b.classList.add('hors');
|
||
b.title = s.nom;
|
||
const icone = L.divIcon({ className: '', html: b.outerHTML, iconSize: null });
|
||
if (marqueurs[s.id]) marqueurs[s.id].setIcon(icone);
|
||
else {
|
||
marqueurs[s.id] = L.marker([s.meta.lat, s.meta.lon], { icon: icone, title: s.nom, riseOnHover: true })
|
||
.on('click', () => ouvrir(s.id)).addTo(carte);
|
||
}
|
||
}
|
||
if (!cadrage) {
|
||
const pts = liste.filter((s) => s.meta.lat != null).map((s) => [s.meta.lat, s.meta.lon]);
|
||
if (pts.length) { carte.fitBounds(pts, { padding: [30, 30] }); cadrage = true; }
|
||
}
|
||
}
|
||
|
||
function majResume(liste) {
|
||
const r = $('#resume'); r.replaceChildren();
|
||
const avecT = liste.filter((s) => !s.hors && s.t !== null);
|
||
if (!avecT.length) return;
|
||
const chaud = avecT.reduce((a, b) => (b.t > a.t ? b : a)), froid = avecT.reduce((a, b) => (b.t < a.t ? b : a));
|
||
const vents = liste.filter((s) => !s.hors).filter((s) => num(s.der.vent_rafales) !== null || num(s.der.vent_moyen) !== null);
|
||
const fort = vents.length ? vents.reduce((a, b) => ((num(b.der.vent_rafales) ?? num(b.der.vent_moyen)) > (num(a.der.vent_rafales) ?? num(a.der.vent_moyen)) ? b : a)) : null;
|
||
const bloc = (val, lib, coul) => { const d = el('div'); const b = el('b', null, val); if (coul) b.style.color = coul; d.append(b, el('span', null, lib)); return d; };
|
||
r.append(bloc(fmt(chaud.t, '°C'), 'Plus chaud · ' + court(chaud.nom), couleurT(chaud.t)),
|
||
bloc(fmt(froid.t, '°C'), 'Plus froid · ' + court(froid.nom), couleurT(froid.t)),
|
||
fort ? bloc(fmt(num(fort.der.vent_rafales) ?? num(fort.der.vent_moyen), 'km/h', 0), 'Vent max · ' + court(fort.nom)) : bloc('—', 'Vent'));
|
||
}
|
||
const court = (n) => n.replace(/^Lans-en-Vercors – /, '').replace(/^La Chapelle-en-Vercors – /, '').replace(/^Combe de /, '').replace(/^Crête de la /, '');
|
||
|
||
function tendance(s) {
|
||
const a = num(s.avant && s.avant.temperature);
|
||
if (s.t === null || a === null) return '';
|
||
const d = s.t - a;
|
||
return Math.abs(d) < 0.3 ? '→' : d > 0 ? '↗' : '↘';
|
||
}
|
||
|
||
function majListe(liste) {
|
||
const tries = [...liste].sort((a, b) => tri === 'nom' ? a.nom.localeCompare(b.nom, 'fr')
|
||
: tri === 'temperature' ? (b.t ?? -99) - (a.t ?? -99) : (b.meta.altitude ?? 0) - (a.meta.altitude ?? 0));
|
||
const ul = $('#liste');
|
||
ul.replaceChildren(...tries.map((s) => {
|
||
const li = el('li', 'ligne' + (s.id === choisie ? ' choisie' : '') + (s.hors ? ' hors' : ''));
|
||
li.tabIndex = 0; li.setAttribute('role', 'button');
|
||
li.style.setProperty('--c', couleurT(s.t));
|
||
const t = el('div', 't', s.hors ? 'Hors ligne' : fmt(s.t, '°', 1));
|
||
const tend = tendance(s); if (tend) t.append(el('span', 'tendance', tend));
|
||
const d = el('div', 'd');
|
||
const h = s.hors ? null : num(s.der.humidite), v = s.hors ? null : num(s.der.vent_moyen), p = s.hors ? null : num(s.der.pluie_cumul_0h);
|
||
if (h !== null) d.append(el('span', null, 'Humidité ' + fmt(h, '%', 0)));
|
||
if (v !== null) d.append(el('span', null, 'Vent ' + fmt(v, 'km/h', 0) + (num(s.der.vent_direction) !== null ? ' ' + cardinal(+s.der.vent_direction) : '')));
|
||
if (p !== null && p > 0) d.append(el('span', null, 'Pluie ' + fmt(p, 'mm', 1)));
|
||
const mn = s.hors ? null : num(s.der.temperature_min), mx = s.hors ? null : num(s.der.temperature_max);
|
||
if (mn !== null && mx !== null) d.append(el('span', null, '↓' + fmt(mn, '', 1) + ' ↑' + fmt(mx, '', 1)));
|
||
let m = el('div', 'm vieux', 'pas de relevé');
|
||
if (s.der.dh_utc) { const min = Math.round((Date.now() - utc(s.der.dh_utc)) / 60000); m = el('div', 'm' + (min > 30 ? ' vieux' : ''), (s.exemple ? 'exemple · ' : '') + 'il y a ' + age(min)); }
|
||
const nom = el('div', 'n', s.nom); if (s.exemple) nom.append(el('span', 'etiquette', 'exemple'));
|
||
li.append(t, nom, el('div', 'a', s.meta.altitude != null ? s.meta.altitude + ' m' : ''), d, m);
|
||
li.addEventListener('click', () => ouvrir(s.id));
|
||
li.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); ouvrir(s.id); } });
|
||
return li;
|
||
}));
|
||
}
|
||
|
||
// ---- Graphique SVG détaillé avec axes ----
|
||
function graphe(titre, rel, champ, unite, opts = {}) {
|
||
const NS = 'http://www.w3.org/2000/svg';
|
||
const fin = Date.now(), debut = fin - 24 * 3600e3;
|
||
const pts = rel.map((r) => [utc(r.dh_utc).getTime(), num(r[champ])]).filter((p) => p[1] !== null && p[0] >= debut);
|
||
if (pts.length < 2) return null;
|
||
const box = el('div', 'graphe');
|
||
const vals = pts.map((p) => p[1]);
|
||
let mn = Math.min(...vals), mx = Math.max(...vals);
|
||
if (opts.zero) mn = Math.min(0, mn);
|
||
if (opts.zero && mx - mn < (opts.ecartMin || 1)) mx = mn + (opts.ecartMin || 1);
|
||
else if (mx - mn < (opts.ecartMin || 1)) { const c = (mx + mn) / 2, e = (opts.ecartMin || 1) / 2; mn = c - e; mx = c + e; }
|
||
const h3 = el('h3', null, titre);
|
||
h3.append(el('em', null, 'min ' + fmt(Math.min(...vals), unite, opts.dec ?? 1) + ' · max ' + fmt(Math.max(...vals), unite, opts.dec ?? 1)));
|
||
box.append(h3);
|
||
const W = 320, H = 120, G = 30, B = 16;
|
||
const x = (t) => G + ((t - debut) / (fin - debut)) * (W - G - 4), y = (v) => 6 + (1 - (v - mn) / (mx - mn)) * (H - B - 6);
|
||
const svg = document.createElementNS(NS, 'svg'); svg.setAttribute('viewBox', `0 0 ${W} ${H}`); svg.setAttribute('role', 'img');
|
||
svg.setAttribute('aria-label', titre + ' sur 24 h');
|
||
const mk = (t, a) => { const n = document.createElementNS(NS, t); for (const k in a) n.setAttribute(k, a[k]); svg.append(n); return n; };
|
||
for (let i = 0; i <= 3; i++) {
|
||
const v = mn + (mx - mn) * i / 3, yy = y(v);
|
||
mk('line', { x1: G, x2: W - 4, y1: yy, y2: yy, class: 'grille' });
|
||
mk('text', { x: G - 4, y: yy + 3, 'text-anchor': 'end' }).textContent = fmt(v, '', opts.dec ?? (mx - mn < 5 ? 1 : 0));
|
||
}
|
||
for (let hh = 0; hh <= 24; hh += 6) {
|
||
const t = debut + hh * 3600e3;
|
||
mk('text', { x: x(t), y: H - 2, 'text-anchor': hh === 0 ? 'start' : hh === 24 ? 'end' : 'middle' }).textContent = heure(new Date(t)).replace(':00', 'h');
|
||
}
|
||
const coul = opts.couleur || 'var(--accent)';
|
||
if (opts.barres) {
|
||
const bw = Math.max(2, (W - G) / 150);
|
||
for (const p of pts) if (p[1] > 0) mk('rect', { x: x(p[0]) - bw / 2, y: y(p[1]), width: bw, height: y(mn) - y(p[1]), fill: coul, opacity: .8 });
|
||
} else {
|
||
const d = pts.map((q, i) => (i ? 'L' : 'M') + x(q[0]).toFixed(1) + ' ' + y(q[1]).toFixed(1)).join(' ');
|
||
if (opts.aire) mk('path', { d: d + ` L${x(pts[pts.length - 1][0]).toFixed(1)} ${y(mn)} L${x(pts[0][0]).toFixed(1)} ${y(mn)} Z`, fill: coul, opacity: .12 });
|
||
mk('path', { d, fill: 'none', stroke: coul, 'stroke-width': 2, 'stroke-linejoin': 'round' });
|
||
const dern = pts[pts.length - 1]; mk('circle', { cx: x(dern[0]), cy: y(dern[1]), r: 3.5, fill: coul });
|
||
}
|
||
if (opts.serie2) {
|
||
const p2 = rel.map((r) => [utc(r.dh_utc).getTime(), num(r[opts.serie2])]).filter((p) => p[1] !== null && p[0] >= debut);
|
||
if (p2.length > 1) mk('path', { d: p2.map((q, i) => (i ? 'L' : 'M') + x(q[0]).toFixed(1) + ' ' + y(Math.min(Math.max(q[1], mn), mx)).toFixed(1)).join(' '), fill: 'none', stroke: coul, 'stroke-width': 1.2, 'stroke-dasharray': '3 3', opacity: .7 });
|
||
}
|
||
box.append(svg);
|
||
return box;
|
||
}
|
||
|
||
function boussole(dir) {
|
||
const NS = 'http://www.w3.org/2000/svg';
|
||
const s = document.createElementNS(NS, 'svg'); s.setAttribute('viewBox', '-12 -12 24 24'); s.setAttribute('class', 'boussole'); s.setAttribute('aria-hidden', 'true');
|
||
const c = document.createElementNS(NS, 'circle'); c.setAttribute('r', 11); c.setAttribute('fill', 'none'); c.setAttribute('stroke', 'currentColor'); c.setAttribute('opacity', '.3');
|
||
const p = document.createElementNS(NS, 'path'); p.setAttribute('d', 'M0 9 L-4 -5 L0 -2 L4 -5 Z'); p.setAttribute('fill', 'var(--accent)');
|
||
p.setAttribute('transform', 'rotate(' + dir + ')');
|
||
s.append(c, p); return s;
|
||
}
|
||
|
||
function remplirFiche(s) {
|
||
const f = $('#fiche'); f.replaceChildren();
|
||
const d = s.der;
|
||
f.append(el('div', 'poignee'));
|
||
const tete = el('div', 'fiche-tete');
|
||
const ti = el('div'); const h2 = el('h2', null, s.nom); h2.id = 'fiche-nom';
|
||
let sous = (s.meta.altitude != null ? s.meta.altitude + ' m' : '');
|
||
if (d.dh_utc) { const q = utc(d.dh_utc); sous += ' · relevé de ' + heure(q) + ' (il y a ' + age(Math.round((Date.now() - q) / 60000)) + ')'; }
|
||
ti.append(h2, el('small', null, sous));
|
||
const fx = el('button', 'fermer', '×'); fx.type = 'button'; fx.setAttribute('aria-label', 'Fermer'); fx.onclick = fermer;
|
||
tete.append(ti, fx); f.append(tete);
|
||
|
||
if (s.hors) f.append(el('p', 'horsligne', 'Station hors ligne. Dernier relevé connu : ' + (d.dh_utc ? heure(utc(d.dh_utc)) + ' le ' + utc(d.dh_utc).toLocaleDateString('fr-FR') : 'aucun') + ". Il n'est pas affiché comme valeur actuelle."));
|
||
if (s.exemple) f.append(el('p', 'horsligne', "Données d'exemple, pas de mesure réelle."));
|
||
const gros = el('div', 'gros');
|
||
gros.append(el('div', 't', s.hors ? '—' : fmt(s.t, '°C', 1)));
|
||
const x = el('div', 'x');
|
||
const mn = num(d.temperature_min), mx = num(d.temperature_max);
|
||
if (mn !== null || mx !== null) x.append(el('div', null, 'Min ' + fmt(mn, '°', 1) + ' · Max ' + fmt(mx, '°', 1)));
|
||
const a = num(s.avant && s.avant.temperature);
|
||
if (s.t !== null && a !== null) { const dd = s.t - a; x.append(el('div', null, (dd >= 0 ? '+' : '') + fmt(dd, '°C', 1) + ' en 1 h')); }
|
||
gros.append(x); f.append(gros);
|
||
|
||
const tu = el('div', 'tuiles');
|
||
const tuile = (lib, val, extra, noeud) => { const t = el('div', 'tuile'); t.append(el('span', null, lib)); const b = el('b', null, val); t.append(b); if (extra) t.append(el('i', null, extra)); if (noeud) t.append(noeud); tu.append(t); };
|
||
const dir = num(d.vent_direction);
|
||
const champs = [
|
||
['Humidité', num(d.humidite), (v) => fmt(v, '%', 0)],
|
||
['Point de rosée', num(d.point_de_rosee), (v) => fmt(v, '°C', 1)],
|
||
['Pression', num(d.pression), (v) => fmt(v, 'hPa', 1)],
|
||
['Pluie 1 h', num(d.pluie_1h), (v) => fmt(v, 'mm', 1)],
|
||
['Pluie depuis 0 h', num(d.pluie_cumul_0h), (v) => fmt(v, 'mm', 1)],
|
||
['Rafales', num(d.vent_rafales), (v) => fmt(v, 'km/h', 0)],
|
||
];
|
||
if (num(d.vent_moyen) !== null) tuile('Vent moyen', fmt(num(d.vent_moyen), 'km/h', 0), dir !== null ? cardinal(dir) : '', dir !== null ? boussole(dir) : null);
|
||
for (const [lib, v, f2] of champs) if (v !== null) tuile(lib, f2(v));
|
||
if (s.avant && num(s.avant.pression) !== null && num(d.pression) !== null) {
|
||
const dp = num(d.pression) - num(s.avant.pression);
|
||
tuile('Tendance pression', (dp >= 0 ? '+' : '') + fmt(dp, 'hPa', 1), '/ 1 h');
|
||
}
|
||
f.append(tu);
|
||
|
||
const gs = [
|
||
graphe('Température', s.rel, 'temperature', '°C', { aire: true, serie2: 'point_de_rosee' }),
|
||
graphe('Humidité', s.rel, 'humidite', '%', { dec: 0, ecartMin: 10 }),
|
||
graphe('Vent moyen et rafales', s.rel, 'vent_moyen', 'km/h', { dec: 0, zero: true, ecartMin: 10, serie2: 'vent_rafales' }),
|
||
graphe('Pression', s.rel, 'pression', 'hPa', { dec: 1, ecartMin: 2 }),
|
||
graphe('Pluie horaire', s.rel, 'pluie_1h', 'mm', { barres: true, zero: true, ecartMin: 1 }),
|
||
];
|
||
for (const g of gs) if (g) f.append(g);
|
||
if (gs[0]) gs[0].querySelector('h3 em').textContent += ' · pointillés : rosée';
|
||
|
||
// tableau des derniers relevés
|
||
const der = s.rel.slice(-12).reverse();
|
||
if (der.length) {
|
||
const tb = el('div', 'table'); const t = el('table'); const tr = el('tr');
|
||
for (const c of ['Heure', 'Temp.', 'Hum.', 'Vent', 'Pluie']) tr.append(el('th', null, c));
|
||
const thead = el('thead'); thead.append(tr); t.append(thead);
|
||
const tbody = el('tbody');
|
||
for (const r of der) {
|
||
const l = el('tr');
|
||
const v = num(r.vent_moyen), dr = num(r.vent_direction);
|
||
l.append(el('td', null, heure(utc(r.dh_utc))), el('td', null, fmt(num(r.temperature), '°', 1)), el('td', null, fmt(num(r.humidite), '%', 0)),
|
||
el('td', null, v === null ? '—' : fmt(v, '', 0) + (dr !== null ? ' ' + cardinal(dr) : '')), el('td', null, fmt(num(r.pluie_1h), '', 1)));
|
||
tbody.append(l);
|
||
}
|
||
t.append(tbody); tb.append(t); f.append(tb);
|
||
}
|
||
f.append(el('p', 'pied', 'Source : ' + (s.source || 'inconnue') + (s.meta.licence ? ' · licence ' + s.meta.licence : '') + (s.exemple ? ' · exemple' : '')));
|
||
}
|
||
|
||
function ouvrir(id) {
|
||
choisie = id;
|
||
const s = stations().find((x) => x.id === id); if (!s) return;
|
||
remplirFiche(s);
|
||
$('#fiche').classList.add('ouverte'); $('#voile').classList.add('ouvert');
|
||
$('#fiche').scrollTop = 0;
|
||
if (s.meta.lat != null) carte.panTo([s.meta.lat, s.meta.lon]);
|
||
rendre(false);
|
||
$('#fiche .fermer').focus({ preventScroll: true });
|
||
}
|
||
function fermer() {
|
||
choisie = null;
|
||
$('#fiche').classList.remove('ouverte'); $('#voile').classList.remove('ouvert');
|
||
rendre(false);
|
||
}
|
||
$('#voile').addEventListener('click', fermer);
|
||
document.addEventListener('keydown', (e) => { if (e.key === 'Escape') fermer(); });
|
||
|
||
function rendre(refiche = true) {
|
||
const liste = stations();
|
||
majCarte(liste); majResume(liste); majListe(liste);
|
||
if (refiche && choisie) { const s = liste.find((x) => x.id === choisie); if (s) { const st = $('#fiche').scrollTop; remplirFiche(s); $('#fiche').scrollTop = st; } }
|
||
if (donnees) {
|
||
const maj = new Date(donnees.mis_a_jour_utc), min = Math.round((Date.now() - maj) / 60000);
|
||
$('#etat').textContent = min <= 1 ? 'En direct · ' + heure(maj) : 'Mis à jour il y a ' + age(min);
|
||
$('#point').classList.toggle('vieux', min > 20);
|
||
}
|
||
}
|
||
|
||
async function charger() {
|
||
try {
|
||
const r = await fetch('data/meteo.json', { cache: 'no-store' });
|
||
if (!r.ok) throw new Error('HTTP ' + r.status);
|
||
donnees = await r.json();
|
||
$('#erreur').replaceChildren();
|
||
$('#bandeau').replaceChildren(...(donnees.exemple ? [el('div', 'exemple', "Données d'exemple : ces valeurs ne sont pas des mesures réelles.")] : []));
|
||
rendre();
|
||
} catch (e) {
|
||
$('#erreur').replaceChildren(el('div', 'erreur', 'Données indisponibles (' + e.message + ').'));
|
||
$('#point').classList.add('vieux');
|
||
}
|
||
}
|
||
|
||
for (const [attr, set] of [['tri', (v) => { tri = v; }], ['couche', (v) => { couche = v; }]]) {
|
||
document.querySelectorAll('[data-' + attr + ']').forEach((b) => b.addEventListener('click', () => {
|
||
set(b.dataset[attr]);
|
||
document.querySelectorAll('[data-' + attr + ']').forEach((x) => x.setAttribute('aria-pressed', String(x === b)));
|
||
rendre(false);
|
||
}));
|
||
}
|
||
|
||
(function () {
|
||
const b = $('#theme');
|
||
const appliquer = (t) => { if (t === 'sombre') document.documentElement.dataset.theme = 'sombre'; else delete document.documentElement.dataset.theme; b.textContent = t === 'sombre' ? 'Clair' : 'Sombre'; };
|
||
let t = 'clair'; try { t = localStorage.getItem('theme') || 'clair'; } catch (e) {}
|
||
appliquer(t);
|
||
b.addEventListener('click', () => { t = t === 'sombre' ? 'clair' : 'sombre'; appliquer(t); try { localStorage.setItem('theme', t); } catch (e) {} });
|
||
})();
|
||
initCarte();
|
||
charger();
|
||
setInterval(charger, 60000);
|
||
setInterval(() => rendre(false), 30000);
|
||
document.addEventListener('visibilitychange', () => { if (!document.hidden) charger(); });
|