Accueil : réglage de l'animation d'arrivée, pancarte réactive et déplaçable, données toutes les 5 min, lien Statistiques
- Paramètres : animation d'arrivée de la carte (plus longue ×1,8 / normale / aucune), mémorisée dans vmReglages ; « animations réduites » force aucune. - Pancarte du direct : réagit au mouvement de la carte (ressort amorti), se glisse à la souris ou au doigt, double-clic pour la remettre ; position dans vmReglages. - Données : rafraîchissement toutes les 5 minutes sans paramètre de contournement (cache: no-cache), suspendu quand l'onglet est caché. - Pied de page : lien « Statistiques du site » (FR/EN/DE). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cette révision appartient à :
1 Parent
4fb53a0df2
révision
2c664488c3
2 fichiers modifiés
+280
-42
Aucun fichier ne correspond à votre recherche
@@ -80,9 +80,9 @@ a{color:inherit}
|
||||
.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 .4s ease}
|
||||
#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 .2s cubic-bezier(.2,.8,.2,1) both;animation-delay:var(--d,0ms)}
|
||||
.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}
|
||||
@@ -230,7 +230,10 @@ a{color:inherit}
|
||||
.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}
|
||||
.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)}
|
||||
@@ -442,6 +445,10 @@ a:focus-visible,button:focus-visible,input:focus-visible{outline:2px solid var(-
|
||||
.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}
|
||||
@@ -509,6 +516,7 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
||||
[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}
|
||||
@@ -547,7 +555,7 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
||||
</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">Relevés en cours…</span></div>
|
||||
<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">
|
||||
@@ -623,7 +631,10 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
||||
<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>
|
||||
<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>
|
||||
@@ -638,7 +649,7 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
||||
</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></ul>
|
||||
<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>
|
||||
@@ -654,16 +665,20 @@ const FORUM_OUVERT = false; // passer à true quand le forum et la connexion Ga
|
||||
// ---- 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'];
|
||||
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};
|
||||
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;
|
||||
}
|
||||
@@ -678,7 +693,7 @@ 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 = () => {};
|
||||
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) ;
|
||||
@@ -726,6 +741,9 @@ const I18N = {
|
||||
'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.',
|
||||
@@ -762,6 +780,9 @@ const I18N = {
|
||||
'pied.contact': 'Contact', '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',
|
||||
@@ -838,6 +859,9 @@ const I18N = {
|
||||
'pied.contact': 'Kontakt', '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',
|
||||
@@ -911,7 +935,7 @@ window.vmReglages = {
|
||||
exporter: () => ({v: 1, date: REG_DATE || null, ...REG}),
|
||||
importer(o){
|
||||
REG = reglagesValides(o); L = REG.langue;
|
||||
enregistrerReglages(); appliquerAffichage(); appliquerAnim(); apresReglage();
|
||||
enregistrerReglages(); appliquerAffichage(); appliquerAnim(); apresReglage(); placerPancarte();
|
||||
return this.exporter();
|
||||
},
|
||||
};
|
||||
@@ -1696,29 +1720,101 @@ function afficherDirect(){
|
||||
}
|
||||
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
|
||||
// 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(); id = requestAnimationFrame(balancer); } };
|
||||
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 = ''; return; }
|
||||
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; }
|
||||
const x = A * Math.sin(ph), a = Math.asin(x / L);
|
||||
cordes.forEach(c => { c.style.transform = `rotate(${-a}rad)`; });
|
||||
plaque.style.transform = `translate(${x}px,${L * (1 - Math.cos(a))}px)`;
|
||||
// é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();
|
||||
})();
|
||||
|
||||
@@ -2097,7 +2193,8 @@ function dessinerGraphes(){
|
||||
});
|
||||
}
|
||||
|
||||
const lire = async f => { try { return await (await fetch(`data/${f}?${Date.now()}`)).json(); } catch (e) { return null; } };
|
||||
// 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' : '';
|
||||
@@ -2123,7 +2220,24 @@ async function chargerDonnees(){
|
||||
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(); });
|
||||
setInterval(chargerDonnees, 60 * 1000); // les relevés arrivent toutes les 6 à 15 minutes
|
||||
// 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(); });
|
||||
@@ -2144,8 +2258,10 @@ addEventListener('hashchange', ouvrirDepuisAdresse);
|
||||
const INTRO = [[2300, "M550.5 661.9L545 668.5L540.7 667.2L544.1 654.7L550.5 647.4"], [2200, "M550.5 665.3L545 670.6L538.1 671.8L537.1 670L542.8 654.7L550.5 644.9M550.5 702.3L544.8 703.4L550.5 698.9"], [2100, "M317.1 485L321.5 490.5L319 496.4L317.1 485M550.5 669.5L546.4 673.2L539.5 674.5L535 671.4L541.4 654.7L550.5 643M550.5 704.8L536.7 710.6L533.4 707.6L550.5 697.3"], [2000, "M358.2 336.1L360.3 335.4L362.1 338.8L359 344.3L343.4 341.6L347.9 337L358.2 336.1M315.9 480.8L321.5 486.3L323.5 496.1L317.6 499.4L314.7 489.1L315.9 480.8M550.5 677.2L536.7 675.8L533.6 671.4L540 654.7L550.5 641.5M550.5 707.5L543.4 709L536.7 715.2L531.5 707.6L550.5 696M527.3 722.9L529.8 719.7L533.8 722.9"], [1900, "M354.6 323.5L359 329.3L362.7 323.5L366.2 323.5L361.2 344.4L359 345.8L349.3 342.8L338.3 346.9L336 341.6L352.1 332.6L354.6 323.5M329.4 352.8L331.3 354.1L327.3 359.2L329.4 352.8M313.5 420.9L315.2 433.5L312.1 438.5L313.5 420.9M314.4 447.4L318.6 457.1L316.4 464.1L319.4 469.6L317.8 476.6L325.6 496.1L317.6 502.4L315 500.3L313 489.1L316 476.6L312.4 454.3L314.4 447.4M314.7 514.2L320.4 516.8L317.4 522.5L313.5 522.6L311.6 519.7L314.7 514.2M319 523.9L321.9 523.9L320.4 528.1L319 523.9M336.8 587.9L341.6 593.5L336.8 587.9M326.9 592.1L330 595.7L325.9 595L326.9 592.1M267.9 600.4L269.4 599.3L270.8 603.9L276.8 608.8L276.5 628.3L283.2 640.8L280.4 644.6L274.9 642.9L272.4 638L266 604.6L267.9 600.4M550.5 609.7L546.4 604.6L550.5 593.8M413.2 643.6L415.1 643.6L417.9 653.3L415.5 657.2L413.2 643.6M550.5 679.6L535.6 677L532.4 671.4L539.2 653.3L550.5 639.7M550.5 710.1L544 711.8L549.1 716.5L539.5 717.9L535.9 722.9M526.3 722.9L527.5 718.7L533 715.9L529.5 706.2L550.5 694.7"], [1800, "M525.5 21.6L528.5 22.8L528.2 27.1L523 31.2L525.5 21.6M391.5 242.8L393.4 246.4L389.7 248.4L391.5 242.8M384.1 258.1L386.6 258.1L386.3 265.1L378.3 278.2L374.3 274.8L379.1 270.7L384.1 258.1M373.8 299.9L361.7 345.7L359 347.1L347.9 344.1L335.5 350.5L320.4 375.4L319.5 369.5L325.4 354.1L334.2 348.6L332.8 340.4L345.8 331.9L354.8 317.6L359 321.1L364.5 319.5L373.8 299.9M320.1 377.8L323 382L316.4 400.1L316.7 432.1L314.5 443.2L320 455.7L318.6 464.1L321.6 482.2L327.2 494.7L318 508.6L322.4 512.8L324.4 523.9L321.6 533.7L317.6 536.6L306.4 532.3L304.7 522.5L313.1 503L310.9 487.7L313.1 476.6L311.1 443.2L308.3 426.5L311.7 412.6L310.9 405.6L315.8 400.1L320.1 377.8M293.9 547.6L296.4 549L294.2 552.5L293.9 547.6M543.2 549L545 547.9L546.3 554.5L542.6 553.1L543.2 549M326.7 562.9L335.2 565.7L338 574L336 581L345.7 594.9L342.4 600.7L328.6 600.4L329.1 606L324.5 609.9L317.6 593.5L318.5 582.4L311.4 575.4L313.2 567.1L317.6 569.1L326.7 562.9M270.4 590.7L273.8 590.7L279 607.9L279.9 626.9L286.4 640.8L284.6 647L273.3 643.6L269.6 633.8L264.4 604.6L270.4 590.7M550.5 611.5L543 604.6L546.7 600.4L546.8 594.9L550.5 591.8M387.7 632.5L390 635.2L385.2 637.5L384.7 633.8L387.7 632.5M412.3 640.8L419.9 640.8L417.4 646.4L420 654.7L416.8 663.1L414.1 664.1L410.4 643.6L412.3 640.8M550.5 719.7L540.9 720.3L538.4 722.9M525.1 722.9L526.7 717.3L531.4 714.6L525.9 706.2L530.4 702L538.9 700.6L550.2 692.3L546.9 688.1L547.8 682.1L534 677.9L530.9 672.8L536.9 660.3L537.3 653.3L542.5 649.2L550.5 635.1"], [1700, "M456.6 7.7L459.4 7.7L456.8 18.6L453.5 14.6L456.6 7.7M525.1 20.2L529.2 20.2L529.3 28.5L521.6 33.5L519.6 29.9L525.1 20.2M406.1 177.4L408.6 177.5L410.5 183L404.4 191.6L406.1 177.4M395.7 222L395 247L388.2 252.6L387.8 265.1L376.9 284.7L371.6 273.4L380.6 263.7L382.8 256.7L387.4 254L385.9 247L390.6 230.3L395.7 222M375.3 290.1L375.5 305.8L362.3 347.2L359 348.5L349.3 345.1L342.4 348.1L330.2 359.7L322.8 375L324.4 383.4L318.7 401.5L316.4 441.8L321.7 455.7L323.1 481.4L328.8 493.3L320.4 507.2L324.7 511.4L326.2 523.9L322.5 535L314.9 541.7L299.7 540.9L299.9 553.1L291.4 558.8L285.7 551.7L295.1 537.8L294.2 527.5L301.1 520.9L307.8 503L307.3 480.8L310.2 469.6L303.4 426.5L306.8 412.6L305.6 405.6L311.8 395.9L312.1 386.4L315.5 382L315.9 368.1L323.5 352.8L329 347.2L330 339.8L340.9 330.5L353.5 313.7L363.1 316.4L369 308.2L375.3 290.1M550.5 343.7L550.5 330.3M471.5 447.4L475.4 448.8L473.3 453L471.5 447.4M337.8 521.1L341.6 522.5L336.9 526.4L334.9 523.9L337.8 521.1M543.5 543.4L548 550.4L546.4 557.1L540.8 553.1L543.5 543.4M323.7 558.7L337.5 564.3L337.2 569.8L342.2 575.4L341.3 581L347.8 596.3L339.7 607.4L334.2 604.1L325.9 612.2L316.3 613.6L310.7 606.2L301 600.4L306.4 594.9L305.2 589.3L308.3 583.8L308.8 567.1L313.5 562.8L320.4 563.5L323.7 558.7M269.1 567.1L272.4 567.1L272.2 570.6L268.9 569.8L269.1 567.1M269.4 586.5L276.8 587.9L285.8 635.2L290.1 645L300.7 656.1L301.1 660.7L270.8 641.7L263.3 604.6L269.4 586.5M291.3 603.2L295.6 606L294.2 611.8L290 607.4L291.3 603.2M392 617.1L394.8 616L399.9 618.5L398.9 624.1L393.1 621.3L392 617.1M386.1 631.1L393.8 632.5L392.5 636.6L383.8 641.1L378 638L386.1 631.1M417.6 638L422.9 640.8L419.8 647.8L422.5 654.7L419.6 664.5L411.3 667.3L409.9 649.2L404.7 642.2L417.6 638M458.6 645L461.7 645L460.9 649.5L458.2 648.2L458.6 645M484.1 664.5L492.6 667.1L502.3 683.5L487.7 682.5L489.9 677L484 671.4L484.1 664.5M498 722.9L502.3 720.5L508.3 722.9M523.2 72Ligne tronquée
|
||||
function ouverture(){
|
||||
disposer();
|
||||
if (reduit || !Z || !INTRO.length) { carte.classList.remove('ouverture'); return; }
|
||||
const T = carte.clientWidth < 720 ? 700 : 1300, tc = T * 0.6, ns = 'http://www.w3.org/2000/svg';
|
||||
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');
|
||||
@@ -2167,7 +2283,7 @@ function ouverture(){
|
||||
setTimeout(() => carte.classList.add('fond'), tc * 0.7);
|
||||
setTimeout(() => carte.classList.add('stations'), tc);
|
||||
setTimeout(() => {
|
||||
carte.classList.remove('ouverture', 'fond', 'stations'); sv.remove();
|
||||
carte.classList.remove('ouverture', 'fond', 'stations'); sv.remove(); carte.style.removeProperty('--k');
|
||||
puces.forEach(p => p.m.style.removeProperty('--d'));
|
||||
}, T + 50);
|
||||
}
|
||||
@@ -2218,6 +2334,8 @@ 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', () => {
|
||||
@@ -2233,6 +2351,7 @@ dlgPrm.addEventListener('change', ev => {
|
||||
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
|
||||
|
||||
@@ -80,9 +80,9 @@ a{color:inherit}
|
||||
.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 .4s ease}
|
||||
#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 .2s cubic-bezier(.2,.8,.2,1) both;animation-delay:var(--d,0ms)}
|
||||
.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}
|
||||
@@ -230,7 +230,10 @@ a{color:inherit}
|
||||
.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}
|
||||
.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)}
|
||||
@@ -442,6 +445,10 @@ a:focus-visible,button:focus-visible,input:focus-visible{outline:2px solid var(-
|
||||
.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}
|
||||
@@ -509,6 +516,7 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
||||
[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}
|
||||
@@ -547,7 +555,7 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
||||
</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">Relevés en cours…</span></div>
|
||||
<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">
|
||||
@@ -623,7 +631,10 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
||||
<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>
|
||||
<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>
|
||||
@@ -638,7 +649,7 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
||||
</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></ul>
|
||||
<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>
|
||||
@@ -654,16 +665,20 @@ const FORUM_OUVERT = false; // passer à true quand le forum et la connexion Ga
|
||||
// ---- 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'];
|
||||
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};
|
||||
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;
|
||||
}
|
||||
@@ -678,7 +693,7 @@ 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 = () => {};
|
||||
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) ;
|
||||
@@ -726,6 +741,9 @@ const I18N = {
|
||||
'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.',
|
||||
@@ -762,6 +780,9 @@ const I18N = {
|
||||
'pied.contact': 'Contact', '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',
|
||||
@@ -838,6 +859,9 @@ const I18N = {
|
||||
'pied.contact': 'Kontakt', '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',
|
||||
@@ -911,7 +935,7 @@ window.vmReglages = {
|
||||
exporter: () => ({v: 1, date: REG_DATE || null, ...REG}),
|
||||
importer(o){
|
||||
REG = reglagesValides(o); L = REG.langue;
|
||||
enregistrerReglages(); appliquerAffichage(); appliquerAnim(); apresReglage();
|
||||
enregistrerReglages(); appliquerAffichage(); appliquerAnim(); apresReglage(); placerPancarte();
|
||||
return this.exporter();
|
||||
},
|
||||
};
|
||||
@@ -1696,29 +1720,101 @@ function afficherDirect(){
|
||||
}
|
||||
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
|
||||
// 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(); id = requestAnimationFrame(balancer); } };
|
||||
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 = ''; return; }
|
||||
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; }
|
||||
const x = A * Math.sin(ph), a = Math.asin(x / L);
|
||||
cordes.forEach(c => { c.style.transform = `rotate(${-a}rad)`; });
|
||||
plaque.style.transform = `translate(${x}px,${L * (1 - Math.cos(a))}px)`;
|
||||
// é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();
|
||||
})();
|
||||
|
||||
@@ -2097,7 +2193,8 @@ function dessinerGraphes(){
|
||||
});
|
||||
}
|
||||
|
||||
const lire = async f => { try { return await (await fetch(`data/${f}?${Date.now()}`)).json(); } catch (e) { return null; } };
|
||||
// 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' : '';
|
||||
@@ -2123,7 +2220,24 @@ async function chargerDonnees(){
|
||||
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(); });
|
||||
setInterval(chargerDonnees, 60 * 1000); // les relevés arrivent toutes les 6 à 15 minutes
|
||||
// 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(); });
|
||||
@@ -2144,8 +2258,10 @@ addEventListener('hashchange', ouvrirDepuisAdresse);
|
||||
const INTRO = /*INTRO*/;
|
||||
function ouverture(){
|
||||
disposer();
|
||||
if (reduit || !Z || !INTRO.length) { carte.classList.remove('ouverture'); return; }
|
||||
const T = carte.clientWidth < 720 ? 700 : 1300, tc = T * 0.6, ns = 'http://www.w3.org/2000/svg';
|
||||
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');
|
||||
@@ -2167,7 +2283,7 @@ function ouverture(){
|
||||
setTimeout(() => carte.classList.add('fond'), tc * 0.7);
|
||||
setTimeout(() => carte.classList.add('stations'), tc);
|
||||
setTimeout(() => {
|
||||
carte.classList.remove('ouverture', 'fond', 'stations'); sv.remove();
|
||||
carte.classList.remove('ouverture', 'fond', 'stations'); sv.remove(); carte.style.removeProperty('--k');
|
||||
puces.forEach(p => p.m.style.removeProperty('--d'));
|
||||
}, T + 50);
|
||||
}
|
||||
@@ -2218,6 +2334,8 @@ 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', () => {
|
||||
@@ -2233,6 +2351,7 @@ dlgPrm.addEventListener('change', ev => {
|
||||
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
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur