Optimized modals

This commit is contained in:
2025-01-09 14:59:30 +01:00
parent d59cc73470
commit 9455f40079
4 changed files with 65 additions and 61 deletions

18
app/static/js/modal.js Normal file
View File

@@ -0,0 +1,18 @@
function openDynamicPopup(subitem) {
// Set modal title and content
document.getElementById('dynamicModalLabel').innerText = subitem.description;
const modalContent = document.getElementById('dynamicModalContent');
modalContent.value = subitem.identifier;
// Add copy functionality
document.getElementById('dynamicCopyButton').addEventListener('click', function () {
modalContent.select();
navigator.clipboard.writeText(modalContent.value)
.then(() => alert('Content copied to clipboard!'))
.catch(() => alert('Failed to copy content.'));
});
// Show the modal
const modal = new bootstrap.Modal(document.getElementById('dynamicModal'));
modal.show();
}