This commit is contained in:
Nordi98 2025-06-26 03:02:08 +02:00
parent f653901eb9
commit 6a11ec41ca
3 changed files with 198 additions and 265 deletions

View file

@ -10,39 +10,70 @@
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.7);
}
#image {
#image-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 90%;
max-height: 90%;
display: none;
}
#image {
max-width: 100%;
max-height: 100%;
}
#document-id {
position: absolute;
bottom: 10px;
left: 10px;
color: white;
background-color: rgba(0, 0, 0, 0.5);
padding: 5px;
border-radius: 3px;
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<img id="image" src="" alt="Image" style="display:none;">
<div id="image-container">
<img id="image" src="" alt="Document">
<div id="document-id"></div>
</div>
<script>
window.addEventListener('message', function(event) {
if (event.data.action === 'show') {
// Zeige das spezifische Dokument basierend auf der ID oder URL
document.getElementById('image').src = event.data.imageUrl;
document.getElementById('image').style.display = 'block';
// Zeige optional die Dokument-ID an
if (event.data.documentId) {
document.getElementById('document-id').textContent = "Dokument: " + event.data.documentId;
}
document.getElementById('image-container').style.display = 'block';
// Logge die Dokument-Informationen zur Fehlersuche
console.log("Dokument angezeigt:", event.data);
} else if (event.data.action === 'hide') {
document.getElementById('image').style.display = 'none';
document.getElementById('image-container').style.display = 'none';
}
});
document.addEventListener("keydown", function(event) {
if (event.key === "Escape") {
document.getElementById('image').style.display = 'none';
axios.post(`https://${GetParentResourceName()}/hideFrame`, {})
.then(function (response) {
})
.catch(function (error) {
});
}
});
if (event.key === "Escape") {
document.getElementById('image-container').style.display = 'none';
axios.post(`https://${GetParentResourceName()}/hideFrame`, {})
.then(function (response) {
console.log("Frame versteckt");
})
.catch(function (error) {
console.error("Fehler beim Verstecken des Frames:", error);
});
}
});
</script>
</body>
</html>