mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 08:09:18 +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
36 lines
1.3 KiB
PHP
36 lines
1.3 KiB
PHP
<!-- Toast region — polled by HTMX after page load -->
|
|
<aside id="toast-region"
|
|
aria-live="polite"
|
|
hx-get="/admin/toast-fragment.php"
|
|
hx-trigger="load"
|
|
hx-swap="innerHTML"
|
|
hx-target="#toast-region">
|
|
</aside>
|
|
|
|
<?php foreach ($extraJs ?? [] as $js): ?>
|
|
<script src="<?= App::assetV($js) ?>"></script>
|
|
<?php endforeach; ?>
|
|
<?php if (!empty($extraJsInline)): ?>
|
|
<script><?= $extraJsInline ?></script>
|
|
<?php endif; ?>
|
|
<script src="/assets/js/vendor/htmx.min.js"></script>
|
|
<script>
|
|
// Global HTMX debugging for settings checkboxes
|
|
document.body.addEventListener('htmx:sendError', function (e) {
|
|
console.error('[htmx:sendError] target=', e.target.id, 'detail=', e.detail);
|
|
});
|
|
document.body.addEventListener('htmx:beforeSend', function (e) {
|
|
if (e.target.id && (e.target.id.includes('fieldset-') || e.target.name)) {
|
|
console.log('[htmx:beforeSend] name=' + e.target.name + ' checked=' + e.target.checked, 'formData keys:', Array.from(new FormData(e.target.closest('fieldset'))).map(function(kv){return kv[0]}));
|
|
}
|
|
});
|
|
document.body.addEventListener('htmx:afterSettle', function (e) {
|
|
if (e.target && e.target.id === 'toast-region') {
|
|
var warn = e.target.querySelector('.toast--warning');
|
|
if (warn) { warn.setAttribute('tabindex', '-1'); warn.focus(); }
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|