index.html aktualisiert
This commit is contained in:
256
index.html
256
index.html
@@ -1,70 +1,186 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8" />
|
||||||
<title>ZIR - Live Preview</title>
|
<title>ZIR - Live Preview</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
html, body {
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
height: 100%;
|
||||||
margin: 0; padding: 0;
|
margin: 0;
|
||||||
background-color: #f4f4f7; color: #333;
|
font-family: "Segoe UI", Roboto, Arial, sans-serif;
|
||||||
display: flex; flex-direction: column; align-items: center; min-height: 100vh;
|
background: #f0f2f5;
|
||||||
}
|
color: #222;
|
||||||
header {
|
display: flex;
|
||||||
background-color: #0078d7; color: white; width: 100%;
|
flex-direction: column;
|
||||||
padding: 16px 24px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
}
|
||||||
text-align: center; font-size: 1.2rem; font-weight: 600;
|
|
||||||
}
|
header {
|
||||||
main { flex: 1; display:flex; align-items:center; justify-content:center; width:100%; padding:20px; box-sizing:border-box; }
|
background: #0078d7;
|
||||||
.preview-container {
|
color: white;
|
||||||
background-color: white; padding: 16px; border-radius: 12px;
|
padding: 16px 24px;
|
||||||
box-shadow: 0 6px 18px rgba(0,0,0,0.08); max-width: 1000px; width: 100%; text-align: center; position: relative;
|
font-size: 20px;
|
||||||
}
|
font-weight: 600;
|
||||||
.preview-container img { border: 1px solid #e0e0e0; max-width: 100%; height: auto; border-radius: 8px; display: none; }
|
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
|
||||||
.info { margin-top: 12px; font-size: 0.95rem; color: #555; }
|
flex-shrink: 0;
|
||||||
footer { padding: 12px 24px; text-align:center; font-size:0.8rem; color:#888; }
|
|
||||||
.spinner { border:6px solid #f3f3f3; border-top:6px solid #0078d7; border-radius:50%; width:48px; height:48px; animation:spin 1s linear infinite; margin: 26px auto; }
|
display: flex;
|
||||||
@keyframes spin { 0%{transform:rotate(0deg)} 100%{transform:rotate(360deg)} }
|
justify-content: center;
|
||||||
</style>
|
align-items: center;
|
||||||
</head>
|
text-align: center;
|
||||||
<body>
|
}
|
||||||
<header>ZIR – Live Preview</header>
|
|
||||||
<main>
|
main {
|
||||||
<div class="preview-container">
|
flex: 1;
|
||||||
<div class="spinner" id="spinner"></div>
|
display: flex;
|
||||||
<img id="labelImage" src="" alt="Label preview" />
|
flex-direction: column;
|
||||||
<div class="info"><code id="inputPath"></code> Neue Labels werden automatisch angezeigt.</div>
|
max-width: 1200px;
|
||||||
</div>
|
margin: 20px auto;
|
||||||
</main>
|
width: 95%;
|
||||||
<footer>© 2025 ZIR Viewer</footer>
|
}
|
||||||
|
|
||||||
<script>
|
.controls {
|
||||||
const { ipcRenderer, remote } = require('electron');
|
display: flex;
|
||||||
const img = document.getElementById('labelImage');
|
gap: 12px;
|
||||||
const spinner = document.getElementById('spinner');
|
align-items: center;
|
||||||
const inputPath = document.getElementById('inputPath');
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
// Zeige Input-Pfad (wird per ipc vom Main ggf. gesetzt)
|
|
||||||
ipcRenderer.on('show-input-path', (ev, p) => {
|
button {
|
||||||
inputPath.textContent = p;
|
background: #0078d7;
|
||||||
});
|
color: white;
|
||||||
|
border: none;
|
||||||
ipcRenderer.on('show-png', (ev, filePath) => {
|
padding: 8px 14px;
|
||||||
spinner.style.display = 'block';
|
border-radius: 6px;
|
||||||
img.style.display = 'none';
|
cursor: pointer;
|
||||||
img.src = filePath + "?t=" + Date.now();
|
font-size: 14px;
|
||||||
img.onload = () => {
|
transition: background 0.2s ease;
|
||||||
spinner.style.display = 'none';
|
}
|
||||||
img.style.display = 'block';
|
|
||||||
};
|
button:hover {
|
||||||
img.onerror = () => {
|
background: #005fa1;
|
||||||
spinner.style.display = 'none';
|
}
|
||||||
img.style.display = 'none';
|
|
||||||
};
|
button.secondary {
|
||||||
});
|
background: #e5e7eb;
|
||||||
|
color: #222;
|
||||||
// Request main to send input path (in case main wants to show it)
|
}
|
||||||
ipcRenderer.send('request-input-path');
|
|
||||||
</script>
|
button.secondary:hover {
|
||||||
</body>
|
background: #d1d5db;
|
||||||
</html>
|
}
|
||||||
|
|
||||||
|
.panel {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
box-shadow: 0 6px 18px rgba(0,0,0,0.06);
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.labels {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-card {
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #fafafa;
|
||||||
|
padding: 16px;
|
||||||
|
align-items: flex-start;
|
||||||
|
box-shadow: 0 3px 10px rgba(0,0,0,0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.label-card img {
|
||||||
|
max-width: 500px;
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.meta {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
flex-shrink: 0;
|
||||||
|
text-align: center;
|
||||||
|
color: #666;
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 10px 0;
|
||||||
|
background: #f0f2f5;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>ZIR - Live Preview</header>
|
||||||
|
<main>
|
||||||
|
<div class="controls">
|
||||||
|
<button id="clearBtn" class="secondary">Verlauf löschen</button>
|
||||||
|
<div style="flex:1"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<div id="labels" class="labels"></div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>Neue Labels werden automatisch angezeigt. Neueste oben.</footer>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const { ipcRenderer } = require('electron');
|
||||||
|
const container = document.getElementById('labels');
|
||||||
|
const clearBtn = document.getElementById('clearBtn');
|
||||||
|
|
||||||
|
ipcRenderer.on('show-png', (ev, filePath) => {
|
||||||
|
const card = document.createElement('div');
|
||||||
|
card.className = 'label-card';
|
||||||
|
|
||||||
|
const img = document.createElement('img');
|
||||||
|
img.src = filePath + '?t=' + Date.now();
|
||||||
|
img.alt = 'Label';
|
||||||
|
|
||||||
|
const info = document.createElement('div');
|
||||||
|
info.innerHTML = `<div class="meta">Erstellt: ${new Date().toLocaleString()}</div>`;
|
||||||
|
|
||||||
|
card.appendChild(img);
|
||||||
|
card.appendChild(info);
|
||||||
|
|
||||||
|
container.prepend(card);
|
||||||
|
container.scrollTop = 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
clearBtn.addEventListener('click', () => {
|
||||||
|
while (container.firstChild) container.removeChild(container.firstChild);
|
||||||
|
ipcRenderer.send('clear-history');
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.send('request-existing');
|
||||||
|
ipcRenderer.on('existing-files', (ev, files) => {
|
||||||
|
files.reverse().forEach(fp => {
|
||||||
|
const card = document.createElement('div');
|
||||||
|
card.className = 'label-card';
|
||||||
|
const img = document.createElement('img');
|
||||||
|
img.src = fp + '?t=' + Date.now();
|
||||||
|
const info = document.createElement('div');
|
||||||
|
info.innerHTML = `<div class="meta">Vorhanden</div>`;
|
||||||
|
card.appendChild(img);
|
||||||
|
card.appendChild(info);
|
||||||
|
container.appendChild(card);
|
||||||
|
});
|
||||||
|
container.scrollTop = 0;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
Reference in New Issue
Block a user