Repris des copies site-principal-news et site-principal-reglages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
544 lignes
28 KiB
Diff
544 lignes
28 KiB
Diff
diff --git a/.gitignore b/.gitignore
|
|
index 6babfc7..f32bb50 100644
|
|
--- a/.gitignore
|
|
+++ b/.gitignore
|
|
@@ -64,3 +64,4 @@ id_ed25519*
|
|
*.mkv
|
|
*.wav
|
|
*.flac
|
|
+*.bak
|
|
diff --git a/CONSIGNES-AGENTS.md b/CONSIGNES-AGENTS.md
|
|
new file mode 100644
|
|
index 0000000..10126fa
|
|
--- /dev/null
|
|
+++ b/CONSIGNES-AGENTS.md
|
|
@@ -0,0 +1,6 @@
|
|
+# Consignes pour les agents (règle de Théo)
|
|
+- Accueil, Portfolio, Réalisations et « L'envers du décor » : contenu d'origine uniquement. Aucun widget, lien, bloc ou entrée News sans accord explicite de Théo.
|
|
+- Le « Carnet de bord » (#news, `data/news.json`, `tools/admin-news.js`) ne contient QUE des sorties audiovisuelles : ne pas le modifier ni le mélanger.
|
|
+- Le nouveau flux News utilise `data/actus.json`, `news/actus.js`, `tools/add-news.js`, classes/id `actus-*` : jamais `news-*`.
|
|
+- Emplacement du widget : en attente de la réponse de Théo. Ne le placer nulle part d'ici là.
|
|
+- Pas de déploiement, pas de push, pas d'accès VPS/Hub sans demande de Théo.
|
|
diff --git a/data/actus.json b/data/actus.json
|
|
new file mode 100644
|
|
index 0000000..ea1adcc
|
|
--- /dev/null
|
|
+++ b/data/actus.json
|
|
@@ -0,0 +1,63 @@
|
|
+[
|
|
+ {
|
|
+ "id": 8,
|
|
+ "date": "2026-10-24",
|
|
+ "category": "site",
|
|
+ "title": "[EXEMPLE] Une section News arrive sur le site",
|
|
+ "summary": "[EXEMPLE] Les dernières nouveautés seront bientôt réunies ici : vidéos, projets, applications et mises à jour du site.",
|
|
+ "link": "/news/"
|
|
+ },
|
|
+ {
|
|
+ "id": 7,
|
|
+ "date": "2026-10-24",
|
|
+ "category": "site",
|
|
+ "title": "[EXEMPLE] [À VÉRIFIER] Le site existe en cinq langues",
|
|
+ "summary": "[EXEMPLE] [À VÉRIFIER] La page d'accueil est aussi disponible en anglais, allemand, italien et espagnol."
|
|
+ },
|
|
+ {
|
|
+ "id": 6,
|
|
+ "date": "2026-10-23",
|
|
+ "category": "site",
|
|
+ "title": "[EXEMPLE] [À VÉRIFIER] Des statistiques de visite sans service tiers",
|
|
+ "summary": "[EXEMPLE] [À VÉRIFIER] Le comptage des visites se fait sur le serveur du site, sans outil de pistage extérieur.",
|
|
+ "link": "https://stats.gastinel.me/"
|
|
+ },
|
|
+ {
|
|
+ "id": 5,
|
|
+ "date": "2026-10-18",
|
|
+ "category": "technique",
|
|
+ "title": "[EXEMPLE] [À VÉRIFIER] Un site météo pour les stations du Vercors",
|
|
+ "summary": "[EXEMPLE] [À VÉRIFIER] Une maquette avec une carte et une liste de stations est en cours de travail. Les données de la maquette sont inventées."
|
|
+ },
|
|
+ {
|
|
+ "id": 4,
|
|
+ "date": "2026-10-16",
|
|
+ "category": "technique",
|
|
+ "title": "[EXEMPLE] [À VÉRIFIER] GastinelGarde 0.3.1 : une version prête à être testée",
|
|
+ "summary": "[EXEMPLE] [À VÉRIFIER] Une nouvelle version de ce projet pour Minecraft est prête. Elle a passé ses tests automatiques, mais pas encore de test en jeu."
|
|
+ },
|
|
+ {
|
|
+ "id": 3,
|
|
+ "date": "2026-09-24",
|
|
+ "category": "application",
|
|
+ "title": "[EXEMPLE] [À VÉRIFIER] Gastinel Weather Studio : page de téléchargement",
|
|
+ "summary": "[EXEMPLE] [À VÉRIFIER] Le logiciel qui étudie les trous à froid du Vercors a sa page de téléchargement pour Windows.",
|
|
+ "link": "/gws/download/"
|
|
+ },
|
|
+ {
|
|
+ "id": 2,
|
|
+ "date": "2026-09-19",
|
|
+ "category": "audiovisuel",
|
|
+ "title": "[EXEMPLE] Une nouvelle photo de montagne au crépuscule",
|
|
+ "summary": "[EXEMPLE] Exemple de news photo : une prise de vue aérienne du Vercors, avec une image et une description courte.",
|
|
+ "image": "/assets/img/dji-fly-20250919-194610-0004-1758304172909-photo.webp",
|
|
+ "imageAlt": "Ciel orangé au crépuscule sur le plateau du Vercors, vu du drone"
|
|
+ },
|
|
+ {
|
|
+ "id": 1,
|
|
+ "date": "2026-09-01",
|
|
+ "category": "audiovisuel",
|
|
+ "title": "[EXEMPLE] Une nouvelle vidéo de drone FPV",
|
|
+ "summary": "[EXEMPLE] Exemple de news vidéo. Ce texte n'annonce aucune vraie vidéo : il sert à tester l'affichage."
|
|
+ }
|
|
+]
|
|
diff --git a/index.html b/index.html
|
|
index d65da6e..dc8ef17 100644
|
|
--- a/index.html
|
|
+++ b/index.html
|
|
@@ -207,6 +207,7 @@
|
|
<link rel="preload" href="assets/fonts/inter-latin.woff2" as="font" type="font/woff2" crossorigin>
|
|
<link rel="preload" as="image" href="assets/img/dji-fly-20250919-194610-0004-1758304172909-photo.webp" fetchpriority="high">
|
|
<style>
|
|
+/* GARDE (consigne de Théo) : ne rien ajouter pour accueil/portfolio/realisations/apropos (pas de news ni widget) sans son accord explicite. */
|
|
|
|
@font-face {
|
|
font-family: 'Comfortaa';
|
|
@@ -1714,6 +1715,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
|
|
</nav>
|
|
|
|
<section id="accueil" class="spa-section">
|
|
+<!-- GARDE (consigne de Théo) : ne rien ajouter ici (pas de news, widget ni bloc) sans son accord explicite. Contenu audiovisuel d'origine uniquement. -->
|
|
<h1 style="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;">Théo Gastinel, 15 ans : photo, vidéo, drone et logiciels à Lans-en-Vercors</h1>
|
|
<div class="carousel-container reveal-down-init" id="carouselWindow">
|
|
<button class="carousel-arrow carousel-arrow-left" id="prevBtn" aria-label="Précédent"><svg class="svg-icon" viewBox="0 0 320 512" aria-hidden="true"><path d="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"/></svg><svg class="btn-border-svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="48" /></svg></button>
|
|
@@ -1766,6 +1768,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
|
|
</section>
|
|
|
|
<section id="portfolio" class="spa-section">
|
|
+<!-- GARDE (consigne de Théo) : ne rien ajouter ici (pas de news, widget ni bloc) sans son accord explicite. Contenu audiovisuel d'origine uniquement. -->
|
|
<div class="migration-note" id="migration-popup">
|
|
<div class="migration-bar-container"><div class="migration-bar-progress"></div></div>
|
|
<svg class="svg-icon" viewBox="0 0 512 512" style="margin-right:8px;" aria-hidden="true"><path d="M78.6 5C69.1-2.4 55.6-1.5 47 7L7 47c-8.5 8.5-9.4 22-2.1 31.6l80 104c4.5 5.9 11.6 9.4 19 9.4h54.1l109 109c-14.7 29-10 65.4 14.3 89.6l112 112c12.5 12.5 32.8 12.5 45.3 0l64-64c12.5-12.5 12.5-32.8 0-45.3l-112-112c-24.2-24.2-60.6-29-89.6-14.3l-109-109V104c0-7.5-3.5-14.5-9.4-19L78.6 5zM19.9 396.1C7.2 408.8 0 426.1 0 444.1C0 481.6 30.4 512 67.9 512c18 0 35.3-7.2 48-19.9L233.7 374.3c-7.8-20.9-9-43.6-3.6-65.1l-61.7-61.7L19.9 396.1zM512 144c0-10.5-1.1-20.7-3.2-30.5c-2.4-11.2-16.1-14.1-24.2-6l-63.9 63.9c-3 3-7.1 4.7-11.3 4.7H352c-8.8 0-16-7.2-16-16V102.6c0-4.2 1.7-8.3 4.7-11.3l63.9-63.9c8.1-8.1 5.2-21.8-6-24.2C388.7 1.1 378.5 0 368 0C288.5 0 224 64.5 224 144l0 .8 85.3 85.3c36-9.1 75.8 .5 104 28.7L429 274.5c49-23 83-72.8 83-130.5zM56 432a24 24 0 1 1 48 0 24 24 0 1 1 -48 0z"/></svg><strong>Site en migration</strong>
|
|
@@ -1815,6 +1818,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
|
|
</section>
|
|
|
|
<section id="realisations" class="spa-section">
|
|
+<!-- GARDE (consigne de Théo) : ne rien ajouter ici (pas de news, widget ni bloc) sans son accord explicite. Contenu audiovisuel d'origine uniquement. -->
|
|
<header class="main-banner"><h1>Réalisations</h1></header>
|
|
<nav class="gallery-nav" id="gallery-nav">
|
|
<button class="filter-btn active" data-filter="all">Toute la collection</button>
|
|
@@ -1974,6 +1978,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
|
|
</section>
|
|
|
|
<section id="apropos" class="spa-section">
|
|
+<!-- GARDE (consigne de Théo) : ne rien ajouter ici (pas de news, widget ni bloc) sans son accord explicite. Contenu audiovisuel d'origine uniquement. -->
|
|
<div class="hero"><div class="hero-bg"></div><h1 class="hero-title">L'envers du Décor</h1></div>
|
|
<div class="main-container">
|
|
|
|
@@ -2880,6 +2885,7 @@ body.spa-nav-hidden .spa-nav { display:none; }
|
|
<div class="footer-bottom">© 2026 THÉO - SOLUTIONS VISUELLES & ACQUISITION OPTIQUE | <a href="#legal-cgv" data-spa="termes" style="color:white;">Termes et conditions du site</a> | <a href="#legal-rgpd" data-spa="termes" style="color:white;">Confidentialité (RGPD)</a> | <a href="#legal-mentions" data-spa="termes" style="color:white;">Mentions légales</a></div>
|
|
</footer>
|
|
<script>
|
|
+// GARDE (consigne de Théo) : ne rien ajouter pour accueil/portfolio/realisations/apropos (pas de news ni widget) sans son accord explicite.
|
|
(function(){
|
|
'use strict';
|
|
var reduceMotion=!!(window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches);
|
|
diff --git a/news/actus.js b/news/actus.js
|
|
new file mode 100644
|
|
index 0000000..2bf7335
|
|
--- /dev/null
|
|
+++ b/news/actus.js
|
|
@@ -0,0 +1,209 @@
|
|
+/* news/actus.js — widget News autonome (sans bibliothèque).
|
|
+ * Deux usages :
|
|
+ * <aside data-actus-widget hidden></aside> -> les 3 dernières news (accueil)
|
|
+ * <div data-actus-list></div> -> liste complète avec filtre (page /news/)
|
|
+ * Les données viennent de /data/actus.json (attribut data-src pour changer).
|
|
+ * Si le fichier manque ou est invalide : le widget reste caché, la page ne casse pas.
|
|
+ */
|
|
+(function () {
|
|
+ 'use strict';
|
|
+ var CATS = { audiovisuel: 'Audiovisuel', technique: 'Technique', application: 'Application', site: 'Site' };
|
|
+ var DEFAULT_SRC = '/data/actus.json';
|
|
+ var NEWS_URL = '/news/';
|
|
+
|
|
+ var CSS = '' +
|
|
+ '.actus-widget{background:#fafafa;border-top:1px solid #eaeaea;padding:48px 20px 72px;font-family:var(--font-sans,Inter,system-ui,sans-serif);color:#111}' +
|
|
+ '.actus-widget[hidden]{display:none}' +
|
|
+ '.actus-wrap{max-width:1120px;margin:0 auto}' +
|
|
+ '.actus-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:8px 16px;margin-bottom:22px}' +
|
|
+ '.actus-title{font-size:1.6rem;font-weight:700;letter-spacing:-.02em;margin:0;color:#111}' +
|
|
+ '.actus-all{font-weight:600;font-size:.95rem;color:#111;text-decoration:underline;text-underline-offset:3px;padding:8px 0}' +
|
|
+ '.actus-all:hover{color:#1e4d8b}' +
|
|
+ '.actus-all:focus-visible{outline:3px solid #1e4d8b;outline-offset:3px}' +
|
|
+ '.actus-list{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(3,1fr);gap:22px}' +
|
|
+ '.actus-list.actus-full{grid-template-columns:repeat(auto-fill,minmax(280px,1fr))}' +
|
|
+ '@media(max-width:900px){.actus-list{grid-template-columns:1fr}.actus-widget{padding:36px 16px 72px}}' +
|
|
+ '.actus-card{position:relative;display:flex;flex-direction:column;background:#fff;border:1px solid #d9d9d9;border-radius:8px;padding:22px 20px;height:100%;box-sizing:border-box}' +
|
|
+ '.actus-card:hover{border-color:#111;box-shadow:0 8px 22px rgba(0,0,0,.08)}' +
|
|
+ '.actus-card:focus-within{outline:3px solid #1e4d8b;outline-offset:2px}' +
|
|
+ '.actus-img{width:100%;aspect-ratio:16/9;object-fit:cover;border-radius:6px;margin:0 0 14px;background:#eee;display:block}' +
|
|
+ '.actus-meta{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;margin-bottom:10px;font-size:.82rem}' +
|
|
+ '.actus-cat{background:#eceef1;color:#1a1d21;font-weight:700;padding:3px 10px;border-radius:4px;text-transform:uppercase;letter-spacing:.03em;font-size:.74rem}' +
|
|
+ '.actus-date{color:#4b5563}' +
|
|
+ '.actus-card-title{font-size:1.05rem;line-height:1.35;font-weight:700;margin:0 0 8px;color:#111}' +
|
|
+ '.actus-card-title a{color:inherit;text-decoration:none}' +
|
|
+ '.actus-card-title a::after{content:"";position:absolute;inset:0;border-radius:8px}' +
|
|
+ '.actus-card-title a:hover{text-decoration:underline}' +
|
|
+ '.actus-card-title a:focus-visible{outline:none}' +
|
|
+ '.actus-sum{margin:0;color:#3f4650;font-size:.92rem;line-height:1.55}' +
|
|
+ '.actus-filters{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 18px;padding:0;border:0;min-width:0}' +
|
|
+ '.actus-filter{font:inherit;font-size:.9rem;font-weight:600;padding:9px 16px;min-height:44px;border-radius:999px;border:2px solid #242424;background:#fff;color:#242424;cursor:pointer}' +
|
|
+ '.actus-filter:hover{background:#eceef1}' +
|
|
+ '.actus-filter[aria-pressed="true"]{background:#242424;color:#fff}' +
|
|
+ '.actus-filter:focus-visible{outline:3px solid #1e4d8b;outline-offset:3px}' +
|
|
+ '.actus-status{margin:0 0 16px;color:#4b5563;font-size:.92rem}';
|
|
+
|
|
+ function injectCss() {
|
|
+ if (document.getElementById('actus-css')) return;
|
|
+ var s = document.createElement('style');
|
|
+ s.id = 'actus-css';
|
|
+ s.textContent = CSS;
|
|
+ document.head.appendChild(s);
|
|
+ }
|
|
+
|
|
+ function el(tag, cls, text) {
|
|
+ var e = document.createElement(tag);
|
|
+ if (cls) e.className = cls;
|
|
+ if (text != null) e.textContent = text;
|
|
+ return e;
|
|
+ }
|
|
+
|
|
+ /* Seuls les liens relatifs (/...) et https sont acceptés. */
|
|
+ function safeUrl(u) {
|
|
+ if (typeof u !== 'string') return '';
|
|
+ return (/^\/(?!\/)/.test(u) || /^https:\/\//i.test(u)) ? u : '';
|
|
+ }
|
|
+
|
|
+ /* Garde seulement les entrées au bon format, triées de la plus récente à la plus ancienne. */
|
|
+ function clean(raw) {
|
|
+ if (!Array.isArray(raw)) return [];
|
|
+ var out = [];
|
|
+ raw.forEach(function (n) {
|
|
+ if (!n || typeof n !== 'object') return;
|
|
+ if (typeof n.title !== 'string' || !n.title.trim()) return;
|
|
+ if (typeof n.summary !== 'string') return;
|
|
+ if (typeof n.date !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(n.date)) return;
|
|
+ if (!Object.prototype.hasOwnProperty.call(CATS, n.category)) return;
|
|
+ out.push({
|
|
+ id: n.id, date: n.date, category: n.category, title: n.title, summary: n.summary,
|
|
+ link: safeUrl(n.link), image: safeUrl(n.image), imageAlt: typeof n.imageAlt === 'string' ? n.imageAlt : ''
|
|
+ });
|
|
+ });
|
|
+ out.sort(function (a, b) {
|
|
+ if (a.date !== b.date) return a.date < b.date ? 1 : -1;
|
|
+ return (Number(b.id) || 0) - (Number(a.id) || 0);
|
|
+ });
|
|
+ return out;
|
|
+ }
|
|
+
|
|
+ function fmtDate(iso) {
|
|
+ try {
|
|
+ return new Date(iso + 'T12:00:00').toLocaleDateString('fr-FR', { day: 'numeric', month: 'long', year: 'numeric' });
|
|
+ } catch (e) { return iso; }
|
|
+ }
|
|
+
|
|
+ function card(n, withImage) {
|
|
+ var li = el('li');
|
|
+ var art = el('article', 'actus-card');
|
|
+ if (withImage && n.image) {
|
|
+ var img = el('img', 'actus-img');
|
|
+ img.src = n.image; img.alt = n.imageAlt; img.loading = 'lazy'; img.decoding = 'async';
|
|
+ img.onerror = function () { img.remove(); };
|
|
+ art.appendChild(img);
|
|
+ }
|
|
+ var meta = el('div', 'actus-meta');
|
|
+ meta.appendChild(el('span', 'actus-cat', CATS[n.category]));
|
|
+ var t = el('time', 'actus-date', fmtDate(n.date));
|
|
+ t.setAttribute('datetime', n.date);
|
|
+ meta.appendChild(t);
|
|
+ art.appendChild(meta);
|
|
+ var h = el('h3', 'actus-card-title');
|
|
+ if (n.link) {
|
|
+ var a = el('a', null, n.title);
|
|
+ a.href = n.link;
|
|
+ if (/^https:/i.test(n.link)) a.rel = 'noopener';
|
|
+ h.appendChild(a);
|
|
+ } else {
|
|
+ h.textContent = n.title;
|
|
+ }
|
|
+ art.appendChild(h);
|
|
+ art.appendChild(el('p', 'actus-sum', n.summary));
|
|
+ li.appendChild(art);
|
|
+ return li;
|
|
+ }
|
|
+
|
|
+ function load(src) {
|
|
+ return fetch(src, { credentials: 'same-origin' })
|
|
+ .then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.json(); })
|
|
+ .then(clean);
|
|
+ }
|
|
+
|
|
+ function initWidget(root) {
|
|
+ injectCss();
|
|
+ load(root.getAttribute('data-src') || DEFAULT_SRC).then(function (items) {
|
|
+ if (!items.length) return; /* rien à montrer : reste caché */
|
|
+ root.className = 'actus-widget';
|
|
+ root.setAttribute('aria-labelledby', 'actus-widget-title');
|
|
+ var wrap = el('div', 'actus-wrap');
|
|
+ var head = el('div', 'actus-head');
|
|
+ var h = el('h2', 'actus-title', 'Dernières news');
|
|
+ h.id = 'actus-widget-title';
|
|
+ head.appendChild(h);
|
|
+ var all = el('a', 'actus-all', 'Toutes les news');
|
|
+ all.href = NEWS_URL;
|
|
+ head.appendChild(all);
|
|
+ wrap.appendChild(head);
|
|
+ var ul = el('ul', 'actus-list');
|
|
+ items.slice(0, 3).forEach(function (n) { ul.appendChild(card(n, false)); });
|
|
+ wrap.appendChild(ul);
|
|
+ root.appendChild(wrap);
|
|
+ root.hidden = false;
|
|
+ }).catch(function () { /* fichier absent ou invalide : le widget reste caché */ });
|
|
+ }
|
|
+
|
|
+ function initList(root) {
|
|
+ injectCss();
|
|
+ root.classList.add('actus-wrap');
|
|
+ var status = el('p', 'actus-status');
|
|
+ status.setAttribute('role', 'status');
|
|
+ status.setAttribute('aria-live', 'polite');
|
|
+ status.textContent = 'Chargement des news…';
|
|
+ root.appendChild(status);
|
|
+
|
|
+ load(root.getAttribute('data-src') || DEFAULT_SRC).then(function (items) {
|
|
+ if (!items.length) { status.textContent = 'Il n’y a pas encore de news.'; return; }
|
|
+ var fs = el('fieldset', 'actus-filters');
|
|
+ var lg = el('legend', null, 'Filtrer par catégorie');
|
|
+ lg.style.cssText = 'position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap';
|
|
+ fs.appendChild(lg);
|
|
+ var ul = el('ul', 'actus-list actus-full');
|
|
+ var buttons = {};
|
|
+ var current = 'all';
|
|
+
|
|
+ function render() {
|
|
+ ul.textContent = '';
|
|
+ var shown = items.filter(function (n) { return current === 'all' || n.category === current; });
|
|
+ shown.forEach(function (n) { ul.appendChild(card(n, true)); });
|
|
+ status.textContent = shown.length === 0 ? 'Aucune news dans cette catégorie.'
|
|
+ : shown.length + (shown.length > 1 ? ' news affichées' : ' news affichée') +
|
|
+ (current === 'all' ? '.' : ' dans la catégorie « ' + CATS[current] + ' ».');
|
|
+ Object.keys(buttons).forEach(function (k) { buttons[k].setAttribute('aria-pressed', String(k === current)); });
|
|
+ }
|
|
+ function setCat(c, push) {
|
|
+ current = c;
|
|
+ render();
|
|
+ if (push) { try { history.replaceState(null, '', c === 'all' ? location.pathname : '#' + c); } catch (e) {} }
|
|
+ }
|
|
+
|
|
+ ['all'].concat(Object.keys(CATS)).forEach(function (k) {
|
|
+ var b = el('button', 'actus-filter', k === 'all' ? 'Toutes' : CATS[k]);
|
|
+ b.type = 'button';
|
|
+ b.addEventListener('click', function () { setCat(k, true); });
|
|
+ buttons[k] = b;
|
|
+ fs.appendChild(b);
|
|
+ });
|
|
+ root.insertBefore(fs, status);
|
|
+ root.appendChild(ul);
|
|
+ var hash = (location.hash || '').replace('#', '');
|
|
+ setCat(Object.prototype.hasOwnProperty.call(CATS, hash) ? hash : 'all', false);
|
|
+ }).catch(function () {
|
|
+ status.textContent = 'Les news ne sont pas disponibles pour le moment. Reviens un peu plus tard.';
|
|
+ });
|
|
+ }
|
|
+
|
|
+ function start() {
|
|
+ Array.prototype.forEach.call(document.querySelectorAll('[data-actus-widget]'), initWidget);
|
|
+ Array.prototype.forEach.call(document.querySelectorAll('[data-actus-list]'), initList);
|
|
+ }
|
|
+ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
|
|
+})();
|
|
diff --git a/news/index.html b/news/index.html
|
|
new file mode 100644
|
|
index 0000000..e8f7fa1
|
|
--- /dev/null
|
|
+++ b/news/index.html
|
|
@@ -0,0 +1,56 @@
|
|
+<!DOCTYPE html>
|
|
+<html lang="fr">
|
|
+<head>
|
|
+<meta charset="UTF-8">
|
|
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
+<title>News — Théo Gastinel : vidéos, projets et applications</title>
|
|
+<meta name="description" content="Toutes les news de Théo Gastinel : nouvelles vidéos et photos, projets techniques, sorties d'applications et mises à jour du site.">
|
|
+<link rel="canonical" href="https://gastinel.me/news/">
|
|
+<!-- BROUILLON : retirer la ligne noindex quand les vraies news remplacent les [EXEMPLE] -->
|
|
+<meta name="robots" content="noindex, follow">
|
|
+<meta name="author" content="Théo Gastinel">
|
|
+<meta property="og:type" content="website">
|
|
+<meta property="og:locale" content="fr_FR">
|
|
+<meta property="og:url" content="https://gastinel.me/news/">
|
|
+<meta property="og:site_name" content="Théo Gastinel">
|
|
+<meta property="og:title" content="News — Théo Gastinel : vidéos, projets et applications">
|
|
+<meta property="og:description" content="Toutes les news de Théo Gastinel : nouvelles vidéos et photos, projets techniques, sorties d'applications et mises à jour du site.">
|
|
+<meta property="og:image" content="https://gastinel.me/assets/img/dji-fly-20250919-194610-0004-1758304172909-photo.webp">
|
|
+<meta property="og:image:alt" content="Ciel orangé au crépuscule sur le plateau du Vercors, vu du drone">
|
|
+<meta name="twitter:card" content="summary_large_image">
|
|
+<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
|
+<link rel="icon" href="/favicon.ico" sizes="any">
|
|
+<script type="application/ld+json">
|
|
+{"@context":"https://schema.org","@graph":[
|
|
+{"@type":"CollectionPage","@id":"https://gastinel.me/news/#page","url":"https://gastinel.me/news/","name":"News","inLanguage":"fr-FR","isPartOf":{"@id":"https://gastinel.me/#website"}},
|
|
+{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https://gastinel.me/"},{"@type":"ListItem","position":2,"name":"News","item":"https://gastinel.me/news/"}]}
|
|
+]}
|
|
+</script>
|
|
+<style>
|
|
+@font-face{font-family:Inter;font-weight:400 700;font-display:swap;src:url(/assets/fonts/inter-latin.woff2) format("woff2")}
|
|
+:root{--bg:#fff;--tx:#1a1d21;--mu:#4b5563;--ac:#1e4d8b;--ln:#e5e7eb;--font-sans:Inter,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif}
|
|
+*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--tx);font:18px/1.7 var(--font-sans)}
|
|
+nav{display:flex;gap:6px;flex-wrap:wrap;padding:12px 18px;border-bottom:1px solid var(--ln)}
|
|
+nav a{color:var(--tx);text-decoration:none;padding:8px 12px;border-radius:6px;font-weight:500}
|
|
+nav a[aria-current]{background:var(--ln)}nav a:hover{text-decoration:underline}
|
|
+nav a:focus-visible{outline:3px solid var(--ac);outline-offset:2px}
|
|
+main{max-width:1120px;margin:0 auto;padding:28px 18px 56px}
|
|
+h1{font-size:1.9rem;line-height:1.25;margin:.2em 0 .4em}
|
|
+a{color:var(--ac)}.lead{font-size:1.1rem;color:var(--mu);max-width:42rem;margin:0 0 1.2em}
|
|
+.note{background:#fff4d6;border-left:4px solid #e0b100;padding:12px 16px;border-radius:4px;margin:0 0 1.5em;max-width:42rem;font-size:.95rem}
|
|
+footer{border-top:1px solid var(--ln);padding:20px 18px;text-align:center;color:var(--mu);font-size:.9rem}
|
|
+</style>
|
|
+</head>
|
|
+<body>
|
|
+<nav aria-label="Menu principal"><a href="/">Accueil</a><a href="/meteo-lans/">Météo à Lans</a><a href="/stations-romma/">Stations</a><a href="/qui-suis-je/">Qui suis-je</a><a href="/projets/">Projets</a><a href="/news/" aria-current="page">News</a></nav>
|
|
+<main>
|
|
+<h1>News</h1>
|
|
+<p class="lead">Ici, tu trouves les dernières nouveautés : vidéos et photos, projets techniques, sorties d'applications et mises à jour du site.</p>
|
|
+<div class="note"><strong>Brouillon.</strong> Les news affichées sont des exemples ([EXEMPLE]). Elles seront remplacées par de vraies news avant la mise en ligne.</div>
|
|
+<div data-actus-list></div>
|
|
+<noscript><p>Cette page a besoin de JavaScript pour afficher les news.</p></noscript>
|
|
+</main>
|
|
+<footer><a href="/#legal-mentions">Mentions légales</a> · <a href="/#legal-rgpd">Données personnelles</a> · Théo Gastinel, Lans-en-Vercors</footer>
|
|
+<script src="/news/actus.js" defer></script>
|
|
+</body>
|
|
+</html>
|
|
diff --git a/tools/add-news.js b/tools/add-news.js
|
|
new file mode 100644
|
|
index 0000000..3772b33
|
|
--- /dev/null
|
|
+++ b/tools/add-news.js
|
|
@@ -0,0 +1,100 @@
|
|
+#!/usr/bin/env node
|
|
+/**
|
|
+ * tools/add-news.js — ajoute une entrée à data/actus.json, après validation.
|
|
+ *
|
|
+ * Exemple :
|
|
+ * node tools/add-news.js --category technique --title "Nouvelle version de GWS" \
|
|
+ * --summary "Le logiciel gère maintenant les exports PDF." --link /gws/ [--date 2026-11-02] \
|
|
+ * [--image /assets/img/photo.webp --image-alt "Description de l'image"] [--dry-run]
|
|
+ *
|
|
+ * Catégories : audiovisuel, technique, application, site.
|
|
+ * Zéro dépendance. N'écrit rien si une règle n'est pas respectée.
|
|
+ */
|
|
+'use strict';
|
|
+const fs = require('fs');
|
|
+const path = require('path');
|
|
+
|
|
+const FILE = path.resolve(__dirname, '..', 'data', 'actus.json');
|
|
+const CATS = ['audiovisuel', 'technique', 'application', 'site'];
|
|
+const LIMITS = { title: 120, summary: 280 };
|
|
+
|
|
+function parseArgs(argv) {
|
|
+ const out = {};
|
|
+ for (let i = 0; i < argv.length; i++) {
|
|
+ const a = argv[i];
|
|
+ if (!a.startsWith('--')) throw new Error(`Argument inattendu : ${a}`);
|
|
+ const key = a.slice(2);
|
|
+ if (key === 'dry-run' || key === 'help') { out[key] = true; continue; }
|
|
+ const v = argv[++i];
|
|
+ if (v === undefined || v.startsWith('--')) throw new Error(`Valeur manquante pour --${key}`);
|
|
+ out[key] = v;
|
|
+ }
|
|
+ return out;
|
|
+}
|
|
+
|
|
+function todayLocal() {
|
|
+ const d = new Date();
|
|
+ const p = (n) => String(n).padStart(2, '0');
|
|
+ return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}`;
|
|
+}
|
|
+
|
|
+function validDate(s) {
|
|
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(s)) return false;
|
|
+ const d = new Date(s + 'T12:00:00Z');
|
|
+ return !isNaN(d) && d.toISOString().slice(0, 10) === s;
|
|
+}
|
|
+
|
|
+function validUrl(u) { return /^\/(?!\/)\S*$/.test(u) || /^https:\/\/\S+$/i.test(u); }
|
|
+
|
|
+function main() {
|
|
+ const a = parseArgs(process.argv.slice(2));
|
|
+ if (a.help) {
|
|
+ console.log('Usage : node tools/add-news.js --category <audiovisuel|technique|application|site> --title "..." --summary "..." [--link URL] [--image URL --image-alt "..."] [--date AAAA-MM-JJ] [--dry-run]');
|
|
+ return;
|
|
+ }
|
|
+ const errors = [];
|
|
+ const category = a.category;
|
|
+ const title = (a.title || '').trim();
|
|
+ const summary = (a.summary || '').trim();
|
|
+ const date = a.date || todayLocal();
|
|
+
|
|
+ if (!CATS.includes(category)) errors.push(`--category doit être : ${CATS.join(', ')}`);
|
|
+ if (!title) errors.push('--title est obligatoire');
|
|
+ else if (title.length > LIMITS.title) errors.push(`--title : ${LIMITS.title} caractères maximum (${title.length})`);
|
|
+ if (!summary) errors.push('--summary est obligatoire');
|
|
+ else if (summary.length > LIMITS.summary) errors.push(`--summary : ${LIMITS.summary} caractères maximum (${summary.length})`);
|
|
+ if (!validDate(date)) errors.push('--date doit être une vraie date au format AAAA-MM-JJ');
|
|
+ if (a.link && !validUrl(a.link)) errors.push('--link doit commencer par / (page du site) ou https://');
|
|
+ if (a.image && !validUrl(a.image)) errors.push('--image doit commencer par / ou https://');
|
|
+ if (a.image && !a['image-alt']) errors.push('--image-alt est obligatoire quand il y a une image (accessibilité)');
|
|
+ if (errors.length) { console.error('Entrée refusée :\n- ' + errors.join('\n- ')); process.exit(1); }
|
|
+
|
|
+ let list = [];
|
|
+ if (fs.existsSync(FILE)) {
|
|
+ try { list = JSON.parse(fs.readFileSync(FILE, 'utf8')); }
|
|
+ catch (e) { console.error(`${FILE} n'est pas un JSON valide : ${e.message}`); process.exit(1); }
|
|
+ if (!Array.isArray(list)) { console.error('actus.json doit contenir un tableau.'); process.exit(1); }
|
|
+ }
|
|
+ if (list.some((n) => n && n.title === title && n.date === date)) {
|
|
+ console.error('Une news avec le même titre et la même date existe déjà : rien écrit.');
|
|
+ process.exit(1);
|
|
+ }
|
|
+
|
|
+ const id = list.reduce((m, n) => Math.max(m, Number(n && n.id) || 0), 0) + 1;
|
|
+ const entry = { id, date, category, title, summary };
|
|
+ if (a.link) entry.link = a.link;
|
|
+ if (a.image) { entry.image = a.image; entry.imageAlt = a['image-alt']; }
|
|
+
|
|
+ list.unshift(entry);
|
|
+ list.sort((x, y) => (x.date === y.date ? y.id - x.id : x.date < y.date ? 1 : -1));
|
|
+ const text = JSON.stringify(list, null, 2) + '\n';
|
|
+ JSON.parse(text); // contrôle final
|
|
+
|
|
+ if (a['dry-run']) { console.log('[essai] rien écrit. Entrée :\n' + JSON.stringify(entry, null, 2)); return; }
|
|
+ fs.copyFileSync(FILE, FILE + '.bak');
|
|
+ fs.writeFileSync(FILE, text, 'utf8');
|
|
+ console.log(`News n°${id} ajoutée (${date}, ${category}). Sauvegarde : data/actus.json.bak`);
|
|
+ console.log('Suite : node tools/build.js puis node tools/deploy.js (lancés par toi).');
|
|
+}
|
|
+
|
|
+try { main(); } catch (e) { console.error(e.message); process.exit(1); }
|
|
diff --git a/tools/build.js b/tools/build.js
|
|
index adea648..2e07478 100644
|
|
--- a/tools/build.js
|
|
+++ b/tools/build.js
|
|
@@ -39,10 +39,12 @@ const DIST = path.join(ROOT, 'dist');
|
|
const BUILD_DIR = 'assets/build';
|
|
// Sections retirées du HTML initial (lourdes, peu utiles au référencement).
|
|
const FRAGMENTS = ['termes'];
|
|
-const COPY_AS_IS =['llms.txt', 'robots.txt', 'sitemap.xml', 'data/news.json',
|
|
+const COPY_AS_IS =['llms.txt', 'robots.txt', 'sitemap.xml', 'data/news.json', 'data/actus.json',
|
|
'favicon.svg', 'favicon.ico',
|
|
// Pages de contenu (SEO) : brouillons noindex tant que les [À VÉRIFIER] ne sont pas levés.
|
|
'meteo-lans/index.html', 'stations-romma/index.html', 'qui-suis-je/index.html', 'projets/index.html',
|
|
+ // Section News : page de liste + script du widget (brouillon noindex tant qu'il y a des [EXEMPLE]).
|
|
+ 'news/index.html', 'news/actus.js',
|
|
// Traductions informatives (hreflang) : copiées telles quelles, chemins d'assets absolus.
|
|
'en/index.html', 'de/index.html', 'it/index.html', 'es/index.html'];
|
|
const COMPRESSIBLE = new Set(['.html', '.css', '.js', '.json', '.txt', '.xml', '.svg']);
|