mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 15:21:22 +02:00
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
/**
|
|
* admin-acces-sharelink.js — Share link management for acces-etudiante.php.
|
|
*
|
|
* Provides: dialog openers, clipboard copy, password dialog.
|
|
*/
|
|
(() => {
|
|
var createBtn = document.getElementById("open-create-dialog");
|
|
if (createBtn) {
|
|
createBtn.addEventListener("click", () => {
|
|
document.getElementById("create-dialog").showModal();
|
|
});
|
|
}
|
|
})();
|
|
|
|
var _pendingDeleteLinkId = null;
|
|
|
|
function openDeleteLinkDialog(id) {
|
|
_pendingDeleteLinkId = id;
|
|
document.getElementById("delete-link-dialog").showModal();
|
|
}
|
|
window.openDeleteLinkDialog = openDeleteLinkDialog;
|
|
|
|
function executeDeleteLink() {
|
|
var form = document.getElementById(
|
|
`delete-link-form-${_pendingDeleteLinkId}`,
|
|
);
|
|
if (form) form.submit();
|
|
}
|
|
window.executeDeleteLink = executeDeleteLink;
|
|
|
|
function copyUrl(id) {
|
|
var input = document.getElementById(`url-${id}`);
|
|
navigator.clipboard.writeText(input.value).then(() => {
|
|
var btn = event.target.closest("button");
|
|
var orig = btn.textContent;
|
|
btn.textContent = "✓ Copié";
|
|
setTimeout(() => {
|
|
btn.textContent = orig;
|
|
}, 1200);
|
|
});
|
|
}
|
|
window.copyUrl = copyUrl;
|
|
|
|
function openPasswordDialog(id, hasPassword) {
|
|
document.getElementById("password-link-id").value = id;
|
|
var info = document.getElementById("password-current-info");
|
|
info.textContent = hasPassword
|
|
? "Un mot de passe est actuellement configuré. Entrez-en un nouveau ou laissez vide pour le supprimer."
|
|
: "Aucun mot de passe configuré.";
|
|
document.getElementById("password-dialog").showModal();
|
|
}
|
|
window.openPasswordDialog = openPasswordDialog;
|