Files
xamxam/app/public/assets/js/app/repertoire-student-popover.js
Pontoporeia 6ecd3d4540 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.
2026-06-24 13:57:00 +02:00

58 lines
1.7 KiB
JavaScript

/**
* repertoire-student-popover.js — Student name popover on repertoire page.
*
* Shows a popover with HTMX-fetched student details on hover over links
* with `data-student-name` attribute.
*/
(() => {
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',
(e) => {
var a = e.target.closest('[data-student-name]');
if (!a) return;
currentAnchor = a;
},
true
);
document.body.addEventListener('htmx:afterSwap', (e) => {
if (e.detail.target !== popover) return;
if (currentAnchor) position(currentAnchor);
popover.hidden = false;
});
document.body.addEventListener(
'mouseleave',
(e) => {
if (
!e.target.closest('[data-student-name]') &&
!e.target.closest('#student-popover')
)
return;
setTimeout(() => {
if (
!document.querySelector('[data-student-name]:hover') &&
!document.querySelector('#student-popover:hover')
) {
popover.hidden = true;
}
}, 120);
},
true
);
})();