#gzip #extract-inline-js enable gzip in nginx + move ~730 lines of inline JS to 15 external files

This commit is contained in:
Pontoporeia
2026-06-24 12:56:09 +02:00
parent 0ff6ee78d9
commit e74f9210c5
35 changed files with 1198 additions and 843 deletions

View File

@@ -583,76 +583,10 @@
</form>
</dialog>
<script>
// ── Forward PHP flash data to JS globals ──────────────────────────────────
const BASE_URL = <?= json_encode($baseUrl) ?>;
const _newLinkPassword = <?= json_encode($newLinkPassword ?? '') ?>;
const _newLinkSlug = <?= json_encode($newLinkSlug ?? '') ?>;
// ── Show result dialogs after redirect ────────────────────────────────────
if (_newLinkSlug && _newLinkPassword) {
document.getElementById('create-result-password').value = _newLinkPassword;
document.getElementById('create-result-url').value = BASE_URL + '/partage/' + _newLinkSlug;
document.getElementById('create-result-dialog').showModal();
}
document.getElementById('open-create-dialog').addEventListener('click', () => {
document.getElementById('create-dialog').showModal();
});
function copyUrl(id) {
const input = document.getElementById('url-' + id);
navigator.clipboard.writeText(input.value).then(() => {
const btn = event.target.closest('button');
if (btn) { const orig = btn.getAttribute('title') || ''; btn.setAttribute('title', '✓ Copié'); setTimeout(() => btn.setAttribute('title', orig), 1200); }
});
}
function copyUrlFrom(el) {
navigator.clipboard.writeText(el.value).then(() => {
const btn = el.nextElementSibling;
if (btn) { const orig = btn.textContent; btn.textContent = '✓ Copié'; setTimeout(() => { btn.textContent = orig; }, 1200); }
});
}
function copyTextToClipboard(text) {
navigator.clipboard.writeText(text).then(() => {
const btn = event?.target?.closest('button');
if (btn) { const orig = btn.getAttribute('title') || ''; btn.setAttribute('title', '✓ Copié'); setTimeout(() => btn.setAttribute('title', orig), 1200); }
}).catch(() => {});
}
function openEditDialog(id, name, hasPassword, expiresVal) {
document.getElementById('edit-link-id').value = id;
document.getElementById('edit-name').value = name || '';
document.getElementById('edit-expires').value = expiresVal || '';
document.getElementById('edit-dialog').showModal();
}
function openApproveDialog(requestId) {
document.getElementById('approve-request-id').value = requestId;
document.getElementById('approve-dialog').showModal();
}
function openRejectDialog(requestId) {
document.getElementById('reject-request-id').value = requestId;
document.getElementById('reject-dialog').showModal();
}
let _pendingArchiveLinkId = null;
function openArchiveLinkDialog(id) {
_pendingArchiveLinkId = id;
document.getElementById('archive-link-dialog').showModal();
}
function _executeArchiveLink() {
const form = document.getElementById('archive-link-form-' + _pendingArchiveLinkId);
if (form) form.submit();
}
function openDeleteArchivedLinkDialog(id) {
document.getElementById('delete-archived-link-id').value = id;
document.getElementById('delete-archived-link-dialog').showModal();
}
</script>
<meta name="acces-base-url" content="<?= htmlspecialchars($baseUrl) ?>">
<meta name="acces-new-link-password" content="<?= htmlspecialchars($newLinkPassword ?? '') ?>">
<meta name="acces-new-link-slug" content="<?= htmlspecialchars($newLinkSlug ?? '') ?>">
<script src="<?= App::assetV('/assets/js/app/admin-acces.js') ?>"></script>
<!-- Archive link confirm -->
<dialog id="archive-link-dialog" class="admin-dialog admin-dialog--sm" aria-labelledby="archive-link-title">