Fix biome lint errors: remove duplicate CSS properties, apply safe auto-fixes

CSS:
- Remove duplicate 'background' fallbacks in base.css, header.css, search.css
  (solid color declared before gradient — gradient always wins)
- Remove duplicate 'padding' in admin.css .admin-import-log

JS (biome --write safe fixes applied):
- function() → arrow functions in all IIFEs and callbacks
- forEach/callback → arrow functions
- evaluePtrn → parseInt(x, 10) in admin-contacts-form.js
- Cleaned label text in build.mjs lint step

Remaining warnings are intentional: !important overrides, descending
specificity (admin.css cascade), noUnusedVariables (functions exported
to window/onclick), useTemplate style preference.
This commit is contained in:
Pontoporeia
2026-06-24 13:21:04 +02:00
parent 82d3dcb084
commit 6ecd3d4540
31 changed files with 336 additions and 348 deletions

View File

@@ -1198,7 +1198,6 @@ th.admin-ap-col {
.admin-import-log {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: var(--space-3xs);
@@ -2158,18 +2157,23 @@ th.admin-ap-col {
100% { transform: scaleX(0); transform-origin: right; }
}
/* ── Sidebar TOC ───────────────────────────────────────────────────────────── */
/* ── Sidebar TOC (matches public .page-content alignment pattern) ────────── */
.admin-main--toc {
display: flex;
gap: var(--space-xs);
align-items: flex-start;
gap: var(--space-2xl);
align-items: start;
padding: var(--space-xl) var(--space-m) var(--space-2xl);
}
.admin-main--toc > article {
flex: 1;
min-width: 0;
padding-top: var(--space-m);
}
/* Align first child of article with TOC heading (same as public) */
.admin-main--toc > article > :first-child {
margin-top: 2.2rem;
}
.admin-main--toc > article > section {
@@ -2180,41 +2184,14 @@ th.admin-ap-col {
margin-bottom: var(--space-m);
}
.admin-toc {
position: sticky;
top: var(--space-xs);
width: 160px;
/* Admin TOC: same <details class="toc"> as public pages, positioned sticky */
#admin-toc {
width: 180px;
flex-shrink: 0;
padding-top: var(--space-m);
}
.admin-toc-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.admin-toc-list a {
display: block;
padding: var(--space-3xs) var(--space-2xs);
font-size: var(--step--2);
color: var(--text-secondary);
text-decoration: none;
border-left: 2px solid transparent;
transition: color 0.15s, border-color 0.15s;
}
.admin-toc-list a:hover {
color: var(--text-primary);
}
.admin-toc-list a.admin-toc-active {
color: var(--text-primary);
font-weight: 600;
border-left-color: var(--accent, var(--color-primary));
#admin-toc .toc-list a {
font-size: var(--step--1);
}
/* ── Lazy-load transition ─────────────────────────────────────────────────── */

View File

@@ -39,7 +39,6 @@ html, body {
body {
font-family: var(--font-body);
font-weight: 300;
background: var(--bg-primary);
color: var(--text-primary);
background: linear-gradient(
180deg,

View File

@@ -8,7 +8,6 @@
header {
vertical-align: center;
flex-shrink: 0;
background: #c05de1;
background: linear-gradient(
0deg,
rgba(192, 93, 225, 1) 0%,

View File

@@ -21,7 +21,6 @@ form[role="search"]:not(.header-search-form) {
.header-search-wrap {
padding: 0;
flex-shrink: 0;
background: #C05DE1;
background: linear-gradient(180deg, rgba(192, 93, 225, 1) 0%, rgba(255, 255, 255, 1) 100%);
}

View File

@@ -0,0 +1,141 @@
/* ============================================================
SHARED TOC — sidebar table-of-contents for admin + public pages.
Both use <details class="toc"> markup.
Public: server-rendered links (about, charte, licence)
Admin: JS-populated links (contenus, accès, paramètres — admin-toc.js)
============================================================ */
/* ── Shared list styles (.toc-list) ─────────────────────────────────────── */
.toc-list,
.toc ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: var(--space-3xs);
}
.toc-list a,
.toc ul a {
display: block;
font-family: var(--font-body);
font-size: var(--step-0);
font-weight: 300;
color: var(--text-primary);
text-decoration: none;
padding: var(--space-3xs) 0;
transition: color 0.15s;
}
.toc-list a:hover {
color: var(--accent-primary);
}
.toc-list a.toc-active,
.toc ul a.toc-active {
color: var(--accent-primary);
font-weight: 400;
}
/* ── Public TOC (details/summary block) ─────────────────────────────────── */
.toc {
border: none;
border-radius: 0;
background: transparent;
overflow: visible;
}
.toc[open] {
padding-bottom: 0;
}
.toc > :not(summary) {
padding-left: 0;
padding-right: 0;
}
.toc summary {
font-family: var(--font-display);
font-size: var(--step-1);
font-weight: 400;
color: var(--text-primary);
padding: 0 0 var(--space-2xs) 0;
border-bottom: 1px solid var(--text-primary);
display: flex;
align-items: center;
gap: var(--space-2xs);
background: transparent;
cursor: pointer;
list-style: none;
}
.toc summary::-webkit-details-marker {
display: none;
}
.toc summary:hover {
color: inherit;
background: transparent;
}
/* Caret icon inside summary — visible only on mobile */
.toc-caret {
flex-shrink: 0;
transition: transform 0.2s ease;
}
.toc[open] > summary .toc-caret {
transform: rotate(180deg);
}
/* Sidebar links (about page — custom links below TOC) */
.toc-sidebar-link:first-of-type {
padding-top: var(--space-s);
border-top: 1px solid var(--border-primary);
}
.toc-sidebar-link + .toc-sidebar-link {
padding-top: var(--space-xs);
}
.toc-sidebar-link a {
font-size: var(--step--2);
color: var(--accent-primary);
text-decoration: none;
transition: opacity 0.15s;
}
.toc-sidebar-link a:hover {
opacity: 0.8;
}
/* ── Desktop: sticky sidebar ───────────────────────────────────────────── */
@media (min-width: 768px) {
.toc {
position: sticky;
top: var(--space-l);
grid-column: 1;
}
.toc summary {
pointer-events: none;
}
.toc-caret {
display: none;
}
}
/* ── Mobile: collapsible TOC ────────────────────────────────────────────── */
@media (max-width: 767px) {
.toc {
position: static;
grid-column: 1;
}
.toc summary {
cursor: pointer;
list-style: revert;
}
}

View File

@@ -21,142 +21,17 @@
align-items: start;
}
/* ------------------------------------------------------------------ */
/* Table of contents — details/summary block */
/* ------------------------------------------------------------------ */
.toc {
border: none;
border-radius: 0;
background: transparent;
overflow: visible;
}
.toc[open] {
padding-bottom: 0;
}
.toc > :not(summary) {
padding-left: 0;
padding-right: 0;
}
.toc summary {
font-family: var(--font-display);
font-size: var(--step-1);
font-weight: 400;
color: var(--text-primary);
padding: 0 0 var(--space-2xs) 0;
border-bottom: 1px solid var(--text-primary);
display: flex;
align-items: center;
gap: var(--space-2xs);
background: transparent;
cursor: pointer;
list-style: none;
}
.toc summary::-webkit-details-marker {
display: none;
}
.toc summary:hover {
color: inherit;
background: transparent;
}
/* Caret icon inside summary — visible only on mobile */
.toc-caret {
flex-shrink: 0;
transition: transform 0.2s ease;
}
.toc[open] > summary .toc-caret {
transform: rotate(180deg);
}
.toc ul {
list-style: none;
margin: var(--space-xs) 0 0 0;
padding: 0;
display: flex;
flex-direction: column;
gap: var(--space-3xs);
}
.toc ul a {
font-family: var(--font-body);
font-size: var(--step-0);
font-weight: 300;
color: var(--text-primary);
text-decoration: none;
display: block;
padding: var(--space-3xs) 0;
transition: color 0.15s;
}
.toc ul a:hover {
color: var(--accent-primary);
}
/* Sidebar links (about page) */
.toc-sidebar-link:first-of-type {
padding-top: var(--space-s);
border-top: 1px solid var(--border-primary);
}
.toc-sidebar-link + .toc-sidebar-link {
padding-top: var(--space-xs);
}
.toc-sidebar-link a {
font-size: var(--step--2);
color: var(--accent-primary);
text-decoration: none;
transition: opacity 0.15s;
}
.toc-sidebar-link a:hover {
color: var(--accent-primary);
opacity: 1;
}
/* ------------------------------------------------------------------ */
/* Desktop: force-open TOC, hide caret, sticky sidebar */
/* ------------------------------------------------------------------ */
/* ── TOC styles → components/toc.css (shared with admin) ───────────────── */
/* Grid column positioning for content pages with sidebar TOC */
@media (min-width: 768px) {
.toc {
position: sticky;
top: var(--space-l);
grid-column: 1;
}
.toc summary {
pointer-events: none;
list-style: none;
}
.toc summary::-webkit-details-marker {
display: none;
}
.toc-caret {
display: none;
}
.page-content > .content,
.page-content > .content-section {
.page-content > article {
grid-column: 2;
min-width: 0;
max-width: 100%;
}
}
/* ------------------------------------------------------------------ */
/* Mobile: collapsible TOC */
/* ------------------------------------------------------------------ */
@media (max-width: 767px) {
.page-content {
grid-template-columns: 1fr;
@@ -164,30 +39,25 @@
padding: var(--space-m) var(--space-s) var(--space-xl);
}
.page-content > article {
grid-column: 1;
}
.toc {
margin-top: var(--space-s);
position: static;
grid-column: 1;
}
}
.page-content > .content,
.page-content > .content-section {
grid-column: 1;
}
.toc summary {
cursor: pointer;
list-style: revert;
}
/* ── First content child aligns with TOC heading top ───────────────────── */
.page-content > article > :first-child {
margin-top: 2.2rem;
}
/* ------------------------------------------------------------------ */
/* Main content area */
/* Article content typography */
/* ------------------------------------------------------------------ */
/* Shared typography for about-page sections and charte/licence content */
.content,
.content-section {
.page-content > article {
display: block;
max-width: 100%;
font-family: var(--font-body);
@@ -195,77 +65,57 @@
line-height: 1.6;
color: var(--text-primary);
font-weight: 300;
padding-bottom: var(--space-xl);
}
.content *,
.content-section * {
.page-content > article * {
max-width: 100%;
overflow-wrap: anywhere;
word-break: break-word;
}
.content {
padding-bottom: var(--space-xl);
}
.content p,
.content-section p {
.page-content > article p {
margin: 0 0 1em 0;
}
.content p:last-child,
.content-section p:last-child {
.page-content > article p:last-child {
margin-bottom: 0;
}
.content :where(h1, h2, h3),
.content-section :where(h1, h2, h3) {
.page-content > article :where(h1, h2, h3) {
margin: 1.5em 0 0.5em 0;
}
.content :where(h1, h2, h3):first-child,
.content-section :where(h1, h2, h3):first-child {
margin-top: 2.2rem;
}
.content a,
.content-section a {
.page-content > article a {
color: inherit;
text-decoration: none;
font-weight: 700;
}
.content a:hover,
.content-section a:hover {
.page-content > article a:hover {
color: var(--accent-primary);
text-decoration: none;
}
.content ul,
.content ol,
.content-section ul,
.content-section ol {
.page-content > article ul,
.page-content > article ol {
padding-left: var(--space-m);
margin-bottom: var(--space-s);
}
.content li,
.content-section li {
.page-content > article li {
margin-bottom: 0.3em;
}
.content strong,
.content-section strong {
.page-content > article strong {
font-weight: 700;
}
.content em,
.content-section em {
.page-content > article em {
font-style: italic;
}
.content :where(pre, pre code, code),
.content-section :where(pre, pre code, code) {
.page-content > article :where(pre, pre code, code) {
display: block;
max-width: 100%;
overflow-x: auto;
@@ -288,19 +138,29 @@
max-width: 100%;
}
/* Section separators (about page only — .content-section adds dividers) */
.page-content > .content-section {
/* Section separators (about page only) */
.page-content > article > section {
padding-bottom: var(--space-xl);
border-bottom: 1px solid var(--border-primary);
margin-bottom: var(--space-xl);
}
.page-content > .content-section:last-child {
.page-content > article > section:last-child {
border-bottom: none;
margin-bottom: 0;
padding-bottom: var(--space-xl);
}
/* Scroll margin so anchor links account for the sticky header */
.page-content > article :where(h1, h2, h3) {
scroll-margin-top: var(--space-l);
}
/* Hide CommonMark heading permalink anchors */
.heading-permalink {
display: none;
}
/* ------------------------------------------------------------------ */
/* Section titles */
/* ------------------------------------------------------------------ */
@@ -314,17 +174,6 @@
line-height: 1.1;
}
/* Scroll margin so anchor links account for the sticky header */
.content :where(h1, h2, h3),
.content-section :where(h1, h2, h3) {
scroll-margin-top: var(--space-l);
}
/* Hide CommonMark heading permalink anchors (id now lives on the heading itself) */
.heading-permalink {
display: none;
}
/* ------------------------------------------------------------------ */
/* Contacts grid */
/* ------------------------------------------------------------------ */
@@ -431,7 +280,7 @@
padding: var(--space-m) var(--space-s) var(--space-xl);
}
.content-section {
.page-content > article {
font-size: var(--step-0);
}

View File

@@ -23,5 +23,6 @@
@import "components/pagination.css";
@import "components/header.css";
@import "components/search.css";
@import "components/toc.css";
@import "utilities.css";

View File

@@ -3,10 +3,10 @@
*
* Provides: dialog openers, clipboard copy, password dialog.
*/
(function () {
(() => {
var createBtn = document.getElementById('open-create-dialog');
if (createBtn) {
createBtn.addEventListener('click', function () {
createBtn.addEventListener('click', () => {
document.getElementById('create-dialog').showModal();
});
}
@@ -26,11 +26,11 @@ function _executeDeleteLink() {
function copyUrl(id) {
var input = document.getElementById('url-' + id);
navigator.clipboard.writeText(input.value).then(function () {
navigator.clipboard.writeText(input.value).then(() => {
var btn = event.target.closest('button');
var orig = btn.textContent;
btn.textContent = '✓ Copié';
setTimeout(function () {
setTimeout(() => {
btn.textContent = orig;
}, 1200);
});

View File

@@ -6,7 +6,7 @@
* <meta name="acces-new-link-password" content="...">
* <meta name="acces-new-link-slug" content="...">
*/
(function () {
(() => {
var baseUrlMeta = document.querySelector('meta[name="acces-base-url"]');
var passwordMeta = document.querySelector('meta[name="acces-new-link-password"]');
var slugMeta = document.querySelector('meta[name="acces-new-link-slug"]');
@@ -22,7 +22,7 @@
// Create dialog opener
var createBtn = document.getElementById('open-create-dialog');
if (createBtn) {
createBtn.addEventListener('click', function () {
createBtn.addEventListener('click', () => {
document.getElementById('create-dialog').showModal();
});
}
@@ -30,12 +30,12 @@
function copyUrl(id) {
var input = document.getElementById('url-' + id);
navigator.clipboard.writeText(input.value).then(function () {
navigator.clipboard.writeText(input.value).then(() => {
var btn = event.target.closest('button');
if (btn) {
var orig = btn.getAttribute('title') || '';
btn.setAttribute('title', '✓ Copié');
setTimeout(function () {
setTimeout(() => {
btn.setAttribute('title', orig);
}, 1200);
}
@@ -43,12 +43,12 @@ function copyUrl(id) {
}
function copyUrlFrom(el) {
navigator.clipboard.writeText(el.value).then(function () {
navigator.clipboard.writeText(el.value).then(() => {
var btn = el.nextElementSibling;
if (btn) {
var orig = btn.textContent;
btn.textContent = '✓ Copié';
setTimeout(function () {
setTimeout(() => {
btn.textContent = orig;
}, 1200);
}
@@ -57,17 +57,17 @@ function copyUrlFrom(el) {
function copyTextToClipboard(text) {
navigator.clipboard.writeText(text)
.then(function () {
.then(() => {
var btn = event && event.target ? event.target.closest('button') : null;
if (btn) {
var orig = btn.getAttribute('title') || '';
btn.setAttribute('title', '✓ Copié');
setTimeout(function () {
setTimeout(() => {
btn.setAttribute('title', orig);
}, 1200);
}
})
.catch(function () {});
.catch(() => {});
}
function openEditDialog(id, name, hasPassword, expiresVal) {

View File

@@ -4,7 +4,7 @@
* Reads `data-apropos-key` and `data-apropos-group-count` from the form element.
* Expects templates with ids `entry-template-f-{key}` and `group-template-f-{key}`.
*/
(function () {
(() => {
var form = document.querySelector('form[data-apropos-key]');
if (!form) return;
@@ -16,12 +16,12 @@
function reindexGroups() {
var fieldsets = form.querySelectorAll('fieldset.apropos-group');
groupCount = fieldsets.length;
fieldsets.forEach(function (fs, i) {
fieldsets.forEach((fs, i) => {
var newIdx = i;
var legend = fs.querySelector('legend');
if (legend) legend.textContent = 'Contact ' + (newIdx + 1);
fs.querySelectorAll('input').forEach(function (inp) {
fs.querySelectorAll('input').forEach((inp) => {
if (inp.name) {
inp.name = inp.name.replace(/groups\[\d+\]/, 'groups[' + newIdx + ']');
}
@@ -33,7 +33,7 @@
}
});
fs.querySelectorAll('label[for]').forEach(function (lbl) {
fs.querySelectorAll('label[for]').forEach((lbl) => {
lbl.setAttribute(
'for',
lbl.getAttribute('for').replace(

View File

@@ -18,7 +18,7 @@ function languesSubmitPending() {
}
function languesToggleAll(src) {
document.querySelectorAll('input[name="selected_langs[]"]').forEach(function (cb) {
document.querySelectorAll('input[name="selected_langs[]"]').forEach((cb) => {
cb.checked = src.checked;
});
languesUpdateBulk();
@@ -32,7 +32,7 @@ function languesUpdateBulk() {
var visible = n > 1;
bar.style.display = visible ? 'flex' : 'none';
if (visible) {
requestAnimationFrame(function () {
requestAnimationFrame(() => {
wrap.style.setProperty('--sticky-top', bar.offsetHeight + 'px');
});
} else {
@@ -41,7 +41,7 @@ function languesUpdateBulk() {
}
function languesCancelSelection() {
document.querySelectorAll('input[name="selected_langs[]"]').forEach(function (cb) {
document.querySelectorAll('input[name="selected_langs[]"]').forEach((cb) => {
cb.checked = false;
});
languesUpdateBulk();
@@ -57,7 +57,7 @@ function languesConfirmBulkDelete() {
function languesExecBulkDelete() {
var container = document.getElementById('langues-bulk-checkboxes');
container.innerHTML = '';
document.querySelectorAll('input[name="selected_langs[]"]:checked').forEach(function (cb) {
document.querySelectorAll('input[name="selected_langs[]"]:checked').forEach((cb) => {
var inp = document.createElement('input');
inp.type = 'hidden';
inp.name = 'selected_langs[]';
@@ -76,7 +76,7 @@ function languesConfirmBulkMerge() {
document.getElementById('langues-bulk-merge-count').textContent = checked.length;
var sel = document.getElementById('langues-bulk-merge-target-select');
sel.innerHTML = '<option value="">— Choisir la destination —</option>';
checked.forEach(function (cb) {
checked.forEach((cb) => {
var tr = cb.closest('tr');
sel.innerHTML +=
'<option value="' +
@@ -94,7 +94,7 @@ function languesExecBulkMerge() {
document.getElementById('langues-bulk-target').value = targetId;
var container = document.getElementById('langues-bulk-checkboxes');
container.innerHTML = '';
document.querySelectorAll('input[name="selected_langs[]"]:checked').forEach(function (cb) {
document.querySelectorAll('input[name="selected_langs[]"]:checked').forEach((cb) => {
var inp = document.createElement('input');
inp.type = 'hidden';
inp.name = 'selected_langs[]';
@@ -105,11 +105,11 @@ function languesExecBulkMerge() {
document.getElementById('langues-bulk-form').submit();
}
document.addEventListener('htmx:afterSwap', function (evt) {
document.addEventListener('htmx:afterSwap', (evt) => {
if (evt.target.id === 'langues-table-wrap') {
document
.querySelectorAll('input[name="selected_langs[]"]')
.forEach(function (cb) {
.forEach((cb) => {
cb.addEventListener('change', languesUpdateBulk);
});
languesUpdateBulk();

View File

@@ -18,7 +18,7 @@ function motsclesSubmitPending() {
}
function motsclesToggleAll(src) {
document.querySelectorAll('input[name="selected_tags[]"]').forEach(function (cb) {
document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => {
cb.checked = src.checked;
});
motsclesUpdateBulk();
@@ -32,7 +32,7 @@ function motsclesUpdateBulk() {
var visible = n > 1;
bar.style.display = visible ? 'flex' : 'none';
if (visible) {
requestAnimationFrame(function () {
requestAnimationFrame(() => {
wrap.style.setProperty('--sticky-top', bar.offsetHeight + 'px');
});
} else {
@@ -46,7 +46,7 @@ function motsclesConfirmBulkMerge() {
document.getElementById('motscles-bulk-merge-count').textContent = checked.length;
var sel = document.getElementById('motscles-bulk-merge-target-select');
sel.innerHTML = '<option value="">— Choisir la destination —</option>';
checked.forEach(function (cb) {
checked.forEach((cb) => {
var tr = cb.closest('tr');
sel.innerHTML +=
'<option value="' +
@@ -64,7 +64,7 @@ function motsclesExecBulkMerge() {
document.getElementById('motscles-bulk-target').value = targetId;
var container = document.getElementById('motscles-bulk-checkboxes');
container.innerHTML = '';
document.querySelectorAll('input[name="selected_tags[]"]:checked').forEach(function (cb) {
document.querySelectorAll('input[name="selected_tags[]"]:checked').forEach((cb) => {
var inp = document.createElement('input');
inp.type = 'hidden';
inp.name = 'selected_tags[]';
@@ -76,7 +76,7 @@ function motsclesExecBulkMerge() {
}
function motsclesCancelSelection() {
document.querySelectorAll('input[name="selected_tags[]"]').forEach(function (cb) {
document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => {
cb.checked = false;
});
motsclesUpdateBulk();
@@ -92,7 +92,7 @@ function motsclesConfirmBulkDelete() {
function motsclesExecBulkDelete() {
var container = document.getElementById('motscles-bulk-checkboxes');
container.innerHTML = '';
document.querySelectorAll('input[name="selected_tags[]"]:checked').forEach(function (cb) {
document.querySelectorAll('input[name="selected_tags[]"]:checked').forEach((cb) => {
var inp = document.createElement('input');
inp.type = 'hidden';
inp.name = 'selected_tags[]';
@@ -105,11 +105,11 @@ function motsclesExecBulkDelete() {
document.getElementById('motscles-bulk-form').submit();
}
document.addEventListener('htmx:afterSwap', function (evt) {
document.addEventListener('htmx:afterSwap', (evt) => {
if (evt.target.id === 'motscles-table-wrap') {
document
.querySelectorAll('input[name="selected_tags[]"]')
.forEach(function (cb) {
.forEach((cb) => {
cb.addEventListener('change', motsclesUpdateBulk);
});
motsclesUpdateBulk();

View File

@@ -4,18 +4,20 @@
* Provides: toggleAll, updateBulk, getSelectedIds, confirmBulk, execBulk,
* confirmExport, confirmExportFiles, confirmDelete.
*/
(function () {
(() => {
function toggleAll(src) {
document.querySelectorAll('input[name="selected_theses[]"]').forEach(function (cb) {
document.querySelectorAll('input[name="selected_theses[]"]').forEach((cb) => {
cb.checked = src.checked;
});
updateBulk();
}
function updateBulk() {
var n = document.querySelectorAll('input[name="selected_theses[]"]:checked').length;
var b = document.getElementById('bulk-actions');
document.getElementById('selected-count').textContent = n;
var c = document.getElementById('selected-count');
if (!b || !c) return; // only on thesis index page
var n = document.querySelectorAll('input[name="selected_theses[]"]:checked').length;
c.textContent = n;
b.style.display = n > 0 ? 'flex' : 'none';
document.getElementById('admin-table-wrap').style.setProperty(
'--sticky-top',
@@ -26,15 +28,15 @@
function getSelectedIds() {
return Array.from(
document.querySelectorAll('input[name="selected_theses[]"]:checked')
).map(function (cb) {
return cb.value;
});
).map((cb) => cb.value);
}
function confirmBulk(act) {
var noSel = document.getElementById('no-selection-dialog');
if (!noSel) return; // only on thesis index page
var ids = getSelectedIds();
if (!ids.length) {
document.getElementById('no-selection-dialog').showModal();
noSel.showModal();
return;
}
var n = ids.length;
@@ -56,7 +58,7 @@
f.action = a === 'delete' ? 'actions/delete.php' : 'actions/publish.php';
var c = document.getElementById('bulk-checkboxes');
c.innerHTML = '';
getSelectedIds().forEach(function (id) {
getSelectedIds().forEach((id) => {
var inp = document.createElement('input');
inp.type = 'hidden';
inp.name = 'selected_theses[]';
@@ -85,15 +87,17 @@
}
function confirmDelete(id, title) {
var dialog = document.getElementById('delete-thesis-dialog');
if (!dialog) return; // only on thesis index page
document.getElementById('delete-thesis-title').textContent = title;
document.getElementById('delete-thesis-dialog').showModal();
document.getElementById('delete-dialog-confirm').onclick = function () {
dialog.showModal();
document.getElementById('delete-dialog-confirm').onclick = () => {
document.getElementById('delete-form-' + id).submit();
};
}
function reattachListeners() {
document.querySelectorAll('input[name="selected_theses[]"]').forEach(function (cb) {
document.querySelectorAll('input[name="selected_theses[]"]').forEach((cb) => {
cb.addEventListener('change', updateBulk);
});
updateBulk();

View File

@@ -11,7 +11,7 @@
var _pendingTagForm = null;
function tagsToggleAll(src) {
document.querySelectorAll('input[name="selected_tags[]"]').forEach(function (cb) {
document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => {
cb.checked = src.checked;
});
tagsUpdateBulk();
@@ -29,7 +29,7 @@ function tagsConfirmBulkMerge() {
document.getElementById('bulk-merge-count').textContent = checked.length;
var sel = document.getElementById('bulk-merge-target-select');
sel.innerHTML = '<option value="">— Choisir la destination —</option>';
checked.forEach(function (cb) {
checked.forEach((cb) => {
var tr = cb.closest('tr');
sel.innerHTML +=
'<option value="' +
@@ -47,7 +47,7 @@ function tagsExecBulkMerge() {
document.getElementById('tags-bulk-target').value = targetId;
var container = document.getElementById('tags-bulk-checkboxes');
container.innerHTML = '';
document.querySelectorAll('input[name="selected_tags[]"]:checked').forEach(function (cb) {
document.querySelectorAll('input[name="selected_tags[]"]:checked').forEach((cb) => {
var inp = document.createElement('input');
inp.type = 'hidden';
inp.name = 'selected_tags[]';
@@ -68,11 +68,11 @@ function _submitPendingTagForm() {
if (_pendingTagForm) _pendingTagForm.submit();
}
document.addEventListener('htmx:afterSwap', function (evt) {
document.addEventListener('htmx:afterSwap', (evt) => {
if (evt.target.id === 'tags-table-wrap') {
document
.querySelectorAll('input[name="selected_tags[]"]')
.forEach(function (cb) {
.forEach((cb) => {
cb.addEventListener('change', tagsUpdateBulk);
});
tagsUpdateBulk();

View File

@@ -1,33 +1,35 @@
/**
* admin-toc.js — Sticky table-of-contents with IntersectionObserver active-section
* admin-toc.js — Table-of-contents with IntersectionObserver active-section
* highlighting.
*
* Renders nav links from section[aria-labelledby] headings inside #main-content.
* Hides the TOC aside if fewer than 2 sections exist.
* Shared markup with public content pages: <details class="toc" id="admin-toc">
* contains a <ul class="toc-list"> populated by this script from
* section[aria-labelledby] headings inside #main-content.
* Hides the TOC if fewer than 2 sections exist.
*
* Guarded: only runs once even if loaded multiple times (e.g. via bundle + direct <script>).
* Guarded: only runs once.
*/
(function () {
(() => {
if (window.__adminTocBuilt) return;
window.__adminTocBuilt = true;
function build() {
var main = document.getElementById('main-content');
var nav = document.getElementById('admin-toc-list');
var aside = document.getElementById('admin-toc');
if (!main || !nav || !aside) return;
var toc = document.getElementById('admin-toc');
var list = document.getElementById('admin-toc-list');
if (!main || !toc || !list) return;
// Guard against double population (nav already has children from a prior run)
if (nav.children.length > 0) return;
// Guard against double population
if (list.children.length > 0) return;
var sections = main.querySelectorAll('section[aria-labelledby]');
if (sections.length < 2) {
aside.hidden = true;
toc.hidden = true;
return;
}
var items = [];
sections.forEach(function (sec) {
sections.forEach((sec) => {
var headingId = sec.getAttribute('aria-labelledby');
var heading = document.getElementById(headingId);
if (!heading) return;
@@ -36,29 +38,31 @@
var a = document.createElement('a');
a.href = '#' + sec.id;
a.textContent = heading.textContent.trim();
a.style.display = 'block';
nav.appendChild(a);
var li = document.createElement('li');
li.appendChild(a);
list.appendChild(li);
items.push({ section: sec, link: a });
});
var observer = new IntersectionObserver(
function (entries) {
(entries) => {
var best = null,
bestRatio = 0;
entries.forEach(function (e) {
entries.forEach((e) => {
if (e.intersectionRatio > bestRatio) {
bestRatio = e.intersectionRatio;
best = e.target;
}
});
items.forEach(function (item) {
item.link.classList.toggle('admin-toc-active', item.section === best);
items.forEach((item) => {
item.link.classList.toggle('toc-active', item.section === best);
});
},
{ rootMargin: '-10% 0px -70% 0px', threshold: [0, 0.25, 0.5, 0.75, 1] }
);
items.forEach(function (item) {
items.forEach((item) => {
observer.observe(item.section);
});
}

View File

@@ -699,7 +699,7 @@
// The format checkboxes no longer trigger HTMX swaps; this JS toggles the TFE
// required attribute and asterisk client-side so the student sees immediate feedback.
// admin_mode hidden input (value="1") suppresses required toggling for admins.
(function () {
(() => {
var optionalFormatIds = ["1", "4", "6"];
function isAdminMode() {
@@ -743,7 +743,7 @@
// Delegate change events on the format fieldset
var formatFieldset = document.getElementById("fieldset-formats");
if (formatFieldset) {
formatFieldset.addEventListener("change", function (e) {
formatFieldset.addEventListener("change", (e) => {
if (e.target && e.target.name === "formats[]") {
updateTfeRequired();
}

View File

@@ -4,7 +4,7 @@
* Switches between integer input (pages/mo) and h/m/s time inputs (durée).
* Updates hidden #duration_value on change.
*/
(function () {
(() => {
var unit = document.getElementById('duration_unit');
var hidden = document.getElementById('duration_value');
var intWrap = document.getElementById('duration-value-integer');

View File

@@ -4,9 +4,9 @@
*
* Reads `data-admin-mode` (0/1) from the jury <fieldset>.
*/
(function () {
(() => {
// ── Dynamic row add/remove ──────────────────────────────────────────────
window.addJuryRow = function (listId, inputName, roleLabel) {
window.addJuryRow = (listId, inputName, roleLabel) => {
var list = document.getElementById(listId);
if (!list) return;
var n = list.querySelectorAll('.admin-jury-entry').length + 1;
@@ -25,7 +25,7 @@
list.appendChild(div);
};
window.removeJuryRow = function (btn) {
window.removeJuryRow = (btn) => {
var entry = btn.closest('.admin-jury-entry');
if (entry) entry.remove();
};
@@ -51,7 +51,7 @@
ulbRow.style.display = show ? '' : 'none';
if (ulbAsterisk) ulbAsterisk.style.display = show ? '' : 'none';
var inputs = ulbRow.querySelectorAll('input[name="jury_promoteur_ulb_name[]"]');
inputs.forEach(function (inp, idx) {
inputs.forEach((inp, idx) => {
inp.required = adminMode ? false : show && idx === 0;
inp.disabled = !show;
if (!show) inp.value = '';

View File

@@ -4,7 +4,7 @@
*
* Reads the container id from data-search-container-id on the pill-search div.
*/
(function () {
(() => {
var pillDiv = document.querySelector('[data-search-container-id]');
if (!pillDiv) return;
var containerId = pillDiv.getAttribute('data-search-container-id');

View File

@@ -7,9 +7,9 @@
*
* Loaded on all admin pages via footer.php.
*/
(function () {
(() => {
// Toast accessibility — auto-focus warning toasts
document.body.addEventListener('htmx:afterSettle', function (e) {
document.body.addEventListener('htmx:afterSettle', (e) => {
if (e.target && e.target.id === 'toast-region') {
var warn = e.target.querySelector('.toast--warning');
if (warn) {
@@ -20,7 +20,7 @@
});
// Markdown cheatsheet: remove stale dialogs before a new one arrives
document.body.addEventListener('htmx:beforeRequest', function (e) {
document.body.addEventListener('htmx:beforeRequest', (e) => {
if (
e.detail.requestConfig &&
e.detail.requestConfig.path === '/admin/markdown-cheatsheet-fragment.php'
@@ -31,7 +31,7 @@
});
// Markdown cheatsheet: close on backdrop (dialog element) click
document.body.addEventListener('click', function (e) {
document.body.addEventListener('click', (e) => {
if (e.target.tagName === 'DIALOG' && e.target.id === 'md-cheatsheet-dialog') {
e.target.close();
}

View File

@@ -4,7 +4,7 @@
* Single-open behavior on mobile (≤ 1025px). Re-initializes after HTMX swaps.
* On desktop, all panels close when crossing the breakpoint.
*/
(function () {
(() => {
var INDEX_SEL = '#repertoire-index';
var ACCORDION_SEL = '.rep-accordion';
var TOGGLE_SEL = '.rep-accordion__toggle';
@@ -17,18 +17,18 @@
function initAccordions(root) {
if (!isMobile()) return;
var toggles = root.querySelectorAll(TOGGLE_SEL);
toggles.forEach(function (btn) {
toggles.forEach((btn) => {
// Skip students column — always visible, not an accordion
if (btn.closest('[data-col="students"]')) return;
if (btn._accordionBound) return;
btn._accordionBound = true;
btn.addEventListener('click', function () {
btn.addEventListener('click', () => {
var section = btn.closest(ACCORDION_SEL);
var panel = section.querySelector(PANEL_SEL);
var isOpen = btn.getAttribute('aria-expanded') === 'true';
// Close all others (except students column)
root.querySelectorAll(ACCORDION_SEL).forEach(function (s) {
root.querySelectorAll(ACCORDION_SEL).forEach((s) => {
if (s.dataset.col === 'students') return;
var p = s.querySelector(PANEL_SEL);
var t = s.querySelector(TOGGLE_SEL);
@@ -54,7 +54,7 @@
initAccordions(document);
// Re-bind after HTMX swaps (use live DOM since e.detail.target may be detached)
document.body.addEventListener('htmx:afterSwap', function (e) {
document.body.addEventListener('htmx:afterSwap', (e) => {
if (
e.detail.target &&
e.detail.target.matches &&
@@ -67,7 +67,7 @@
// Re-bind on resize crossing the breakpoint
var wasMobile = isMobile();
window.addEventListener('resize', function () {
window.addEventListener('resize', () => {
var nowMobile = isMobile();
if (nowMobile !== wasMobile) {
wasMobile = nowMobile;
@@ -75,12 +75,12 @@
// Switching to desktop — close all panels
document
.querySelectorAll(INDEX_SEL + ' ' + TOGGLE_SEL)
.forEach(function (btn) {
.forEach((btn) => {
btn.setAttribute('aria-expanded', 'false');
});
document
.querySelectorAll(INDEX_SEL + ' ' + PANEL_SEL)
.forEach(function (p) {
.forEach((p) => {
p.classList.remove('is-open');
});
}

View File

@@ -4,7 +4,7 @@
* Shows a popover with HTMX-fetched student details on hover over links
* with `data-student-name` attribute.
*/
(function () {
(() => {
var popover = document.getElementById('student-popover');
var currentAnchor = null;
@@ -21,7 +21,7 @@
document.body.addEventListener(
'mouseenter',
function (e) {
(e) => {
var a = e.target.closest('[data-student-name]');
if (!a) return;
currentAnchor = a;
@@ -29,7 +29,7 @@
true
);
document.body.addEventListener('htmx:afterSwap', function (e) {
document.body.addEventListener('htmx:afterSwap', (e) => {
if (e.detail.target !== popover) return;
if (currentAnchor) position(currentAnchor);
popover.hidden = false;
@@ -37,13 +37,13 @@
document.body.addEventListener(
'mouseleave',
function (e) {
(e) => {
if (
!e.target.closest('[data-student-name]') &&
!e.target.closest('#student-popover')
)
return;
setTimeout(function () {
setTimeout(() => {
if (
!document.querySelector('[data-student-name]:hover') &&
!document.querySelector('#student-popover:hover')

View File

@@ -3,7 +3,7 @@
*
* Operates on #sidebar-links-form and #sidebar-link-tpl.
*/
(function () {
(() => {
var form = document.getElementById('sidebar-links-form');
var tpl = document.getElementById('sidebar-link-tpl');
if (!form || !tpl) return;
@@ -11,8 +11,8 @@
function reindexLinks() {
var rows = form.querySelectorAll('.sidebar-link-row');
rows.forEach(function (row, i) {
row.querySelectorAll('input').forEach(function (inp) {
rows.forEach((row, i) => {
row.querySelectorAll('input').forEach((inp) => {
if (inp.name) {
inp.name = inp.name.replace(/links\[\d+\]/, 'links[' + i + ']');
}
@@ -20,14 +20,14 @@
inp.id = inp.id.replace(/sl_\d+/, 'sl_' + i);
}
});
row.querySelectorAll('label[for]').forEach(function (lbl) {
row.querySelectorAll('label[for]').forEach((lbl) => {
lbl.setAttribute('for', lbl.getAttribute('for').replace(/sl_\d+/, 'sl_' + i));
});
});
}
// Event delegation for remove buttons
form.addEventListener('click', function (e) {
form.addEventListener('click', (e) => {
if (!e.target.closest('.remove-sidebar-link-btn')) return;
e.preventDefault();
e.target.closest('.sidebar-link-row').remove();

View File

@@ -2,7 +2,7 @@
* smtp-error-focus.js — Scrolls to and focuses the SMTP field that caused a probe
* error. Reads the field id from data-smtp-error-field on the SMTP form.
*/
(function () {
(() => {
var form = document.querySelector('form[data-smtp-error-field]');
if (!form) return;
var fieldId = form.getAttribute('data-smtp-error-field');

View File

@@ -2,12 +2,14 @@
/**
* admin-toc.php — sidebar table-of-contents for long admin pages.
*
* Rendered as an <aside> inside <main>, before the <article> content.
* Uses IntersectionObserver to highlight the active section.
* Uses the same <details class="toc"> markup as the public content pages
* (about, charte, licence). The link list is populated by admin-toc.js
* at runtime.
*/
?>
<aside id="admin-toc" class="admin-toc" aria-label="Sur cette page">
<nav class="admin-toc-list" id="admin-toc-list">
<!-- populated by JS (admin-toc.js, loaded via admin.min.js) -->
</nav>
</aside>
<details class="toc" id="admin-toc" open aria-label="Sur cette page">
<summary><?= icon('caret-down', 0, 'toc-caret') ?> SUR CETTE PAGE</summary>
<ul class="toc-list" id="admin-toc-list">
<!-- populated by admin-toc.js -->
</ul>
</details>

View File

@@ -36,7 +36,7 @@ function renderEntries(array $entries): string
<!-- Table of contents: collapsible on mobile, force-open on desktop -->
<details class="toc" open>
<summary><?= icon('caret-down', 0, 'toc-caret') ?> PARTIES</summary>
<ul>
<ul class="toc-list">
<li><a href="#apropos-intro">À propos</a></li>
<?php if (!empty($contacts)): ?>
<li><a href="#apropos-contacts">Contacts</a></li>
@@ -54,6 +54,7 @@ function renderEntries(array $entries): string
<?php endif; ?>
</details>
<article>
<!-- Intro text from DB -->
<section class="content-section" id="apropos-intro">
<?= $aboutHtml ?>
@@ -113,5 +114,6 @@ function renderEntries(array $entries): string
</div>
</dl>
</section>
</article>
</main>

View File

@@ -4,7 +4,7 @@
<?php if (!empty($tocItems)): ?>
<details class="toc" open>
<summary><?= icon('caret-down', 0, 'toc-caret') ?> PARTIES</summary>
<ul>
<ul class="toc-list">
<?php foreach ($tocItems as $item): ?>
<li><a href="<?= htmlspecialchars($item['href']) ?>"><?= htmlspecialchars($item['label']) ?></a></li>
<?php endforeach; ?>
@@ -12,12 +12,12 @@
</details>
<?php endif; ?>
<div class="content">
<article>
<?php if (!empty(trim($content))): ?>
<?= $html ?>
<?php else: ?>
<p>Contenu à venir.</p>
<?php endif; ?>
</div>
</article>
</main>

View File

@@ -4,7 +4,7 @@
<?php if (!empty($tocItems)): ?>
<details class="toc" open>
<summary><?= icon('caret-down', 0, 'toc-caret') ?> PARTIES</summary>
<ul>
<ul class="toc-list">
<?php foreach ($tocItems as $item): ?>
<li><a href="<?= htmlspecialchars($item['href']) ?>"><?= htmlspecialchars($item['label']) ?></a></li>
<?php endforeach; ?>
@@ -12,12 +12,12 @@
</details>
<?php endif; ?>
<div class="content">
<article>
<?php if (!empty(trim($content))): ?>
<?= $html ?>
<?php else: ?>
<p>Contenu à venir.</p>
<?php endif; ?>
</div>
</article>
</main>

View File

@@ -7,7 +7,10 @@
"!app/public/assets/js/htmx.min.js",
"!app/public/assets/js/overtype.min.js",
"!app/public/assets/js/sortable.min.js",
"!app/public/assets/js/vendor/**"
"!app/public/assets/js/vendor/**",
"!app/public/assets/css/filepond*.css",
"!app/public/assets/css/modern-normalize*.css",
"!app/public/assets/dist/**"
]
},
"css": {
@@ -15,7 +18,7 @@
"enabled": true
},
"linter": {
"enabled": false
"enabled": true
}
},
"linter": {

View File

@@ -74,6 +74,10 @@ build-js:
build-install:
@npm ci
[group('build')]
build-lint:
@npx biome lint app/public/assets/css/ app/public/assets/js/app/ scripts/
[group('build')]
build-check:
@echo "Checking if build output is up to date…"

View File

@@ -37,6 +37,10 @@ if (!existsSync(resolve(root, "node_modules"))) {
execSync("npm ci", { cwd: root, stdio: "inherit" });
}
if (buildAll || onlyCss) {
run("Linting CSS + JS (biome)", "npx biome lint app/public/assets/css/ app/public/assets/js/app/ scripts/ || true");
}
if (buildAll || onlyCss) {
run("Building CSS bundles", "node scripts/build-css.mjs");
}