mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
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:
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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 = '';
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user