Meteo Vercors : afficher le bulletin public sur la carte
Cette révision appartient à :
1 Parent
60be1e5193
révision
3f1e1621a3
5 fichiers modifiés
+127
-18
Aucun fichier ne correspond à votre recherche
@@ -226,6 +226,20 @@ class Forum:
|
|||||||
" WHERE p.topic_id=? AND (p.hidden=0 OR ?) ORDER BY p.id", (topic_id, int(voit))).fetchall()
|
" WHERE p.topic_id=? AND (p.hidden=0 OR ?) ORDER BY p.id", (topic_id, int(voit))).fetchall()
|
||||||
return t, msgs
|
return t, msgs
|
||||||
|
|
||||||
|
def a_la_une(self):
|
||||||
|
"""Dernier bulletin visible par un visiteur et nombre de nouveaux sujets publics sur sept jours."""
|
||||||
|
bulletin = self.con.execute(
|
||||||
|
"SELECT t.id AS sujet, t.title AS titre, p.body AS corps, u.display_name AS auteur"
|
||||||
|
" FROM topics t JOIN posts p ON p.topic_id=t.id JOIN users u ON u.id=p.author_id"
|
||||||
|
" WHERE t.fixed=1 AND t.status='publie' AND t.hidden=0 AND p.hidden=0"
|
||||||
|
" ORDER BY p.id DESC LIMIT 1"
|
||||||
|
).fetchone()
|
||||||
|
n = self.con.execute(
|
||||||
|
"SELECT COUNT(*) FROM topics WHERE fixed=0 AND status='publie' AND hidden=0"
|
||||||
|
" AND created_at >= datetime('now', '-7 days')"
|
||||||
|
).fetchone()[0]
|
||||||
|
return bulletin, n
|
||||||
|
|
||||||
def en_attente(self, user):
|
def en_attente(self, user):
|
||||||
self._exiger(user, "valider_sujet")
|
self._exiger(user, "valider_sujet")
|
||||||
return self.con.execute("SELECT t.*, u.display_name AS auteur FROM topics t JOIN users u ON u.id=t.author_id"
|
return self.con.execute("SELECT t.*, u.display_name AS auteur FROM topics t JOIN users u ON u.id=t.author_id"
|
||||||
|
|||||||
@@ -685,6 +685,18 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
self.envoyer(200, corps, "application/json; charset=utf-8",
|
self.envoyer(200, corps, "application/json; charset=utf-8",
|
||||||
[("Cache-Control", "public, max-age=300"), ("Access-Control-Allow-Origin", "*")])
|
[("Cache-Control", "public, max-age=300"), ("Access-Control-Allow-Origin", "*")])
|
||||||
|
|
||||||
|
def a_la_une(self):
|
||||||
|
bulletin, n = self.app.forum.a_la_une()
|
||||||
|
donnees = {"n": n}
|
||||||
|
if bulletin:
|
||||||
|
extrait = " ".join(bulletin["corps"].split())
|
||||||
|
if len(extrait) > 180:
|
||||||
|
extrait = extrait[:179].rstrip() + "…"
|
||||||
|
donnees.update(titre=bulletin["titre"], auteur=bulletin["auteur"], extrait=extrait,
|
||||||
|
url=self.prefixe + "/t/%d" % bulletin["sujet"])
|
||||||
|
self.envoyer(200, json.dumps(donnees, ensure_ascii=False), "application/json; charset=utf-8",
|
||||||
|
[("Cache-Control", "no-store")])
|
||||||
|
|
||||||
def photo_adhesion(self, user, nom):
|
def photo_adhesion(self, user, nom):
|
||||||
if not PHOTO_OK.match(nom):
|
if not PHOTO_OK.match(nom):
|
||||||
return self.envoyer(404, "introuvable", "text/plain; charset=utf-8")
|
return self.envoyer(404, "introuvable", "text/plain; charset=utf-8")
|
||||||
@@ -694,6 +706,8 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
u = urlparse(self.path)
|
u = urlparse(self.path)
|
||||||
u = u._replace(path=self.chemin_sans_prefixe(u.path))
|
u = u._replace(path=self.chemin_sans_prefixe(u.path))
|
||||||
|
if u.path == "/api/une.json":
|
||||||
|
return self.a_la_une()
|
||||||
filtre = parse_qs(u.query).get("q", [""])[0].strip()[:80]
|
filtre = parse_qs(u.query).get("q", [""])[0].strip()[:80]
|
||||||
user = self.utilisateur()
|
user = self.utilisateur()
|
||||||
f = self.app.forum
|
f = self.app.forum
|
||||||
|
|||||||
@@ -734,6 +734,47 @@ class TestFicheHTTP(BaseHTTP):
|
|||||||
self.assertEqual(self.f.photos_fiche_ids("geve"), {self.ids[1]})
|
self.assertEqual(self.f.photos_fiche_ids("geve"), {self.ids[1]})
|
||||||
|
|
||||||
|
|
||||||
|
class TestUneHTTP(BaseHTTP):
|
||||||
|
def setUp(self):
|
||||||
|
super().setUp()
|
||||||
|
self.reglages.prefixe = "/forum"
|
||||||
|
self.chemin = "/forum/api/une.json"
|
||||||
|
self.bulletin = self.f.sujets(None)[0]["id"]
|
||||||
|
|
||||||
|
def test_bulletin_public_et_lien(self):
|
||||||
|
self.assertEqual(json.loads(self.req(self.chemin)[2]), {"n": 0})
|
||||||
|
self.f.repondre(self.pere, self.bulletin, "Ancien bulletin")
|
||||||
|
self.f.repondre(self.adh, self.bulletin, "Neige\n à Gêve")
|
||||||
|
masque = self.f.repondre(self.pere, self.bulletin, "Bulletin masqué")
|
||||||
|
self.f.masquer_message(self.modo, masque)
|
||||||
|
|
||||||
|
st, h, b = self.req(self.chemin, "mo1")
|
||||||
|
self.assertEqual(st, 200)
|
||||||
|
self.assertEqual(h["Content-Type"], "application/json; charset=utf-8")
|
||||||
|
self.assertEqual(h["Cache-Control"], "no-store")
|
||||||
|
self.assertIsNone(h["Set-Cookie"])
|
||||||
|
d = json.loads(b)
|
||||||
|
self.assertEqual(d, {"n": 0, "titre": "Bulletin de la semaine du Vercors", "auteur": "Alex",
|
||||||
|
"extrait": "Neige à Gêve", "url": "/forum/t/%d" % self.bulletin})
|
||||||
|
self.assertEqual(json.loads(self.req("/api/une.json")[2]), d)
|
||||||
|
self.assertEqual(self.req(d["url"])[0], 200)
|
||||||
|
|
||||||
|
message = self.f.repondre(self.adh, self.bulletin, "x" * 181)
|
||||||
|
self.assertEqual(json.loads(self.req(self.chemin)[2])["extrait"], "x" * 179 + "…")
|
||||||
|
self.f.masquer_message(self.modo, message)
|
||||||
|
self.assertEqual(json.loads(self.req(self.chemin)[2]), d)
|
||||||
|
|
||||||
|
def test_compte_des_sujets_publics_recents_sans_bulletin(self):
|
||||||
|
self.f.creer_sujet(self.adh, "Public", "Texte")
|
||||||
|
masque = self.f.creer_sujet(self.adh, "Masqué", "Texte")
|
||||||
|
self.f.masquer_sujet(self.modo, masque)
|
||||||
|
self.f.creer_sujet_station(self.prop, "geve", "En attente")
|
||||||
|
ancien = self.f.creer_sujet(self.adh, "Ancien", "Texte")
|
||||||
|
self.f.con.execute("UPDATE topics SET created_at=datetime('now', '-8 days') WHERE id=?", (ancien,))
|
||||||
|
self.f.con.commit()
|
||||||
|
self.assertEqual(json.loads(self.req(self.chemin, "theo")[2]), {"n": 1})
|
||||||
|
|
||||||
|
|
||||||
class TestPrefixe(BaseHTTP):
|
class TestPrefixe(BaseHTTP):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ a:focus-visible,button:focus-visible,input:focus-visible{outline:2px solid var(-
|
|||||||
.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{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 a:hover{text-decoration:underline}
|
||||||
.fb-une span{font-size:12.5px;color:var(--gris)}
|
.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{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-cta:hover{background:#17382b}
|
||||||
.fb-co{margin:0 16px 12px;text-align:center;font-size:12.5px;color:var(--gris)}
|
.fb-co{margin:0 16px 12px;text-align:center;font-size:12.5px;color:var(--gris)}
|
||||||
@@ -564,7 +565,7 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
|||||||
<a class="suite" href="#stations" data-i18n="suite">Toutes les stations ↓</a>
|
<a class="suite" href="#stations" data-i18n="suite">Toutes les stations ↓</a>
|
||||||
<div class="forum-box">
|
<div class="forum-box">
|
||||||
<div class="fb-haut"><b data-i18n="fb.titre">Forum</b><small data-n></small></div>
|
<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></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>
|
<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>
|
<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 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>
|
||||||
@@ -578,7 +579,7 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
|||||||
<p class="aide" data-i18n="aide">Ces choix valent aussi pour la liste des stations, plus bas.</p>
|
<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="forum-box mobile">
|
||||||
<div class="fb-haut"><b data-i18n="fb.titre">Forum</b><small data-n></small></div>
|
<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></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>
|
<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>
|
<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 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>
|
||||||
@@ -700,6 +701,7 @@ const dec = s => L === 'en' ? s : s.replace('.', ',');
|
|||||||
// les noms de stations et de lieux ne sont jamais traduits.
|
// les noms de stations et de lieux ne sont jamais traduits.
|
||||||
const I18N = {
|
const I18N = {
|
||||||
fr: {
|
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',
|
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…',
|
'phrase.charge': 'Relevés en cours de chargement…',
|
||||||
'reseau.n': n => `${n} stations dans le massif`,
|
'reseau.n': n => `${n} stations dans le massif`,
|
||||||
@@ -757,6 +759,7 @@ const I18N = {
|
|||||||
'record.label': 'Highlight', 'record.auto': 'By season', 'record.froid': 'Coldest', 'record.chaud': 'Warmest', 'record.vent': 'Windiest', 'record.pluie': 'Wettest',
|
'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 ↓',
|
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.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.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.',
|
'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)',
|
'sous-carte': 'Contour lines every 100 m · zoom: mouse wheel (PC) or two fingers (phone)',
|
||||||
@@ -836,6 +839,7 @@ const I18N = {
|
|||||||
'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',
|
'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 ↓',
|
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.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.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.',
|
'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)',
|
'sous-carte': 'Höhenlinien alle 100 m · Zoom: Mausrad (PC) oder zwei Finger (Handy)',
|
||||||
@@ -1914,12 +1918,28 @@ btnLecture.addEventListener('click', () => {
|
|||||||
btnLecture.textContent = '❚❚'; btnLecture.setAttribute('aria-label', t('lecture.pause'));
|
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);
|
lectureId = setInterval(() => { curseur.value = Math.min(N, +curseur.value + 1); poserTemps(); if (+curseur.value >= N) arreterLecture(); }, 260);
|
||||||
});
|
});
|
||||||
(FORUM_OUVERT ? fetch('data/forum-une.json?' + Math.floor(Date.now() / 300000)).then(r => r.ok ? r.json() : null).then(u => {
|
let uneForum = null;
|
||||||
if (!u || !u.titre) return;
|
function afficherUneForum(){
|
||||||
document.querySelectorAll('[data-une]').forEach(a => { a.textContent = u.titre; if (typeof u.url === 'string' && u.url.startsWith('/forum/') && !u.url.startsWith('//')) a.href = u.url; });
|
if (!uneForum) return;
|
||||||
document.querySelectorAll('[data-auteur]').forEach(e => { e.textContent = u.auteur ? 'par ' + u.auteur : ''; });
|
const {titre, auteur, extrait, url, n} = uneForum;
|
||||||
if (u.n) document.querySelectorAll('[data-n]').forEach(e => { e.textContent = u.n + (u.n > 1 ? ' sujets' : ' sujet') + ' cette semaine'; });
|
if (Number.isSafeInteger(n) && n > 0) {
|
||||||
}).catch(() => {}) : 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
|
remplirBilan(); // le bilan est déplié dès l'arrivée
|
||||||
function apresDonnees(){ chargerSeries(); if (TEMPS != null) { snapshotLive(); appliquerTemps(); } }
|
function apresDonnees(){ chargerSeries(); if (TEMPS != null) { snapshotLive(); appliquerTemps(); } }
|
||||||
const selRecord = document.getElementById('record');
|
const selRecord = document.getElementById('record');
|
||||||
@@ -2356,7 +2376,7 @@ dlgPrm.addEventListener('change', ev => {
|
|||||||
});
|
});
|
||||||
// après un changement de langue ou d'affichage : textes refaits, étiquettes remesurées, puces replacées
|
// après un changement de langue ou d'affichage : textes refaits, étiquettes remesurées, puces replacées
|
||||||
function apresReglage(){
|
function apresReglage(){
|
||||||
traduirePage(); formatsDates(); forumTextes(); majAlt(); majTempsTxt(); majDate(); afficherDirect();
|
traduirePage(); formatsDates(); forumTextes(); afficherUneForum(); majAlt(); majTempsTxt(); majDate(); afficherDirect();
|
||||||
btnLecture.setAttribute('aria-label', t(lectureId ? 'lecture.pause' : 'lecture.rejouer'));
|
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');
|
plein.setAttribute('aria-label', t('plein.aria')); plein.querySelector('.plein-ferme').textContent = t('plein.retour');
|
||||||
phraseDuJour(); listeStations(); coupe();
|
phraseDuJour(); listeStations(); coupe();
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ a:focus-visible,button:focus-visible,input:focus-visible{outline:2px solid var(-
|
|||||||
.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{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 a:hover{text-decoration:underline}
|
||||||
.fb-une span{font-size:12.5px;color:var(--gris)}
|
.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{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-cta:hover{background:#17382b}
|
||||||
.fb-co{margin:0 16px 12px;text-align:center;font-size:12.5px;color:var(--gris)}
|
.fb-co{margin:0 16px 12px;text-align:center;font-size:12.5px;color:var(--gris)}
|
||||||
@@ -564,7 +565,7 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
|||||||
<a class="suite" href="#stations" data-i18n="suite">Toutes les stations ↓</a>
|
<a class="suite" href="#stations" data-i18n="suite">Toutes les stations ↓</a>
|
||||||
<div class="forum-box">
|
<div class="forum-box">
|
||||||
<div class="fb-haut"><b data-i18n="fb.titre">Forum</b><small data-n></small></div>
|
<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></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>
|
<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>
|
<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 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>
|
||||||
@@ -578,7 +579,7 @@ html[data-aff=acces]{--gris:#3a3f3c;--pierre:#b9b4a6}
|
|||||||
<p class="aide" data-i18n="aide">Ces choix valent aussi pour la liste des stations, plus bas.</p>
|
<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="forum-box mobile">
|
||||||
<div class="fb-haut"><b data-i18n="fb.titre">Forum</b><small data-n></small></div>
|
<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></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>
|
<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>
|
<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 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>
|
||||||
@@ -700,6 +701,7 @@ const dec = s => L === 'en' ? s : s.replace('.', ',');
|
|||||||
// les noms de stations et de lieux ne sont jamais traduits.
|
// les noms de stations et de lieux ne sont jamais traduits.
|
||||||
const I18N = {
|
const I18N = {
|
||||||
fr: {
|
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',
|
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…',
|
'phrase.charge': 'Relevés en cours de chargement…',
|
||||||
'reseau.n': n => `${n} stations dans le massif`,
|
'reseau.n': n => `${n} stations dans le massif`,
|
||||||
@@ -757,6 +759,7 @@ const I18N = {
|
|||||||
'record.label': 'Highlight', 'record.auto': 'By season', 'record.froid': 'Coldest', 'record.chaud': 'Warmest', 'record.vent': 'Windiest', 'record.pluie': 'Wettest',
|
'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 ↓',
|
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.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.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.',
|
'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)',
|
'sous-carte': 'Contour lines every 100 m · zoom: mouse wheel (PC) or two fingers (phone)',
|
||||||
@@ -836,6 +839,7 @@ const I18N = {
|
|||||||
'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',
|
'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 ↓',
|
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.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.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.',
|
'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)',
|
'sous-carte': 'Höhenlinien alle 100 m · Zoom: Mausrad (PC) oder zwei Finger (Handy)',
|
||||||
@@ -1914,12 +1918,28 @@ btnLecture.addEventListener('click', () => {
|
|||||||
btnLecture.textContent = '❚❚'; btnLecture.setAttribute('aria-label', t('lecture.pause'));
|
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);
|
lectureId = setInterval(() => { curseur.value = Math.min(N, +curseur.value + 1); poserTemps(); if (+curseur.value >= N) arreterLecture(); }, 260);
|
||||||
});
|
});
|
||||||
(FORUM_OUVERT ? fetch('data/forum-une.json?' + Math.floor(Date.now() / 300000)).then(r => r.ok ? r.json() : null).then(u => {
|
let uneForum = null;
|
||||||
if (!u || !u.titre) return;
|
function afficherUneForum(){
|
||||||
document.querySelectorAll('[data-une]').forEach(a => { a.textContent = u.titre; if (typeof u.url === 'string' && u.url.startsWith('/forum/') && !u.url.startsWith('//')) a.href = u.url; });
|
if (!uneForum) return;
|
||||||
document.querySelectorAll('[data-auteur]').forEach(e => { e.textContent = u.auteur ? 'par ' + u.auteur : ''; });
|
const {titre, auteur, extrait, url, n} = uneForum;
|
||||||
if (u.n) document.querySelectorAll('[data-n]').forEach(e => { e.textContent = u.n + (u.n > 1 ? ' sujets' : ' sujet') + ' cette semaine'; });
|
if (Number.isSafeInteger(n) && n > 0) {
|
||||||
}).catch(() => {}) : 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
|
remplirBilan(); // le bilan est déplié dès l'arrivée
|
||||||
function apresDonnees(){ chargerSeries(); if (TEMPS != null) { snapshotLive(); appliquerTemps(); } }
|
function apresDonnees(){ chargerSeries(); if (TEMPS != null) { snapshotLive(); appliquerTemps(); } }
|
||||||
const selRecord = document.getElementById('record');
|
const selRecord = document.getElementById('record');
|
||||||
@@ -2356,7 +2376,7 @@ dlgPrm.addEventListener('change', ev => {
|
|||||||
});
|
});
|
||||||
// après un changement de langue ou d'affichage : textes refaits, étiquettes remesurées, puces replacées
|
// après un changement de langue ou d'affichage : textes refaits, étiquettes remesurées, puces replacées
|
||||||
function apresReglage(){
|
function apresReglage(){
|
||||||
traduirePage(); formatsDates(); forumTextes(); majAlt(); majTempsTxt(); majDate(); afficherDirect();
|
traduirePage(); formatsDates(); forumTextes(); afficherUneForum(); majAlt(); majTempsTxt(); majDate(); afficherDirect();
|
||||||
btnLecture.setAttribute('aria-label', t(lectureId ? 'lecture.pause' : 'lecture.rejouer'));
|
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');
|
plein.setAttribute('aria-label', t('plein.aria')); plein.querySelector('.plein-ferme').textContent = t('plein.retour');
|
||||||
phraseDuJour(); listeStations(); coupe();
|
phraseDuJour(); listeStations(); coupe();
|
||||||
|
|||||||
Référencer dans un nouveau ticket
Bloquer un utilisateur