Site vercors.me : pages Station, A propos (mentions), 404, SEO, favicon, deploy/
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Cette révision appartient à :
1 Parent
0ee7b8e723
révision
a608fad84a
12 fichiers modifiés
+253
-16
Aucun fichier ne correspond à votre recherche
+23
-2
@@ -11,6 +11,7 @@ const cardinal = (d) => POINTS[Math.round(d / 22.5) % 16];
|
||||
|
||||
const couleurT = () => 'var(--texte)';
|
||||
|
||||
const PAGE = document.body.dataset.page || 'accueil';
|
||||
const SEUIL_HORS_MIN = 90;
|
||||
let donnees = null, tri = 'altitude', couche = 'temperature', choisie = null, carte = null, marqueurs = {}, cadrage = false;
|
||||
|
||||
@@ -244,6 +245,7 @@ function remplirFiche(s) {
|
||||
}
|
||||
t.append(tbody); tb.append(t); f.append(tb);
|
||||
}
|
||||
if (PAGE === 'accueil') { const l = el('p', 'pied'); const a = el('a', null, 'Page de la station'); a.href = 'station.html?id=' + encodeURIComponent(s.id); l.append(a); f.append(l); }
|
||||
f.append(el('p', 'pied', 'Source : ' + (s.source || 'inconnue') + (s.meta.licence ? ' · licence ' + s.meta.licence : '') + (s.exemple ? ' · exemple' : '')));
|
||||
}
|
||||
|
||||
@@ -262,13 +264,32 @@ function fermer() {
|
||||
$('#fiche').classList.remove('ouverte'); $('#voile').classList.remove('ouvert');
|
||||
rendre(false);
|
||||
}
|
||||
$('#voile').addEventListener('click', fermer);
|
||||
if ($('#voile')) $('#voile').addEventListener('click', fermer);
|
||||
document.addEventListener('keydown', (e) => { if (e.key === 'Escape') fermer(); });
|
||||
|
||||
function rendreStation() {
|
||||
const liste = stations();
|
||||
const id = new URLSearchParams(location.search).get('id');
|
||||
const s = liste.find((x) => x.id === id);
|
||||
const f = $('#fiche');
|
||||
if (!s) {
|
||||
document.title = 'Station introuvable · Météo Vercors';
|
||||
f.replaceChildren(el('h2', null, id ? 'Station introuvable' : 'Choisir une station'));
|
||||
const ul = el('ul', 'choix');
|
||||
for (const x of liste.sort((a, b) => (b.meta.altitude ?? -1) - (a.meta.altitude ?? -1))) { const li = el('li'); const a = el('a', null, x.nom); a.href = 'station.html?id=' + encodeURIComponent(x.id); li.append(a); ul.append(li); }
|
||||
f.append(ul); return;
|
||||
}
|
||||
document.title = s.nom + ' · Météo Vercors';
|
||||
const st = window.scrollY; remplirFiche(s); window.scrollTo(0, st);
|
||||
}
|
||||
function rendre(refiche = true) {
|
||||
if (PAGE === 'station') { if (donnees) rendreStation(); majEtat(); return; }
|
||||
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; } }
|
||||
majEtat();
|
||||
}
|
||||
function majEtat() {
|
||||
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);
|
||||
@@ -305,7 +326,7 @@ for (const [attr, set] of [['tri', (v) => { tri = v; }], ['couche', (v) => { cou
|
||||
appliquer(t);
|
||||
b.addEventListener('click', () => { t = t === 'sombre' ? 'clair' : 'sombre'; appliquer(t); try { localStorage.setItem('theme', t); } catch (e) {} });
|
||||
})();
|
||||
initCarte();
|
||||
if (PAGE === 'accueil') initCarte();
|
||||
charger();
|
||||
setInterval(charger, 60000);
|
||||
setInterval(() => rendre(false), 30000);
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur