homepage.veen.world/app/static/js/modal.js

52 lines
1.6 KiB
JavaScript
Raw Normal View History

2025-01-08 18:06:08 +01:00
function openDynamicPopup(subitem) {
2025-01-09 15:17:34 +01:00
// Setze den Titel
document.getElementById('dynamicModalLabel').innerText = subitem.description;
2025-01-08 18:06:08 +01:00
2025-01-09 15:17:34 +01:00
// Setze den Identifier, falls vorhanden
const modalContent = document.getElementById('dynamicModalContent');
if (subitem.identifier) {
modalContent.value = subitem.identifier;
} else {
modalContent.value = '';
}
// Konfiguriere die Warnbox
const warningBox = document.getElementById('dynamicModalWarning');
if (subitem.warning) {
warningBox.classList.remove('d-none');
document.getElementById('dynamicModalWarningText').innerText = subitem.warning;
} else {
warningBox.classList.add('d-none');
}
// Konfiguriere die Infobox
const infoBox = document.getElementById('dynamicModalInfo');
if (subitem.info) {
infoBox.classList.remove('d-none');
document.getElementById('dynamicModalInfoText').innerText = subitem.info;
} else {
infoBox.classList.add('d-none');
}
// Konfiguriere den Link
const linkBox = document.getElementById('dynamicModalLink');
const linkHref = document.getElementById('dynamicModalLinkHref');
if (subitem.url) {
linkBox.classList.remove('d-none');
linkHref.href = subitem.url;
} else {
linkBox.classList.add('d-none');
linkHref.href = '#';
}
// Kopierfunktion für den Identifier
document.getElementById('dynamicCopyButton').addEventListener('click', function () {
2025-01-08 18:06:08 +01:00
modalContent.select();
navigator.clipboard.writeText(modalContent.value)
2025-01-09 15:17:34 +01:00
});
2025-01-08 18:06:08 +01:00
2025-01-09 15:17:34 +01:00
// Modal anzeigen
const modal = new bootstrap.Modal(document.getElementById('dynamicModal'));
modal.show();
}