.
This commit is contained in:
@@ -256,55 +256,7 @@ function updatePrinterData(data) {
|
||||
}
|
||||
|
||||
if(printer.view==0 || printer.view==2){
|
||||
if (own_id == printer.userid || cancel_all == "1") {
|
||||
// Get the current iframe
|
||||
const iframe = printerCard.querySelector('iframe');
|
||||
|
||||
// Store necessary iframe attributes if needed
|
||||
const iframeSrc = iframe ? iframe.src : null;
|
||||
|
||||
// Remove iframe temporarily
|
||||
if (iframe) {
|
||||
printerCard.removeChild(iframe);
|
||||
}
|
||||
|
||||
// Update the innerHTML, excluding the iframe initially
|
||||
printerCard.innerHTML = `
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Drucker ${printer.printer_id}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- Placeholder for iframe reattachment -->
|
||||
<div id="iframe-placeholder"></div>
|
||||
<div class="progress">
|
||||
<div class="progress-bar" role="progressbar" style="width: ${printer.progress}%" aria-valuenow="${printer.progress}" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
<table class="table table-borderless">
|
||||
<thead>
|
||||
<tr><td>Status</td><td style="color: ${getColorByStatus(printer.view)}">${printerStatus}</td></tr>
|
||||
<tr><td>Genutzt von</td><td>${printer.username}</td></tr>
|
||||
<tr><td>Filamentfarbe</td><td>${printer.filament_color}</td></tr>
|
||||
<tr><td>Erwartete Druckzeit</td><td>${printer.print_time_total}</td></tr>
|
||||
<tr><td>Verbleibende Druckzeit</td><td>${printer.print_time_left}</td></tr>
|
||||
<tr><td>Vergangene Druckzeit</td><td>${printer.print_time}</td></tr>
|
||||
<tr><td>Datei</td><td><div class='hover-element'>${printer.file}<div class='description'>${printer.full_file}</div></div></td></tr>
|
||||
</thead>
|
||||
<tr><td><a class='btn btn-success' href='overview.php?free=${printer.printer_id}&rid=<?php echo($_SESSION["rid"]); ?>'>Freigeben</a></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
`;
|
||||
|
||||
// Create a new iframe element or use the existing one if it was stored
|
||||
const newIframe = document.createElement('iframe');
|
||||
newIframe.height = "230px";
|
||||
newIframe.scrolling = "no";
|
||||
newIframe.width = "100%";
|
||||
newIframe.src = iframeSrc ? iframeSrc : `/app/webcam.php?printer_id=${printer.printer_id}&username=<?php echo($username); ?>&url=${printer.url}`;
|
||||
|
||||
// Reattach the iframe at the placeholder
|
||||
const placeholder = printerCard.querySelector('#iframe-placeholder');
|
||||
placeholder.parentNode.replaceChild(newIframe, placeholder);
|
||||
}1~if (own_id == printer.userid || cancel_all == "1") {
|
||||
if (own_id == printer.userid || cancel_all == "1") {
|
||||
// Get the current iframe
|
||||
const iframe = printerCard.querySelector('iframe');
|
||||
|
||||
@@ -353,6 +305,8 @@ if (own_id == printer.userid || cancel_all == "1") {
|
||||
const placeholder = printerCard.querySelector('#iframe-placeholder');
|
||||
placeholder.parentNode.replaceChild(newIframe, placeholder);
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
printerCard.innerHTML = `
|
||||
<div class="card-body">
|
||||
|
||||
Reference in New Issue
Block a user