diff --git a/sys0-code/test/overview.php b/sys0-code/test/overview.php index a404b1d..437f6f2 100644 --- a/sys0-code/test/overview.php +++ b/sys0-code/test/overview.php @@ -257,15 +257,12 @@ function updatePrinterData(data) { if(printer.view==0 || printer.view==2){ if (own_id == printer.userid || cancel_all == "1") { - // Extract the iframe + // Locate the iframe const iframe = printerCard.querySelector('iframe'); - const iframeParent = iframe.parentNode; + if (!iframe) return; // If iframe doesn't exist, exit the function - // Create a temporary container for the new content - const tempContainer = document.createElement('div'); - - // Set the new content, excluding the iframe - tempContainer.innerHTML = ` + // Construct the new HTML content + const data = `
Drucker ${printer.printer_id}
@@ -283,17 +280,22 @@ if (own_id == printer.userid || cancel_all == "1") { Vergangene Druckzeit${printer.print_time} Datei
${printer.file}
${printer.full_file}
- Freigeben + Freigeben `; - // Replace the content around the iframe - while (iframeParent.firstChild && printerCard.firstChild !== iframe) { - iframeParent.removeChild(iframeParent.firstChild); + // Insert the new content before the iframe + iframe.insertAdjacentHTML('beforebegin', data); + + // Optionally, remove old content that is not part of the new data or iframe + const children = Array.from(printerCard.childNodes); + for (let child of children) { + if (child !== iframe && child !== iframe.previousElementSibling) { + printerCard.removeChild(child); + } } - printerCard.insertBefore(contentContainer, iframe); }else{ printerCard.innerHTML = `