mirror of
				https://github.com/kevinveenbirkenbach/homepage.veen.world.git
				synced 2025-10-31 23:48:59 +00:00 
			
		
		
		
	Solved identifier bug
This commit is contained in:
		| @@ -1,18 +1,53 @@ | |||||||
| function openDynamicPopup(subitem) { | function openDynamicPopup(subitem) { | ||||||
|     // Set modal title and content |   // Setze den Titel | ||||||
|     document.getElementById('dynamicModalLabel').innerText = subitem.description; |   document.getElementById('dynamicModalLabel').innerText = subitem.description; | ||||||
|     const modalContent = document.getElementById('dynamicModalContent'); |  | ||||||
|     modalContent.value = subitem.identifier; |  | ||||||
|  |  | ||||||
|     // Add copy functionality |   // Setze den Identifier, falls vorhanden | ||||||
|     document.getElementById('dynamicCopyButton').addEventListener('click', function () { |   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 () { | ||||||
|       modalContent.select(); |       modalContent.select(); | ||||||
|       navigator.clipboard.writeText(modalContent.value) |       navigator.clipboard.writeText(modalContent.value) | ||||||
|         .then(() => alert('Content copied to clipboard!')) |           .then(() => alert('Content copied to clipboard!')) | ||||||
|         .catch(() => alert('Failed to copy content.')); |           .catch(() => alert('Failed to copy content.')); | ||||||
|     }); |   }); | ||||||
|  |  | ||||||
|     // Show the modal |   // Modal anzeigen | ||||||
|     const modal = new bootstrap.Modal(document.getElementById('dynamicModal')); |   const modal = new bootstrap.Modal(document.getElementById('dynamicModal')); | ||||||
|     modal.show(); |   modal.show(); | ||||||
|   } | } | ||||||
|   | |||||||
| @@ -1,4 +1,3 @@ | |||||||
| <!-- Universal Modal Structure --> |  | ||||||
| <div class="modal fade" id="dynamicModal" tabindex="-1" aria-labelledby="dynamicModalLabel" aria-hidden="true"> | <div class="modal fade" id="dynamicModal" tabindex="-1" aria-labelledby="dynamicModalLabel" aria-hidden="true"> | ||||||
|   <div class="modal-dialog"> |   <div class="modal-dialog"> | ||||||
|     <div class="modal-content"> |     <div class="modal-content"> | ||||||
| @@ -7,14 +6,27 @@ | |||||||
|         <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> |         <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> | ||||||
|       </div> |       </div> | ||||||
|       <div class="modal-body"> |       <div class="modal-body"> | ||||||
|         <div class="input-group"> |         <!-- Warnbox, falls vorhanden --> | ||||||
|  |         <div id="dynamicModalWarning" class="alert alert-warning d-none" role="alert"> | ||||||
|  |           <i class="fa-solid fa-triangle-exclamation"></i> <span id="dynamicModalWarningText"></span> | ||||||
|  |         </div> | ||||||
|  |         <!-- Infobox, falls vorhanden --> | ||||||
|  |         <div id="dynamicModalInfo" class="alert alert-info d-none" role="alert"> | ||||||
|  |           <i class="fa-solid fa-circle-info"></i> <span id="dynamicModalInfoText"></span> | ||||||
|  |         </div> | ||||||
|  |         <!-- Eingabebox für Identifier --> | ||||||
|  |         <div class="input-group mt-2"> | ||||||
|           <input type="text" id="dynamicModalContent" class="form-control" readonly> |           <input type="text" id="dynamicModalContent" class="form-control" readonly> | ||||||
|           <button class="btn btn-outline-secondary" type="button" id="dynamicCopyButton">Copy</button> |           <button class="btn btn-outline-secondary" type="button" id="dynamicCopyButton">Copy</button> | ||||||
|         </div> |         </div> | ||||||
|  |         <!-- Link, falls vorhanden --> | ||||||
|  |         <div id="dynamicModalLink" class="mt-3 d-none"> | ||||||
|  |           <a href="#" target="_blank" class="btn btn-primary w-100" id="dynamicModalLinkHref">Open Link</a> | ||||||
|  |         </div> | ||||||
|       </div> |       </div> | ||||||
|       <div class="modal-footer"> |       <div class="modal-footer"> | ||||||
|         <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> |         <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
| </div> | </div> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user