Fichiers
Théo GastineletClaude Opus 5.5 1df8be2be1 humans.txt, security.txt, ads.txt, interdiction d'entraînement d'IA, liens CGU/confidentialité
- humans.txt, ads.txt (ligne placeholder IAB), ai.txt, .well-known/security.txt (RFC 9116), .well-known/tdmrep.json
- robots.txt : robots d'entraînement d'IA refusés ; robots de recherche et de lecture laissés libres
- À propos : section « Intelligence artificielle » (#ia)
- <link rel="privacy-policy"> et "terms-of-service" (vers /a-propos#mentions) dans toutes les pages et le forum ; <link rel="author"> dans l'accueil
- assembler.py copie les nouveaux fichiers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 01:00:43 +01:00

2394 lignes
172 KiB
HTML
Brut Lien permanent Annotations Historique

Ce fichier contient des caractères Unicode ambigus.
Ce fichier contient des caractères Unicode qui peuvent être confondus avec d'autres caractères. Si vous pensez que c'est intentionnel, vous pouvez ignorer cet avertissement. Utilisez le bouton Échappe pour les dévoiler.
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Météo Vercors : la température du Vercors, station par station</title>
<meta name="theme-color" content="#f5f3ee">
<meta name="description" content="Les températures en direct de 18 stations du Vercors, de Villard-de-Lans à Die : courbes sur 7 jours, vent et pluie. Locale, indépendante, sans publicité ni pistage.">
<link rel="canonical" href="https://vercors.me/">
<meta name="robots" content="index, follow">
<meta name="color-scheme" content="light">
<meta property="og:type" content="website"><meta property="og:site_name" content="Météo Vercors"><meta property="og:locale" content="fr_FR"><meta property="og:url" content="https://vercors.me/">
<meta property="og:title" content="Météo Vercors"><meta property="og:description" content="Le Vercors en direct, station par station. Sans publicité ni pistage.">
<meta name="twitter:card" content="summary"><meta name="twitter:title" content="Météo Vercors"><meta name="twitter:description" content="Le Vercors en direct, station par station.">
<link rel="alternate" type="text/plain" href="/llms.txt" title="llms.txt">
<link rel="alternate" type="text/plain" href="/direct.txt" title="Valeurs en direct">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@graph": [
{
"@type": "WebSite",
"@id": "https://vercors.me/#site",
"url": "https://vercors.me/",
"name": "Météo Vercors",
"inLanguage": "fr",
"description": "Relevés en direct des stations météo du Vercors, station par station."
},
{
"@type": "Dataset",
"@id": "https://vercors.me/#donnees",
"name": "Relevés des stations météo du Vercors",
"description": "Mesures en direct de 18 stations du Vercors (Météo-France, ROMMA, stations de la famille Gastinel), mises à jour toutes les 6 à 10 minutes.",
"url": "https://vercors.me/",
"inLanguage": "fr",
"isAccessibleForFree": true,
"spatialCoverage": "Massif du Vercors, France",
"variableMeasured": ["température", "humidité", "vent", "pluie"],
"creator": {"@type": "Organization", "name": "Météo Vercors", "url": "https://vercors.me/"},
"distribution": [
{"@type": "DataDownload", "encodingFormat": "application/json", "contentUrl": "https://vercors.me/data/meteofrance.json"},
{"@type": "DataDownload", "encodingFormat": "application/json", "contentUrl": "https://vercors.me/data/infoclimat.json"},
{"@type": "DataDownload", "encodingFormat": "application/json", "contentUrl": "https://vercors.me/data/weatherlink.json"},
{"@type": "DataDownload", "encodingFormat": "application/json", "contentUrl": "https://vercors.me/data/vp2.json"}
]
}
]
}
</script>
<link rel="privacy-policy" href="https://vercors.me/a-propos#mentions">
<link rel="terms-of-service" href="https://vercors.me/a-propos#mentions">
<link rel="author" href="/humans.txt">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' fill='%231f4d3a'/%3E%3Cpath d='M3 24 12 9l5 8 3-4 9 11z' fill='%23f5f3ee'/%3E%3C/svg%3E">
<link rel="preload" href="polices/outfit-normal.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="polices/bitter-normal.woff2" as="font" type="font/woff2" crossorigin>
<style>
@font-face{font-family:'Bitter';font-style:italic;font-weight:500;font-display:swap;src:url(polices/bitter-italic.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Bitter';font-style:normal;font-weight:500 700;font-display:swap;src:url(polices/bitter-normal.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Outfit';font-style:normal;font-weight:400 600;font-display:swap;src:url(polices/outfit-normal.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
:root{
--titre:'Bitter', Georgia, serif;
--texte:'Outfit', system-ui, sans-serif;
--sapin:#1f4d3a; --mousse:#6f8f5c; --calcaire:#f5f3ee; --pierre:#e4e0d6;
--roche:#2b2f2c; --glacier:#6eb5bd; --chaud:#b5643c; --gris:#5d635e;
}
*{box-sizing:border-box}
@font-face{font-family:'GastinelG';font-weight:700;font-display:swap;src:url(polices/inter-g.woff2) format('woff2')}
html{scroll-behavior:smooth}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
html,body{margin:0;background:var(--calcaire);color:var(--roche);font-family:var(--texte)}
a{color:inherit}
/* ---------- la carte = l'accueil ---------- */
.carte{position:relative;height:100svh;min-height:600px;overflow:hidden;background:#f2f0e8}
.couche{position:absolute;left:-50%;top:-50%;width:200%;height:200%;display:block;transform-origin:0 0;will-change:transform}
#fond{filter:blur(2px)}
#tuiles{position:absolute;inset:0;overflow:hidden;transition:opacity .35s}
.calque{transition:opacity .35s}
#intro{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
#intro path{fill:none;stroke:#6b7a6e;stroke-opacity:.38;stroke-width:.8px;vector-effect:non-scaling-stroke;stroke-dasharray:1;stroke-dashoffset:1;animation:trace linear forwards}
#intro path.m{stroke-opacity:.6;stroke-width:1.1px}
@keyframes trace{to{stroke-dashoffset:0}}
.carte.ouverture #tuiles,.carte.ouverture .calque,.carte.ouverture .puce{opacity:0}
.carte.ouverture.fond #tuiles,.carte.ouverture.fond .calque{opacity:1}
.carte.ouverture.stations .puce{opacity:1}
#intro{transition:opacity calc(.4s * var(--k,1)) ease}
.carte.ouverture.fond #intro{opacity:0}
.carte.ouverture.stations .puce > button,.carte.ouverture.stations .puce .pt,.carte.ouverture.stations .puce .fil{animation:arrive calc(.2s * var(--k,1)) cubic-bezier(.2,.8,.2,1) both;animation-delay:var(--d,0ms)}
@keyframes arrive{from{opacity:0;transform:translateY(-6px)}}
.niveau{position:absolute;left:0;top:0;transform-origin:0 0;will-change:transform}
.niveau img{position:absolute;width:513px;height:513px;opacity:0;transition:opacity .25s;pointer-events:none;user-select:none}
.niveau img.vu{opacity:1}
.couche .h0{fill:#f2f0e8}
.couche .h500{fill:#ebede1}
.couche .h900{fill:#e2e8d6}
.couche .h1300{fill:#d5dfc7}
.couche .h1700{fill:#e3dfd2}
.couche .h2000{fill:#ece9e0}
.couche .h2200{fill:#f3f1eb}
.couche .courbe{fill:none;stroke:var(--sapin);stroke-opacity:.15;stroke-width:.5px;vector-effect:non-scaling-stroke;stroke-linejoin:round}
.couche .maitresse{stroke-opacity:.32;stroke-width:.9px}
.couche .riviere{fill:none;stroke:var(--glacier);stroke-width:1.2px;vector-effect:non-scaling-stroke;stroke-linejoin:round;stroke-linecap:round}
.couche .riviere.grande{stroke:#3f8c97;stroke-width:3.2px}
.couche .riviere.moyenne{stroke:#5aa3ad;stroke-width:1.8px}
.couche .fleuve-halo.moyen{stroke-width:4.5px;stroke-opacity:.7}
.couche .fleuve-halo{fill:none;stroke:#fff;stroke-opacity:.85;stroke-width:7px;vector-effect:non-scaling-stroke;stroke-linejoin:round;stroke-linecap:round}
.couche .voile{fill:#f5f3ee;opacity:.2}
.couche .limite{fill:none;stroke:var(--sapin);stroke-opacity:.85;stroke-width:1.6px;vector-effect:non-scaling-stroke;stroke-linejoin:round}
.couche .limite-halo{fill:none;stroke:#fff;stroke-opacity:.7;stroke-width:6px;vector-effect:non-scaling-stroke;stroke-linejoin:round}
.carte{cursor:grab;touch-action:pan-y}
.carte.glisse{cursor:grabbing;user-select:none}
.calque{position:absolute;inset:0;pointer-events:none}
.commandes{position:absolute;right:20px;top:50%;transform:translateY(-50%);z-index:4;display:flex;flex-direction:column}
.commandes button{width:36px;height:36px;font:600 20px/1 var(--texte);color:var(--roche);background:rgba(250,249,245,.95);border:1px solid var(--roche);border-radius:0;cursor:pointer}
.commandes button+button{border-top:0}
.commandes button:hover{background:#fff}
.commandes button:disabled{color:#b9bcb5;cursor:default}
/* noms et puces sont placés par une transformation (pas de left/top) : chacun a sa couche,
déplacée par la carte graphique sans redessiner le texte ; le décalage propre à chaque type est ajouté par le script */
.etq{position:absolute;left:0;top:0;white-space:nowrap;will-change:transform;
text-shadow:0 0 2px #f4f2ea,0 0 2px #f4f2ea,0 0 3px #f4f2ea,0 0 5px #f4f2ea}
.etq.village{font-size:12px;font-weight:500;color:var(--roche)}
.etq.village::before{content:"";position:absolute;left:-7px;top:50%;width:4px;height:4px;margin-top:-2px;background:var(--roche)}
.etq.ville{font-size:11.5px;font-weight:600;letter-spacing:.12em;text-transform:uppercase;color:var(--gris)}
.etq.pic{font-family:var(--titre);font-style:italic;font-size:12px;color:#55574f}
.etq.pic::before{content:"";display:block;margin:0 auto 2px;width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:6px solid #55574f}
.etq.pic small{font-style:normal;font-family:var(--texte);font-size:10.5px;margin-left:4px;color:var(--gris)}
.etq.region{font-family:var(--titre);font-size:14px;letter-spacing:.4em;text-transform:uppercase;color:var(--sapin);opacity:.55}
.etq.lieudit{font-family:var(--titre);font-style:italic;font-size:12px;color:#3f7f88}
.etq.fleuve{font-family:var(--titre);font-style:italic;font-size:14px;letter-spacing:.14em;color:#2f7480}
.etq.cache{display:none}
/* mesures : une puce par village ou par site */
.puce{position:absolute;left:0;top:0;pointer-events:auto;will-change:transform}
.puce .pt{position:absolute;left:-4px;top:-4px;width:8px;height:8px;background:var(--roche);outline:2px solid #fff}
.puce .fil{position:absolute;background:var(--roche);height:1px;transform-origin:0 0}
.puce > button{position:absolute;font:inherit;color:inherit;text-align:left;cursor:pointer;white-space:nowrap;
background:rgba(250,249,245,.95);border:1px solid var(--roche);border-radius:0;padding:4px 8px 5px}
.puce.survol > button,.puce.ouverte > button{background:#fff}
/* le clic ne passe pas par le point ni par le fil : c'est la zone de la station (la plus proche du pointeur) qui décide */
.puce .pt,.puce .fil{pointer-events:none}
.carte.vise:not(.glisse){cursor:pointer}
.puce .val{display:inline-block;font-family:var(--titre);font-weight:600;font-size:21px;line-height:1;font-variant-numeric:tabular-nums}
.puce .n{display:inline-block;margin-left:6px;padding:1px 4px;font-size:10.5px;font-weight:600;vertical-align:4px;background:var(--roche);color:#fff}
.puce .nom{display:block;margin-top:3px;font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase}
.puce.cache{display:none}
.puce > button.ex .val{opacity:.45;font-style:italic}
.puce > button.hl .val{color:var(--gris)!important;text-decoration:line-through}
.fiche{position:absolute;display:none;background:#fff;border:1px solid var(--roche);width:272px;padding:12px 14px;z-index:6;pointer-events:auto}
.puce.ouverte{z-index:6}
.puce.ouverte .fiche{display:block;transform-origin:top left;animation:ouvre .26s cubic-bezier(.2,.8,.2,1)}
.puce.ouverte .fiche li{animation:ligne .32s cubic-bezier(.2,.8,.2,1) both;animation-delay:calc(var(--i) * 45ms + 70ms)}
.puce.ouverte > button{box-shadow:inset 0 -3px 0 var(--sapin)}
.puce > button{transition:background .15s,transform .15s}
.puce.survol > button{transform:translateY(-1px)}
@keyframes ouvre{from{opacity:0;transform:translateY(-6px);clip-path:inset(0 0 100% 0)}to{opacity:1;transform:none;clip-path:inset(0 0 0 0)}}
@keyframes ligne{from{opacity:0;transform:translateX(-8px)}}
.puce.ferme .fiche{animation:fermeture .17s ease-in forwards}
@keyframes fermeture{to{opacity:0;transform:translateY(-6px);clip-path:inset(0 0 100% 0)}}
@media (prefers-reduced-motion:reduce){.puce.ouverte .fiche,.puce.ouverte .fiche li{animation:none}}
.fiche h3{margin:0 0 8px;font-family:var(--titre);font-size:17px;font-weight:600}
.fiche ul{list-style:none;margin:0;padding:0;max-height:300px;overflow:auto}
.fiche li{display:grid;grid-template-columns:1fr auto;gap:2px 10px;padding:7px 0;border-top:1px solid var(--pierre)}
.fiche li b{font-family:var(--titre);font-size:19px;font-weight:600;text-align:right}
.fiche li span{font-size:13px}
.fiche li em{grid-column:1/-1;font-style:normal;font-size:11.5px;color:var(--gris)}
.ic{display:inline-block;width:14px;height:14px;vertical-align:-2px;margin-left:5px}
.fiche li em .ic{margin:0 5px 0 0}
.fiche .actions{display:flex;flex-direction:column;align-items:flex-start;gap:8px;margin-top:10px}
.fiche .pleinbtn{font:inherit;font-size:11.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;background:var(--sapin);color:#fff;border:0;border-radius:0;padding:7px 10px;cursor:pointer}
.fiche .pleinbtn:hover{background:#17392b}
#plein{position:fixed;inset:0;z-index:30;background:var(--calcaire);overflow:auto;opacity:0;transform:translateY(14px);transition:opacity .22s ease,transform .26s cubic-bezier(.2,.8,.2,1)}
#plein.vu{opacity:1;transform:none}
#plein[hidden]{display:none}
.plein-barre{position:sticky;top:0;z-index:2;display:flex;gap:10px;align-items:center;padding:10px 16px;background:rgba(245,243,238,.94);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);border-bottom:1px solid var(--pierre)}
.plein-ferme{font:inherit;font-size:12px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;background:var(--sapin);color:#fff;border:0;border-radius:0;padding:9px 12px;cursor:pointer;white-space:nowrap}
.plein-onglets{display:flex;gap:6px;overflow-x:auto}
.plein-onglets button{font:inherit;font-size:12px;font-weight:600;border:1px solid var(--roche);background:#faf9f5;color:var(--roche);border-radius:0;padding:6px 9px;cursor:pointer;white-space:nowrap}
.plein-onglets button.on{background:var(--roche);color:#fff}
.plein-corps{max-width:1200px;margin:0 auto;padding:20px 16px 64px}
[data-aff=acces] .plein-corps{max-width:1480px}
.plein-periode{display:flex;gap:8px;margin-top:16px}
.plein-periode button{font:inherit;font-weight:600;color:var(--sapin);background:none;border:1px solid var(--sapin);padding:7px 12px;cursor:pointer}
.plein-periode button[aria-pressed=true]{background:var(--sapin);color:#fff}
[data-aff=acces] .plein-periode button{min-height:44px}
.plein-lacune{margin:16px 0 0;color:var(--roche)}
.plein-fiche{margin-top:32px;padding-top:18px;border-top:1px solid var(--roche)}
.plein-fiche h3{margin:0;font-family:var(--titre);font-weight:600;font-size:20px;color:var(--sapin)}
.plein-fiche dl{display:grid;grid-template-columns:max-content 1fr;gap:6px 16px;margin:12px 0 0;font-size:14px}
.plein-fiche dt{color:var(--gris)}.plein-fiche dd{margin:0;min-width:0;overflow-wrap:anywhere}
.plein-fiche a{color:var(--sapin);text-underline-offset:2px}
.fiche-photos{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:16px 0 0;max-width:720px}
.fiche-photos img{display:block;width:100%;aspect-ratio:4/3;object-fit:cover;border:1px solid var(--pierre)}
.fiche-forum{display:inline-block;margin-top:14px;font-weight:600;color:var(--sapin);border:1px solid var(--sapin);padding:8px 12px;text-decoration:none}
.fiche-forum:hover{background:var(--sapin);color:#fff}
.fiche-bientot{margin:14px 0 0;font-size:13px;color:var(--gris)}
[data-aff=acces] .plein-fiche dl{font-size:16px}[data-aff=acces] .fiche-bientot{font-size:15px;color:var(--roche)}
[data-aff=acces] .fiche-forum{min-height:44px}
@media (max-width:520px){.plein-fiche dl{grid-template-columns:1fr;gap:0}.plein-fiche dd{margin-bottom:8px}}
.plein-corps h2{margin:0;font-family:var(--titre);font-weight:600;font-size:26px;line-height:1.15;color:var(--sapin)}
.origine{display:inline-flex;flex-direction:column;vertical-align:middle;margin-left:12px;padding:3px 9px;border:1px solid var(--glacier);background:rgba(110,181,189,.14);color:#2f6f78;font-family:var(--texte,inherit);font-size:12px;font-weight:500;line-height:1.25}
.origine small{font-size:11px;font-weight:400;color:var(--gris)}
.origine a{color:#2f6f78;text-decoration:underline;text-underline-offset:2px}
.origine small a{color:#2f6f78;text-decoration:underline;text-underline-offset:2px}
.plein-sous{margin:4px 0 0;font-size:13px;color:var(--gris)}
.plein-val{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap;margin-top:14px;padding-top:12px;border-top:1px solid var(--pierre)}
.plein-val b{font-family:var(--titre);font-weight:600;font-size:52px;line-height:1;letter-spacing:-.01em}
.plein-val span{font-size:13.5px;color:var(--gris)}
.plein-carte{margin-left:auto;font:inherit;font-size:12px;font-weight:600;color:var(--sapin);background:none;border:1px solid var(--sapin);border-radius:0;padding:7px 10px;cursor:pointer}
.graphe{margin-top:26px}
.graphe header{display:flex;align-items:baseline;gap:6px 14px;flex-wrap:wrap;margin-bottom:6px}
.graphe h3{margin:0;font-family:var(--titre);font-weight:600;font-size:17px}
.g-mm{font-size:12px;color:var(--gris)}
.g-lect{margin-left:auto;font-size:12.5px;font-weight:600;font-variant-numeric:tabular-nums}
.graphe > svg{display:block;max-width:100%;touch-action:pan-y;font-family:var(--texte);font-size:10.5px;fill:var(--gris)}
.graphe > svg .gz{fill:#3d6f8e}
.graphe > svg .curseur{stroke:var(--roche);stroke-width:1}
.plein-note,.plein-attente{margin:24px 0 0;font-size:12px;color:var(--gris)}
.fiche .zoom{display:inline-block;margin-top:8px;font:inherit;font-size:13px;font-weight:600;color:var(--sapin);background:none;border:0;padding:0;cursor:pointer;text-decoration:underline}
/* cartouche : le titre posé sur la carte, comme sur une carte imprimée */
.cartouche{position:absolute;top:28px;left:28px;width:340px;z-index:4;
background:rgba(250,249,245,.95);border:1px solid var(--roche);outline:1px solid var(--roche);outline-offset:4px;padding:16px 20px 18px}
.cartouche nav{display:flex;justify-content:space-between;align-items:baseline;font-size:11px;font-weight:600;letter-spacing:.16em;text-transform:uppercase}
.cartouche nav span{color:var(--sapin);font-size:16px;letter-spacing:.22em}
.cartouche nav a{text-decoration:none;margin-left:14px;color:var(--gris)}
.cartouche nav a:hover{color:var(--roche);text-decoration:underline}
.cartouche h1{margin:6px 0 0;font-family:var(--titre);font-weight:700;font-size:66px;line-height:.95;letter-spacing:-.015em;color:var(--sapin)}
.cartouche .date{margin:8px 0 0;font-size:13px;color:var(--gris)}
.cartouche .phrase{margin:14px 0 0;padding-top:12px;border-top:1px solid var(--pierre);font-family:var(--titre);font-size:16px;line-height:1.4}
.cartouche .phrase strong{font-weight:600}
.cartouche .reseau{margin:10px 0 0;font-size:12.5px;color:var(--gris)}
.pendule{position:absolute;top:calc(100% + 6px);left:50%;transform:translateX(-50%);padding-top:21px;pointer-events:none}
.pendule .corde{position:absolute;top:0;width:1px;height:22px;background:var(--roche);transform-origin:50% 0;will-change:transform}
.pancarte{will-change:transform;pointer-events:auto;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none}
.pancarte.prise{cursor:grabbing}
.pendule.libre .corde{display:none}
.pendule.ramene{transition:translate .25s ease}
.pendule .corde.g{left:18%}.pendule .corde.d{right:18%}
.pancarte{display:block;white-space:nowrap;background:#faf9f5;border:1px solid var(--roche);padding:5px 11px 6px;
font-size:11px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--sapin)}
.outils{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.rech{position:relative;flex:1;min-width:0}
#rech{width:100%;font:inherit;font-size:13.5px;color:var(--roche);background:#fff;border:1px solid var(--roche);border-radius:0;padding:7px 9px;-webkit-appearance:none;appearance:none}
#rech::placeholder{color:#8a8f88}
#rech-res{position:absolute;left:0;right:0;top:100%;z-index:8;margin:2px 0 0;padding:0;list-style:none;background:#fff;border:1px solid var(--roche);max-height:260px;overflow:auto}
#rech-res li{padding:7px 9px;font-size:13.5px;cursor:pointer;border-top:1px solid var(--pierre)}
#rech-res li:first-child{border-top:0}
#rech-res li.on,#rech-res li:hover{background:#eef2ea}
#rech-res small{color:var(--gris);margin-left:6px}
.reglages{max-width:1080px;margin:0 auto;padding:10px 28px 0;display:flex;flex-wrap:wrap;gap:10px 22px;align-items:center}
.modes{display:flex;flex:0 0 auto}
.aide{flex:0 0 100%;margin:0;font-size:11.5px;color:var(--gris)}
.temps{flex:1 1 300px;display:flex;align-items:center;gap:10px;min-width:0}
.temps button{font:inherit;font-size:13px;color:var(--sapin);background:#fff;border:1px solid var(--sapin);border-radius:0;width:34px;height:31px;cursor:pointer;padding:0}
.temps button:disabled{opacity:.4;cursor:default}
.temps input{flex:1;min-width:0;accent-color:var(--sapin);height:24px}
.temps output{font-size:12.5px;color:var(--gris);min-width:112px;text-align:right}
.temps.passe output{color:var(--chaud);font-weight:600}
@media (max-width:719px){.reglages{padding:10px 16px 0}.temps{flex:1 1 100%;flex-wrap:wrap}.temps input{flex:1 1 140px}.temps output{min-width:0;flex:0 0 100%;text-align:left;order:3}}
.modes button{flex:none;font:inherit;font-size:11.5px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--sapin);background:#fff;border:1px solid var(--sapin);border-radius:0;margin-left:-1px;padding:7px 14px;cursor:pointer;white-space:nowrap}
.modes button:first-child{margin-left:0}
.modes button[aria-pressed=true]{background:var(--sapin);color:#fff}
.modes button[data-tri="2"][aria-pressed=true]{background:#000;border-color:#000}
.puce.horsmode{display:none}
.puce .ics{display:none;margin-left:6px;vertical-align:1px}
a:focus-visible,button:focus-visible,input:focus-visible{outline:2px solid var(--sapin);outline-offset:2px}
.vieux{color:var(--chaud)!important}
#retour{display:none;margin-top:12px;font:inherit;font-size:12px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;background:var(--sapin);color:#fff;border:0;border-radius:0;padding:7px 10px;cursor:pointer}
#retour.vu{display:inline-block}
.legende{position:absolute;left:28px;bottom:22px;z-index:3;font-size:11.5px;color:var(--gris);
text-shadow:0 0 3px #f4f2ea,0 0 3px #f4f2ea}
.echelle{display:flex;align-items:flex-end;gap:8px;color:var(--roche)}
.sous-carte{max-width:1080px;margin:0 auto;padding:10px 28px 0;font-size:11.5px;color:var(--gris)}
.echelle i{display:block;height:5px;border:1px solid var(--roche);background:linear-gradient(90deg,var(--roche) 50%,#fff 50%);background-size:50% 100%}
.thermo{position:absolute;right:28px;bottom:22px;z-index:3;font-size:11px;color:var(--gris);text-align:right;
text-shadow:0 0 3px #f4f2ea,0 0 3px #f4f2ea}
.thermo i{display:block;width:180px;height:6px;margin:4px 0 3px;border:1px solid var(--roche)}
.thermo span{display:flex;justify-content:space-between}
.suite{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);z-index:3;font-size:12px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--sapin);text-decoration:none;
padding:8px 14px;--coin:linear-gradient(var(--sapin),var(--sapin));
background:var(--coin) left top/9px 1.5px,var(--coin) left top/1.5px 9px,var(--coin) right top/9px 1.5px,var(--coin) right top/1.5px 9px,
var(--coin) left bottom/9px 1.5px,var(--coin) left bottom/1.5px 9px,var(--coin) right bottom/9px 1.5px,var(--coin) right bottom/1.5px 9px,
rgba(250,249,245,.45);
background-repeat:no-repeat;-webkit-backdrop-filter:blur(8px) saturate(1.2);backdrop-filter:blur(8px) saturate(1.2);transition:background-color .15s}
.suite:hover{background-color:rgba(255,255,255,.75)}
.record{flex:0 0 100%;font-size:11.5px;color:var(--gris)}
.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}
.compte{display:inline-flex;align-items:center;gap:8px;padding:5px 11px 5px 7px;background:#fff;border:1px solid #000;color:#000;font-size:12px;font-weight:600;text-decoration:none}
.compte:hover{background:#ecebe5}
.compte .gmark{font-family:'GastinelG','Inter',system-ui,sans-serif;font-weight:700;font-size:22px;line-height:1;color:#000;letter-spacing:-.02em}
.legende{left:auto;right:222px}
.legende.milieu{right:auto;bottom:auto;transform:translate(-50%,-50%)}
.forum-box{position:absolute;left:28px;bottom:16px;z-index:3;width:372px;background:rgba(250,249,245,.97);border:1px solid var(--roche);box-shadow:0 0 0 3px rgba(250,249,245,.97),0 0 0 4px var(--pierre);color:var(--roche)}
.fb-haut{display:flex;justify-content:space-between;align-items:baseline;padding:12px 16px 2px}
.fb-haut b{font-family:var(--titre);font-weight:700;font-size:28px;color:var(--sapin);line-height:1.1}
.fb-haut small{font-size:11px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--gris)}
.fb-une{padding:4px 16px 12px;border-bottom:1px solid var(--pierre)}
.fb-une small{display:block;font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--gris)}
.fb-une a{display:block;margin-top:2px;font-family:var(--titre);font-weight:600;font-size:17px;line-height:1.3;color:var(--roche);text-decoration:none}
.fb-une a:hover{text-decoration:underline}
.fb-une span{font-size:12.5px;color:var(--gris)}
.fb-une p{margin:4px 0 0;font-size:14px;overflow-wrap:anywhere}
.fb-cta{display:block;margin:12px 16px 6px;padding:11px 14px;background:var(--sapin);color:#fff;text-align:center;font-size:13px;font-weight:600;letter-spacing:.07em;text-transform:uppercase;text-decoration:none;border:1px solid var(--sapin)}
.fb-cta:hover{background:#17382b}
.fb-co{margin:0 16px 12px;text-align:center;font-size:12.5px;color:var(--gris)}
.fb-co a{display:inline-flex;align-items:center;gap:5px;color:#000;font-weight:600;text-decoration:underline;text-underline-offset:2px}
.fb-co .g{font-family:'GastinelG','Inter',system-ui,sans-serif;font-weight:700;font-size:17px;line-height:1;text-decoration:none}
.fb-bas{display:flex;gap:12px;align-items:center;padding:10px 16px;background:#303336;color:#d9dbde;font-size:12.5px;line-height:1.4}
.fb-bas .gcarre{flex:0 0 32px;height:32px;display:grid;place-items:center;background:#fff;color:#000;font-family:'GastinelG','Inter',system-ui,sans-serif;font-weight:700;font-size:22px}
.fb-bas strong{color:#fff;font-weight:600}
.forum-box.ferme .fb-co{display:none}
.forum-box.ferme .fb-cta{background:#7d8a82;border-color:#7d8a82;cursor:default}
.forum-box.ferme .fb-une a{pointer-events:none}
.forum-box.mobile{display:none}
@media (max-width:1000px){.forum-box{left:auto;right:28px;bottom:68px;width:320px}.legende{left:28px;right:auto}}
@media (max-width:719px){.carte .forum-box{display:none}.forum-box.mobile{display:block;position:static;width:auto;flex:0 0 100%;margin:6px 0 4px}}
.panneaux-coupe{padding-bottom:0}
.coupe-etat{font-weight:600;color:var(--roche)!important}.coupe-etat:empty{display:none}
#coupe-svg svg{width:100%;height:auto;display:block;background:#faf9f5;border:1px solid var(--roche)}
#coupe-svg text{font-family:var(--texte);font-size:11px;fill:var(--gris)}
@media (max-width:719px){#coupe-svg text{font-size:10.5px}}
#coupe-svg .st{cursor:pointer}
#coupe-svg .st rect{stroke:#fff;stroke-width:1.5}
#coupe-svg .st:hover rect,#coupe-svg .st:focus rect,#coupe-svg .st.on rect{stroke:var(--roche);stroke-width:2}
#coupe-svg .st text{fill:var(--roche);font-size:11px;font-weight:600}
.coupe-lect{min-height:1.5em;font-size:14px;color:var(--roche)}
.puce.mis > button{outline:2px solid var(--roche);outline-offset:2px}
/* ---------- panneaux déroulants ---------- */
.panneaux{max-width:1080px;margin:0 auto;padding:36px 28px 32px;display:grid;gap:14px}
.panneau{border:1px solid var(--roche);background:#faf9f5}
.panneau-tete{display:flex;align-items:baseline;gap:14px;width:100%;padding:18px 20px;background:none;border:0;border-radius:0;cursor:pointer;text-align:left;font:inherit;color:var(--sapin)}
.panneau-tete b{font-family:var(--titre);font-weight:600;font-size:24px}
.panneau-tete small{font-size:13px;color:var(--gris)}
.panneau-tete i{margin-left:auto;align-self:center;width:9px;height:9px;border-right:2px solid var(--sapin);border-bottom:2px solid var(--sapin);transform:rotate(45deg);transition:transform .4s ease}
.panneau.ouvert .panneau-tete i{transform:rotate(225deg)}
.panneau-corps{display:grid;grid-template-rows:0fr;transition:grid-template-rows .45s ease}
.panneau.ouvert .panneau-corps{grid-template-rows:1fr}
.panneau-in{overflow:hidden;min-height:0}
.corps-liste{padding:2px 20px 22px}
.corps-liste > p{margin:0 0 14px;color:var(--gris);font-size:14.5px}
.corps-liste h3{font-family:var(--titre);font-weight:600;font-size:18px;margin:22px 0 10px}
.bilan{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));border-top:1px solid var(--roche);border-left:1px solid var(--roche)}
.bilan div{padding:12px 14px;border-right:1px solid var(--roche);border-bottom:1px solid var(--roche);background:#faf9f5}
.bilan small{display:block;font-size:11.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--gris)}
.bilan b{display:block;font-family:var(--titre);font-size:28px;margin:2px 0}
.bilan span{font-size:13px;color:var(--roche)}
.bilan-note{margin:10px 0 0;font-size:12px;color:var(--gris)}
@media (prefers-reduced-motion:reduce){.panneau-corps,.panneau-tete i{transition:none}}
@media (max-width:719px){.panneaux{padding:24px 16px 24px}.panneau-tete{padding:14px 14px;flex-wrap:wrap;gap:2px 10px}.panneau-tete b{font-size:20px}.corps-liste{padding:2px 14px 18px}}
/* ---------- sous la carte ---------- */
.liste{max-width:1080px;margin:0 auto;padding:56px 28px 32px}
.liste h2{font-family:var(--titre);font-weight:600;font-size:28px;margin:0 0 4px;color:var(--sapin)}
.liste > p{margin:0 0 22px;color:var(--gris);font-size:14.5px}
.liste h3{font-family:var(--titre);font-weight:600;font-size:18px;margin:26px 0 10px}
.grille{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:0;border-top:1px solid var(--roche);border-left:1px solid var(--roche)}
.case{font:inherit;color:inherit;text-align:left;cursor:pointer;border:0;border-radius:0;border-right:1px solid var(--roche);border-bottom:1px solid var(--roche);padding:12px 14px;text-decoration:none;background:#faf9f5}
.case:hover{background:#fff}
.case.ex b{opacity:.45;font-style:italic}
.case small{display:block;font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--gris)}
.case strong{display:block;font-size:14.5px;font-weight:600;margin:2px 0 6px}
.case b{font-family:var(--titre);font-size:30px;font-weight:600;line-height:1}
.case em{display:block;font-style:normal;font-size:12px;color:var(--gris);margin-top:5px}
.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}
@media (max-width:720px){
.carte{min-height:0}
.cartouche{top:0;left:0;right:0;width:auto;padding:12px 16px 12px;border:0;outline:0;border-bottom:1px solid var(--pierre);
background:rgba(250,249,245,.9);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.cartouche h1{font-size:46px}
.cartouche{cursor:pointer;transition:padding .35s ease}
.pendule{display:none}
.cartouche h1{transition:font-size .35s ease,margin .35s ease}
.cartouche .phrase,.cartouche .reseau,.cartouche .date{max-height:160px;overflow:hidden;transition:max-height .35s ease,opacity .25s ease,margin .35s ease,padding .35s ease}
.cartouche.replie .phrase,.cartouche.replie .reseau,.cartouche.replie .date{max-height:0;opacity:0;margin-top:0;padding-top:0;border-top-color:transparent}
.cartouche.replie #retour,.cartouche.replie .outils{display:none}
.cartouche.replie h1{font-size:30px;margin-top:2px}
.cartouche.replie{padding-bottom:9px}
.cartouche .phrase{font-size:14.5px;margin-top:10px;padding-top:9px}
.legende{left:14px;bottom:14px}
.legende .credits{display:none}
.thermo{right:14px;bottom:14px}
.thermo i{width:110px}
.commandes{right:10px}
.suite{display:none}
.puce .val{font-size:18px}
.fiche{width:244px}
.liste{padding:40px 16px 24px}
.pied{padding:26px 16px 30px}
.pied-grille{grid-template-columns:1fr;gap:22px}
.sous-carte{padding:8px 16px 0}
}
.sanscookie{position:fixed;left:16px;bottom:16px;z-index:60;max-width:340px;padding:10px 34px 10px 14px;background:var(--calcaire);border:1px solid var(--sapin);box-shadow:0 0 0 3px var(--calcaire),0 0 0 4px var(--pierre);color:var(--roche);font-family:var(--texte);transition:opacity .5s}
.sanscookie.parti{opacity:0;pointer-events:none}
.sanscookie b{display:block;font-family:var(--titre);font-weight:600;font-size:15px;color:var(--sapin)}
.sanscookie span{font-size:12.5px;color:var(--gris)}
.sanscookie button{position:absolute;top:2px;right:4px;border:0;background:none;font-size:20px;line-height:1;color:var(--gris);cursor:pointer;padding:4px 6px}
@media (prefers-reduced-motion:reduce){.sanscookie{transition:none}}
/* ---------- à propos (bas de page) ---------- */
.apropos{max-width:1080px;margin:0 auto;padding:8px 28px 44px;display:grid;grid-template-columns:1fr 1fr;gap:14px 34px}
.apropos h2{font-family:var(--titre);font-weight:600;font-size:21px;margin:0 0 6px;color:var(--sapin)}
.apropos p{margin:0 0 8px;font-size:14.5px;color:var(--gris)}
.apropos a{color:var(--sapin);font-weight:600;text-underline-offset:3px}
@media (max-width:719px){.apropos{grid-template-columns:1fr;padding:6px 16px 32px}}
[data-aff=acces] .apropos p{font-size:17px;color:var(--roche)}
[data-aff=acces] .apropos a{text-decoration:underline}
/* ---------- revenir en haut ---------- */
.haut{position:fixed;right:16px;bottom:var(--haut-bas,16px);z-index:20;width:44px;height:44px;display:grid;place-items:center;padding:0;font:inherit;color:var(--sapin);background:rgba(250,249,245,.94);border:1px solid var(--roche);border-radius:0;cursor:pointer;opacity:1;transition:opacity .25s ease}
.haut svg{width:20px;height:20px}
.haut:hover{background:#fff}
.haut[hidden]{display:none}
.haut.cache{opacity:0;visibility:hidden}
[data-aff=acces] .haut{width:52px;height:52px;border-width:2px;background:#fff}
[data-aff=acces] .haut svg{width:26px;height:26px}
/* ---------- paramètres (roue du pied de page) ---------- */
.pied-bas a{color:inherit}
.pied-bas{display:flex;justify-content:space-between;align-items:center;gap:10px 16px;flex-wrap:wrap}
.prm-ouvrir{display:inline-flex;align-items:center;gap:7px;font:inherit;font-size:11.5px;font-weight:600;letter-spacing:.12em;text-transform:uppercase;line-height:1;color:#fff;background:none;border:1px solid #5d6166;border-radius:0;padding:7px 11px 7px 8px;cursor:pointer}
.prm-ouvrir:hover{background:#3b3e42;border-color:#9a9ea4}
.prm-ouvrir svg{width:18px;height:18px;flex:none}
.pied .prm-ouvrir:focus-visible{outline:2px solid #fff;outline-offset:2px}
.prm{width:min(360px,calc(100vw - 32px));max-height:calc(100vh - 32px);overflow:auto;margin:auto;padding:0;border:1px solid var(--roche);border-radius:0;background:var(--calcaire);color:var(--roche);font-family:var(--texte);font-size:14px;line-height:1.4}
.prm::backdrop{background:rgba(28,29,31,.45)}
.prm-in{padding:14px 18px 18px}
.prm-tete{display:flex;align-items:center;justify-content:space-between}
.prm h2{margin:0;font-family:var(--titre);font-weight:600;font-size:21px;color:var(--sapin)}
.prm-x{width:36px;height:36px;margin-right:-8px;font:inherit;font-size:24px;line-height:1;color:var(--gris);background:none;border:0;border-radius:0;cursor:pointer}
.prm-x:hover{color:var(--roche)}
.prm fieldset{min-width:0;margin:12px 0 0;padding:12px 0 0;border:0;border-top:1px solid var(--pierre)}
.prm legend{padding:0;font-size:11.5px;font-weight:600;letter-spacing:.12em;text-transform:uppercase;color:var(--gris)}
.prm-choix{display:flex;margin-top:8px}
.prm-choix label{position:relative;flex:1 1 0;min-width:0}
.prm-choix input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.prm-choix span{display:block;margin-left:-1px;padding:9px 4px;border:1px solid var(--sapin);background:#fff;color:var(--sapin);font-size:13px;font-weight:600;text-align:center;overflow-wrap:anywhere}
.prm-choix label:first-child span{margin-left:0}
.prm-choix input:checked+span{background:var(--sapin);color:#fff}
.prm-choix input:focus-visible+span{outline:2px solid var(--roche);outline-offset:2px;position:relative}
.prm .prm-aide{margin:7px 0 0;font-size:12.5px;color:var(--gris)}
.prm-case{display:flex;gap:10px;align-items:center;font-weight:600;cursor:pointer;min-height:32px}
.prm-case input{width:20px;height:20px;margin:0;flex:none;accent-color:var(--sapin)}
.prm fieldset.prm-sous{margin:12px 0 0;padding:0;border:0;min-width:0}
.prm .prm-sous legend{padding:0;font-size:13px;font-weight:600;letter-spacing:0;text-transform:none;color:var(--roche)}
.prm-choix input:disabled{cursor:default}
.prm-choix input:disabled+span{opacity:.45}
/* animations réduites : réglage du site (par défaut, celui de l'appareil) */
html.sans-anim{scroll-behavior:auto}
html.sans-anim *,html.sans-anim *::before,html.sans-anim *::after{animation:none!important;transition:none!important}
/* affichage « Accessibilité » : tout plus grand, contrastes renforcés */
html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
[data-aff=acces] .etq{text-shadow:0 0 2px #fff,0 0 2px #fff,0 0 3px #fff,0 0 5px #fff}
[data-aff=acces] .etq.village,[data-aff=acces] .etq.pic,[data-aff=acces] .etq.lieudit{font-size:14.5px}
[data-aff=acces] .etq.ville{font-size:13.5px;color:var(--roche)}
[data-aff=acces] .etq.pic small{font-size:12.5px}
[data-aff=acces] .etq.region,[data-aff=acces] .etq.fleuve{font-size:16px;opacity:1}
[data-aff=acces] .puce > button{background:#fff;border-width:2px;padding:5px 9px 6px}
[data-aff=acces] .puce .val{font-size:26px}
[data-aff=acces] .puce .nom{font-size:12.5px}
[data-aff=acces] .puce .n{font-size:12.5px}
[data-aff=acces] .commandes button{width:44px;height:44px;font-size:24px}
[data-aff=acces] .cartouche nav{font-size:13px}
[data-aff=acces] .cartouche nav a{color:var(--roche)}
[data-aff=acces] .cartouche .date,[data-aff=acces] .cartouche .reseau{font-size:14.5px}
[data-aff=acces] .cartouche .phrase{font-size:18px}
[data-aff=acces] #rech,[data-aff=acces] #rech-res li{font-size:16px;padding:10px}
[data-aff=acces] .record,[data-aff=acces] .record select{font-size:14px}
[data-aff=acces] #retour,[data-aff=acces] .pancarte{font-size:13.5px}
[data-aff=acces] .legende,[data-aff=acces] .thermo,[data-aff=acces] .sous-carte,[data-aff=acces] .aide{font-size:14px;color:var(--roche)}
[data-aff=acces] .suite{font-size:14px;background-color:rgba(250,249,245,.9)}
[data-aff=acces] .modes button{font-size:14px;padding:11px 16px}
[data-aff=acces] .temps button{width:46px;height:42px;font-size:16px}
[data-aff=acces] .temps output{font-size:15px}
[data-aff=acces] .fiche{width:310px}
[data-aff=acces] .fiche h3{font-size:20px}
[data-aff=acces] .fiche li span{font-size:15.5px}
[data-aff=acces] .fiche li b{font-size:22px}
[data-aff=acces] .fiche li em{font-size:13.5px;color:var(--roche)}
[data-aff=acces] .fiche .pleinbtn{font-size:13.5px;padding:10px 12px}
[data-aff=acces] .fiche .zoom{font-size:15px}
[data-aff=acces] .liste h2,[data-aff=acces] .plein-corps h2{font-size:32px}
[data-aff=acces] .liste > p,[data-aff=acces] .corps-liste > p,[data-aff=acces] .coupe-lect{font-size:17px;color:var(--roche)}
[data-aff=acces] #coupe-svg text{font-size:13.5px}
[data-aff=acces] .panneau{border-width:2px}
[data-aff=acces] .panneau-tete b{font-size:27px}
[data-aff=acces] .panneau-tete small{font-size:15.5px}
[data-aff=acces] .case small{font-size:13px}
[data-aff=acces] .case strong{font-size:17px}
[data-aff=acces] .case b{font-size:35px}
[data-aff=acces] .bilan small{font-size:13px}
[data-aff=acces] .bilan span,[data-aff=acces] .bilan-note{font-size:15px}
/* le cartouche grandit : l'encadré du forum quitte la carte pour la barre sous la carte */
[data-aff=acces] .carte .forum-box{display:none}
[data-aff=acces] .forum-box.mobile{display:block;position:static;width:auto;max-width:440px;flex:0 0 100%;margin:6px 0 4px}
[data-aff=acces] .fb-haut small,[data-aff=acces] .fb-une small{font-size:12.5px}
[data-aff=acces] .fb-une a{font-size:19px}
[data-aff=acces] .fb-une span,[data-aff=acces] .fb-co,[data-aff=acces] .fb-bas{font-size:14px}
[data-aff=acces] .fb-cta{font-size:14.5px}
[data-aff=acces] .plein-ferme,[data-aff=acces] .plein-onglets button,[data-aff=acces] .plein-carte{font-size:14.5px;padding:10px 13px}
[data-aff=acces] .plein-sous,[data-aff=acces] .plein-val span,[data-aff=acces] .g-mm,[data-aff=acces] .g-lect,[data-aff=acces] .plein-note,[data-aff=acces] .plein-attente{font-size:15px;color:var(--roche)}
[data-aff=acces] .graphe h3{font-size:20px}
[data-aff=acces] .graphe > svg{font-size:12.5px;fill:var(--roche)}
[data-aff=acces] .origine{font-size:14px}
[data-aff=acces] .pied{font-size:15.5px;color:#f1f2f3}
[data-aff=acces] .pied a{color:#fff;text-decoration:underline;text-underline-offset:3px}
[data-aff=acces] .pied h4{font-size:13.5px}
[data-aff=acces] .pied-bas{font-size:14px;color:#d4d6d9}
[data-aff=acces] .prm-ouvrir{font-size:13.5px;padding:10px 14px 10px 10px;border-color:#c4c7cc}
[data-aff=acces] .prm{font-size:16px}
[data-aff=acces] .prm-choix span{font-size:15px;padding:12px 4px}
[data-aff=acces] .prm legend{font-size:13px}
[data-aff=acces] .prm .prm-sous legend{font-size:15px}
[data-aff=acces] .prm .prm-aide{font-size:14.5px;color:var(--roche)}
[data-aff=acces] .sanscookie span{font-size:14.5px;color:var(--roche)}
[data-aff=acces] a:focus-visible,[data-aff=acces] button:focus-visible,[data-aff=acces] input:focus-visible,[data-aff=acces] select:focus-visible{outline-width:3px}
/* affichage « Minimaliste » : petites étiquettes (le degré à côté du nom), liste compacte */
[data-aff=mini] .puce > button{display:flex;align-items:baseline;gap:5px;padding:2px 6px 3px}
[data-aff=mini] .puce .nom{order:-1;margin:0;font-size:9.5px}
[data-aff=mini] .puce .val{font-size:12.5px}
[data-aff=mini] .puce .n{margin:0;padding:0 3px;font-size:9px;vertical-align:0}
[data-aff=mini] .grille{grid-template-columns:repeat(auto-fill,minmax(260px,1fr))}
@media (min-width:900px){[data-aff=mini] .grille{grid-template-columns:repeat(3,minmax(0,1fr))}}
[data-aff=mini] .case{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:12px;padding:8px 12px}
[data-aff=mini] .case small{grid-column:1;font-size:10px}
[data-aff=mini] .case strong{grid-column:1;grid-row:2;margin:1px 0 0;font-size:13.5px}
[data-aff=mini] .case b{grid-column:2;grid-row:1/3;font-size:19px}
</style>
</head>
<body>
<main class="carte ouverture" id="carte" aria-label="Carte des stations météo du Vercors" data-i18n-a="aria-label:carte.aria">
<!--SVG-->
<div class="calque" id="calque"></div>
<div class="commandes" id="commandes"><button type="button" id="plus" aria-label="Zoomer" data-i18n-a="aria-label:zoom.plus">+</button><button type="button" id="moins" aria-label="Dézoomer" data-i18n-a="aria-label:zoom.moins">−</button></div>
<header class="cartouche" id="cartouche">
<nav><span data-i18n="nav.meteo">Météo</span><div><a href="#stations" data-i18n="nav.stations">Stations</a><a href="climat.html" data-i18n="nav.climat">Climat</a><a href="a-propos.html" data-i18n="nav.apropos">À propos</a></div></nav>
<h1>Vercors</h1>
<p class="date" id="date" data-i18n="date.exemple">Mardi 3 novembre · relevés de 7 h 40</p>
<p class="phrase" id="phrase"></p>
<p class="reseau" id="reseau"></p>
<div class="outils" id="outils">
<div class="rech"><input type="search" id="rech" placeholder="Une station, un village…" autocomplete="off" aria-label="Chercher une station ou un village" data-i18n-a="placeholder:rech.ph;aria-label:rech.aria"><ul id="rech-res" hidden></ul></div>
<!-- Réglage saisonnier masqué : il se réglera plus tard dans l'admin du site (RECORD : auto = saison météo, ou froid / chaud / vent / pluie). -->
<label class="record" hidden><span data-i18n="record.label">Mise en avant</span> <select id="record"><option value="auto" data-i18n="record.auto">Selon la saison</option><option value="froid" data-i18n="record.froid">Plus froid</option><option value="chaud" data-i18n="record.chaud">Plus chaud</option><option value="vent" data-i18n="record.vent">Plus de vent</option><option value="pluie" data-i18n="record.pluie">Plus de pluie</option></select></label>
</div>
<button type="button" id="retour" data-i18n="retour">← Tout le massif</button>
<div class="pendule" id="pendule" aria-live="polite"><i class="corde g"></i><i class="corde d"></i>
<span class="pancarte" id="direct" data-i18n="direct.attente" data-i18n-a="title:pancarte.titre" title="Glisser pour déplacer, double-clic pour remettre en place">Relevés en cours…</span></div>
</header>
<div class="legende" id="legende">
<div class="echelle"><i id="barre"></i><span id="km">5 km</span></div>
</div>
<a class="suite" href="#stations" data-i18n="suite">Toutes les stations ↓</a>
<div class="forum-box">
<div class="fb-haut"><b data-i18n="fb.titre">Forum</b><small data-n></small></div>
<div class="fb-une"><small data-i18n="fb.une">À la une · Récapitulatif de la semaine</small><a href="/forum/" data-une data-i18n="fb.lien">Le récapitulatif de la semaine arrive ici</a><span data-auteur></span><p data-extrait hidden></p></div>
<a class="fb-cta" href="/forum/" data-i18n="fb.cta">Rejoindre la discussion →</a>
<p class="fb-co"><span data-i18n="fb.co">Déjà un compte ?</span> <a href="/forum/connexion/gastinel"><span class="g" aria-hidden="true">G</span><span data-i18n="fb.connexion">Se connecter avec Gastinel</span></a></p>
<div class="fb-bas"><span class="gcarre" aria-hidden="true">G</span><span data-i18n-html="fb.bas"><strong>L'écosystème Gastinel.</strong> Un compte pour le forum, vos favoris et toutes nos applications. Sans publicité, une alternative aux GAFAM.</span></div>
</div>
<div class="thermo" id="thermo"><i id="degrade"></i><span><span>−10°</span><span>0°</span><span>+15°</span></span></div>
</main>
<p class="sous-carte" data-i18n="sous-carte">Courbes de niveau tous les 100 m · zoom : molette (PC) ou deux doigts (téléphone)</p>
<div class="reglages" id="reglages"><div class="modes" id="modes" role="group" aria-label="Valeur affichée sur les étiquettes" data-i18n-a="aria-label:modes.aria"><button type="button" data-mode="t" aria-pressed="true" data-i18n="mode.t">Temp</button><button type="button" data-mode="alt" aria-pressed="false" data-i18n="mode.alt" data-i18n-a="title:mode.alt.titre" title="Classe la liste par altitude : un clic croissant, un deuxième clic décroissant">Alt</button><button type="button" data-mode="vent" aria-pressed="false" data-i18n="mode.vent" data-i18n-a="title:mode.vent.titre" title="Seules les stations qui mesurent le vent">Vent</button><button type="button" data-mode="pluie" aria-pressed="false" data-i18n="mode.pluie" data-i18n-a="title:mode.pluie.titre" title="Seules les stations qui mesurent la pluie">Pluie</button></div>
<div class="temps" id="temps"><button type="button" id="lecture" aria-label="Rejouer les dernières 24 heures" disabled>▶</button><input type="range" id="curseur" min="0" max="0" step="1" value="0" disabled aria-label="Remonter le temps, sept jours" data-i18n-a="aria-label:curseur.aria"><output id="temps-txt" for="curseur" data-i18n="temps.maintenant">Maintenant</output></div>
<p class="aide" data-i18n="aide">Ces choix valent aussi pour la liste des stations, plus bas.</p>
<div class="forum-box mobile">
<div class="fb-haut"><b data-i18n="fb.titre">Forum</b><small data-n></small></div>
<div class="fb-une"><small data-i18n="fb.une">À la une · Récapitulatif de la semaine</small><a href="/forum/" data-une data-i18n="fb.lien">Le récapitulatif de la semaine arrive ici</a><span data-auteur></span><p data-extrait hidden></p></div>
<a class="fb-cta" href="/forum/" data-i18n="fb.cta">Rejoindre la discussion →</a>
<p class="fb-co"><span data-i18n="fb.co">Déjà un compte ?</span> <a href="/forum/connexion/gastinel"><span class="g" aria-hidden="true">G</span><span data-i18n="fb.connexion">Se connecter avec Gastinel</span></a></p>
<div class="fb-bas"><span class="gcarre" aria-hidden="true">G</span><span data-i18n-html="fb.bas"><strong>L'écosystème Gastinel.</strong> Un compte pour le forum, vos favoris et toutes nos applications. Sans publicité, une alternative aux GAFAM.</span></div>
</div>
</div>
<section class="panneaux panneaux-coupe" id="coupe">
<div class="panneau" id="p-coupe">
<button type="button" class="panneau-tete" aria-expanded="false" aria-controls="c-coupe"><b data-i18n="coupe.titre">La coupe du massif</b><small data-i18n="coupe.sous">altitude et température</small><i aria-hidden="true"></i></button>
<div class="panneau-corps" id="c-coupe" inert><div class="panneau-in"><div class="corps-liste coupe">
<p data-i18n="coupe.intro">Chaque carré est une station : plus il est haut, plus la station est en altitude ; plus il est à gauche, plus il y fait froid. En général, plus on monte, plus il fait froid (la ligne verte). Mais par nuit calme, l’air froid glisse et s’accumule au fond des combes : il fait alors plus chaud plus haut, c’est une « inversion ».</p>
<p class="coupe-etat" id="coupe-txt"></p>
<div id="coupe-svg"></div>
<p class="coupe-lect" id="coupe-lect" aria-live="polite" data-i18n="coupe.survol">Survole ou touche une station.</p>
</div></div></div>
</div>
</section>
<section class="panneaux" id="stations">
<div class="panneau" id="p-stations">
<button type="button" class="panneau-tete" aria-expanded="false" aria-controls="c-stations"><b data-i18n="pan.stations">Les stations</b><small data-i18n="pan.stations.sous">toutes, du nord au sud</small><i aria-hidden="true"></i></button>
<div class="panneau-corps" id="c-stations" inert><div class="panneau-in"><div class="corps-liste">
<p data-i18n="pan.stations.txt">Sur la carte : une valeur par village ou par site ; le détail ici.</p>
<div id="secteurs"></div>
</div></div></div>
</div>
<div class="panneau ouvert" id="p-bilan">
<button type="button" class="panneau-tete" aria-expanded="true" aria-controls="c-bilan"><b data-i18n="pan.bilan">Bilan de la semaine</b><small data-i18n="pan.bilan.sous">records des 7 derniers jours</small><i aria-hidden="true"></i></button>
<div class="panneau-corps" id="c-bilan"><div class="panneau-in"><div class="corps-liste" id="bilan" data-i18n="charge">Chargement…</div></div></div>
</div>
</section>
<section class="apropos" aria-labelledby="ap-site-t">
<div>
<h2 id="ap-site-t" data-i18n="ap.site.t">À propos de ce site</h2>
<p data-i18n="ap.site.txt">Météo Vercors montre sur une carte la température, le vent et la pluie mesurés dans le Vercors, au plus près de chez vous. Sans publicité et sans suivi.</p>
<p><a href="a-propos.html" data-i18n="ap.site.lien">Sources, licences et mentions →</a></p>
</div>
<div>
<h2 data-i18n="ap.g.t">À propos de Gastinel</h2>
<p data-i18n="ap.g.txt">Gastinel est une micro-entreprise de Théo Gastinel, à Lans-en-Vercors. Le compte Gastinel sert à se connecter au forum et aux services Gastinel.</p>
<p><a href="https://gastinel.me" rel="noopener" data-i18n="ap.g.lien">Voir le portfolio, gastinel.me →</a></p>
</div>
</section>
<footer class="pied">
<dialog class="prm" id="prm" aria-labelledby="prm-titre"><div class="prm-in">
<div class="prm-tete"><h2 id="prm-titre" data-i18n="prm.titre">Paramètres</h2><button type="button" class="prm-x" aria-label="Fermer" data-i18n-a="aria-label:fermer">×</button></div>
<fieldset><legend data-i18n="prm.langue">Langue</legend>
<div class="prm-choix"><label><input type="radio" name="prm-langue" value="fr"><span lang="fr">Français</span></label><label><input type="radio" name="prm-langue" value="en"><span lang="en">English</span></label><label><input type="radio" name="prm-langue" value="de"><span lang="de">Deutsch</span></label></div></fieldset>
<fieldset><legend data-i18n="prm.affichage">Affichage</legend>
<div class="prm-choix"><label><input type="radio" name="prm-aff" value="acces" aria-describedby="prm-aff-aide"><span data-i18n="prm.acces">Accessibilité</span></label><label><input type="radio" name="prm-aff" value="normal" aria-describedby="prm-aff-aide"><span data-i18n="prm.normal">Normal</span></label><label><input type="radio" name="prm-aff" value="mini" aria-describedby="prm-aff-aide"><span data-i18n="prm.mini">Minimaliste</span></label></div>
<p class="prm-aide" id="prm-aff-aide"></p></fieldset>
<fieldset><legend data-i18n="prm.mouvement">Mouvement</legend>
<label class="prm-case"><input type="checkbox" id="prm-anim" aria-describedby="prm-anim-aide"><span data-i18n="prm.anim">Animations réduites</span></label>
<p class="prm-aide" id="prm-anim-aide" data-i18n="prm.anim.aide">Par défaut, suit le réglage de l'appareil.</p>
<fieldset class="prm-sous"><legend data-i18n="prm.intro">Animation d'arrivée de la carte</legend>
<div class="prm-choix"><label><input type="radio" name="prm-intro" value="longue" aria-describedby="prm-intro-aide"><span data-i18n="prm.intro.longue">Plus longue</span></label><label><input type="radio" name="prm-intro" value="normale" aria-describedby="prm-intro-aide"><span data-i18n="prm.intro.normale">Normale</span></label><label><input type="radio" name="prm-intro" value="aucune" aria-describedby="prm-intro-aide"><span data-i18n="prm.intro.aucune">Aucune</span></label></div>
<p class="prm-aide" id="prm-intro-aide"></p></fieldset></fieldset>
</div></dialog>
<div class="pied-grille">
<div>
<p class="accroche" data-i18n="pied.accroche">Des stations de chez nous, des chiffres d'ici.</p>
<p data-i18n="pied.donnees">Données : Météo-France (Licence Ouverte), ROMMA (avec l'accord de l'association), stations de la famille Gastinel (WeatherLink, ROMMA, Infoclimat). Fond de carte : IGN, licence ouverte.</p>
</div>
<div>
<h4 data-i18n="pied.contact">Contact</h4>
<ul><li><a href="mailto:studio@gastinel.me">studio@gastinel.me</a></li>
<li><a href="https://wa.me/message/XAHBYTJZNQ6TK1" rel="noopener">WhatsApp</a></li>
<li><a href="tel:+33636276419">06 36 27 64 19</a></li></ul>
</div>
<div>
<h4 data-i18n="pied.site">Le site</h4>
<ul><li><a href="a-propos.html" data-i18n="nav.apropos">À propos</a></li><li><a href="a-propos.html#sources" data-i18n="pied.sources">Sources et licences</a></li><li><a href="a-propos.html#mentions" data-i18n="pied.mentions">Mentions légales</a></li><li><a href="cgu.html" data-i18n="pied.cgu">CGU</a></li><li><a href="confidentialite.html" data-i18n="pied.confid">Confidentialité</a></li><li><a href="statistiques.html" data-i18n="pied.stats">Statistiques du site</a></li></ul>
<p>SIRET <a href="https://entreprises.lefigaro.fr/nd-38/entreprise-104816749" rel="noopener">10481674900014</a></p>
</div>
</div>
<p class="pied-bas"><span>© Théo Gastinel · Météo Vercors · <a href="charte.html" data-i18n="pied.charte">Charte graphique</a></span><button type="button" class="prm-ouvrir" id="prm-ouvrir" aria-haspopup="dialog" aria-controls="prm"><svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor"><circle cx="12" cy="12" r="6.2" stroke-width="2"/><circle cx="12" cy="12" r="2.4" stroke-width="2"/><path stroke-width="2.6" d="M12 1.8v3.4M12 18.8v3.4M1.8 12h3.4M18.8 12h3.4M4.8 4.8l2.4 2.4M16.8 16.8l2.4 2.4M4.8 19.2l2.4-2.4M16.8 7.2l2.4-2.4"/></svg><span data-i18n="prm.titre">Paramètres</span></button></p>
</footer>
<button type="button" class="haut cache" id="haut" aria-label="Revenir en haut de la page" title="Revenir en haut" data-i18n-a="aria-label:haut.aria;title:haut.titre"><svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2.4"><path d="M12 20V5M5 11.5 12 4.5l7 7"/></svg></button>
<noscript><p style="max-width:640px;margin:0 auto;padding:16px;font-family:system-ui">Météo Vercors a besoin de JavaScript pour afficher la carte et les relevés en direct. Les sources et les mentions légales sont sur la page <a href="a-propos.html">À propos</a>.</p></noscript>
<script>
const C = /*CARTE*/;
const ETIQ = /*ETIQUETTES*/;
const FORUM_OUVERT = true; // ouvert le 05/11/2026 (vercors.me/forum, connexion Gastinel)
// ---- paramètres : langue, affichage, animations ----
// Gardés dans ce navigateur seulement (clé vm-reglages, avec la date du dernier changement ; effacés après 13 mois).
// vmReglages.exporter() / vmReglages.importer(objet) : pour les synchroniser plus tard avec le compte Gastinel.
const CLE_REGLAGES = 'vm-reglages', LANGUES = ['fr', 'en', 'de'], AFFICHAGES = ['acces', 'normal', 'mini'], INTROS = ['longue', 'normale', 'aucune'];
const LOC = {fr: 'fr-FR', en: 'en-GB', de: 'de-DE'};
const sysReduit = matchMedia('(prefers-reduced-motion: reduce)');
// anim : null = suit l'appareil, true = animations réduites, false = animations normales
function reglagesValides(o){
const r = {langue: 'fr', affichage: 'normal', anim: null, intro: 'normale', pancarte: null};
if (o && typeof o === 'object') {
if (LANGUES.includes(o.langue)) r.langue = o.langue;
if (AFFICHAGES.includes(o.affichage)) r.affichage = o.affichage;
if (typeof o.anim === 'boolean') r.anim = o.anim;
if (INTROS.includes(o.intro)) r.intro = o.intro;
// pancarte du direct déplacée : écart en pixels par rapport à sa place d'origine
const q = o.pancarte;
if (q && Number.isFinite(q.x) && Number.isFinite(q.y) && (q.x || q.y)) r.pancarte = {x: Math.max(-4000, Math.min(4000, Math.round(q.x))), y: Math.max(-4000, Math.min(4000, Math.round(q.y)))};
}
return r;
}
let REG = reglagesValides(null), REG_DATE = 0;
try {
const o = JSON.parse(localStorage.getItem(CLE_REGLAGES) || 'null'), limite = new Date();
limite.setMonth(limite.getMonth() - 13);
if (o && !(o.date > limite.getTime())) localStorage.removeItem(CLE_REGLAGES);
else if (o) { REG = reglagesValides(o); REG_DATE = o.date; }
} catch (e) {}
function enregistrerReglages(){
REG_DATE = Date.now();
try { localStorage.setItem(CLE_REGLAGES, JSON.stringify({v: 1, date: REG_DATE, ...REG})); } catch (e) {}
}
let L = REG.langue, reduit = REG.anim ?? sysReduit.matches, relancerPendule = () => {}, placerPancarte = () => {};
const dec = s => L === 'en' ? s : s.replace('.', ',');
// textes de l'interface. Le français du HTML est relevé dans la page (clés absentes de I18N.fr) ;
// les noms de stations et de lieux ne sont jamais traduits.
const I18N = {
fr: {
'fb.auteur': nom => `par ${nom}`, 'fb.compte': n => `${n} ${n === 1 ? 'sujet' : 'sujets'} sur 7 jours`,
moment: h => h < 5 ? 'Cette nuit' : h < 12 ? 'Ce matin' : h < 18 ? 'Cet après-midi' : h < 23 ? 'Ce soir' : 'Cette nuit',
'phrase.charge': 'Relevés en cours de chargement…',
'reseau.n': n => `${n} stations dans le massif`,
'reseau.direct': (a, n) => `${a} stations en direct sur ${n} · Météo-France, Infoclimat, station Gastinel`,
'ph.chaud': (m, v, l) => `${m}, <strong>${v} à ${l}</strong>, le point le plus chaud du massif en ce moment.`,
'ph.ecart': (m, v1, l1, v2, l2) => `${m}, de <strong>${v1} à ${l1}</strong> à <strong>${v2} à ${l2}</strong> : le plus froid et le plus chaud du massif.`,
'ph.vent': (m, v, l) => `${m}, <strong>${v} km/h à ${l}</strong>, le vent moyen le plus fort du massif.`,
'ph.vent0': m => `${m}, aucun vent mesuré pour l'instant.`,
'ph.pluie': (m, v, l) => `${m}, <strong>${v} mm en une heure à ${l}</strong>, la pluie la plus forte du massif.`,
'ph.pluie0': m => `${m}, pas de pluie mesurée dans le massif.`,
'ph.froid': (m, v, l) => `${m}, <strong>${v} à ${l}</strong>, le point le plus froid du massif en ce moment.`,
'ph.inversion': (dz, l, v) => ` ${dz} m plus haut, ${l} : ${v}. L'air froid est resté au fond.`,
'direct.releves': (h, q) => `Relevés de ${h} · ${q}`,
'direct.instant': 'à l’instant', 'direct.min': n => `il y a ${n} min`, 'direct.h': n => `il y a ${n} h`,
'lecture.rejouer': 'Rejouer les dernières 24 heures', 'lecture.pause': 'Mettre en pause',
'fiche.alentours': ' et alentours', 'fiche.plein': 'Ouvrir en plein écran →', 'fiche.zoom': 'Zoomer sur ce secteur →',
'etat.direct0': 'pas de données en direct', 'etat.hl': 'hors ligne', 'etat.donnees0': 'pas de données',
vient: s => 'Vient ' + (/^[AEIOUÉ]/i.test(s) ? "d'" : 'de ') + s, 'voir.station': 'Voir la station : ',
'coupe.normal': '- - refroidissement normal', 'coupe.aria': 'Température des stations selon l\'altitude',
'coupe.st': (n, a, v) => `${n}, ${a} mètres, ${v}`,
'coupe.plat': 'En ce moment, il fait presque la même température à toutes les altitudes : pas d’inversion, pas de refroidissement net.',
'coupe.inv': p => `Inversion : en ce moment, il fait plus chaud en altitude (${p} °C de plus tous les 100 m en moyenne). Les combes sont les plus froides.`,
'coupe.baisse': p => `La température baisse de ${p} °C tous les 100 m en moyenne ; la ligne verte montre le refroidissement normal (0,65 °C).`,
'bilan.vide': 'Pas encore assez de relevés.', 'bilan.froid': 'Le plus froid', 'bilan.chaud': 'Le plus chaud',
'bilan.vent': 'Vent moyen maximal', 'bilan.pluie': 'Pluie la plus forte en 1 h', 'bilan.aucune': 'aucune mesure',
'bilan.note': j => `L'archive couvre ${j} jours pour l'instant ; elle se complète jour après jour.`,
'forum.bientot': 'Bientôt', 'forum.ouverture': 'Ouverture prochainement',
'forum.recap': 'Le récapitulatif de la semaine, par les adhérents, arrive bientôt.',
'plein.aria': 'Détail de la station', 'plein.retour': '← Retour à la carte', 'plein.carte': 'Voir sur la carte',
'plein.charge': 'Chargement des courbes…', 'plein.vide': 'Pas encore de courbes pour cette station.',
'g.t': 'Température', 'g.h': 'Humidité', 'g.v': 'Vent moyen', 'g.r': 'Pluie (par heure)', 'g.gel': 'gel',
'g.mm': (a, b) => `mini ${a} · maxi ${b}`,
'g.periode': 'Période des courbes', 'g.jour': '24 h', 'g.semaine': '7 jours',
'g.lacune': 'Courbe de température : des relevés manquent pendant au moins 3 h sur cette période.', 'g.lacune.lans': 'À Lans village, la réception des relevés est parfois difficile.', 'g.lacune.geve': 'À Gêve, une coupure de la Livebox peut interrompre les relevés.',
'g.note': (j, depuis, min) => `Courbes par pas de ${min} minutes sur ${j} jour${j > 1 ? 's' : ''}${depuis ? ` · archive depuis le ${depuis}` : ''}. Le zéro est marqué « gel ».`,
'fiche.titre': 'Fiche de la station', 'fiche.alt': 'Altitude', 'fiche.proprio': 'Propriétaires', 'fiche.source': 'Source des relevés', 'fiche.voir': 'Ailleurs',
'fiche.bientot': 'Photos et sujet de la station sur le forum : bientôt.', 'fiche.sujet': 'Voir le sujet de la station · Poster une photo',
'fiche.forum': 'Aller au forum', 'fiche.photo': a => `Photo de la station, publiée par ${a}`,
'type.station': 'station', 'type.commune': 'commune', 'type.sommet': 'sommet',
'cookie.titre': 'Non, désolé, je ne veux pas de cookie,<br>Je n\'ai pas faim, ni envie de me faire traquer.',
'cookie.txt': 'Ici, rien à accepter : ni cookie de suivi, ni publicité.',
'prm.intro': 'Animation d’arrivée de la carte', 'prm.intro.longue': 'Plus longue', 'prm.intro.normale': 'Normale', 'prm.intro.aucune': 'Aucune',
'intro.aide': 'Visible au prochain affichage de la page.', 'intro.aide.red': 'Désactivée tant que « Animations réduites » est cochée.',
'pancarte.titre': 'Glisser pour déplacer, double-clic pour remettre en place', 'pied.stats': 'Statistiques du site',
'aff.acces': 'Textes, étiquettes et boutons plus grands, contrastes renforcés.',
'aff.normal': 'L’affichage habituel.',
'aff.mini': 'Petites étiquettes, le degré à côté du nom ; liste des stations compacte.',
},
en: {
titre: 'Météo Vercors: temperatures across the Vercors, station by station',
'carte.aria': 'Map of the Vercors weather stations', 'zoom.plus': 'Zoom in', 'zoom.moins': 'Zoom out',
'nav.meteo': 'Weather', 'nav.stations': 'Stations', 'nav.climat': 'Climate', 'nav.apropos': 'About',
'date.exemple': 'Tuesday 3 November · readings from 7:40',
'rech.ph': 'A station, a village…', 'rech.aria': 'Search for a station or a village',
'record.label': 'Highlight', 'record.auto': 'By season', 'record.froid': 'Coldest', 'record.chaud': 'Warmest', 'record.vent': 'Windiest', 'record.pluie': 'Wettest',
retour: '← Whole massif', 'direct.attente': 'Loading readings…', suite: 'All stations ↓',
'fb.titre': 'Forum', 'fb.une': 'Featured · Weekly summary', 'fb.lien': 'The weekly summary will appear here', 'fb.cta': 'Join the discussion →',
'fb.auteur': nom => `by ${nom}`, 'fb.compte': n => `${n} ${n === 1 ? 'topic' : 'topics'} in 7 days`,
'fb.co': 'Already have an account?', 'fb.connexion': 'Sign in with Gastinel',
'fb.bas': '<strong>The Gastinel ecosystem.</strong> One account for the forum, your favourites and all our apps. No ads, an alternative to Big Tech.',
'sous-carte': 'Contour lines every 100 m · zoom: mouse wheel (PC) or two fingers (phone)',
'modes.aria': 'Value shown on the labels', 'mode.t': 'Temp', 'mode.alt': 'Alt', 'mode.vent': 'Wind', 'mode.pluie': 'Rain',
'mode.alt.titre': 'Sorts the list by altitude: one click ascending, a second click descending',
'mode.vent.titre': 'Only the stations that measure wind', 'mode.pluie.titre': 'Only the stations that measure rain',
'curseur.aria': 'Go back in time, seven days', 'temps.maintenant': 'Now',
aide: 'These choices also apply to the station list below.',
'coupe.titre': 'Cross-section of the massif',
'coupe.txt': 'Each square is a station: the higher it is, the higher the station; the further left, the colder it is.',
'coupe.survol': 'Hover over or tap a station.',
'pan.stations': 'The stations', 'pan.stations.sous': 'all of them, north to south', 'pan.stations.txt': 'On the map: one value per village or site; the details are here.',
'coupe.sous': 'altitude and temperature',
'coupe.intro': 'Each square is a station: the higher it is, the higher the station; the further left, the colder it is. Usually, the higher you go, the colder it gets (the green line). But on calm nights, cold air slides down and pools at the bottom of the hollows, so it is warmer higher up: this is called an “inversion”.',
'haut.aria': 'Back to the top of the page', 'haut.titre': 'Back to top',
'ap.site.t': 'About this site', 'ap.site.txt': 'Météo Vercors shows on a map the temperature, wind and rain measured in the Vercors, as close to home as possible. No advertising, no tracking.', 'ap.site.lien': 'Sources, licences and legal notice →',
'ap.g.t': 'About Gastinel', 'ap.g.txt': 'Gastinel is a micro-business run by Théo Gastinel, in Lans-en-Vercors. The Gastinel account is used to sign in to the forum and to Gastinel services.', 'ap.g.lien': 'See the portfolio, gastinel.me →',
'pan.bilan': 'Week in review', 'pan.bilan.sous': 'records of the last 7 days', charge: 'Loading…',
'pied.accroche': 'Our own stations, local figures.',
'pied.donnees': 'Data: Météo-France (Licence Ouverte), ROMMA (with the association’s agreement), the Gastinel family’s stations (WeatherLink, ROMMA, Infoclimat). Base map: IGN, open licence.',
'pied.contact': 'Contact', 'pied.charte': 'Design guidelines', 'pied.site': 'The site', 'pied.sources': 'Sources and licences', 'pied.mentions': 'Legal notice', 'pied.cgu': 'Terms of use', 'pied.confid': 'Privacy',
'prm.titre': 'Settings', fermer: 'Close', 'prm.langue': 'Language', 'prm.affichage': 'Display', 'prm.acces': 'Accessibility', 'prm.normal': 'Normal', 'prm.mini': 'Minimal',
'prm.mouvement': 'Motion', 'prm.anim': 'Reduced animations', 'prm.anim.aide': 'By default, follows your device setting.',
'prm.intro': 'Map arrival animation', 'prm.intro.longue': 'Longer', 'prm.intro.normale': 'Normal', 'prm.intro.aucune': 'None',
'intro.aide': 'Applies the next time the page is shown.', 'intro.aide.red': 'Off while “Reduced animations” is ticked.',
'pancarte.titre': 'Drag to move, double-click to put it back', 'pied.stats': 'Site statistics',
'aff.acces': 'Larger text, labels and buttons, stronger contrast.', 'aff.normal': 'The usual display.',
'aff.mini': 'Small labels with the temperature next to the name; compact station list.',
moment: h => h < 5 ? 'Tonight' : h < 12 ? 'This morning' : h < 18 ? 'This afternoon' : h < 23 ? 'This evening' : 'Tonight',
'phrase.charge': 'Loading readings…',
'reseau.n': n => `${n} stations in the massif`,
'reseau.direct': (a, n) => `${a} of ${n} stations live · Météo-France, Infoclimat, Gastinel station`,
'ph.chaud': (m, v, l) => `${m}, <strong>${v} in ${l}</strong>, the warmest spot in the massif right now.`,
'ph.ecart': (m, v1, l1, v2, l2) => `${m}, from <strong>${v1} in ${l1}</strong> to <strong>${v2} in ${l2}</strong>: the coldest and the warmest in the massif.`,
'ph.vent': (m, v, l) => `${m}, <strong>${v} km/h in ${l}</strong>, the strongest average wind in the massif.`,
'ph.vent0': m => `${m}, no wind measured so far.`,
'ph.pluie': (m, v, l) => `${m}, <strong>${v} mm in one hour in ${l}</strong>, the heaviest rain in the massif.`,
'ph.pluie0': m => `${m}, no rain measured in the massif.`,
'ph.froid': (m, v, l) => `${m}, <strong>${v} in ${l}</strong>, the coldest spot in the massif right now.`,
'ph.inversion': (dz, l, v) => ` ${dz} m higher up, ${l}: ${v}. The cold air has stayed at the bottom.`,
'direct.releves': (h, q) => `Readings from ${h} · ${q}`,
'direct.instant': 'just now', 'direct.min': n => `${n} min ago`, 'direct.h': n => `${n} h ago`,
'lecture.rejouer': 'Replay the last 24 hours', 'lecture.pause': 'Pause',
'fiche.alentours': ' and around', 'fiche.plein': 'Open full screen →', 'fiche.zoom': 'Zoom in on this area →',
'etat.direct0': 'no live data', 'etat.hl': 'offline', 'etat.donnees0': 'no data',
vient: s => 'From ' + s, 'voir.station': 'See the station: ',
'coupe.normal': '- - normal cooling', 'coupe.aria': 'Station temperatures by altitude',
'coupe.st': (n, a, v) => `${n}, ${a} metres, ${v}`,
'coupe.plat': 'Right now, the temperature is almost the same at every altitude: no inversion, no clear cooling.',
'coupe.inv': p => `Inversion: right now it is warmer higher up (${p} °C more every 100 m on average). The hollows are the coldest.`,
'coupe.baisse': p => `The temperature drops by ${p} °C every 100 m on average; the green line shows normal cooling (0.65 °C).`,
'bilan.vide': 'Not enough readings yet.', 'bilan.froid': 'Coldest', 'bilan.chaud': 'Warmest',
'bilan.vent': 'Highest average wind', 'bilan.pluie': 'Heaviest rain in 1 h', 'bilan.aucune': 'no measurement',
'bilan.note': j => `The archive covers ${j} days so far; it fills up day by day.`,
'forum.bientot': 'Coming soon', 'forum.ouverture': 'Opening soon',
'forum.recap': 'The weekly summary, written by members, is coming soon.',
'plein.aria': 'Station details', 'plein.retour': '← Back to the map', 'plein.carte': 'Show on the map',
'plein.charge': 'Loading the charts…', 'plein.vide': 'No charts for this station yet.',
'g.t': 'Temperature', 'g.h': 'Humidity', 'g.v': 'Average wind', 'g.r': 'Rain (per hour)', 'g.gel': 'frost',
'g.mm': (a, b) => `min ${a} · max ${b}`,
'g.periode': 'Chart time range', 'g.jour': '24 hours', 'g.semaine': '7 days',
'g.lacune': 'Temperature chart: readings are missing for at least 3 hours in this range.', 'g.lacune.lans': 'At Lans village, reception can be unreliable.', 'g.lacune.geve': 'At Gêve, a Livebox outage can interrupt readings.',
'g.note': (j, depuis, min) => `Charts in ${min}-minute steps over ${j} day${j > 1 ? 's' : ''}${depuis ? ` · archive since ${depuis}` : ''}. Zero is marked “frost”.`,
'fiche.titre': 'Station profile', 'fiche.alt': 'Altitude', 'fiche.proprio': 'Owners', 'fiche.source': 'Data source', 'fiche.voir': 'Elsewhere',
'fiche.bientot': 'Photos and the station’s forum thread: coming soon.', 'fiche.sujet': 'See the station’s thread · Post a photo',
'fiche.forum': 'Go to the forum', 'fiche.photo': a => `Photo of the station, posted by ${a}`,
'type.station': 'station', 'type.commune': 'village', 'type.sommet': 'summit',
'cookie.titre': 'No, sorry, I don’t want a cookie,<br>I’m not hungry, and I don’t want to be tracked.',
'cookie.txt': 'Nothing to accept here: no tracking cookies, no ads.',
},
de: {
titre: 'Météo Vercors: die Temperatur im Vercors, Station für Station',
'carte.aria': 'Karte der Wetterstationen im Vercors', 'zoom.plus': 'Vergrößern', 'zoom.moins': 'Verkleinern',
'nav.meteo': 'Wetter', 'nav.stations': 'Stationen', 'nav.climat': 'Klima', 'nav.apropos': 'Über uns',
'date.exemple': 'Dienstag, 3. November · Messwerte von 7:40',
'rech.ph': 'Eine Station, ein Dorf…', 'rech.aria': 'Station oder Dorf suchen',
'record.label': 'Hervorheben', 'record.auto': 'Je nach Jahreszeit', 'record.froid': 'Am kältesten', 'record.chaud': 'Am wärmsten', 'record.vent': 'Am windigsten', 'record.pluie': 'Am meisten Regen',
retour: '← Ganzes Massiv', 'direct.attente': 'Messwerte werden geladen…', suite: 'Alle Stationen ↓',
'fb.titre': 'Forum', 'fb.une': 'Im Fokus · Wochenrückblick', 'fb.lien': 'Hier erscheint der Wochenrückblick', 'fb.cta': 'Mitdiskutieren →',
'fb.auteur': nom => `von ${nom}`, 'fb.compte': n => `${n} ${n === 1 ? 'Thema' : 'Themen'} in 7 Tagen`,
'fb.co': 'Schon ein Konto?', 'fb.connexion': 'Mit Gastinel anmelden',
'fb.bas': '<strong>Das Gastinel-Ökosystem.</strong> Ein Konto für das Forum, Ihre Favoriten und alle unsere Apps. Ohne Werbung, eine Alternative zu den großen Tech-Konzernen.',
'sous-carte': 'Höhenlinien alle 100 m · Zoom: Mausrad (PC) oder zwei Finger (Handy)',
'modes.aria': 'Auf den Etiketten angezeigter Wert', 'mode.t': 'Temp', 'mode.alt': 'Höhe', 'mode.vent': 'Wind', 'mode.pluie': 'Regen',
'mode.alt.titre': 'Sortiert die Liste nach Höhe: ein Klick aufsteigend, ein zweiter Klick absteigend',
'mode.vent.titre': 'Nur die Stationen, die Wind messen', 'mode.pluie.titre': 'Nur die Stationen, die Regen messen',
'curseur.aria': 'In der Zeit zurück, sieben Tage', 'temps.maintenant': 'Jetzt',
aide: 'Diese Auswahl gilt auch für die Stationsliste weiter unten.',
'coupe.titre': 'Querschnitt des Massivs',
'coupe.txt': 'Jedes Quadrat ist eine Station: Je höher es steht, desto höher liegt die Station; je weiter links, desto kälter ist es.',
'coupe.survol': 'Mit der Maus über eine Station fahren oder sie antippen.',
'pan.stations': 'Die Stationen', 'pan.stations.sous': 'alle, von Nord nach Süd', 'pan.stations.txt': 'Auf der Karte: ein Wert pro Dorf oder Ort; die Details stehen hier.',
'coupe.sous': 'Höhe und Temperatur',
'coupe.intro': 'Jedes Quadrat ist eine Station: Je höher es steht, desto höher liegt die Station; je weiter links, desto kälter ist es. Normalerweise wird es mit der Höhe kälter (grüne Linie). In ruhigen Nächten sammelt sich die Kaltluft aber am Grund der Mulden, und weiter oben ist es wärmer: Das nennt man „Inversion“.',
'haut.aria': 'Zurück zum Seitenanfang', 'haut.titre': 'Nach oben',
'ap.site.t': 'Über diese Seite', 'ap.site.txt': 'Météo Vercors zeigt auf einer Karte Temperatur, Wind und Regen, die im Vercors gemessen werden, so nah wie möglich bei Ihnen. Keine Werbung, kein Tracking.', 'ap.site.lien': 'Quellen, Lizenzen und Impressum →',
'ap.g.t': 'Über Gastinel', 'ap.g.txt': 'Gastinel ist ein Kleinunternehmen von Théo Gastinel in Lans-en-Vercors. Das Gastinel-Konto dient zur Anmeldung im Forum und bei den Gastinel-Diensten.', 'ap.g.lien': 'Portfolio ansehen, gastinel.me →',
'pan.bilan': 'Wochenbilanz', 'pan.bilan.sous': 'Rekorde der letzten 7 Tage', charge: 'Wird geladen…',
'pied.accroche': 'Stationen von hier, Zahlen von hier.',
'pied.donnees': 'Daten: Météo-France (Licence Ouverte), ROMMA (mit Zustimmung des Vereins), Stationen der Familie Gastinel (WeatherLink, ROMMA, Infoclimat). Kartengrundlage: IGN, offene Lizenz.',
'pied.contact': 'Kontakt', 'pied.charte': 'Gestaltungsrichtlinien', 'pied.site': 'Die Website', 'pied.sources': 'Quellen und Lizenzen', 'pied.mentions': 'Impressum', 'pied.cgu': 'Nutzungsbedingungen', 'pied.confid': 'Datenschutz',
'prm.titre': 'Einstellungen', fermer: 'Schließen', 'prm.langue': 'Sprache', 'prm.affichage': 'Anzeige', 'prm.acces': 'Barrierefrei', 'prm.normal': 'Normal', 'prm.mini': 'Minimal',
'prm.mouvement': 'Bewegung', 'prm.anim': 'Weniger Animationen', 'prm.anim.aide': 'Standardmäßig wie die Einstellung des Geräts.',
'prm.intro': 'Ankunftsanimation der Karte', 'prm.intro.longue': 'Länger', 'prm.intro.normale': 'Normal', 'prm.intro.aucune': 'Keine',
'intro.aide': 'Gilt beim nächsten Anzeigen der Seite.', 'intro.aide.red': 'Aus, solange „Weniger Animationen“ angehakt ist.',
'pancarte.titre': 'Zum Verschieben ziehen, Doppelklick zum Zurücksetzen', 'pied.stats': 'Statistiken der Website',
'aff.acces': 'Größere Texte, Etiketten und Schaltflächen, stärkere Kontraste.', 'aff.normal': 'Die gewohnte Anzeige.',
'aff.mini': 'Kleine Etiketten, die Temperatur neben dem Namen; kompakte Stationsliste.',
moment: h => h < 5 ? 'Heute Nacht' : h < 12 ? 'Heute Morgen' : h < 18 ? 'Heute Nachmittag' : h < 23 ? 'Heute Abend' : 'Heute Nacht',
'phrase.charge': 'Messwerte werden geladen…',
'reseau.n': n => `${n} Stationen im Massiv`,
'reseau.direct': (a, n) => `${a} von ${n} Stationen live · Météo-France, Infoclimat, Station Gastinel`,
'ph.chaud': (m, v, l) => `${m}: <strong>${v} in ${l}</strong>, derzeit der wärmste Punkt des Massivs.`,
'ph.ecart': (m, v1, l1, v2, l2) => `${m}: von <strong>${v1} in ${l1}</strong> bis <strong>${v2} in ${l2}</strong>, der kälteste und der wärmste Punkt des Massivs.`,
'ph.vent': (m, v, l) => `${m}: <strong>${v} km/h in ${l}</strong>, der stärkste mittlere Wind im Massiv.`,
'ph.vent0': m => `${m}: bisher kein Wind gemessen.`,
'ph.pluie': (m, v, l) => `${m}: <strong>${v} mm in einer Stunde in ${l}</strong>, der stärkste Regen im Massiv.`,
'ph.pluie0': m => `${m}: kein Regen im Massiv gemessen.`,
'ph.froid': (m, v, l) => `${m}: <strong>${v} in ${l}</strong>, derzeit der kälteste Punkt des Massivs.`,
'ph.inversion': (dz, l, v) => ` ${dz} m höher, ${l}: ${v}. Die kalte Luft ist unten geblieben.`,
'direct.releves': (h, q) => `Messwerte von ${h} · ${q}`,
'direct.instant': 'gerade eben', 'direct.min': n => `vor ${n} Min.`, 'direct.h': n => `vor ${n} Std.`,
'lecture.rejouer': 'Die letzten 24 Stunden abspielen', 'lecture.pause': 'Pause',
'fiche.alentours': ' und Umgebung', 'fiche.plein': 'Im Vollbild öffnen →', 'fiche.zoom': 'Diesen Bereich vergrößern →',
'etat.direct0': 'keine Live-Daten', 'etat.hl': 'offline', 'etat.donnees0': 'keine Daten',
vient: s => 'Von ' + s, 'voir.station': 'Zur Station: ',
'coupe.normal': '- - normale Abkühlung', 'coupe.aria': 'Temperatur der Stationen nach Höhe',
'coupe.st': (n, a, v) => `${n}, ${a} Meter, ${v}`,
'coupe.plat': 'Derzeit ist es in allen Höhen fast gleich warm: keine Inversion, keine deutliche Abkühlung.',
'coupe.inv': p => `Inversion: Derzeit ist es in der Höhe wärmer (im Mittel ${p} °C mehr pro 100 m). Die Mulden sind am kältesten.`,
'coupe.baisse': p => `Die Temperatur sinkt im Mittel um ${p} °C pro 100 m; die grüne Linie zeigt die normale Abkühlung (0,65 °C).`,
'bilan.vide': 'Noch nicht genug Messwerte.', 'bilan.froid': 'Am kältesten', 'bilan.chaud': 'Am wärmsten',
'bilan.vent': 'Stärkster mittlerer Wind', 'bilan.pluie': 'Stärkster Regen in 1 Std.', 'bilan.aucune': 'keine Messung',
'bilan.note': j => `Das Archiv umfasst bisher ${j} Tage; es wächst Tag für Tag.`,
'forum.bientot': 'Demnächst', 'forum.ouverture': 'Eröffnung demnächst',
'forum.recap': 'Der Wochenrückblick der Mitglieder kommt bald.',
'plein.aria': 'Details der Station', 'plein.retour': '← Zurück zur Karte', 'plein.carte': 'Auf der Karte zeigen',
'plein.charge': 'Kurven werden geladen…', 'plein.vide': 'Für diese Station gibt es noch keine Kurven.',
'g.t': 'Temperatur', 'g.h': 'Luftfeuchtigkeit', 'g.v': 'Mittlerer Wind', 'g.r': 'Regen (pro Stunde)', 'g.gel': 'Frost',
'g.mm': (a, b) => `min. ${a} · max. ${b}`,
'g.periode': 'Zeitraum der Diagramme', 'g.jour': '24 Stunden', 'g.semaine': '7 Tage',
'g.lacune': 'Temperaturkurve: In diesem Zeitraum fehlen Messwerte für mindestens 3 Stunden.', 'g.lacune.lans': 'In Lans Village ist der Empfang mitunter unzuverlässig.', 'g.lacune.geve': 'In Gêve kann ein Ausfall der Livebox die Messdatenübertragung unterbrechen.',
'g.note': (j, depuis, min) => `Kurven im ${min}-Minuten-Raster über ${j} Tag${j > 1 ? 'e' : ''}${depuis ? ` · Archiv seit ${depuis}` : ''}. Null ist mit „Frost“ markiert.`,
'fiche.titre': 'Steckbrief der Station', 'fiche.alt': 'Höhe', 'fiche.proprio': 'Eigentümer', 'fiche.source': 'Datenquelle', 'fiche.voir': 'Anderswo',
'fiche.bientot': 'Fotos und Forumsthema der Station: demnächst.', 'fiche.sujet': 'Thema der Station ansehen · Foto posten',
'fiche.forum': 'Zum Forum', 'fiche.photo': a => `Foto der Station, gepostet von ${a}`,
'type.station': 'Station', 'type.commune': 'Gemeinde', 'type.sommet': 'Gipfel',
'cookie.titre': 'Nein danke, ich will keinen Cookie,<br>ich habe keinen Hunger und will nicht verfolgt werden.',
'cookie.txt': 'Hier gibt es nichts zu akzeptieren: keine Tracking-Cookies, keine Werbung.',
},
};
function t(k, ...a){
const v = I18N[L] && k in I18N[L] ? I18N[L][k] : I18N.fr[k];
return typeof v === 'function' ? v(...a) : v == null ? k : v;
}
// textes fixes de la page : data-i18n (texte), data-i18n-html (avec balises), data-i18n-a="attribut:clé;…"
function traduirePage(){
const fr = I18N.fr;
document.documentElement.lang = L;
if (!('titre' in fr)) fr.titre = document.title;
document.title = t('titre');
document.querySelectorAll('[data-i18n]').forEach(el => { const k = el.dataset.i18n; if (!(k in fr)) fr[k] = el.textContent; el.textContent = t(k); });
document.querySelectorAll('[data-i18n-html]').forEach(el => { const k = el.dataset.i18nHtml; if (!(k in fr)) fr[k] = el.innerHTML; el.innerHTML = t(k); });
document.querySelectorAll('[data-i18n-a]').forEach(el => el.dataset.i18nA.split(';').forEach(x => {
const [a, k] = x.split(':'); if (!(k in fr)) fr[k] = el.getAttribute(a) || ''; el.setAttribute(a, t(k));
}));
}
function appliquerAffichage(){ document.documentElement.dataset.aff = REG.affichage; }
function appliquerAnim(){
reduit = REG.anim ?? sysReduit.matches;
document.documentElement.classList.toggle('sans-anim', reduit);
relancerPendule();
}
sysReduit.addEventListener('change', () => { if (REG.anim === null) appliquerAnim(); });
traduirePage(); appliquerAffichage(); appliquerAnim();
window.vmReglages = {
exporter: () => ({v: 1, date: REG_DATE || null, ...REG}),
importer(o){
REG = reglagesValides(o); L = REG.langue;
enregistrerReglages(); appliquerAffichage(); appliquerAnim(); apresReglage(); placerPancarte();
return this.exporter();
},
};
// Stations du Vercors relevées dans les notes (Boîte + liste du 16/10) ; valeurs d'exemple (matin d'inversion)
const STATIONS = {
'autrans': {nom:'Autrans – L\'Escandille', src:'Météo-France', alt:1069, lat:45.182, lon:5.5522, t:-4.8},
'geve': {nom:'Autrans – Gêve nordique', src:'WeatherLink', alt:1287, lat:45.213, lon:5.56, t:-1.6},
'engins': {nom:'Engins, le Fournel', src:'ROMMA', alt:905, lat:45.1796, lon:5.6172, t:-2.9},
'meaudre': {nom:'Méaudre', src:'WeatherLink', alt:976, lat:45.1306, lon:5.5288, t:-6.4},
'lans': {nom:'Lans-en-Vercors – village', src:'WeatherLink', alt:1020, lat:45.13, lon:5.60, t:-2.8},
'bruyeres': {nom:'Lans-en-Vercors – Les Bruyères', src:'WeatherLink', alt:990, lat:45.10, lon:5.57, t:-4.1},
'allieres': {nom:'Lans-en-Vercors – Les Allières', src:'WeatherLink', alt:1449, lat:45.095, lon:5.6002, t:0.9},
'villard': {nom:'Villard-de-Lans – Payonère', src:'Météo-France', alt:1027, lat:45.0785, lon:5.561, t:-3.6},
'moucherolle': {nom:'Crête de la Moucherolle', src:'Infoclimat', alt:1965, lat:45.0093, lon:5.5575, t:2.1},
'chapelle': {nom:'La Chapelle-en-Vercors – Les Finets', src:'Météo-France', alt:879, lat:44.9615, lon:5.4222, t:-5.2},
'oscence': {nom:'Combe de l\'Oscence', src:'ROMMA', alt:1000, lat:44.972, lon:5.3835, t:-8.9},
'darbounouse': {nom:'Combe de Darbounouse', src:'Infoclimat', alt:1282, lat:44.9676, lon:5.4771, t:-11.2},
'rousset': {nom:'Col du Rousset – plateau de Beurre', src:'Météo-France', alt:1400, lat:44.8417, lon:5.4217, t:-0.5},
'gresse': {nom:'Gresse-en-Vercors', src:'Météo-France', alt:1220, lat:44.8998, lon:5.5657, t:-3.9},
'st-jean': {nom:'Saint-Jean-en-Royans', src:'Météo-France', alt:308, lat:45.0092, lon:5.2925, t:2.6},
'die': {nom:'Die', src:'ROMMA', alt:400, lat:44.75, lon:5.3667, t:1.9},
'st-julien-q': {nom:'Saint-Julien-en-Quint', src:'ROMMA', alt:574, lat:44.8378, lon:5.2922, t:-0.8},
'archiane': {nom:'Cirque d\'Archiane', src:'ROMMA', alt:747, lat:44.7445, lon:5.5064, t:-2.7},
};
// Une puce par village ou site ; la 1re station est celle affichée. Ordre = priorité d'affichage.
const GROUPES = [
{nom:'Darbounouse', st:['darbounouse'], sect:'Hauts-Plateaux et Vercors drômois'},
{nom:'Villard-de-Lans', st:['villard'], sect:'Quatre-Montagnes'},
{nom:'La Chapelle', st:['chapelle'], sect:'Hauts-Plateaux et Vercors drômois'},
{nom:'Autrans', st:['autrans','geve'], sect:'Quatre-Montagnes'},
{nom:'Méaudre', st:['meaudre'], sect:'Quatre-Montagnes'},
{nom:'Lans-en-Vercors', st:['lans','bruyeres','allieres'], sect:'Quatre-Montagnes'},
{nom:'Moucherolle', st:['moucherolle'], sect:'Quatre-Montagnes'},
{nom:'Col du Rousset', st:['rousset'], sect:'Hauts-Plateaux et Vercors drômois'},
{nom:'Gresse', st:['gresse'], sect:'Trièves et Gresse'},
{nom:'Die', st:['die'], sect:'Diois'},
{nom:'St-Jean-en-Royans', st:['st-jean'], sect:'Royans'},
{nom:'Oscence', st:['oscence'], sect:'Hauts-Plateaux et Vercors drômois'},
{nom:'Engins', st:['engins'], sect:'Quatre-Montagnes'},
{nom:'Archiane', st:['archiane'], sect:'Diois'},
{nom:'St-Julien-en-Quint', st:['st-julien-q'], sect:'Diois'},
];
// Propriétaire des stations « de chez nous » ; 'dispo' = où l'on retrouve aussi la station (jamais Infoclimat en premier)
// Propriétaires dans l'ordre donné par Richard Gastinel (feuille du 05/11/2026).
// Liens publics des propriétaires (donnés par Théo le 05/11/2026)
const PROPRIO_LIEN = {"Mairie d'Autrans-Méaudre": 'https://www.autrans-meaudre.fr/fr/',
'Mairie de Lans-en-Vercors': 'https://www.mairie-lansenvercors.fr/fr/',
'Enzo Minelli (Auberge des Allières)': 'https://www.aubergedesallieres.com/accueil.htm',
'Cédric Favant': 'https://www.infoclimat.fr/profil-membre-71-ced30.html'};
const PROPRIO = {lans:['Station Gastinel'], moucherolle:['Station Gastinel'],
geve:['Mairie d\'Autrans-Méaudre', 'Fabrice Empereur-Mot', 'Richard Gastinel'],
meaudre:['Mairie d\'Autrans-Méaudre', 'Richard Gastinel'],
allieres:['Mairie de Lans-en-Vercors', 'Enzo Minelli (Auberge des Allières)', 'Richard Gastinel'],
bruyeres:['Pierre Eymard-Biron', 'Richard Gastinel'],
darbounouse:['Département', 'Infoclimat', 'Cédric Favant', 'Richard Gastinel'],
oscence:['Cédric Favant', 'Richard Gastinel']};
// Pages publiques de chaque station (vérifiées le 04/11/2026). Pas de lien WeatherLink.
const ROMMA_ID = {bruyeres:80, geve:294, moucherolle:772, villard:578, allieres:133, engins:139, meaudre:266, oscence:705, darbounouse:762,
die:159, 'st-julien-q':158, archiane:212}; // Gresse : station Météo-France (la 131 de ROMMA est une autre station)
const IC_ID = {bruyeres:'000T0', allieres:'000GS', engins:'000HT', meaudre:'000IA', geve:'000IL',
moucherolle:'STATIC0479', darbounouse:'STATIC0213', oscence:'000UF', die:'000PD', 'st-julien-q':'000OS', archiane:'000ZK'};
const MF_PAGE = {autrans:'autrans/38880', villard:'villard-de-lans/38250', chapelle:'la-chapelle-en-vercors/26420',
rousset:'saint-agnan-en-vercors/26420', gresse:'gresse-en-vercors/38650', 'st-jean':'saint-jean-en-royans/26190'};
function liens(id){
const l = []; // Météo-France, puis ROMMA, Infoclimat jamais en premier
if (MF_PAGE[id]) l.push(['Météo-France', 'https://meteofrance.com/previsions-meteo-france/' + MF_PAGE[id]]);
if (ROMMA_ID[id]) l.push(['ROMMA', 'https://www.romma.fr/station_24.php?id=' + ROMMA_ID[id]]);
if (IC_ID[id] && (ROMMA_ID[id] || PROPRIO[id])) l.push(['Infoclimat', 'https://www.infoclimat.fr/observations-meteo/temps-reel/station/' + IC_ID[id] + '.html']);
return l.map(([n, u]) => `<a href="${u}" target="_blank" rel="noopener">${n}</a>`).join(' · ');
}
function origine(id){
const s = STATIONS[id], p = PROPRIO[id], l = liens(id);
if (p) return {titre: p.map(n => PROPRIO_LIEN[n] ? `<a href="${PROPRIO_LIEN[n]}" target="_blank" rel="noopener">${n}</a>` : n).join(' · '), aussi: 'WeatherLink' + (l ? ' · ' + l : '')};
const src = (ROMMA_ID[id] && !MF_PAGE[id]) ? 'ROMMA' : (s.src || ''); // autorisées par ROMMA (relais technique Infoclimat)
return {titre: src ? t('vient', src) : '', aussi: l ? t('voir.station') + l : ''};
}
const MASSIF = [5.06, 45.305, 5.835, 44.635]; // ouest, nord, est, sud : tout le Parc (limite IGN)
// Une puce par station : la 1re station d'un groupe porte le nom du village et passe en priorité ;
// les autres viennent après, elles rejoignent la puce du village tant que la place manque.
const NOMS = {geve:'Gêve', bruyeres:'Les Bruyères', allieres:'Les Allières'};
const PUCES = [...GROUPES.map(g => ({nom: g.nom, st: [g.st[0]]})),
...GROUPES.flatMap(g => g.st.slice(1).map(id => ({nom: NOMS[id], st: [id], parent: g.nom})))];
const P = (lon, lat) => [(lon - C.lon0) * C.k * C.m, (C.lat1 - lat) * C.m];
const fmt = v => v == null ? '—' : (v < 0 ? '−' : v > 0 ? '+' : '') + dec(Math.abs(v).toFixed(1)) + '°';
const court = n => n.split(' – ').pop();
const STOPS = [[-10,[36,95,107]],[-3,[56,128,138]],[3,[31,77,58]],[9,[120,104,52]],[15,[181,100,60]]];
function couleur(t){
if (t == null) return 'var(--gris)';
if (t <= STOPS[0][0]) return `rgb(${STOPS[0][1]})`;
for (let i = 1; i < STOPS.length; i++) if (t <= STOPS[i][0]) {
const [a, ca] = STOPS[i-1], [b, cb] = STOPS[i], u = (t - a) / (b - a);
return `rgb(${ca.map((v, j) => Math.round(v + (cb[j] - v) * u))})`;
}
return `rgb(${STOPS.at(-1)[1]})`;
}
document.getElementById('degrade').style.background =
`linear-gradient(90deg,${[-10,-6,-3,0,3,6,9,12,15].map(couleur).join(',')})`;
// tant que les données réelles ne sont pas arrivées, tout est exemple
Object.values(STATIONS).forEach(x => { x.t = x.mn = x.mx = null; x.exemple = true; });
// phrase du jour : le point le plus froid, et l'inversion si elle se voit
const MOMENT = h => t('moment', h);
let RECORD = 'auto';
// RECORD : valeur par défaut = saison météo ('auto'). Le sélecteur n'est plus affiché ; ce réglage ira dans l'admin du site.
// 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 = t('phrase.charge');
document.getElementById('reseau').textContent = t('reseau.n', toutes.length);
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 = t('ph.chaud', mom, deg(c.t), court(c.nom));
else if (mode === 'ecart') s = t('ph.ecart', mom, deg(f.t), court(f.nom), deg(c.t), court(c.nom));
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 ? t('ph.vent', mom, Math.round(v.vent), court(v.nom)) : t('ph.vent0', mom);
} 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 ? t('ph.pluie', mom, nb1(r.pluie), court(r.nom)) : t('ph.pluie0', mom);
} else {
s = t('ph.froid', mom, deg(f.t), court(f.nom));
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 += t('ph.inversion', h.alt - f.alt, court(h.nom), deg(h.t));
}
document.getElementById('phrase').innerHTML = s;
document.getElementById('reseau').textContent = t('reseau.direct', reelles.length, toutes.length);
}
function heureParis(d = new Date()){ return +new Intl.DateTimeFormat('en-GB', {hour: '2-digit', hourCycle: 'h23', timeZone: 'Europe/Paris'}).format(d); }
phraseDuJour();
// ---- calques ----
const carte = document.getElementById('carte'), calque = document.getElementById('calque'),
cart = document.getElementById('cartouche'),
retour = document.getElementById('retour');
// décalage de chaque type de nom par rapport à son point : [transformation CSS, décalage en px selon la taille]
const DECALAGE = {village: ['translate(7px,-50%)', (w, h) => [7, -h / 2]], pic: ['translate(-50%,-2px)', (w, h) => [-w / 2, -2]]};
const DECALAGE_DEF = ['translate(-50%,-50%)', (w, h) => [-w / 2, -h / 2]];
const etqs = ETIQ.map(e => {
const d = document.createElement('div');
d.className = 'etq ' + e.t;
d.innerHTML = e.n + (e.t === 'pic' && e.ele ? `<small>${e.ele}</small>` : '');
calque.appendChild(d);
return {e, d, xy: P(e.lon, e.lat), o: DECALAGE[e.t] || DECALAGE_DEF, vis: true, tr: ''};
});
const puces = PUCES.map(g => {
const m = document.createElement('div');
m.className = 'puce';
m.innerHTML = '<i class="fil"></i><i class="pt"></i><button type="button" aria-expanded="false"></button><div class="fiche"></div>';
carte.appendChild(m);
const p = {g, m, b: m.querySelector('button'), f: m.querySelector('.fiche'), fil: m.querySelector('.fil'),
xy: P(STATIONS[g.st[0]].lon, STATIONS[g.st[0]].lat), ids: g.st, x: 0, y: 0, vis: true, tr: '', op: ''};
p.b.addEventListener('click', ev => { ev.stopPropagation(); ouvrir(p); });
m.querySelector('.fiche').addEventListener('click', ev => {
ev.stopPropagation();
if (ev.target.closest('.zoom')) { fermer(); zoomer(boite(p.ids)); }
if (ev.target.closest('.pleinbtn')) { fermer(); ouvrirPlein(p.ids.filter(i => STATIONS[i]), p.ids[0]); }
});
return p;
});
function fermer(){
puces.forEach(x => {
if (!x.m.classList.contains('ouverte')) return;
x.b.setAttribute('aria-expanded', 'false');
if (reduit) { x.m.classList.remove('ouverte'); return; }
x.m.classList.add('ferme');
clearTimeout(x.minuteur);
x.minuteur = setTimeout(() => x.m.classList.remove('ouverte', 'ferme'), 170);
});
}
document.addEventListener('click', fermer);
// pincer sur la carte zoome la carte, pas la page (Safari : gesturestart ; autres : toucher à deux doigts)
carte.addEventListener('touchmove', ev => { if (ev.touches.length > 1) ev.preventDefault(); }, {passive: false});
carte.addEventListener('gesturestart', ev => ev.preventDefault());
let MODE = 't'; // t, alt, vent, pluie
function valMode(r){
return MODE === 'alt' ? [`${r.alt} m`, 'var(--sapin)']
: MODE === 'vent' ? [r.vent == null ? '—' : `${Math.round(r.vent)} km/h`, '#3d6f8e']
: MODE === 'pluie' ? [r.pluie == null ? '—' : `${nb1(r.pluie)} mm`, '#3d6f8e'] : [fmt(r.t), couleur(r.t)];
}
const capteur = (id, m) => m === 'vent' ? !!(SEM[id] && SEM[id].vent) : m === 'pluie' ? !!(SEM[id] && SEM[id].pluie) : true;
const nb1 = v => v == null ? '—' : dec(String(Math.round(v * 10) / 10));
// contenu d'une puce : ses stations propres + celles qu'elle a absorbées faute de place.
// contenu() ne fait que calculer le HTML ; ecrire() ne touche au DOM que si quelque chose a changé.
function contenu(p){
const st = p.ids.map(id => ({id, ...STATIONS[id]})), pool = st.filter(x => capteur(x.id, MODE)), r = pool.find(x => x.t != null) || pool[0] || st.find(x => x.t != null) || st[0];
const autres = st.length - 1;
const cap = st.some(x => SEM[x.id] && SEM[x.id].pluie), vent = st.some(x => SEM[x.id] && SEM[x.id].vent);
const vm = valMode(r);
const hb = `<span class="val" style="color:${vm[1]}">${vm[0]}</span>${autres ? `<span class="n">+${autres}</span>` : ''}<span class="nom">${p.titre}<span class="ics">${cap ? IC_GOUTTE : ''}${vent ? IC_EOLIENNE : ''}</span></span>`;
const hf = `<h3>${p.titre}${p.absorbe ? t('fiche.alentours') : ''}</h3><ul>${st.map((s, i) => `<li style="--i:${i}"><span>${s.nom}</span><b style="color:${couleur(s.t)}">${fmt(s.t)}</b>
<em>${icones(s.id)}${s.alt} m · ${s.src}${s.licence ? ` (${s.licence})` : ''}${s.exemple ? ' · ' + t('etat.direct0') : s.horsLigne ? ' · ' + t('etat.hl') : ''}${s.mn != null ? ` · 24 h : ${fmt(s.mn)} / ${fmt(s.mx)}` : ''}</em></li>`).join('')}</ul>` +
`<div class="actions"><button type="button" class="pleinbtn">${t('fiche.plein')}</button>${p.mini ? '' : `<button type="button" class="zoom">${t('fiche.zoom')}</button>`}</div>`;
const cl = (r.exemple ? ' ex' : '') + (r.horsLigne ? ' hl' : '');
return {hb, hf, cl};
}
function ecrire(p, c = p.c){
if (c.cl !== p.cl) { p.b.className = c.cl.trim(); p.cl = c.cl; }
if (c.hb !== p.hb) { p.b.innerHTML = c.hb; p.hb = c.hb; }
// la fiche n'est écrite que si elle est ouverte (sinon à son ouverture) : rien à refaire pour les fiches cachées
p.hfVoulu = c.hf;
if (p.m.classList.contains('ouverte')) ecrireFiche(p);
}
function ecrireFiche(p){ if (p.hfVoulu && p.hfVoulu !== p.hf) { p.f.innerHTML = p.hfVoulu; p.hf = p.hfVoulu; } }
function ouvrir(p){
if (carte.clientWidth < 720) { fermer(); ouvrirPlein(p.ids, p.ids[0]); return; } // téléphone : plein écran direct
const o = !p.m.classList.contains('ouverte');
fermer();
// une puce qui regroupe plusieurs sites : on zoome directement, la fiche reste pour le reste
if (o && p.absorbe && !p.mini) { zoomer(boite(p.ids)); return; }
if (o) { ecrireFiche(p); clearTimeout(p.minuteur); p.m.classList.remove('ferme'); p.m.classList.add('ouverte'); p.b.setAttribute('aria-expanded', 'true'); }
}
function boite(ids){
const la = ids.map(i => STATIONS[i].lat), lo = ids.map(i => STATIONS[i].lon);
const cx = (Math.min(...lo) + Math.max(...lo)) / 2, cy = (Math.min(...la) + Math.max(...la)) / 2;
const dx = Math.max(Math.max(...lo) - Math.min(...lo), 0.09) / 2 + 0.03, dy = Math.max(Math.max(...la) - Math.min(...la), 0.07) / 2 + 0.03;
return [cx - dx, cy + dy, cx + dx, cy - dy];
}
function chevauche(a, b){ return !(a.right < b.left || a.left > b.right || a.bottom < b.top || a.top > b.bottom); }
// Vue libre : centre (unités de la carte, 100 m) et échelle (px par unité).
// « cible » est la vue visée : la vue affichée la rejoint en douceur à chaque image.
// La carte est faite d'images pré-calculées (4 niveaux de zoom) : à chaque image affichée, on ne fait
// que les déplacer et les agrandir (transformation CSS, faite par la carte graphique).
let vue = null, cible = null, Z = null, boucleId = 0, sMin = 1, largeur = 0, actif = 0, calcul = 0;
const S_MAX = 9;
const T = /*TUILES*/, dPnr = document.getElementById('d-pnr');
const couches = T.niveaux.map(n => {
const d = document.createElement('div');
d.className = 'niveau';
document.getElementById('tuiles').appendChild(d);
return {n, d, imgs: new Map()};
});
// place les images : le niveau 0 couvre tout (dessous), le niveau adapté à l'échelle se pose dessus
function poser(){
const {W, H} = Z, s = vue.s, vx = vue.cx - Z.cx / s, vy = vue.cy - Z.cy / s;
const voulu = Math.min(couches.length - 1, Math.max(0, Math.ceil(Math.log2(s * devicePixelRatio * 0.85))));
couches.forEach((c, k) => {
const affiche = k === 0 || k === voulu;
c.d.style.display = affiche ? '' : 'none';
if (!affiche) return;
const sl = c.n.s, a = T.taille / sl;
c.d.style.transform = `translate3d(${(T.ox - vx) * s}px,${(T.oy - vy) * s}px,0) scale(${s / sl})`;
const i0 = Math.max(c.n.i0, Math.floor((vx - T.ox) / a)), i1 = Math.min(c.n.i1, Math.floor((vx + W / s - T.ox) / a));
const j0 = Math.max(c.n.j0, Math.floor((vy - T.oy) / a)), j1 = Math.min(c.n.j1, Math.floor((vy + H / s - T.oy) / a));
for (let i = i0; i <= i1; i++) for (let j = j0; j <= j1; j++) {
const cle = i + '_' + j;
if (c.imgs.has(cle)) continue;
const img = new Image();
img.decoding = 'async'; img.alt = '';
img.style.left = i * T.taille + 'px'; img.style.top = j * T.taille + 'px';
img.onload = () => img.classList.add('vu');
img.src = `tuiles/${c.n.L}/${cle}.webp?v=${T.version}`;
c.d.appendChild(img); c.imgs.set(cle, img);
}
});
}
// zone utile de la carte : hors cartouche et marges
function zone(){
const W = carte.clientWidth, mob = W < 720;
const r0 = carte.getBoundingClientRect(), rc = cart.getBoundingClientRect();
const pxL = mob ? 0 : rc.right - r0.left + 16, pxT = mob ? rc.bottom - r0.top + 6 : 0;
const pad = mob ? [46, 12, 64, 12] : [46, 60, 70, 30]; // haut, droite, bas, gauche
const H = carte.clientHeight, aw = W - pxL - pad[1] - pad[3], ah = H - pxT - pad[0] - pad[2];
return {W, H, mob, r0, aw, ah, pxT, pad, cx: pxL + pad[3] + aw / 2, cy: pxT + pad[0] + ah / 2};
}
function ajuster(b, z){
const [ax, ay] = P(b[0], b[1]), [bx, by] = P(b[2], b[3]);
return {cx: (ax + bx) / 2, cy: (ay + by) / 2, s: Math.min(z.aw / (bx - ax), z.ah / (by - ay))};
}
// cadre du Parc (MASSIF) en unités de la carte : la zone utile de la vue n'en sort jamais
const [CX0, CY0] = P(MASSIF[0], MASSIF[1]), [CX1, CY1] = P(MASSIF[2], MASSIF[3]);
function borner(v){
// jamais plus dézoomé que la vue de départ ; le centre est ramené dans le cadre à chaque zoom :
// la zone utile (hors cartouche et marges) reste dans le cadre, ou centrée sur lui quand elle est plus grande
v.s = Math.min(S_MAX, Math.max(sMin, v.s));
const z = Z || zone(), dx = z.aw / 2 / v.s, dy = z.ah / 2 / v.s;
v.cx = 2 * dx >= CX1 - CX0 ? (CX0 + CX1) / 2 : Math.min(CX1 - dx, Math.max(CX0 + dx, v.cx));
v.cy = 2 * dy >= CY1 - CY0 ? (CY0 + CY1) / 2 : Math.min(CY1 - dy, Math.max(CY0 + dy, v.cy));
return v;
}
// vue obtenue en zoomant d'un facteur f autour d'un point de l'écran (px dans la carte)
function autour(f, mx, my, base = cible || vue){
const z = Z || zone(), s = base.s, ns = Math.min(S_MAX, Math.max(sMin, s * f));
const ux = base.cx + (mx - z.cx) / s, uy = base.cy + (my - z.cy) / s;
return borner({cx: ux - (mx - z.cx) / ns, cy: uy - (my - z.cy) / ns, s: ns});
}
function viser(v){ cible = v; actif = performance.now(); relancer(); }
function zoomer(b){ viser(borner(ajuster(b, Z || zone()))); }
function relancer(){ if (!boucleId) boucleId = requestAnimationFrame(boucle); }
function boucle(){
boucleId = 0;
if (!vue) { disposer(); return; }
let bouge = false;
if (cible) {
const k = reduit || document.hidden ? 1 : 0.2;
const ls = Math.log(vue.s), lc = Math.log(cible.s);
vue = {cx: vue.cx + (cible.cx - vue.cx) * k, cy: vue.cy + (cible.cy - vue.cy) * k, s: Math.exp(ls + (lc - ls) * k)};
if (Math.abs(lc - ls) < 0.003 && Math.hypot(cible.cx - vue.cx, cible.cy - vue.cy) * vue.s < 0.4) { vue = cible; cible = null; }
else bouge = true;
}
// geste en cours : images et étiquettes suivent à chaque image ; les regroupements de stations
// sont recalculés quelques fois par seconde, donc les stations se séparent pendant le zoom.
// Au repos : un seul placement complet, puis seule l'animation des puces (transformation et opacité) tourne.
const t = performance.now();
if (bouge || t - actif < 150) { aJour = false; if (t - calcul > 120) disposer(); else suivre(); relancer(); }
else if (!aJour) { aJour = true; if (disposer()) relancer(); }
else if (animer(t)) relancer();
}
// placement complet à refaire (cartouche replié, fenêtre redimensionnée…)
function redisposer(){ aJour = false; relancer(); }
retour.addEventListener('click', () => zoomer(MASSIF));
// première vue : tout le massif ; sur téléphone la carte prend la hauteur qu'il lui faut
function initialiser(){
largeur = carte.clientWidth;
carte.style.height = '';
let z = zone();
if (z.mob) {
const [ax, ay] = P(MASSIF[0], MASSIF[1]), [bx, by] = P(MASSIF[2], MASSIF[3]);
carte.style.height = Math.round(z.pxT + z.pad[0] + (by - ay) * z.aw / (bx - ax) + z.pad[2]) + 'px';
z = zone();
}
vue = ajuster(MASSIF, z); sMin = vue.s; cible = null;
}
// le point de l'écran est-il dans le Parc ? (la molette y zoome ; ailleurs elle fait défiler la page)
function dansParc(mx, my){
const z = Z, s = vue.s;
try { return dPnr.isPointInFill(new DOMPoint(vue.cx + (mx - z.cx) / s, vue.cy + (my - z.cy) / s)); }
catch (e) { return true; }
}
carte.addEventListener('wheel', ev => {
if (!vue || !Z || ev.target.closest('.cartouche, .fiche')) return;
const r = carte.getBoundingClientRect(), mx = ev.clientX - r.left, my = ev.clientY - r.top;
if (!ev.ctrlKey && !dansParc(mx, my)) return;
// dans le Parc, la molette ne fait jamais défiler la page (tout dézoomé, elle ne fait rien)
ev.preventDefault();
const f = Math.exp(-ev.deltaY * (ev.deltaMode ? 0.06 : 0.0022));
viser(autour(f, mx, my));
}, {passive: false});
carte.addEventListener('dblclick', ev => {
if (ev.target.closest('button, a, .fiche, .cartouche, .commandes')) return;
// double-clic dans la zone d'une station : c'est elle qu'on vise, pas un zoom
if (stationProche(ev.pageX - posCarte[0], ev.pageY - posCarte[1], RAYON.mouse)) return;
const r = carte.getBoundingClientRect();
viser(autour(ev.shiftKey ? 0.5 : 2, ev.clientX - r.left, ev.clientY - r.top));
});
// glisser à la souris ; au doigt, un doigt fait défiler la page, deux doigts déplacent et zooment.
// Le geste suit le doigt sans retard : la vue est posée directement.
const doigts = new Map();
carte.addEventListener('pointerdown', ev => {
// au doigt, une étiquette de station compte aussi pour pincer ; à la souris, elle reste un bouton
const zoneLibre = ev.pointerType === 'touch' ? '.fiche, .cartouche, .commandes' : 'button, a, .fiche, .cartouche, .commandes';
if (ev.target.closest(zoneLibre)) return;
doigts.set(ev.pointerId, {x: ev.clientX, y: ev.clientY});
if (ev.pointerType === 'mouse') { carte.setPointerCapture(ev.pointerId); carte.classList.add('glisse'); }
});
carte.addEventListener('pointermove', ev => {
if (!doigts.has(ev.pointerId)) return;
const avant = [...doigts.values()].map(p => ({...p}));
doigts.set(ev.pointerId, {x: ev.clientX, y: ev.clientY});
const apres = [...doigts.values()];
if (ev.pointerType === 'touch' && apres.length < 2) return;
const r = carte.getBoundingClientRect();
const milieu = l => [l.reduce((a, p) => a + p.x, 0) / l.length - r.left, l.reduce((a, p) => a + p.y, 0) / l.length - r.top];
const [x0, y0] = milieu(avant), [x1, y1] = milieu(apres);
let v = vue;
if (apres.length >= 2) {
const d = l => Math.hypot(l[0].x - l[1].x, l[0].y - l[1].y) || 1;
v = autour(d(apres) / d(avant), x1, y1, vue);
}
vue = borner({...v, cx: v.cx - (x1 - x0) / v.s, cy: v.cy - (y1 - y0) / v.s});
cible = null; actif = performance.now(); relancer();
});
['pointerup', 'pointercancel'].forEach(t => carte.addEventListener(t, ev => { doigts.delete(ev.pointerId); carte.classList.remove('glisse'); }));
// ---- zones de clic des stations ----
// Un clic (ou un toucher) sur la carte va à la station la plus proche du pointeur : son étiquette ou son point.
// Zones à la Voronoï bornées par un rayon : elles se partagent la place quand les stations se serrent
// (Saint-Jean-en-Royans et sa voisine) et s'étendent jusqu'au rayon quand la station est isolée.
// Au doigt, le rayon donne au moins 24 px de cible autour du point. Le clavier passe par les boutons eux-mêmes.
const RAYON = {mouse: 12, pen: 16, touch: 24};
const HORS_ZONES = '.fiche, .cartouche, .commandes, .forum-box, .legende, .thermo, .suite';
let posCarte = [0, 0]; // position de la carte dans la page, relevée au placement complet (pas de lecture au clic)
function stationProche(mx, my, rayon){
let meilleure = null, dMin = Infinity, dPt = Infinity;
for (const p of puces) {
if (p.etat !== 'vue' || !p.vis) continue;
const bx = p.x + p.dx, by = p.y + p.dy;
const ex = Math.max(bx - mx, 0, mx - bx - p.bw), ey = Math.max(by - my, 0, my - by - p.bh);
const dp = Math.max(0, Math.hypot(mx - p.x, my - p.y) - 6); // le point compte pour un disque de 6 px
const d = Math.min(Math.hypot(ex, ey), dp);
// à égalité (pointeur sur une étiquette et sur le point d'une autre) : le point le plus proche l'emporte
if (d < dMin - 0.5 || (d <= dMin + 0.5 && dp < dPt)) { meilleure = p; dMin = d; dPt = dp; }
}
return dMin <= rayon ? meilleure : null;
}
let typePointeur = 'mouse', depart = null;
carte.addEventListener('pointerdown', ev => { typePointeur = ev.pointerType || 'mouse'; depart = [ev.clientX, ev.clientY]; }, true);
carte.addEventListener('click', ev => {
if (!ev.detail || ev.target.closest(HORS_ZONES)) return; // clavier (Entrée, Espace) : le bouton s'en charge
if (depart && Math.hypot(ev.clientX - depart[0], ev.clientY - depart[1]) > 6) return; // fin d'un glissé
const p = stationProche(ev.pageX - posCarte[0], ev.pageY - posCarte[1], RAYON[typePointeur] || RAYON.mouse);
if (!p) return;
ev.stopPropagation(); ev.preventDefault();
ouvrir(p);
}, true);
// survol à la souris : la station qui recevra le clic s'éclaire (une fois par image au plus)
let survol = null, survolXY = null, survolId = 0;
function majSurvol(){
survolId = 0;
const p = survolXY && !doigts.size ? stationProche(survolXY[0] - posCarte[0], survolXY[1] - posCarte[1], RAYON.mouse) : null;
if (p === survol) return;
if (survol) survol.m.classList.remove('survol');
survol = p;
if (p) p.m.classList.add('survol');
carte.classList.toggle('vise', !!p);
}
carte.addEventListener('pointermove', ev => {
if (ev.pointerType !== 'mouse') return;
survolXY = ev.target.closest(HORS_ZONES) ? null : [ev.pageX, ev.pageY];
if (!survolId) survolId = requestAnimationFrame(majSurvol);
});
carte.addEventListener('pointerleave', () => { survolXY = null; if (!survolId) survolId = requestAnimationFrame(majSurvol); });
document.getElementById('plus').addEventListener('click', () => { const z = Z || zone(); viser(autour(2, z.cx, z.cy)); });
document.getElementById('moins').addEventListener('click', () => { const z = Z || zone(); viser(autour(0.5, z.cx, z.cy)); });
// échelle et boutons : mis à jour au placement complet (quelques fois par seconde pendant un geste),
// jamais à chaque image : la barre change de largeur, ce qui demanderait une mise en page
const barre = document.getElementById('barre'), kmTxt = document.getElementById('km'),
btnPlus = document.getElementById('plus'), btnMoins = document.getElementById('moins');
let barreW = '';
function echelle(s){
if (s > sMin * 1.05) replier(true); // zoomer replie le cartouche sur téléphone
const km = [1, 2, 5, 10, 20].find(k => k * 10 * s >= 60) || 20, w = Math.round(km * 10 * s) + 'px';
if (w !== barreW) { barre.style.width = w; barreW = w; }
if (kmTxt.textContent !== km + ' km') kmTxt.textContent = km + ' km';
retour.classList.toggle('vu', s > sMin * 1.15);
btnPlus.disabled = s >= S_MAX;
btnMoins.disabled = s <= sMin * 1.001;
}
// positions en px arrondies au pixel de l'écran : texte net à l'arrêt
const arrondi = v => Math.round(v * devicePixelRatio) / devicePixelRatio;
function placerEtq(q, x, y){
const v = `translate3d(${arrondi(x)}px,${arrondi(y)}px,0) ${q.o[0]}`;
if (v !== q.tr) { q.d.style.transform = v; q.tr = v; }
}
function visEtq(q, oui){ if (q.vis !== oui) { q.d.classList.toggle('cache', !oui); q.vis = oui; } }
// position d'une puce, avec son animation de séparation (« sort ») ou de fusion (« entre ») :
// transformation et opacité seulement
const DUREE_ANIM = 300;
function placerPuce(p, t){
let ox = 0, oy = 0, k = 1, op = '';
const a = p.anim;
if (a) {
const u = Math.min(1, (t - a.t) / DUREE_ANIM), e = 1 - Math.pow(1 - u, 3);
if (u >= 1) p.anim = null;
else if (a.sens === 'sort') { const r = 1 - e; ox = (a.de.x - p.x) * r; oy = (a.de.y - p.y) * r; k = 0.6 + 0.4 * e; op = e; }
else { ox = (p.dans.x - p.x) * e; oy = (p.dans.y - p.y) * e; k = 1 - 0.4 * e; op = 1 - e; }
}
const v = `translate3d(${arrondi(p.x + ox)}px,${arrondi(p.y + oy)}px,0)` + (k !== 1 ? ` scale(${k.toFixed(3)})` : '');
if (v !== p.tr) { p.m.style.transform = v; p.tr = v; }
const o = op === '' ? '' : op.toFixed(3);
if (o !== p.op) { p.m.style.opacity = o; p.op = o; }
}
// visible : posée, ou en train de rentrer dans sa voisine
function visPuce(p){
const oui = p.etat === 'vue' || !!(p.anim && p.anim.sens === 'entre');
if (oui !== p.vis) { p.m.classList.toggle('cache', !oui); p.vis = oui; }
}
// une image d'animation des puces, sans aucun recalcul de placement ; vrai tant qu'il en reste
function animer(t = performance.now()){
let encore = false;
puces.forEach(p => { if (!p.anim) return; placerPuce(p, t); visPuce(p); if (p.anim) encore = true; });
return encore;
}
// à chaque image d'un geste : les images suivent, puces et noms glissent avec, sans recalcul ni lecture de mise en page
function suivre(){
if (!Z) return;
poser();
const s = vue.s, vx = vue.cx - Z.cx / s, vy = vue.cy - Z.cy / s, t = performance.now();
puces.forEach(p => {
p.x = (p.xy[0] - vx) * s; p.y = (p.xy[1] - vy) * s;
if (p.vis) { placerPuce(p, t); visPuce(p); }
});
etqs.forEach(q => { if (q.vis) placerEtq(q, (q.xy[0] - vx) * s, (q.xy[1] - vy) * s); });
}
// placement complet : images, puces (regroupements) et noms (sans chevauchement).
// Toutes les lectures de mise en page sont faites d'abord ; tailles des puces et des noms mesurées
// une fois puis gardées ; ensuite rien que des calculs, et des écritures seulement quand quelque chose change.
// Renvoie vrai tant qu'une puce est en mouvement.
let aJour = false, etqMesurees = false;
const TAILLES = new Map(); // contenu d'une puce -> [largeur, hauteur] du bouton
const [elCmd, elPend, elThermo, elLeg] = ['commandes', 'pendule', 'thermo', 'legende'].map(i => document.getElementById(i)),
elSuite = document.querySelector('.carte .suite');
let legendeEtat = '';
// échelle des km sur grand écran : centrée à mi-chemin entre le bouton « Toutes les stations » et l'échelle
// des degrés (dans les deux sens), plus collée à cette dernière ; ailleurs, la place prévue par le CSS
function milieuLegende(rl, rs, rt, r0, W){
if (W <= 1000 || !rs.width || rt.left - rs.right < rl.width + 40) return null;
const cx = (rs.right + rt.left) / 2 - r0.left, cy = ((rs.top + rs.bottom) / 2 + (rt.top + rt.bottom) / 2) / 2 - r0.top;
const l = r0.left + cx - rl.width / 2, h = r0.top + cy - rl.height / 2;
return {cx: Math.round(cx), cy: Math.round(cy), r: {left: l, top: h, right: l + rl.width, bottom: h + rl.height}};
}
function disposer(){
if (!carte.clientWidth) return false;
if (!vue) initialiser();
// 1. lectures
const z = Z = zone(), {W, H, mob, r0} = z, s = vue.s;
const vx = vue.cx - z.cx / s, vy = vue.cy - z.cy / s;
posCarte = [r0.left + scrollX, r0.top + scrollY];
calcul = performance.now();
const ecran = ([x, y]) => [(x - vx) * s, (y - vy) * s];
const marge = r => ({left: r.left - 8, top: r.top - 8, right: r.right + 8, bottom: r.bottom + 8});
const [rCart, rCmd, rPend, rTh, rLeg, rSuite] = [cart, elCmd, elPend, elThermo, elLeg, elSuite].map(el => el.getBoundingClientRect());
const leg = milieuLegende(rLeg, rSuite, rTh, r0, W);
const interdits = [rCart, rCmd, rPend, rTh, leg ? leg.r : rLeg].map(marge);
if (!etqMesurees) { // une fois (et après le chargement des polices) : taille de chaque nom
etqs.forEach(q => visEtq(q, true));
etqs.forEach(q => { q.w = q.d.offsetWidth; q.h = q.d.offsetHeight; });
etqMesurees = true;
}
const dedans = r => r.left >= r0.left + 4 && r.right <= r0.right - 4 && r.top >= r0.top + 4 && r.bottom <= r0.bottom - 4;
// puces : au-dessus du point, sinon dessous, à droite, à gauche ; sinon fusion avec la voisine
const posees = [];
puces.forEach(p => {
p.avant = p.etat; p.dansAvant = p.dans; p.etat = 'hors'; p.dans = null;
p.ids = p.g.st.slice(); p.absorbe = false; p.mini = s > 5; p.titre = p.g.nom;
p.force = null;
[p.x, p.y] = ecran(p.xy);
});
// tant qu'on n'a pas bien zoomé, les stations d'un même village restent dans la puce du village
// (comptées avant le placement, pour que la puce soit mesurée avec son « +N »)
if (s < sMin * 2.2) puces.forEach(p => {
if (!p.g.parent) return;
const v = puces.find(q => q.g.nom === p.g.parent);
if (v) { v.ids.push(...p.ids); p.force = v; }
});
const modeOk = p => !(MODE === 'vent' || MODE === 'pluie') || p.ids.some(id => capteur(id, MODE));
const candidates = puces.filter(p => !p.force && modeOk(p));
// taille de chaque puce selon son contenu : les contenus jamais vus sont écrits puis mesurés ensemble (une seule mise en page)
const nouvelles = [];
candidates.forEach(p => { p.c = contenu(p); p.cle = (mob ? 'm' : 'd') + p.c.cl + p.c.hb; if (!TAILLES.has(p.cle)) nouvelles.push(p); });
if (nouvelles.length) {
nouvelles.forEach(p => { ecrire(p); if (!p.vis) { p.m.classList.remove('cache'); p.vis = true; } });
nouvelles.forEach(p => TAILLES.set(p.cle, [p.b.offsetWidth, p.b.offsetHeight]));
}
// la station la plus froide et la plus chaude du moment passent en premier : jamais cachées dans un « +N »
const vivantes = puces.filter(p => !p.force && STATIONS[p.g.st[0]].t != null);
const extremes = new Set(vivantes.length ? [
vivantes.reduce((a, b) => STATIONS[a.g.st[0]].t <= STATIONS[b.g.st[0]].t ? a : b),
vivantes.reduce((a, b) => STATIONS[a.g.st[0]].t >= STATIONS[b.g.st[0]].t ? a : b)] : []);
const pointsAutres = candidates.map(q => ({p: q, r: {left: r0.left + q.x - 6, right: r0.left + q.x + 6, top: r0.top + q.y - 6, bottom: r0.top + q.y + 6}}));
[...extremes, ...puces.filter(p => !extremes.has(p))].forEach(p => {
const {x, y} = p;
if (!modeOk(p)) return;
if (p.force) { p.etat = 'dans'; p.dans = p.force; return; }
const [bw, bh] = TAILLES.get(p.cle);
const essais = [[-bw / 2, -bh - 12], [-bw / 2, 12], [14, -bh / 2], [-bw - 14, -bh / 2], [12, -bh - 8], [-bw - 12, -bh - 8]];
let choix = null;
for (const strict of [true, false]) {
for (const [dx, dy] of essais) {
const r = {left: r0.left + x + dx, top: r0.top + y + dy, right: r0.left + x + dx + bw, bottom: r0.top + y + dy + bh};
const m = {left: r.left - 3, right: r.right + 3, top: r.top - 3, bottom: r.bottom + 3}; // 3 px d'air entre étiquettes
if (dedans(r) && !interdits.some(z => chevauche(m, z)) && !posees.some(q => chevauche(m, q.r))
&& !(strict && pointsAutres.some(z => z.p !== p && chevauche(r, z.r)))) { choix = {dx, dy, r}; break; }
}
if (choix) break;
}
if (!choix) {
// pas de place : la station rejoint la puce posée la plus proche
const hors = x < 0 || y < 0 || x > W || y > H;
// la puce de son village d'abord, sinon la plus proche
const pres = q => Math.hypot(q.p.x - x, q.p.y - y);
const village = posees.find(q => q.p.g.nom === p.g.parent && pres(q) < 220);
const q = !hors && (village || posees.length && posees.reduce((a, b) => pres(a) < pres(b) ? a : b));
if (q && (q === village || pres(q) < 160)) { q.p.ids.push(...p.ids); q.p.absorbe = true; p.etat = 'dans'; p.dans = q.p; }
return;
}
p.dx = choix.dx; p.dy = choix.dy; p.bw = bw; p.bh = bh;
posees.push({p, r: choix.r});
p.etat = 'vue';
});
// 2. écritures. Séparation : la puce sort de celle qui la contenait ; fusion : elle y rentre en s'effaçant
const t = performance.now(), fw = mob ? 244 : 272;
puces.forEach(p => {
if (!reduit && p.etat === 'vue' && p.avant === 'dans' && p.dansAvant) p.anim = {t, sens: 'sort', de: p.dansAvant};
if (!reduit && p.etat === 'dans' && p.avant === 'vue') p.anim = {t, sens: 'entre'};
if (p.anim && (p.anim.sens === 'sort' ? p.etat !== 'vue' : p.etat !== 'dans')) p.anim = null;
if (p.etat === 'vue') {
ecrire(p, p.absorbe ? contenu(p) : p.c);
const g = `${p.dx},${p.dy},${p.bw},${p.bh}`;
if (g !== p.geo) {
p.geo = g;
p.b.style.left = p.dx + 'px'; p.b.style.top = p.dy + 'px';
const fx = Math.min(Math.max(0, p.dx), p.dx + p.bw), fy = Math.min(Math.max(0, p.dy), p.dy + p.bh);
p.fil.style.width = Math.hypot(fx, fy) + 'px';
p.fil.style.transform = `rotate(${Math.atan2(fy, fx)}rad)`;
}
// une fusion peut élargir une puce déjà posée : on garde sa place, la fiche se cale dessous
const fl = Math.round(Math.max(-p.x + 8, Math.min(p.dx, W - p.x - fw - 8))) + 'px', ft = (p.dy + p.bh + 6) + 'px';
if (fl !== p.fl) { p.f.style.left = fl; p.fl = fl; }
if (ft !== p.ft) { p.f.style.top = ft; p.ft = ft; }
}
placerPuce(p, t); visPuce(p);
});
posees.forEach(q => interdits.push(q.r, {left: r0.left + q.p.x - 7, right: r0.left + q.p.x + 7, top: r0.top + q.p.y - 7, bottom: r0.top + q.p.y + 7}));
// noms : priorité selon l'échelle, puis sans chevauchement (rectangles calculés depuis la taille gardée)
const seuil = s > 3 ? 3 : s > 1.6 ? 2 : 1;
const placees = [];
etqs.sort((a, b) => a.e.p - b.e.p).forEach(q => {
const [x, y] = ecran(q.xy);
let oui = !(q.e.p > seuil || x < 0 || y < 0 || x > W || y > H);
if (oui) {
const [ox, oy] = q.o[1](q.w, q.h), l = r0.left + x + ox, h = r0.top + y + oy;
const r = {left: l, top: h, right: l + q.w, bottom: h + q.h};
const g = {left: r.left - 4, right: r.right + 4, top: r.top - 3, bottom: r.bottom + 3};
if (!dedans(r) || interdits.some(z => chevauche(g, z)) || placees.some(z => chevauche(g, z))) oui = false;
else placees.push(g);
}
if (oui) placerEtq(q, x, y);
visEtq(q, oui);
});
const le = leg ? leg.cx + ',' + leg.cy : '';
if (le !== legendeEtat) {
legendeEtat = le; elLeg.classList.toggle('milieu', !!leg);
elLeg.style.left = leg ? leg.cx + 'px' : ''; elLeg.style.top = leg ? leg.cy + 'px' : '';
}
poser();
echelle(s);
return puces.some(p => p.anim);
}
// liste sous la carte, par secteur
let TRI = 0; // 0 par secteur, 1 altitude croissante, 2 décroissante
function listeStations(){
const carteCase = id => {
const s = STATIONS[id], vm = valMode(s);
return `<button type="button" class="case${s.exemple ? ' ex' : ''}" data-id="${id}"><small>${s.alt} m · ${s.src}${s.exemple ? ' · ' + t('etat.donnees0') : s.horsLigne ? ' · ' + t('etat.hl') : ''}</small><strong>${s.nom}</strong><b style="color:${vm[1]}">${vm[0]}</b></button>`;
};
if (TRI) {
const ids = GROUPES.flatMap(g => g.st).filter(id => capteur(id, MODE)).sort((a, b) => (STATIONS[a].alt - STATIONS[b].alt) * (TRI === 1 ? 1 : -1));
document.getElementById('secteurs').innerHTML = `<div class="grille">${ids.map(carteCase).join('')}</div>`;
return;
}
const sects = {};
GROUPES.forEach(g => g.st.forEach(id => (sects[g.sect] ||= []).push(id)));
const ordre = ['Quatre-Montagnes', 'Hauts-Plateaux et Vercors drômois', 'Trièves et Gresse', 'Royans', 'Diois'];
document.getElementById('secteurs').innerHTML = ordre.map(n => { const l = sects[n].filter(id => capteur(id, MODE)); return l.length ? `<h3>${n}</h3><div class="grille">${l.map(carteCase).join('')}</div>` : ''; }).join('');
}
function coupe(){
const L = Object.entries(STATIONS).filter(([, x]) => x.t != null).map(([id, x]) => ({id, ...x}));
const cible = document.getElementById('coupe-svg');
if (L.length < 3) { cible.innerHTML = ''; return; }
const W = Math.max(300, Math.min(720, cible.clientWidth || 720)), H = W < 500 ? 330 : 380, g = W < 500 ? 46 : 52, d = 14, b = 30, h = 12;
const tMin = Math.floor(Math.min(...L.map(x => x.t)) - 1), tMax = Math.ceil(Math.max(...L.map(x => x.t)) + 1);
const aMin = Math.floor(Math.min(...L.map(x => x.alt)) / 250) * 250 - 100, aMax = Math.ceil(Math.max(...L.map(x => x.alt)) / 250) * 250 + 100;
const X = t => g + (t - tMin) / (tMax - tMin) * (W - g - d), Y = a => H - b - (a - aMin) / (aMax - aMin) * (H - b - h);
const pas = (tMax - tMin) > 14 ? 5 : 2;
let o = '';
for (let t = Math.ceil(tMin / pas) * pas; t <= tMax; t += pas) o += `<line x1="${X(t)}" x2="${X(t)}" y1="${h}" y2="${H - b}" stroke="#e4e0d6"/><text x="${X(t)}" y="${H - b + 16}" text-anchor="middle">${t}°</text>`;
for (let a = Math.ceil(aMin / 500) * 500; a <= aMax; a += 500) o += `<line x1="${g}" x2="${W - d}" y1="${Y(a)}" y2="${Y(a)}" stroke="#e4e0d6"/><text x="${g - 6}" y="${Y(a) + 4}" text-anchor="end">${a} m</text>`;
// atmosphère standard : −0,65 °C par 100 m, depuis la station la plus basse
const bas = L.reduce((a, c) => c.alt < a.alt ? c : a);
const tAt = a => bas.t - 0.0065 * (a - bas.alt);
o += `<line x1="${X(tAt(aMin))}" y1="${Y(aMin)}" x2="${X(tAt(aMax))}" y2="${Y(aMax)}" stroke="#6f8f5c" stroke-width="1.5" stroke-dasharray="5 4"/><text x="${g + 6}" y="${H - b - 8}" style="fill:#6f8f5c">${t('coupe.normal')}</text>`;
const ext = new Set([L.reduce((a, c) => c.t < a.t ? c : a).id, L.reduce((a, c) => c.t > a.t ? c : a).id, L.reduce((a, c) => c.alt > a.alt ? c : a).id, bas.id]);
L.sort((a, c) => a.alt - c.alt).forEach(x => {
o += `<g class="st" tabindex="0" data-id="${x.id}" role="button" aria-label="${t('coupe.st', x.nom, x.alt, fmt(x.t))}"><rect x="${X(x.t) - 6}" y="${Y(x.alt) - 6}" width="12" height="12" fill="${couleur(x.t)}"/>${ext.has(x.id) ? `<text x="${X(x.t) + (X(x.t) > W - 130 ? -10 : 10)}" y="${Y(x.alt) + 4}" text-anchor="${X(x.t) > W - 130 ? 'end' : 'start'}">${NOMS[x.id] || court(x.nom)}</text>` : ''}</g>`;
});
cible.innerHTML = `<svg viewBox="0 0 ${W} ${H}" role="img" aria-label="${t('coupe.aria')}">${o}</svg>`;
// inversion : corrélation entre altitude et température
const n = L.length, ma = L.reduce((a, c) => a + c.alt, 0) / n, mt = L.reduce((a, c) => a + c.t, 0) / n;
const pente = L.reduce((a, c) => a + (c.alt - ma) * (c.t - mt), 0) / L.reduce((a, c) => a + (c.alt - ma) ** 2, 0) * 100;
document.getElementById('coupe-txt').textContent = Math.abs(pente) < 0.15 ? t('coupe.plat') : pente > 0 ? t('coupe.inv', nb1(pente)) : t('coupe.baisse', nb1(-pente));
}
let largeurCoupe = 0;
addEventListener('resize', () => { const w = document.getElementById('coupe-svg').clientWidth; if (w !== largeurCoupe) { largeurCoupe = w; coupe(); } });
function surlignerCarte(id, oui){ puces.forEach(q => q.m.classList.toggle('mis', oui && q.ids.includes(id))); }
const coupeSvg = document.getElementById('coupe-svg'), coupeLect = document.getElementById('coupe-lect');
const lectureCoupe = id => { const x = STATIONS[id]; coupeLect.textContent = `${x.nom} · ${x.alt} m · ${fmt(x.t)}`; };
coupeSvg.addEventListener('mouseover', ev => { const g = ev.target.closest('.st'); if (g) { lectureCoupe(g.dataset.id); surlignerCarte(g.dataset.id, true); } });
coupeSvg.addEventListener('mouseout', ev => { if (ev.target.closest('.st')) surlignerCarte('', false); });
coupeSvg.addEventListener('focusin', ev => { const g = ev.target.closest('.st'); if (g) { lectureCoupe(g.dataset.id); surlignerCarte(g.dataset.id, true); } });
coupeSvg.addEventListener('focusout', () => surlignerCarte('', false));
coupeSvg.addEventListener('click', ev => { const g = ev.target.closest('.st'); if (g) { lectureCoupe(g.dataset.id); ouvrirPlein([g.dataset.id], g.dataset.id); } });
listeStations();
document.getElementById('secteurs').addEventListener('click', ev => {
const c = ev.target.closest('.case'); if (c && STATIONS[c.dataset.id]) ouvrirPlein([c.dataset.id], c.dataset.id);
});
// Forum : tant qu'il n'est pas ouvert (connexion Gastinel non branchée), l'encadré annonce l'ouverture sans faux bouton
function forumTextes(){ if (!FORUM_OUVERT) document.querySelectorAll('.forum-box').forEach(b => {
b.classList.add('ferme');
const cta = b.querySelector('.fb-cta'); cta.removeAttribute('href'); cta.setAttribute('aria-disabled', 'true'); cta.textContent = t('forum.ouverture');
const une = b.querySelector('[data-une]'); une.removeAttribute('href'); une.textContent = t('forum.recap');
b.querySelector('.fb-une small').textContent = t('forum.bientot');
}); }
forumTextes();
// panneaux déroulants (stations, bilan)
function basculer(p, oui){
const o = oui == null ? !p.classList.contains('ouvert') : oui;
p.classList.toggle('ouvert', o);
p.querySelector('.panneau-tete').setAttribute('aria-expanded', o);
p.querySelector('.panneau-corps').inert = !o;
if (o && p.id === 'p-bilan') remplirBilan();
}
document.querySelectorAll('.panneau-tete').forEach(b => b.addEventListener('click', () => basculer(b.closest('.panneau'))));
document.querySelectorAll('a[href="#stations"]').forEach(a => a.addEventListener('click', ev => {
ev.preventDefault(); basculer(document.getElementById('p-stations'), true);
document.getElementById('stations').scrollIntoView({behavior: reduit ? 'auto' : 'smooth', block: 'start'});
}));
// lien partagé #stations : on ouvre le panneau puis on efface l'ancre, pour qu'un rechargement depuis le haut de page ne redescende pas
if (location.hash === '#stations') { basculer(document.getElementById('p-stations'), true); history.replaceState(null, '', location.pathname + location.search); }
async function remplirBilan(){
const z = document.getElementById('bilan');
await chargerSeries();
if (!SERIES || !Object.keys(SERIES).length) { z.textContent = t('bilan.vide'); return; }
let fr, ch, vt, pl, debut = Infinity;
Object.entries(SERIES).forEach(([id, d]) => {
debut = Math.min(debut, d.archive_depuis || d.debut);
const cap = SEM[id] || {};
d.t.forEach((v, i) => {
const ts = d.debut + i * d.pas;
if (v != null) { if (!fr || v < fr.v) fr = {v, id, ts}; if (!ch || v > ch.v) ch = {v, id, ts}; }
if (cap.vent && d.v[i] != null && (!vt || d.v[i] > vt.v)) vt = {v: d.v[i], id, ts};
if (cap.pluie && d.r[i] != null && d.r[i] > 0 && (!pl || d.r[i] > pl.v)) pl = {v: d.r[i], id, ts};
});
});
const jours = (Date.now() / 1000 - debut) / 86400;
const quand = r => `${court(STATIONS[r.id].nom)} · ${fmtJH.format(new Date(r.ts * 1000)).replace(',', '')}`;
const carte = (titre, r, val) => `<div><small>${titre}</small><b>${r ? val(r.v) : '—'}</b><span>${r ? quand(r) : t('bilan.aucune')}</span></div>`;
z.innerHTML = `<div class="bilan">${carte(t('bilan.froid'), fr, fmt)}${carte(t('bilan.chaud'), ch, fmt)}${carte(t('bilan.vent'), vt, v => Math.round(v) + ' km/h')}${carte(t('bilan.pluie'), pl, v => nb1(v) + ' mm')}</div>`
+ (jours < 6.5 ? `<p class="bilan-note">${t('bilan.note', dec(Math.max(1, Math.round(jours * 10) / 10).toString()))}</p>` : '');
}
// données en direct : postes Météo-France (collecteur toutes les 6 min) et stations Infoclimat (extraction du fichier LAN)
const POSTES_MF = {'mf-autrans': 'autrans', 'mf-villard': 'villard', 'mf-chapelle': 'chapelle',
'mf-rousset': 'rousset', 'mf-gresse': 'gresse', 'mf-st-jean': 'st-jean'};
let dernierReleve = null;
function majDate(){
if (!dernierReleve) return;
const jour = new Intl.DateTimeFormat(LOC[L], {weekday: 'long', day: 'numeric', month: 'long', timeZone: 'Europe/Paris'}).format(dernierReleve);
document.getElementById('date').textContent = jour[0].toUpperCase() + jour.slice(1);
}
function afficherDirect(){
if (!dernierReleve) return;
const min = Math.max(0, Math.round((Date.now() - dernierReleve) / 60000));
const d = document.getElementById('direct');
const hm = new Intl.DateTimeFormat(LOC[L], {hour: '2-digit', minute: '2-digit', timeZone: 'Europe/Paris'}).format(dernierReleve);
d.textContent = t('direct.releves', L === 'fr' ? hm.replace(':', ' h ') : hm, min < 1 ? t('direct.instant') : min < 120 ? t('direct.min', min) : t('direct.h', Math.round(min / 60)));
d.classList.toggle('vieux', min > 45);
}
setInterval(afficherDirect, 30000);
// la pancarte se balance au bout de ses cordes : à chaque passage au milieu, nouvelle amplitude (15 px au plus d'un bord à l'autre) et nouvelle période.
// Quand la carte bouge (déplacement, zoom), elle prend un peu d'élan dans le même sens puis revient (ressort amorti).
// On peut aussi la glisser ailleurs (souris ou doigt) ; double-clic ou double-toucher pour la remettre. Tout en transform / translate.
(function(){
const pendule = document.getElementById('pendule');
const cordes = [...pendule.querySelectorAll('.corde')], plaque = pendule.querySelector('.pancarte'), L = 22;
let ph = 0, A = 6, P = 3000, avant = performance.now(), id = 0, vu = true;
let ox = 0, oy = 0, vx = 0, vy = 0, pv = null; // écart dû au mouvement de la carte, sa vitesse, et la vue de l'image précédente
// la boucle ne tourne que si la pancarte se voit : cachée sur téléphone, arrêtée quand la carte sort de l'écran
const mq = matchMedia('(max-width:720px)');
const lancer = () => { if (!id && vu && !mq.matches && !reduit) { avant = performance.now(); pv = null; id = requestAnimationFrame(balancer); } };
mq.addEventListener('change', lancer);
if ('IntersectionObserver' in window) new IntersectionObserver(l => { vu = l[0].isIntersecting; lancer(); }).observe(pendule.parentNode);
const libre = () => !!REG.pancarte;
const poser = (x, y) => {
const a = Math.asin(Math.max(-0.95, Math.min(0.95, x / L)));
cordes.forEach(c => { c.style.transform = `rotate(${-a}rad)`; });
plaque.style.transform = `translate(${x}px,${L * (1 - Math.cos(a)) + y}px)`;
};
const balancer = t => {
id = 0;
if (reduit) { cordes.forEach(c => { c.style.transform = ''; }); plaque.style.transform = ''; ox = oy = vx = vy = 0; return; }
if (!vu || mq.matches) return;
const dt = Math.min(100, t - avant); avant = t;
const ancien = ph; ph += dt / P * 2 * Math.PI;
if (Math.floor(ancien / Math.PI) !== Math.floor(ph / Math.PI)) { A = 3 + Math.random() * 4.5; P = 2600 + Math.random() * 1600; }
// élan : vitesse de l'image de la carte sur l'écran (px/s) et du zoom ; la pancarte est tirée un peu dans ce sens, puis le ressort la ramène
const h = Math.max(dt, 1) / 1000;
let cx = 0, cy = 0;
if (vue && pv) {
cx = -(vue.cx - pv.cx) * vue.s / h * 0.008; cy = (-(vue.cy - pv.cy) * vue.s / h * 0.008) + Math.log(vue.s / pv.s) / h * 5;
}
pv = vue ? {cx: vue.cx, cy: vue.cy, s: vue.s} : null;
cx = Math.max(-8, Math.min(8, cx)); cy = Math.max(-5, Math.min(5, cy));
vx += (-70 * (ox - cx) - 7 * vx) * h; vy += (-70 * (oy - cy) - 7 * vy) * h;
ox += vx * h; oy += vy * h;
if (Math.abs(ox) < 0.01 && Math.abs(vx) < 0.05) ox = vx = 0;
if (Math.abs(oy) < 0.01 && Math.abs(vy) < 0.05) oy = vy = 0;
poser((libre() ? 0 : A * Math.sin(ph)) + ox, oy);
id = requestAnimationFrame(balancer);
};
relancerPendule = lancer;
// ----- position choisie par la personne -----
let dx = 0, dy = 0; // écart actuel par rapport à la place d'origine
const limites = () => { // la pancarte reste dans la carte et dans la fenêtre
const r = plaque.getBoundingClientRect(), c = carte.getBoundingClientRect();
const bx = r.left - dx, by = r.top - dy, m = 4;
const g = Math.max(c.left, 0) + m, d = Math.min(c.right, innerWidth) - m, h = Math.max(c.top, 0) + m, b = Math.min(c.bottom, innerHeight) - m;
return {x0: g - bx, x1: Math.max(g - bx, d - bx - r.width), y0: h - by, y1: Math.max(h - by, b - by - r.height)};
};
const appliquer = (x, y) => {
dx = x; dy = y;
pendule.style.translate = x || y ? `${x}px ${y}px` : '';
pendule.classList.toggle('libre', !!(x || y));
if (!id) poser(0, 0);
};
placerPancarte = () => {
const q = REG.pancarte;
if (!q || mq.matches) { appliquer(0, 0); return; }
const l = limites();
appliquer(Math.max(l.x0, Math.min(l.x1, q.x)), Math.max(l.y0, Math.min(l.y1, q.y)));
};
const remettre = () => {
if (!reduit) { pendule.classList.add('ramene'); setTimeout(() => pendule.classList.remove('ramene'), 300); }
REG.pancarte = null; enregistrerReglages(); appliquer(0, 0);
};
let prise = null, dernierToucher = 0;
plaque.addEventListener('pointerdown', ev => {
if (ev.button > 0) return;
ev.preventDefault();
prise = {pid: ev.pointerId, x: ev.clientX, y: ev.clientY, dx, dy, lim: limites(), bouge: false};
try { plaque.setPointerCapture(ev.pointerId); } catch (e) {}
plaque.classList.add('prise');
});
plaque.addEventListener('pointermove', ev => {
if (!prise || ev.pointerId !== prise.pid) return;
const ex = ev.clientX - prise.x, ey = ev.clientY - prise.y;
if (!prise.bouge && Math.hypot(ex, ey) < 4) return;
prise.bouge = true;
const l = prise.lim;
appliquer(Math.max(l.x0, Math.min(l.x1, prise.dx + ex)), Math.max(l.y0, Math.min(l.y1, prise.dy + ey)));
});
const lacher = ev => {
if (!prise || ev.pointerId !== prise.pid) return;
const p = prise; prise = null; plaque.classList.remove('prise');
if (p.bouge) { REG.pancarte = dx || dy ? {x: Math.round(dx), y: Math.round(dy)} : null; enregistrerReglages(); dernierToucher = 0; return; }
const maintenant = performance.now(); // double-clic ou double-toucher : retour à la place d'origine
if (ev.type === 'pointerup' && maintenant - dernierToucher < 400) { dernierToucher = 0; remettre(); } else dernierToucher = maintenant;
};
plaque.addEventListener('pointerup', lacher); plaque.addEventListener('pointercancel', lacher);
plaque.addEventListener('dblclick', ev => { ev.preventDefault(); if (dx || dy) remettre(); });
addEventListener('resize', () => { if (REG.pancarte) placerPancarte(); });
mq.addEventListener('change', placerPancarte);
placerPancarte();
lancer();
})();
// recherche : stations d'abord, puis villages et sommets de la carte
const RECH = [];
Object.keys(STATIONS).forEach(id => RECH.push({n: STATIONS[id].nom, id, lon: STATIONS[id].lon, lat: STATIONS[id].lat, t: 'station'}));
ETIQ.filter(e => ['village', 'ville', 'pic'].includes(e.t)).forEach(e => RECH.push({n: e.n, lon: e.lon, lat: e.lat, t: e.t === 'pic' ? 'sommet' : 'commune'}));
const norm = x => x.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
const rech = document.getElementById('rech'), resultats = document.getElementById('rech-res');
let choixRech = -1;
function listerRecherche(){
const q = norm(rech.value);
const l = q ? RECH.filter(r => norm(r.n).includes(q)).sort((a, b) => (a.t === 'station' ? 0 : 1) - (b.t === 'station' ? 0 : 1)).slice(0, 7) : [];
resultats.innerHTML = l.map((r, i) => `<li data-i="${RECH.indexOf(r)}" class="${i === choixRech ? 'on' : ''}">${r.n}<small>${t('type.' + r.t)}</small></li>`).join('');
resultats.hidden = !l.length;
return l;
}
function allerA(r){
resultats.hidden = true; rech.blur(); rech.value = '';
fermer();
const b = r.id ? boite([r.id]) : [r.lon - 0.05, r.lat + 0.04, r.lon + 0.05, r.lat - 0.04];
zoomer(b);
if (r.id) setTimeout(() => { const p = puces.find(q => q.ids.includes(r.id) && !q.m.classList.contains('cache')); if (p) ouvrir(p); }, 650);
}
rech.addEventListener('input', () => { choixRech = -1; listerRecherche(); });
rech.addEventListener('keydown', ev => {
const l = listerRecherche();
if (ev.key === 'ArrowDown') { choixRech = Math.min(l.length - 1, choixRech + 1); listerRecherche(); ev.preventDefault(); }
else if (ev.key === 'ArrowUp') { choixRech = Math.max(0, choixRech - 1); listerRecherche(); ev.preventDefault(); }
else if (ev.key === 'Enter' && l.length) { allerA(l[Math.max(0, choixRech)]); }
else if (ev.key === 'Escape') { resultats.hidden = true; }
});
resultats.addEventListener('mousedown', ev => { const li = ev.target.closest('li'); if (li) { ev.preventDefault(); allerA(RECH[+li.dataset.i]); } });
rech.addEventListener('blur', () => setTimeout(() => { resultats.hidden = true; }, 120));
const modes = document.getElementById('modes');
function majAlt(){ const alt = modes.querySelector('[data-mode=alt]'); alt.dataset.tri = TRI; alt.textContent = t('mode.alt') + ['', ' ↑', ' ↓'][TRI]; }
modes.addEventListener('click', ev => {
const b = ev.target.closest('button'); if (!b) return;
const m = b.dataset.mode;
TRI = m !== 'alt' ? 0 : MODE === 'alt' ? (TRI === 1 ? 2 : 1) : 1;
MODE = m;
majAlt();
modes.querySelectorAll('button').forEach(x => x.setAttribute('aria-pressed', x === b));
puces.forEach(q => { q.hb = null; });
listeStations();
disposer(); relancer();
});
// ----- curseur du temps -----
let SERIES = null, TEMPS = null, LIVE = null, T0 = 0, N = 0, lectureId = null, majAttente = false, chargeSeries = null;
const curseur = document.getElementById('curseur'), tempsBox = document.getElementById('temps'), tempsTxt = document.getElementById('temps-txt'), btnLecture = document.getElementById('lecture');
function chargerSeries(){
if (chargeSeries) return chargeSeries;
chargeSeries = Promise.all(Object.keys(STATIONS).map(id => fetch(`data/semaine/${id}.json?${Math.floor(Date.now() / 300000)}`).then(r => r.ok ? r.json() : null).catch(() => null))).then(rs => {
SERIES = {}; let a = Infinity, b = 0;
rs.forEach(d => { if (!d || !d.t) return; SERIES[d.id] = d; a = Math.min(a, d.archive_depuis || d.debut); b = Math.max(b, d.debut + (d.t.length - 1) * d.pas); });
if (!isFinite(a) || b <= a) return;
const fin = Math.floor(b / 1800) * 1800, deb = Math.max(Math.ceil(a / 1800) * 1800, fin - 7 * 86400);
T0 = deb; N = (fin - deb) / 1800;
curseur.max = N; curseur.value = N; curseur.disabled = false; btnLecture.disabled = false;
});
return chargeSeries;
}
function valeurA(id, ts, k){
const d = SERIES && SERIES[id]; if (!d) return null;
const i = Math.round((ts - d.debut) / d.pas); if (i < 0 || i >= d.t.length) return null;
const v = d[k][i]; return v == null ? null : v;
}
function snapshotLive(){ LIVE = {}; Object.entries(STATIONS).forEach(([id, x]) => { LIVE[id] = {t: x.t, vent: x.vent, pluie: x.pluie, mn: x.mn, mx: x.mx}; }); }
function appliquerTemps(){
if (TEMPS == null || !LIVE) return;
Object.entries(STATIONS).forEach(([id, x]) => Object.assign(x, {t: valeurA(id, TEMPS, 't'), vent: valeurA(id, TEMPS, 'v'), pluie: valeurA(id, TEMPS, 'r'), mn: null, mx: null}));
}
function rafraichirTemps(){
if (majAttente) return; majAttente = true;
setTimeout(() => { majAttente = false; puces.forEach(q => { q.hb = null; }); disposer(); relancer(); listeStations(); coupe(); }, 30);
}
function poserTemps(){
const v = +curseur.value;
if (v >= N) { // retour au direct
if (TEMPS != null && LIVE) Object.entries(LIVE).forEach(([id, x]) => Object.assign(STATIONS[id], x));
TEMPS = null; tempsBox.classList.remove('passe'); majTempsTxt();
} else {
if (TEMPS == null) snapshotLive();
TEMPS = T0 + v * 1800; tempsBox.classList.add('passe');
majTempsTxt();
appliquerTemps();
}
rafraichirTemps();
}
function majTempsTxt(){ tempsTxt.textContent = TEMPS == null ? t('temps.maintenant') : fmtJH.format(new Date(TEMPS * 1000)).replace(',', ''); }
function arreterLecture(){ if (lectureId) { clearInterval(lectureId); lectureId = null; } btnLecture.textContent = '▶'; btnLecture.setAttribute('aria-label', t('lecture.rejouer')); }
curseur.addEventListener('input', () => { arreterLecture(); poserTemps(); });
btnLecture.addEventListener('click', () => {
if (lectureId) { arreterLecture(); return; }
if (+curseur.value >= N - 1) curseur.value = Math.max(0, N - 48);
poserTemps();
btnLecture.textContent = '❚❚'; btnLecture.setAttribute('aria-label', t('lecture.pause'));
lectureId = setInterval(() => { curseur.value = Math.min(N, +curseur.value + 1); poserTemps(); if (+curseur.value >= N) arreterLecture(); }, 260);
});
let uneForum = null;
function afficherUneForum(){
if (!uneForum) return;
const {titre, auteur, extrait, url, n} = uneForum;
if (Number.isSafeInteger(n) && n > 0) {
document.querySelectorAll('[data-n]').forEach(e => { e.textContent = t('fb.compte', n); });
}
if (typeof titre !== 'string' || !titre || typeof url !== 'string' || !/^\/forum\/t\/[1-9][0-9]*$/.test(url)) return;
document.querySelectorAll('[data-une]').forEach(a => { a.textContent = titre; a.href = url; });
if (typeof auteur === 'string' && auteur) {
document.querySelectorAll('[data-auteur]').forEach(e => { e.textContent = t('fb.auteur', auteur); });
}
if (typeof extrait === 'string' && extrait) {
document.querySelectorAll('[data-extrait]').forEach(e => { e.textContent = extrait; e.hidden = false; });
}
}
if (FORUM_OUVERT) {
fetch('/forum/api/une.json', {credentials: 'omit'}).then(r => r.ok ? r.json() : null).then(u => {
uneForum = u;
afficherUneForum();
}).catch(() => {});
}
remplirBilan(); // le bilan est déplié dès l'arrivée
function apresDonnees(){ chargerSeries(); if (TEMPS != null) { snapshotLive(); appliquerTemps(); } }
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(i => document.getElementById(i).addEventListener('click', ev => ev.stopPropagation()));
// téléphone : le cartouche se replie tout de suite dès qu'on touche la carte, qu'on descend ou qu'on zoome, se rouvre en remontant
let minuteurRepli = 0;
function replier(oui){
// largeur gardée du dernier placement : pas de lecture de mise en page ici (appelé pendant les gestes)
if ((Z ? Z.W : carte.clientWidth) >= 720) oui = false;
if (cart.classList.contains('replie') === oui) return;
cart.classList.toggle('replie', oui); redisposer();
}
// le cartouche change de taille en douceur : nouveau placement une fois la transition finie
cart.addEventListener('transitionend', ev => { if (ev.target === cart) redisposer(); });
function armerRepli(){} // plus de délai : le cartouche se replie dès qu'on touche la carte ou qu'on descend
carte.addEventListener('pointerdown', ev => { if (!ev.target.closest('.cartouche')) replier(true); });
addEventListener('scroll', () => { if (scrollY > 30) replier(true); else { replier(false); armerRepli(); } }, {passive: true});
cart.addEventListener('click', ev => {
if (ev.target.closest('a, button, input, select, label, .rech') || carte.clientWidth >= 720) return;
const ouvrir = cart.classList.contains('replie');
replier(!ouvrir); if (ouvrir) armerRepli();
});
armerRepli();
// ---- plein écran d'une station : courbes sur 7 jours (archive du serveur) ----
const IC_GOUTTE = '<svg class="ic" viewBox="0 0 16 16" role="img" aria-label="Pluviomètre"><title>Pluviomètre</title><path d="M8 1.4C8 1.4 3 7.1 3 10.3a5 5 0 0 0 10 0C13 7.1 8 1.4 8 1.4z" fill="#2f7fc1"/></svg>';
const IC_EOLIENNE = '<svg class="ic" viewBox="0 0 16 16" role="img" aria-label="Anémomètre"><title>Anémomètre</title><path d="M7.3 7h1.4l.5 8H6.8z" fill="#d9a400"/><g fill="#d9a400"><path d="M8 6.6 7.1.9h1.8z"/><path transform="rotate(120 8 6.6)" d="M8 6.6 7.1.9h1.8z"/><path transform="rotate(240 8 6.6)" d="M8 6.6 7.1.9h1.8z"/><circle cx="8" cy="6.6" r="1.2"/></g></svg>';
let SEM = {}; // capteurs connus par station (index de l'archive)
function icones(id){ const c = SEM[id]; return c ? `${c.pluie ? IC_GOUTTE : ''}${c.vent ? IC_EOLIENNE : ''}` : ''; }
const plein = document.createElement('div');
plein.id = 'plein'; plein.hidden = true;
plein.setAttribute('role', 'dialog'); plein.setAttribute('aria-modal', 'true'); plein.setAttribute('aria-label', t('plein.aria'));
plein.innerHTML = '<div class="plein-barre"><button type="button" class="plein-ferme">' + t('plein.retour') + '</button><nav class="plein-onglets"></nav></div><div class="plein-corps"></div>';
document.body.appendChild(plein);
let pleinIds = [], pleinId = null, pleinDonnees = null, pleinJours = 7;
let fmtJH, fmtMinuit;
function formatsDates(){
fmtJH = new Intl.DateTimeFormat(LOC[L], {weekday: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', hourCycle: 'h23', timeZone: 'Europe/Paris'});
fmtMinuit = new Intl.DateTimeFormat(LOC[L], {weekday: 'short', day: 'numeric', timeZone: 'Europe/Paris'});
}
formatsDates();
const fmtHM = new Intl.DateTimeFormat('en-GB', {hour: '2-digit', minute: '2-digit', hourCycle: 'h23', timeZone: 'Europe/Paris'});
function ouvrirPlein(ids, id = ids[0]){
pleinIds = ids.slice(); pleinId = id;
const deja = !plein.hidden;
if (!deja) pleinJours = 7;
plein.hidden = false;
document.documentElement.style.overflow = 'hidden';
if (!deja) { history.pushState({plein: 1}, '', '#station=' + id); requestAnimationFrame(() => plein.classList.add('vu')); }
else history.replaceState({plein: 1}, '', '#station=' + id);
rendrePlein();
plein.scrollTop = 0;
plein.querySelector('.plein-ferme').focus({preventScroll: true});
}
function masquerPlein(){
if (location.hash.startsWith('#station=')) history.replaceState(null, '', location.pathname + location.search);
plein.classList.remove('vu');
document.documentElement.style.overflow = '';
setTimeout(() => { if (!plein.classList.contains('vu')) plein.hidden = true; }, reduit ? 0 : 260);
}
function fermerPlein(){ if (history.state && history.state.plein) history.back(); else masquerPlein(); }
addEventListener('popstate', () => { if (!plein.hidden && !(history.state && history.state.plein)) masquerPlein(); });
addEventListener('keydown', ev => { if (ev.key === 'Escape' && !plein.hidden) fermerPlein(); });
plein.querySelector('.plein-ferme').addEventListener('click', fermerPlein);
function rendrePlein(){
const id = pleinId, s = STATIONS[id];
plein.querySelector('.plein-onglets').innerHTML = pleinIds.length > 1
? pleinIds.map(i => `<button type="button" data-id="${i}" class="${i === id ? 'on' : ''}">${NOMS[i] || court(STATIONS[i].nom)} ${fmt(STATIONS[i].t)}</button>`).join('') : '';
const etat = s.t == null ? (s.horsLigne ? t('etat.hl') : t('etat.direct0')) : (s.mn != null ? `24 h : ${fmt(s.mn)} / ${fmt(s.mx)}` : '');
plein.querySelector('.plein-corps').innerHTML =
`<h2>${s.nom}${icones(id)}${(o => o.titre ? `<span class="origine">${o.titre}${o.aussi ? `<small>${o.aussi}</small>` : ''}</span>` : '')(origine(id))}</h2>
<p class="plein-sous">${s.alt} m · ${s.src}${s.licence ? ` (${s.licence})` : ''}</p>
<div class="plein-val"><b style="color:${couleur(s.t)}">${fmt(s.t)}</b><span>${etat}</span>
<button type="button" class="plein-carte">${t('plein.carte')}</button></div>
<div class="plein-periode" role="group" aria-label="${t('g.periode')}">
<button type="button" data-jours="1" aria-pressed="${pleinJours === 1}">${t('g.jour')}</button>
<button type="button" data-jours="7" aria-pressed="${pleinJours === 7}">${t('g.semaine')}</button>
</div>
<div class="graphes"><p class="plein-attente">${t('plein.charge')}</p></div>
${ficheStation(id)}`;
if (FORUM_OUVERT) chargerFicheForum(id);
pleinDonnees = null;
fetch(`data/semaine/${id}.json?${Math.floor(Date.now() / 300000)}`).then(r => r.json()).then(d => {
if (id !== pleinId) return;
pleinDonnees = d; dessinerGraphes();
}).catch(() => {
if (id === pleinId) plein.querySelector('.graphes').innerHTML = `<p class="plein-attente">${t('plein.vide')}</p>`;
});
}
// Fiche de la station : sobre (altitude, propriétaires, sources) ; photos épinglées et lien du sujet viennent du forum.
const FORUM = '/forum';
const echapper = x => String(x).replace(/[&<>"']/g, c => ({'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;'})[c]);
function ficheStation(id){
const s = STATIONS[id], p = PROPRIO[id], l = liens(id);
const ligne = (k, v) => v ? `<dt>${t(k)}</dt><dd>${v}</dd>` : '';
return `<section class="plein-fiche" aria-labelledby="fiche-titre"><h3 id="fiche-titre">${t('fiche.titre')}</h3><dl>
${ligne('fiche.alt', s.alt + ' m')}
${ligne('fiche.proprio', p && p.map(n => PROPRIO_LIEN[n] ? `<a href="${PROPRIO_LIEN[n]}" target="_blank" rel="noopener">${n}</a>` : n).join(' · '))}
${ligne('fiche.source', (s.src || '') + (s.licence ? ` (${s.licence})` : ''))}
${ligne('fiche.voir', l)}</dl>
<div class="fiche-forum-zone">${FORUM_OUVERT ? '' : `<p class="fiche-bientot">${t('fiche.bientot')}</p>`}</div></section>`;
}
function chargerFicheForum(id){
fetch(`${FORUM}/api/station/${encodeURIComponent(id)}.json?${Math.floor(Date.now() / 300000)}`).then(r => r.ok ? r.json() : null).then(d => {
const zone = plein.querySelector('.fiche-forum-zone');
if (!d || id !== pleinId || !zone) return;
const lien = d.sujet && d.sujet.startsWith(FORUM + '/') ? d.sujet : FORUM + '/';
const photos = (d.photos || []).filter(x => typeof x.url === 'string' && x.url.startsWith(FORUM + '/photo/')).slice(0, 3);
zone.innerHTML = (photos.length ? `<div class="fiche-photos">${photos.map(x =>
`<a href="${echapper(lien)}"><img src="${echapper(x.url)}" alt="${echapper(t('fiche.photo', x.auteur || ''))}" loading="lazy" decoding="async"></a>`).join('')}</div>` : '')
+ `<a class="fiche-forum" href="${echapper(lien)}">${t(d.sujet ? 'fiche.sujet' : 'fiche.forum')}</a>`;
}).catch(() => {});
}
plein.addEventListener('click', ev => {
const o = ev.target.closest('.plein-onglets button');
if (o) { pleinId = o.dataset.id; rendrePlein(); return; }
const periode = ev.target.closest('.plein-periode button');
if (periode) {
pleinJours = Number(periode.dataset.jours);
plein.querySelectorAll('.plein-periode button').forEach(bouton => {
bouton.setAttribute('aria-pressed', Number(bouton.dataset.jours) === pleinJours);
});
if (pleinDonnees) dessinerGraphes();
return;
}
if (ev.target.closest('.plein-carte')) {
const ids = pleinIds.slice();
fermerPlein();
setTimeout(() => zoomer(boite(ids)), 320);
}
});
addEventListener('resize', () => { if (!plein.hidden && pleinDonnees) dessinerGraphes(); });
// graduations « rondes » entre bas et haut
function graduations(bas, haut, n = 4){
const brut = (haut - bas) / n, mag = Math.pow(10, Math.floor(Math.log10(brut || 1)));
const pas = [1, 2, 2.5, 5, 10].map(k => k * mag).find(p => p >= brut) || mag * 10;
const out = [];
for (let v = Math.ceil(bas / pas) * pas; v <= haut + 1e-9; v += pas) out.push(+v.toFixed(6));
return out;
}
function cadrerCourbes(d, jours){
const cles = ['t', 'h', 'v', 'r'];
// Écarter le remplissage avant le début de l'archive, puis limiter à la période choisie.
const archive = d.archive_depuis == null
? d.t.findIndex((_, i) => cles.some(cle => d[cle][i] != null))
: Math.floor((d.archive_depuis - d.debut) / d.pas);
const periode = d.t.length - 1 - Math.floor(jours * 86400 / d.pas);
const i0 = Math.min(Math.max(0, archive, periode), Math.max(0, d.t.length - 2));
const vue = {...d, debut: d.debut + i0 * d.pas};
for (const cle of cles) vue[cle] = d[cle].slice(i0);
return vue;
}
function lacuneTemperature(temperatures, pas){
// La pluie a des cases vides prévues entre ses mesures horaires.
let duree = 0;
return temperatures.some(valeur => {
duree = valeur == null ? duree + pas : 0;
return duree >= 3 * 3600;
});
}
function dessinerGraphes(){
const zone = plein.querySelector('.graphes');
if (!pleinDonnees || !zone) return;
zone.onpointermove = zone.onpointerdown = zone.onpointerleave = null;
const d = cadrerCourbes(pleinDonnees, pleinJours);
const n = d.t.length;
if (n < 2) {
zone.innerHTML = `<p class="plein-attente">${t('plein.vide')}</p>`;
return;
}
const infoStation = pleinId === 'lans' || pleinId === 'geve' ? ' ' + t('g.lacune.' + pleinId) : '';
const lacune = pleinDonnees.t.some(valeur => valeur != null) && lacuneTemperature(d.t, d.pas)
? `<p class="plein-lacune">${t('g.lacune')}${infoStation}</p>`
: '';
const hum = d.h.map(v => v != null && v >= 3 ? v : null); // hygromètre défaillant (1 %) : ignoré
const defs = [];
if (d.t.some(v => v != null)) defs.push({cle: 't', titre: t('g.t'), v: d.t, f: fmt, ligne: true, couleurs: couleur});
if (d.capteurs.humidite && hum.some(v => v != null)) defs.push({cle: 'h', titre: t('g.h'), v: hum, f: v => Math.round(v) + ' %', ligne: true, c: '#3f8c97', borne: [0, 100]});
if (d.capteurs.vent && d.v.some(v => v != null)) defs.push({cle: 'v', titre: t('g.v'), v: d.v, f: v => Math.round(v) + ' km/h', ligne: true, c: '#c99700', zero: true, icone: IC_EOLIENNE});
if (d.capteurs.pluie && d.r.some(v => v != null)) defs.push({cle: 'r', titre: t('g.r'), v: d.r, f: v => dec(v.toFixed(1)) + ' mm', ligne: false, c: '#2f7fc1', zero: true, icone: IC_GOUTTE});
if (!defs.length) {
zone.innerHTML = lacune + `<p class="plein-attente">${t('plein.vide')}</p>`;
return;
}
const W = Math.max(160, zone.clientWidth), H = 150, ml = 40, mr = 10, mt = 8, mb = 22, pw = W - ml - mr;
const X = i => ml + i / (n - 1) * pw;
// Repères en heure de Paris : toutes les 6 h sur 24 h, à minuit sur 7 jours.
const reperesTemps = [];
for (let i = 0; i < n; i++) {
const date = new Date((d.debut + i * d.pas) * 1000);
const heure = fmtHM.format(date);
if (pleinJours === 1 ? ['00:00', '06:00', '12:00', '18:00'].includes(heure) : heure === '00:00') {
reperesTemps.push([i, pleinJours === 1 ? heure : fmtMinuit.format(date)]);
}
}
zone.innerHTML = lacune + defs.map((g, k) => {
const vals = g.v.filter(v => v != null);
let bas = Math.min(...vals), haut = Math.max(...vals);
if (g.borne) { bas = g.borne[0]; haut = g.borne[1]; }
else if (g.zero) { bas = 0; haut = Math.max(haut * 1.15, g.cle === 'r' ? 1 : 10); }
else { const m = Math.max(1, (haut - bas) * 0.12); bas -= m; haut += m; }
const Y = v => mt + (1 - (v - bas) / (haut - bas)) * (H - mt - mb);
const grad = graduations(bas, haut, 4);
let trace = '';
if (g.ligne) {
let seg = '';
g.v.forEach((v, i) => { seg += v == null ? '' : `${seg && g.v[i - 1] != null ? 'L' : 'M'}${X(i).toFixed(1)} ${Y(v).toFixed(1)}`; });
let stroke = g.c;
if (g.couleurs) {
const stops = Array.from({length: 11}, (_, j) => { const val = haut - (haut - bas) * j / 10; return `<stop offset="${j * 10}%" stop-color="${g.couleurs(val)}"/>`; }).join('');
trace = `<defs><linearGradient id="gt${k}" gradientUnits="userSpaceOnUse" x1="0" y1="${Y(haut)}" x2="0" y2="${Y(bas)}">${stops}</linearGradient></defs>`;
stroke = `url(#gt${k})`;
}
trace += `<path d="${seg}" fill="none" stroke="${stroke}" stroke-width="1.8" stroke-linejoin="round" stroke-linecap="round"/>`;
} else {
const bw = Math.max(2, pw / (n - 1) * 2 - 1.5);
trace = g.v.map((v, i) => v ? `<rect x="${(X(i) - bw / 2).toFixed(1)}" y="${Y(v).toFixed(1)}" width="${bw.toFixed(1)}" height="${(Y(0) - Y(v)).toFixed(1)}" fill="${g.c}"/>` : '').join('');
}
const zero = g.cle === 't' && bas < 0 && haut > 0 ? `<line x1="${ml}" x2="${W - mr}" y1="${Y(0)}" y2="${Y(0)}" stroke="#3d6f8e" stroke-dasharray="4 3" stroke-opacity=".7"/><text x="${W - mr}" y="${Y(0) - 3}" text-anchor="end" class="gz">${t('g.gel')}</text>` : '';
const grille = grad.map(v => `<line x1="${ml}" x2="${W - mr}" y1="${Y(v)}" y2="${Y(v)}" stroke="#e4e0d6"/><text x="${ml - 5}" y="${Y(v) + 3.5}" text-anchor="end">${g.cle === 't' ? Math.round(v) + '°' : Math.round(v * 10) / 10}</text>`).join('');
const reperes = reperesTemps.map(([i, nom]) => `<line x1="${X(i)}" x2="${X(i)}" y1="${mt}" y2="${H - mb}" stroke="#d9d4c6"/><text x="${i > (n - 1) * 0.85 ? X(i) - 4 : X(i) + 4}" y="${H - 7}" text-anchor="${i > (n - 1) * 0.85 ? 'end' : 'start'}">${nom}</text>`).join('');
const mm = vals.length ? t('g.mm', g.f(Math.min(...vals)), g.f(Math.max(...vals))) : '';
return `<section class="graphe" data-k="${k}"><header><h3>${g.titre}${g.icone || ''}</h3><span class="g-mm">${mm}</span><b class="g-lect"></b></header>
<svg width="${W}" height="${H}" viewBox="0 0 ${W} ${H}">${reperes}${grille}${zero}${trace}
<line class="curseur" x1="0" x2="0" y1="${mt}" y2="${H - mb}" visibility="hidden"/><circle class="point" r="3.5" visibility="hidden" fill="#fff" stroke="${g.c || '#1f4d3a'}" stroke-width="2"/></svg></section>`;
}).join('') + `<p class="plein-note">${t('g.note', Math.min(7, Math.max(1, Math.round(n * d.pas / 86400))), d.archive_depuis ? new Intl.DateTimeFormat(LOC[L], {day: 'numeric', month: 'long', timeZone: 'Europe/Paris'}).format(new Date(d.archive_depuis * 1000)) : '', d.pas / 60)}</p>`;
// curseur partagé : le doigt ou la souris lit la même heure sur toutes les courbes
const gr = [...zone.querySelectorAll('.graphe')];
const poser = ev => {
const r = gr[0].querySelector('svg').getBoundingClientRect();
const i = Math.max(0, Math.min(n - 1, Math.round((ev.clientX - r.left - ml) / pw * (n - 1))));
gr.forEach((el, k) => {
const g = defs[k], v = g.v[i], x = X(i);
const ligne = el.querySelector('.curseur'), pt = el.querySelector('.point');
ligne.setAttribute('x1', x); ligne.setAttribute('x2', x); ligne.setAttribute('visibility', 'visible');
el.querySelector('.g-lect').textContent = `${fmtJH.format(new Date((d.debut + i * d.pas) * 1000))} · ${v == null ? '—' : g.f(v)}`;
if (v == null || !g.ligne) { pt.setAttribute('visibility', 'hidden'); return; }
pt.setAttribute('cx', x); pt.setAttribute('visibility', 'visible');
});
};
// hauteur du point : recalculée depuis les mêmes échelles
defs.forEach((g, k) => {
const vals = g.v.filter(v => v != null);
let bas = Math.min(...vals), haut = Math.max(...vals);
if (g.borne) { bas = g.borne[0]; haut = g.borne[1]; }
else if (g.zero) { bas = 0; haut = Math.max(haut * 1.15, g.cle === 'r' ? 1 : 10); }
else { const m = Math.max(1, (haut - bas) * 0.12); bas -= m; haut += m; }
g.Y = v => mt + (1 - (v - bas) / (haut - bas)) * (H - mt - mb);
});
const poserPoint = ev => {
poser(ev);
const r = gr[0].querySelector('svg').getBoundingClientRect();
const i = Math.max(0, Math.min(n - 1, Math.round((ev.clientX - r.left - ml) / pw * (n - 1))));
gr.forEach((el, k) => { const v = defs[k].v[i]; if (v != null && defs[k].ligne) el.querySelector('.point').setAttribute('cy', defs[k].Y(v)); });
};
zone.onpointermove = poserPoint;
zone.onpointerdown = poserPoint;
zone.onpointerleave = () => gr.forEach(el => {
el.querySelector('.curseur').setAttribute('visibility', 'hidden'); el.querySelector('.point').setAttribute('visibility', 'hidden'); el.querySelector('.g-lect').textContent = '';
});
}
// pas de paramètre de contournement : 'no-cache' revalide auprès du serveur (ETag / If-Modified-Since), qui répond 304 sans renvoyer le fichier s'il n'a pas changé
const lire = async f => { try { return await (await fetch(`data/${f}`, {cache: 'no-cache'})).json(); } catch (e) { return null; } };
// stations autorisées par ROMMA (ni Météo-France ni de la famille) : ROMMA est la source citée, Infoclimat n'est qu'un relais
const viaRomma = id => !!ROMMA_ID[id] && !MF_PAGE[id] && !PROPRIO[id];
const licenceCourte = l => !l ? '' : /NC/.test(l) ? 'CC BY-NC' : /CC BY/.test(l) ? 'CC BY' : '';
async function chargerDonnees(){
const [mf, ic, wl, vp2, sem] = await Promise.all([lire('meteofrance.json'), lire('infoclimat.json'), lire('weatherlink.json'), lire('vp2.json'), lire('semaine/index.json')]);
if (sem) SEM = sem;
let dernier = null;
const poser = (d, cle, id) => {
const st = d && d.stations && d.stations[cle], r = st && st.releves && st.releves.at(-1);
if (!st || !STATIONS[id]) return;
const enLigne = r && !st.hors_ligne;
Object.assign(STATIONS[id], {t: enLigne ? r.temperature : null, mn: enLigne ? r.temperature_min : null, mx: enLigne ? r.temperature_max : null, vent: enLigne && r.vent_moyen != null ? r.vent_moyen : null, pluie: enLigne && r.pluie_1h != null ? r.pluie_1h : null,
exemple: false, horsLigne: !enLigne, ...(viaRomma(id) ? {src: 'ROMMA', licence: ''} : {src: st.source || STATIONS[id].src, licence: licenceCourte(d.metadonnees && d.metadonnees[cle] && d.metadonnees[cle].licence)})});
if (enLigne) { const t = new Date(r.dh_utc.replace(' ', 'T') + 'Z'); if (!dernier || t > dernier) dernier = t; }
};
for (const [cle, id] of Object.entries(POSTES_MF)) poser(mf, cle, id);
if (ic && ic.stations) for (const id of Object.keys(ic.stations)) poser(ic, id, id);
if (wl && wl.stations) for (const [id, st] of Object.entries(wl.stations)) if (!st.hors_ligne && STATIONS[id]) poser(wl, id, id);
if (vp2 && vp2.stations) poser(vp2, 'lans', 'lans'); // VP2 de Lans : directement depuis le LAN, plus par Infoclimat
if (dernier) {
dernierReleve = dernier; majDate(); afficherDirect();
}
apresDonnees(); phraseDuJour(); listeStations(); coupe(); disposer(); relancer(); // les puces qui se regroupent s'animent
}
Promise.race([chargerDonnees(), new Promise(r => setTimeout(r, 1500))]).then(() => { ouverture(); ouvrirDepuisAdresse(); });
// rafraîchissement toutes les 5 minutes (les relevés arrivent toutes les 6 à 15 minutes), suspendu quand l'onglet est caché
const PERIODE_DONNEES = 5 * 60 * 1000;
let dernierChargement = Date.now(), minuteurDonnees = 0;
function planifierDonnees(delai){
clearTimeout(minuteurDonnees); minuteurDonnees = 0;
if (!document.hidden) minuteurDonnees = setTimeout(rafraichirDonnees, delai);
}
async function rafraichirDonnees(){
minuteurDonnees = 0; dernierChargement = Date.now();
try { await chargerDonnees(); } catch (e) {}
planifierDonnees(PERIODE_DONNEES);
}
document.addEventListener('visibilitychange', () => {
if (document.hidden) { clearTimeout(minuteurDonnees); minuteurDonnees = 0; return; }
afficherDirect(); // « il y a … min » remis à l'heure au retour
planifierDonnees(Math.max(0, PERIODE_DONNEES - (Date.now() - dernierChargement)));
});
planifierDonnees(PERIODE_DONNEES);
// la barre d'adresse du téléphone change la hauteur : on ne recadre que si la largeur change
addEventListener('resize', () => { if (carte.clientWidth !== largeur) vue = null; redisposer(); });
// premier dessin sans attendre une image (requestAnimationFrame est suspendu dans un onglet caché)
// les polices changent la taille des noms et des puces : on les remesure
document.fonts.ready.then(() => { etqMesurees = false; TAILLES.clear(); disposer(); });
disposer();
// lien direct vers une station : #station=autrans
function ouvrirDepuisAdresse(){
const m = location.hash.match(/^#station=([\w-]+)/);
if (m && STATIONS[m[1]] && plein.hidden) ouvrirPlein([m[1]], m[1]);
}
addEventListener('hashchange', ouvrirDepuisAdresse);
// ouverture : les courbes se tracent de la plus haute à la plus basse, puis les stations arrivent du nord au sud.
// 0,7 s au plus sur téléphone, 1,3 s sur ordinateur ou tablette.
const INTRO = /*INTRO*/;
function ouverture(){
disposer();
if (reduit || REG.intro === 'aucune' || !Z || !INTRO.length) { carte.classList.remove('ouverture'); return; }
const k = REG.intro === 'longue' ? 1.8 : 1; // « plus longue » : tout l'enchaînement ralenti d'un même facteur
carte.style.setProperty('--k', k);
const T = (carte.clientWidth < 720 ? 700 : 1300) * k, tc = T * 0.6, ns = 'http://www.w3.org/2000/svg';
const s = vue.s, vx = vue.cx - Z.cx / s, vy = vue.cy - Z.cy / s;
const sv = document.createElementNS(ns, 'svg');
sv.id = 'intro'; sv.setAttribute('aria-hidden', 'true'); sv.setAttribute('preserveAspectRatio', 'none');
sv.setAttribute('viewBox', `${vx} ${vy} ${Z.W / s} ${Z.H / s}`);
// tracé limité au Parc
sv.innerHTML = '<clipPath id="c-intro"><use href="#d-pnr"/></clipPath><g clip-path="url(#c-intro)"></g>';
const g = sv.querySelector('g');
INTRO.forEach(([alt, d], i) => {
const p = document.createElementNS(ns, 'path');
p.setAttribute('d', d); p.setAttribute('pathLength', '1');
if (alt % 500 === 0) p.classList.add('m');
p.style.animationDelay = (i / INTRO.length * tc * 0.55) + 'ms';
p.style.animationDuration = (tc * 0.45) + 'ms';
g.appendChild(p);
});
carte.insertBefore(sv, calque);
const vues = puces.filter(p => !p.m.classList.contains('cache')).sort((a, b) => a.y - b.y);
vues.forEach((p, i) => p.m.style.setProperty('--d', (i / Math.max(1, vues.length - 1) * (T - tc - 200)) + 'ms'));
setTimeout(() => carte.classList.add('fond'), tc * 0.7);
setTimeout(() => carte.classList.add('stations'), tc);
setTimeout(() => {
carte.classList.remove('ouverture', 'fond', 'stations'); sv.remove(); carte.style.removeProperty('--k');
puces.forEach(p => p.m.style.removeProperty('--d'));
}, T + 50);
}
// Bandeau « pas de cookie » : une fois par appareil, s'efface après 6250 ms (pause au survol / toucher)
(function(){
// Dynamique : affiché à la 1re visite, puis seulement après 7 jours sans visite (?cookie force l'affichage). La date de dernière visite reste dans le navigateur, jamais envoyée au serveur.
let montrer = true;
try {
const dernier = +localStorage.getItem('vm-derniere-visite') || 0, maintenant = Date.now();
montrer = !dernier || maintenant - dernier >= 7 * 86400000 || /[?&]cookie\b/.test(location.search);
localStorage.setItem('vm-derniere-visite', String(maintenant));
} catch (e) {}
if (!montrer) return;
const b = document.createElement('div'); b.className = 'sanscookie'; b.setAttribute('role', 'status');
b.innerHTML = `<b>${t('cookie.titre')}</b><span>${t('cookie.txt')}</span><button type="button" aria-label="${t('fermer')}">×</button>`;
document.body.appendChild(b);
let minut, fini = false;
const partir = () => { if (fini) return; fini = true; b.classList.add('parti'); setTimeout(() => b.remove(), 600); };
const armer = () => { clearTimeout(minut); minut = setTimeout(partir, 6250); };
b.addEventListener('pointerenter', () => clearTimeout(minut)); b.addEventListener('pointerleave', armer);
b.addEventListener('focusin', () => clearTimeout(minut));
b.querySelector('button').addEventListener('click', partir);
armer();
})();
// bouton « Revenir en haut » : visible seulement quand la carte n'est plus à l'écran, et toujours au-dessus du pied de page
const btnHaut = document.getElementById('haut'), piedPage = document.querySelector('.pied');
let carteVue = true, rafHaut = 0;
function placerHaut(){
rafHaut = 0;
btnHaut.classList.toggle('cache', carteVue);
if (carteVue) return;
const r = piedPage.getBoundingClientRect();
btnHaut.style.setProperty('--haut-bas', Math.max(16, innerHeight - r.top + 12) + 'px');
}
const demanderHaut = () => { if (!rafHaut) rafHaut = requestAnimationFrame(placerHaut); };
if ('IntersectionObserver' in window) new IntersectionObserver(l => { carteVue = l[0].isIntersecting; demanderHaut(); }).observe(document.getElementById('carte'));
else btnHaut.hidden = true;
addEventListener('scroll', () => { if (!carteVue) demanderHaut(); }, {passive: true});
addEventListener('resize', demanderHaut);
btnHaut.addEventListener('click', () => {
scrollTo({top: 0, behavior: reduit ? 'auto' : 'smooth'});
const h1 = document.querySelector('h1'); h1.tabIndex = -1; h1.focus({preventScroll: true});
});
// ---- fenêtre des paramètres (roue du pied de page) ----
const dlgPrm = document.getElementById('prm'), btnPrm = document.getElementById('prm-ouvrir');
function etatParametres(){
dlgPrm.querySelectorAll('input[name=prm-langue]').forEach(i => { i.checked = i.value === L; });
dlgPrm.querySelectorAll('input[name=prm-aff]').forEach(i => { i.checked = i.value === REG.affichage; });
document.getElementById('prm-anim').checked = reduit;
dlgPrm.querySelectorAll('input[name=prm-intro]').forEach(i => { i.checked = i.value === (reduit ? 'aucune' : REG.intro); i.disabled = reduit; });
document.getElementById('prm-intro-aide').textContent = t(reduit ? 'intro.aide.red' : 'intro.aide');
document.getElementById('prm-aff-aide').textContent = t('aff.' + REG.affichage);
}
btnPrm.addEventListener('click', () => {
etatParametres();
if (dlgPrm.showModal) dlgPrm.showModal(); else dlgPrm.setAttribute('open', '');
dlgPrm.querySelector('input[name=prm-langue]:checked').focus();
});
dlgPrm.querySelector('.prm-x').addEventListener('click', () => dlgPrm.close ? dlgPrm.close() : dlgPrm.removeAttribute('open'));
dlgPrm.addEventListener('click', ev => { if (ev.target === dlgPrm) dlgPrm.close(); }); // clic sur le fond
dlgPrm.addEventListener('close', () => btnPrm.focus());
dlgPrm.addEventListener('change', ev => {
const i = ev.target;
if (i.name === 'prm-langue') REG.langue = L = i.value;
else if (i.name === 'prm-aff') REG.affichage = i.value;
else if (i.id === 'prm-anim') REG.anim = i.checked;
else if (i.name === 'prm-intro') REG.intro = i.value;
enregistrerReglages(); appliquerAffichage(); appliquerAnim(); apresReglage(); etatParametres();
});
// après un changement de langue ou d'affichage : textes refaits, étiquettes remesurées, puces replacées
function apresReglage(){
traduirePage(); formatsDates(); forumTextes(); afficherUneForum(); majAlt(); majTempsTxt(); majDate(); afficherDirect();
btnLecture.setAttribute('aria-label', t(lectureId ? 'lecture.pause' : 'lecture.rejouer'));
plein.setAttribute('aria-label', t('plein.aria')); plein.querySelector('.plein-ferme').textContent = t('plein.retour');
phraseDuJour(); listeStations(); coupe();
if (document.getElementById('p-bilan').classList.contains('ouvert')) remplirBilan();
if (!plein.hidden) rendrePlein();
puces.forEach(q => { q.hb = q.hf = q.cl = null; });
TAILLES.clear(); etqMesurees = false; disposer(); relancer();
}
</script>
</body>
</html>