Huit pages statiques servies sous federation.alliance-boreale.ca, selon la norme des applications clientes (execution: statique). Le thème est celui du site de Chezlepro (feuille complète, ciel étoilé animé, apparitions, 404 du trou noir), repris de site-web-chezlepro au commit 7079066. En pièce maîtresse, un planisphère réel : le ciel vu de Montréal à l'heure de la visite, l'horizon, le cercle des étoiles qui ne se couchent jamais, et les deux sites sous leur étoile (Miram pour Chezlepro, membre fondateur ; Achird pour TechnoLibre, membre partenaire). La page Constellation ajoute le registre des 70 circumpolaires et l'anatomie d'un site, sans aucune adresse. La page de contact présente les deux membres, chacun avec un lien vers sa propre page de contact. Le générateur refuse tout style ou script en ligne et toute ressource extérieure : le vhost pose default-src 'self'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
394 lines
18 KiB
JavaScript
394 lines
18 KiB
JavaScript
/* Alliance Boréale — le planisphère.
|
|
Le ciel tel qu'on le voit de Montréal, à l'heure de la visite, en regardant
|
|
vers le nord : le pôle céleste au centre, le zénith en haut, l'horizon nord
|
|
en bas. Projection stéréographique polaire. Les étoiles à l'intérieur du
|
|
cercle pointillé (déclinaison > +44,5°) ne passent jamais sous l'horizon :
|
|
ce sont les circumpolaires, et c'est parmi elles que les sites de
|
|
l'Alliance prennent leur nom.
|
|
|
|
Données : window.CIEL (ciel-donnees.js). Aucune dépendance, aucun tiers. */
|
|
(function () {
|
|
"use strict";
|
|
|
|
var CIEL = window.CIEL;
|
|
if (!CIEL) return;
|
|
|
|
var LAT = 45.50, LON = -73.57; // Montréal
|
|
var DEC_MIN = 8; // bord de la carte : le ciel boréal
|
|
var CIRCUMPOLAIRE = 90 - LAT; // 44,5°
|
|
var RAD = Math.PI / 180;
|
|
var reduit = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
|
|
/* Les sites de la constellation. L'étoile vient de la table figée de
|
|
Set-OPS (scripts/etoiles.py) ; aucune adresse ne figure ici. */
|
|
var MEMBRES = [
|
|
{ etoile: "Miram", ra: 42.67, dec: 55.90, mag: 3.77, desig: "η de Persée",
|
|
qui: "Chezlepro", role: "membre fondateur" },
|
|
{ etoile: "Achird", ra: 12.28, dec: 57.82, mag: 3.46, desig: "η de Cassiopée",
|
|
qui: "TechnoLibre", role: "membre partenaire" }
|
|
];
|
|
|
|
var COUL = {
|
|
nuit: "#05060f", nuit2: "#0a0d24", filet: "rgba(255,255,255,.10)",
|
|
astre: "#e9ecff", astre2: "#99a1c9", astre3: "#727aa6",
|
|
or: "#4fe3c1", teal: "#4fe3c1", cyan: "#56c2ff", violet: "#a98bff"
|
|
};
|
|
var F_TITRE = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Cantarell, "Noto Sans", Arial, sans-serif';
|
|
var F_ORNE = 'italic 400 {t}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Cantarell, "Noto Sans", Arial, sans-serif';
|
|
var F_MONO = 'ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace';
|
|
|
|
/* ---------- Astronomie ---------- */
|
|
function tempsSideral(date) { // temps sidéral local, en degrés
|
|
var jd = date.getTime() / 86400000 + 2440587.5;
|
|
var gmst = 280.46061837 + 360.98564736629 * (jd - 2451545.0);
|
|
return (((gmst + LON) % 360) + 360) % 360;
|
|
}
|
|
function hauteur(ra, dec, tsl) { // sinus de la hauteur sur l'horizon
|
|
var h = (tsl - ra) * RAD, d = dec * RAD, p = LAT * RAD;
|
|
return Math.sin(p) * Math.sin(d) + Math.cos(p) * Math.cos(d) * Math.cos(h);
|
|
}
|
|
function couleurBV(bv) { // indice de couleur → teinte d'astre
|
|
if (bv < 0) return [196, 214, 255];
|
|
if (bv < 0.3) return [226, 233, 255];
|
|
if (bv < 0.6) return [248, 246, 240];
|
|
if (bv < 1.0) return [255, 236, 200];
|
|
if (bv < 1.4) return [255, 214, 160];
|
|
return [255, 190, 140];
|
|
}
|
|
|
|
function Planisphere(racine) {
|
|
this.racine = racine;
|
|
this.disque = racine.querySelector(".disque");
|
|
this.canvas = racine.querySelector("canvas");
|
|
this.ctx = this.canvas.getContext("2d");
|
|
this.decalage = 0; // minutes ajoutées à « maintenant »
|
|
this.choisi = null; // index du membre en vue
|
|
this.surligne = null; // [ra, dec, nom] d'une place survolée
|
|
this.boutons = [];
|
|
this.construire();
|
|
var self = this;
|
|
if (window.ResizeObserver) new ResizeObserver(function () { self.dimensionner(); }).observe(this.disque);
|
|
else window.addEventListener("resize", function () { self.dimensionner(); });
|
|
this.dimensionner();
|
|
if (document.fonts && document.fonts.ready) document.fonts.ready.then(function () { self.dessiner(); });
|
|
setInterval(function () { if (!self.joue) self.dessiner(); }, 60000);
|
|
}
|
|
|
|
Planisphere.prototype.construire = function () {
|
|
var self = this;
|
|
// Points d'accès au clavier et au toucher, posés sur chaque étoile membre.
|
|
MEMBRES.forEach(function (m, i) {
|
|
var b = document.createElement("button");
|
|
b.type = "button";
|
|
b.className = "astre-membre";
|
|
b.setAttribute("aria-label", m.etoile + ", " + m.desig + " : le site de " + m.qui);
|
|
b.addEventListener("click", function () { self.choisir(i); });
|
|
b.addEventListener("mouseenter", function () { self.choisir(i, true); });
|
|
b.addEventListener("focus", function () { self.choisir(i, true); });
|
|
self.disque.appendChild(b);
|
|
self.boutons.push(b);
|
|
});
|
|
this.racine.querySelectorAll("[data-membre]").forEach(function (b) {
|
|
var i = +b.getAttribute("data-membre");
|
|
b.addEventListener("click", function () { self.choisir(i); });
|
|
b.addEventListener("mouseenter", function () { self.choisir(i, true); });
|
|
b.addEventListener("focus", function () { self.choisir(i, true); });
|
|
});
|
|
|
|
this.curseur = this.racine.querySelector("input[type=range]");
|
|
this.sortie = this.racine.querySelector("output");
|
|
this.jouer = this.racine.querySelector("[data-jouer]");
|
|
this.maintenant = this.racine.querySelector("[data-maintenant]");
|
|
if (this.curseur) this.curseur.addEventListener("input", function () {
|
|
self.arreter(); self.decalage = +self.curseur.value; self.dessiner();
|
|
});
|
|
if (this.maintenant) this.maintenant.addEventListener("click", function () {
|
|
self.arreter(); self.decalage = 0; if (self.curseur) self.curseur.value = 0; self.dessiner();
|
|
});
|
|
if (this.jouer) this.jouer.addEventListener("click", function () {
|
|
if (self.joue) self.arreter(); else self.lancer();
|
|
});
|
|
};
|
|
|
|
Planisphere.prototype.choisir = function (i, survol) {
|
|
if (survol && this.fige) return;
|
|
if (!survol) this.fige = this.choisi === i && this.fige ? false : true;
|
|
this.choisi = i;
|
|
this.racine.querySelectorAll("[data-membre]").forEach(function (b) {
|
|
b.setAttribute("aria-pressed", +b.getAttribute("data-membre") === i ? "true" : "false");
|
|
});
|
|
this.dessiner();
|
|
};
|
|
Planisphere.prototype.surligner = function (place) { this.surligne = place; this.dessiner(); };
|
|
|
|
/* Une nuit entière en 24 secondes, lancée par la personne seulement. */
|
|
Planisphere.prototype.lancer = function () {
|
|
var self = this, debut = null, depart = this.decalage;
|
|
this.joue = true;
|
|
if (this.jouer) { this.jouer.setAttribute("aria-pressed", "true"); this.jouer.textContent = "❚❚ Arrêter"; }
|
|
function pas(t) {
|
|
if (!self.joue) return;
|
|
if (debut === null) debut = t;
|
|
var minutes = ((t - debut) / 24000) * 1440;
|
|
self.decalage = Math.round(depart + minutes) % 1440;
|
|
if (self.curseur) self.curseur.value = self.decalage;
|
|
self.dessiner();
|
|
if (minutes >= 1440) { self.arreter(); return; }
|
|
requestAnimationFrame(pas);
|
|
}
|
|
requestAnimationFrame(pas);
|
|
};
|
|
Planisphere.prototype.arreter = function () {
|
|
this.joue = false;
|
|
if (this.jouer) { this.jouer.setAttribute("aria-pressed", "false"); this.jouer.textContent = "▶ Une nuit en 24 s"; }
|
|
};
|
|
|
|
Planisphere.prototype.dimensionner = function () {
|
|
var w = this.disque.clientWidth;
|
|
if (!w) return;
|
|
var dpr = Math.min(window.devicePixelRatio || 1, 2);
|
|
this.canvas.width = Math.round(w * dpr);
|
|
this.canvas.height = Math.round(w * dpr);
|
|
this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
this.taille = w;
|
|
this.dessiner();
|
|
};
|
|
|
|
Planisphere.prototype.dessiner = function () {
|
|
var w = this.taille;
|
|
if (!w) return;
|
|
var ctx = this.ctx;
|
|
var date = new Date(Date.now() + this.decalage * 60000);
|
|
var tsl = tempsSideral(date);
|
|
var marge = Math.max(36, w * 0.06);
|
|
var cx = w / 2, cy = w / 2, R = w / 2 - marge;
|
|
var echelle = R / Math.tan(((90 - DEC_MIN) / 2) * RAD);
|
|
var k = Math.max(0.75, w / 640); // grossissement des tracés
|
|
|
|
function proj(ra, dec) {
|
|
var r = echelle * Math.tan(((90 - dec) / 2) * RAD);
|
|
var a = (ra - tsl) * RAD;
|
|
return [cx + r * Math.sin(a), cy - r * Math.cos(a)];
|
|
}
|
|
function rayonDec(dec) { return echelle * Math.tan(((90 - dec) / 2) * RAD); }
|
|
|
|
ctx.clearRect(0, 0, w, w);
|
|
|
|
/* Fond du disque */
|
|
var g = ctx.createRadialGradient(cx, cy, 0, cx, cy, R);
|
|
g.addColorStop(0, "#121a48"); g.addColorStop(1, COUL.nuit);
|
|
ctx.save();
|
|
ctx.beginPath(); ctx.arc(cx, cy, R, 0, Math.PI * 2); ctx.fillStyle = g; ctx.fill();
|
|
ctx.clip();
|
|
|
|
/* Graticule : parallèles tous les 30°, méridiens toutes les 2 h */
|
|
ctx.lineWidth = 0.7; ctx.strokeStyle = "rgba(86,194,255,.13)";
|
|
[0, 30, 60].forEach(function (d) { ctx.beginPath(); ctx.arc(cx, cy, rayonDec(d), 0, Math.PI * 2); ctx.stroke(); });
|
|
for (var h = 0; h < 360; h += 30) {
|
|
var p0 = proj(h, 80), p1 = proj(h, DEC_MIN - 5);
|
|
ctx.beginPath(); ctx.moveTo(p0[0], p0[1]); ctx.lineTo(p1[0], p1[1]); ctx.stroke();
|
|
}
|
|
|
|
/* Cercle de perpétuelle apparition */
|
|
ctx.save();
|
|
ctx.setLineDash([3 * k, 5 * k]); ctx.lineWidth = 1.1 * k; ctx.strokeStyle = "rgba(79,227,193,.55)";
|
|
ctx.beginPath(); ctx.arc(cx, cy, rayonDec(CIRCUMPOLAIRE), 0, Math.PI * 2); ctx.stroke();
|
|
ctx.restore();
|
|
|
|
/* Lignes des constellations */
|
|
ctx.lineWidth = 0.8 * k; ctx.lineCap = "round";
|
|
CIEL.constellations.forEach(function (c) {
|
|
c.s.forEach(function (seg) {
|
|
for (var i = 1; i < seg.length; i++) {
|
|
var a = seg[i - 1], b = seg[i];
|
|
if (Math.abs(a[0] - b[0]) > 180) continue;
|
|
var vis = hauteur((a[0] + b[0]) / 2, (a[1] + b[1]) / 2, tsl) > 0;
|
|
ctx.strokeStyle = vis ? "rgba(79,227,193,.30)" : "rgba(114,122,166,.13)";
|
|
var pa = proj(a[0], a[1]), pb = proj(b[0], b[1]);
|
|
ctx.beginPath(); ctx.moveTo(pa[0], pa[1]); ctx.lineTo(pb[0], pb[1]); ctx.stroke();
|
|
}
|
|
});
|
|
});
|
|
|
|
/* Étoiles */
|
|
CIEL.etoiles.forEach(function (e) {
|
|
var p = proj(e[0], e[1]);
|
|
var r = Math.max(0.35, (5.9 - e[2]) * 0.42) * k;
|
|
var vis = hauteur(e[0], e[1], tsl) > 0;
|
|
var c = couleurBV(e[3]);
|
|
ctx.fillStyle = "rgba(" + c[0] + "," + c[1] + "," + c[2] + "," + (vis ? Math.min(1, 0.45 + (5.9 - e[2]) * 0.16) : 0.2) + ")";
|
|
ctx.beginPath(); ctx.arc(p[0], p[1], r, 0, Math.PI * 2); ctx.fill();
|
|
});
|
|
|
|
/* Horizon de Montréal : au-delà, la nuit est sous nos pieds */
|
|
var horizon = [];
|
|
for (var az = 0; az <= 360; az += 2) {
|
|
var A = az * RAD, phi = LAT * RAD;
|
|
var sd = Math.cos(phi) * Math.cos(A);
|
|
var d = Math.asin(sd);
|
|
var cosH = (-Math.sin(phi) * sd) / (Math.cos(phi) * Math.cos(d));
|
|
var H = Math.acos(Math.max(-1, Math.min(1, cosH)));
|
|
if (Math.sin(A) > 0) H = -H; // à l'est : avant le méridien
|
|
horizon.push(proj(tsl - H / RAD, d / RAD));
|
|
}
|
|
ctx.beginPath();
|
|
ctx.rect(0, 0, w, w);
|
|
horizon.forEach(function (p, i) { if (i) ctx.lineTo(p[0], p[1]); else ctx.moveTo(p[0], p[1]); });
|
|
ctx.closePath();
|
|
ctx.fillStyle = "rgba(6,8,18,.58)";
|
|
ctx.fill("evenodd");
|
|
ctx.beginPath();
|
|
horizon.forEach(function (p, i) { if (i) ctx.lineTo(p[0], p[1]); else ctx.moveTo(p[0], p[1]); });
|
|
ctx.lineWidth = 1.2 * k; ctx.strokeStyle = "rgba(153,161,201,.55)"; ctx.stroke();
|
|
|
|
/* Noms des constellations et des astres brillants */
|
|
ctx.textAlign = "center"; ctx.textBaseline = "middle";
|
|
ctx.font = F_ORNE.replace("{t}", Math.round(11.5 * k));
|
|
CIEL.constellations.forEach(function (c) {
|
|
if (c.l[1] < DEC_MIN + 6) return;
|
|
var p = proj(c.l[0], c.l[1]);
|
|
ctx.fillStyle = hauteur(c.l[0], c.l[1], tsl) > 0 ? "rgba(153,161,201,.62)" : "rgba(114,122,166,.3)";
|
|
ctx.fillText(c.nom, p[0], p[1]);
|
|
});
|
|
ctx.font = "400 " + Math.round(10.5 * k) + "px " + F_TITRE;
|
|
ctx.textAlign = "left";
|
|
CIEL.brillantes.forEach(function (b) {
|
|
var p = proj(b.p[0], b.p[1]);
|
|
ctx.fillStyle = hauteur(b.p[0], b.p[1], tsl) > 0 ? "rgba(233,236,255,.75)" : "rgba(114,122,166,.35)";
|
|
ctx.fillText(b.n, p[0] + 6 * k, p[1] + 1);
|
|
});
|
|
|
|
/* La place survolée dans le registre des 70 */
|
|
if (this.surligne) {
|
|
var ps = proj(this.surligne[0], this.surligne[1]);
|
|
ctx.strokeStyle = COUL.or; ctx.lineWidth = 1.2 * k;
|
|
ctx.beginPath(); ctx.arc(ps[0], ps[1], 10 * k, 0, Math.PI * 2); ctx.stroke();
|
|
ctx.font = "700 " + Math.round(14 * k) + "px " + F_TITRE; ctx.fillStyle = COUL.or; ctx.textAlign = "left";
|
|
ctx.fillText(this.surligne[2], ps[0] + 14 * k, ps[1]);
|
|
}
|
|
|
|
/* Le lien entre les sites : une aurore d'une étoile à l'autre */
|
|
var pm = MEMBRES.map(function (m) { return proj(m.ra, m.dec); });
|
|
if (pm.length > 1) {
|
|
var ga = ctx.createLinearGradient(pm[0][0], pm[0][1], pm[1][0], pm[1][1]);
|
|
ga.addColorStop(0, COUL.teal); ga.addColorStop(0.5, COUL.cyan); ga.addColorStop(1, COUL.violet);
|
|
var mx = (pm[0][0] + pm[1][0]) / 2, my = (pm[0][1] + pm[1][1]) / 2;
|
|
var vx = mx - cx, vy = my - cy, n = Math.hypot(vx, vy) || 1;
|
|
var bomb = Math.hypot(pm[0][0] - pm[1][0], pm[0][1] - pm[1][1]) * 0.28;
|
|
ctx.save();
|
|
ctx.shadowColor = "rgba(86,194,255,.8)"; ctx.shadowBlur = 10 * k;
|
|
ctx.strokeStyle = ga; ctx.lineWidth = 2.4 * k;
|
|
ctx.beginPath(); ctx.moveTo(pm[0][0], pm[0][1]);
|
|
ctx.quadraticCurveTo(mx + (vx / n) * bomb, my + (vy / n) * bomb, pm[1][0], pm[1][1]);
|
|
ctx.stroke();
|
|
ctx.restore();
|
|
}
|
|
|
|
/* Les étoiles des sites */
|
|
var self = this;
|
|
MEMBRES.forEach(function (m, i) {
|
|
var p = pm[i];
|
|
var en = self.choisi === i;
|
|
var halo = ctx.createRadialGradient(p[0], p[1], 0, p[0], p[1], (en ? 30 : 22) * k);
|
|
halo.addColorStop(0, "rgba(79,227,193,.55)"); halo.addColorStop(1, "rgba(79,227,193,0)");
|
|
ctx.fillStyle = halo; ctx.beginPath(); ctx.arc(p[0], p[1], (en ? 30 : 22) * k, 0, Math.PI * 2); ctx.fill();
|
|
etoileQuatre(ctx, p[0], p[1], (en ? 9 : 7) * k, COUL.astre);
|
|
// L'étiquette s'écarte du pôle, vers l'extérieur : le centre reste lisible.
|
|
var ux = p[0] - cx, uy = p[1] - cy, un = Math.hypot(ux, uy) || 1;
|
|
ux /= un; uy /= un;
|
|
var lx = p[0] + ux * 16 * k, ly = p[1] + uy * 16 * k;
|
|
ctx.textAlign = ux >= 0 ? "left" : "right";
|
|
ctx.font = "700 " + Math.round(16 * k) + "px " + F_TITRE; ctx.fillStyle = COUL.or;
|
|
ctx.fillText(m.etoile, lx, ly - 7 * k);
|
|
ctx.font = F_ORNE.replace("{t}", Math.round(12.5 * k)); ctx.fillStyle = COUL.astre2;
|
|
ctx.fillText(m.qui, lx, ly + 9 * k);
|
|
var b = self.boutons[i];
|
|
if (b) { b.style.left = (p[0] / w * 100) + "%"; b.style.top = (p[1] / w * 100) + "%"; }
|
|
});
|
|
|
|
ctx.restore(); // fin de la découpe du disque
|
|
|
|
/* Couronne : heures d'ascension droite, qui tournent avec le ciel */
|
|
ctx.strokeStyle = "rgba(114,122,166,.55)"; ctx.lineWidth = 1;
|
|
ctx.beginPath(); ctx.arc(cx, cy, R, 0, Math.PI * 2); ctx.stroke();
|
|
ctx.beginPath(); ctx.arc(cx, cy, R + marge * 0.42, 0, Math.PI * 2); ctx.strokeStyle = "rgba(255,255,255,.10)"; ctx.stroke();
|
|
for (var m = 0; m < 24 * 6; m++) {
|
|
var ang = (m * 2.5 - tsl) * RAD;
|
|
var long = m % 6 === 0 ? 0.42 : (m % 3 === 0 ? 0.26 : 0.14);
|
|
ctx.beginPath();
|
|
ctx.moveTo(cx + R * Math.sin(ang), cy - R * Math.cos(ang));
|
|
ctx.lineTo(cx + (R + marge * long) * Math.sin(ang), cy - (R + marge * long) * Math.cos(ang));
|
|
ctx.strokeStyle = m % 6 === 0 ? "rgba(79,227,193,.7)" : "rgba(114,122,166,.5)";
|
|
ctx.stroke();
|
|
}
|
|
ctx.font = Math.round(Math.max(9, 10 * k)) + "px " + F_MONO;
|
|
ctx.fillStyle = COUL.astre3; ctx.textAlign = "center"; ctx.textBaseline = "middle";
|
|
for (var hh = 0; hh < 24; hh += 2) {
|
|
var an = (hh * 15 - tsl) * RAD, rr = R + marge * 0.72;
|
|
ctx.fillText(hh + " h", cx + rr * Math.sin(an), cy - rr * Math.cos(an));
|
|
}
|
|
|
|
/* Repères fixes : le zénith en haut, le nord en bas */
|
|
var pz = [cx, cy - rayonDec(LAT)];
|
|
ctx.strokeStyle = "rgba(233,236,255,.55)"; ctx.lineWidth = 1;
|
|
ctx.beginPath(); ctx.moveTo(pz[0] - 5, pz[1]); ctx.lineTo(pz[0] + 5, pz[1]); ctx.moveTo(pz[0], pz[1] - 5); ctx.lineTo(pz[0], pz[1] + 5); ctx.stroke();
|
|
ctx.font = Math.round(Math.max(9, 9.5 * k)) + "px " + F_MONO; ctx.fillStyle = COUL.astre3;
|
|
ctx.fillText("ZÉNITH", pz[0], pz[1] - 11 * k);
|
|
var pn = [cx, cy + rayonDec(CIRCUMPOLAIRE)];
|
|
ctx.fillText("HORIZON NORD", pn[0], pn[1] + 13 * k);
|
|
|
|
/* L'heure affichée */
|
|
if (this.sortie) {
|
|
var txt = date.toLocaleString("fr-CA", { timeZone: "America/Toronto", weekday: "short", hour: "2-digit", minute: "2-digit" });
|
|
this.sortie.textContent = (this.decalage === 0 ? "maintenant · " : "") + txt;
|
|
}
|
|
};
|
|
|
|
function etoileQuatre(ctx, x, y, r, coul) {
|
|
var i = r * 0.22;
|
|
ctx.save();
|
|
ctx.shadowColor = "rgba(233,236,255,.9)"; ctx.shadowBlur = r * 1.4;
|
|
ctx.fillStyle = coul;
|
|
ctx.beginPath();
|
|
ctx.moveTo(x, y - r);
|
|
ctx.quadraticCurveTo(x + i, y - i, x + r, y);
|
|
ctx.quadraticCurveTo(x + i, y + i, x, y + r);
|
|
ctx.quadraticCurveTo(x - i, y + i, x - r, y);
|
|
ctx.quadraticCurveTo(x - i, y - i, x, y - r);
|
|
ctx.fill();
|
|
ctx.restore();
|
|
}
|
|
|
|
/* ---------- Mise en route ---------- */
|
|
var instances = [];
|
|
document.querySelectorAll("[data-planisphere]").forEach(function (el) { instances.push(new Planisphere(el)); });
|
|
|
|
/* Le registre des 70 circumpolaires (page La Constellation). */
|
|
var registre = document.querySelector("[data-places]");
|
|
if (registre && instances.length) {
|
|
var prises = {}; MEMBRES.forEach(function (m) { prises[m.etoile] = m.qui; });
|
|
var CONST = { UMa: "Gde Ourse", UMi: "Pte Ourse", Cas: "Cassiopée", Cep: "Céphée", Dra: "Dragon", Per: "Persée",
|
|
Aur: "Cocher", Cyg: "Cygne", Cam: "Girafe", Lyn: "Lynx", And: "Andromède", Lac: "Lézard", CVn: "Chiens de chasse",
|
|
Boo: "Bouvier", Her: "Hercule", Lyr: "Lyre", Tri: "Triangle", LMi: "Pte Lionne" };
|
|
CIEL.circumpolaires.forEach(function (c) {
|
|
var li = document.createElement("li");
|
|
var b = document.createElement("button");
|
|
b.type = "button";
|
|
var titre = c.n + (c.b ? " · " + c.b + " " + (CONST[c.c] || c.c) : "") + (prises[c.n] ? " · le site de " + prises[c.n] : "");
|
|
b.title = titre;
|
|
b.setAttribute("aria-label", titre + (c.p ? "" : " (trop faible pour l'œil nu)"));
|
|
var n = document.createElement("span"); n.className = "n"; n.textContent = c.n;
|
|
var s = document.createElement("span"); s.className = "c"; s.textContent = c.p ? c.p[2].toFixed(1).replace(".", ",") : "—";
|
|
b.appendChild(n); b.appendChild(s);
|
|
if (prises[c.n]) li.className = "prise";
|
|
if (c.p) {
|
|
b.setAttribute("data-place", "");
|
|
var on = function () { instances[0].surligner([c.p[0], c.p[1], c.n]); };
|
|
b.addEventListener("mouseenter", on); b.addEventListener("focus", on);
|
|
b.addEventListener("mouseleave", function () { instances[0].surligner(null); });
|
|
b.addEventListener("blur", function () { instances[0].surligner(null); });
|
|
}
|
|
li.appendChild(b); registre.appendChild(li);
|
|
});
|
|
}
|
|
})();
|