mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
- Remove overtype-webcomponent.min.js (zero references) - Extract copyLogContent + fallbackCopy + HTMX tab-updater → app/admin-logs.js (removes duplicate from both system.php and parametres.php) - Extract copyUrl → app/clipboard.js (shared by acces.php) - Extract tag/language pill-search logic → app/pill-search.js Generalized with data-pill-search attributes, auto-inits via DOMContentLoaded + htmx:afterSwap - Extract access-request form handler → app/access-request.js (was inline in templates/public/tfe.php) Files created: admin-logs.js, clipboard.js, pill-search.js, access-request.js Files modified: 9 templates/controllers to drop inline scripts and reference external JS files
47 lines
1.7 KiB
PHP
47 lines
1.7 KiB
PHP
<main class="search-main" id="main-content">
|
|
<h1 class="sr-only">Répertoire</h1>
|
|
<span id="rep-indicator" class="rep-indicator htmx-indicator" aria-hidden="true"></span>
|
|
<?php include APP_ROOT . '/templates/partials/repertoire-index.php'; ?>
|
|
</main>
|
|
<!-- Student popover -->
|
|
<div id="student-popover" class="student-popover" hidden aria-live="polite"></div>
|
|
|
|
<script src="/assets/js/vendor/htmx.min.js"></script>
|
|
<script>
|
|
(function () {
|
|
var popover = document.getElementById('student-popover');
|
|
var currentAnchor = null;
|
|
|
|
function position(anchor) {
|
|
var r = anchor.getBoundingClientRect();
|
|
var left = r.right + window.scrollX + 12;
|
|
var top = r.top + window.scrollY;
|
|
if (left + 300 > window.innerWidth + window.scrollX) left = r.left + window.scrollX - 312;
|
|
popover.style.left = left + 'px';
|
|
popover.style.top = top + 'px';
|
|
}
|
|
|
|
document.body.addEventListener('mouseenter', function (e) {
|
|
var a = e.target.closest('[data-student-name]');
|
|
if (!a) return;
|
|
currentAnchor = a;
|
|
}, true);
|
|
|
|
document.body.addEventListener('htmx:afterSwap', function (e) {
|
|
if (e.detail.target !== popover) return;
|
|
if (currentAnchor) position(currentAnchor);
|
|
popover.hidden = false;
|
|
});
|
|
|
|
document.body.addEventListener('mouseleave', function (e) {
|
|
if (!e.target.closest('[data-student-name]') && !e.target.closest('#student-popover')) return;
|
|
setTimeout(function () {
|
|
if (!document.querySelector('[data-student-name]:hover') &&
|
|
!document.querySelector('#student-popover:hover')) {
|
|
popover.hidden = true;
|
|
}
|
|
}, 120);
|
|
}, true);
|
|
}());
|
|
</script>
|