diff --git a/index.html b/index.html index ddfb1d7..113a35e 100644 --- a/index.html +++ b/index.html @@ -348,6 +348,26 @@ color: #6b7280; margin-top: 4px; } + + .vcard-preview-label { + margin: 4px 0 6px 0; + color: #374151; + font-weight: 500; + } + + .vcard-preview { + margin: 0 0 15px 0; + padding: 10px; + border: 1px solid #e5e7eb; + border-radius: 6px; + background: #f9fafb; + color: #374151; + font-size: 12px; + line-height: 1.45; + white-space: pre-wrap; + word-break: break-word; + min-height: 80px; + } @@ -439,44 +459,47 @@
- +
- +
- +
- +
- +
- +
- + - + - + + +

vCard-Vorschau:

+
Bitte mindestens Vorname, Nachname oder Organisation eingeben.
diff --git a/main.js b/main.js index 9788bbc..7e8143b 100644 --- a/main.js +++ b/main.js @@ -42,6 +42,7 @@ document.addEventListener('DOMContentLoaded', function() { const shareBtn = document.getElementById('share'); const shareHint = document.getElementById('share-hint'); const eventBerlinPreview = document.getElementById('event-berlin-preview'); + const vcardPreview = document.getElementById('vcard-preview'); const MAX_EVENT_TITLE = 2000; const MAX_EVENT_LOCATION = 1000; @@ -688,6 +689,21 @@ document.addEventListener('DOMContentLoaded', function() { return lines.join('\r\n'); } + function updateVCardPreview(text) { + if (!vcardPreview) { + return; + } + if (contentModeSelect.value !== 'vcard') { + vcardPreview.textContent = ''; + return; + } + if (text && String(text).trim()) { + vcardPreview.textContent = String(text); + return; + } + vcardPreview.textContent = 'Bitte mindestens Vorname, Nachname oder Organisation eingeben.'; + } + function generateQRCode() { const mode = contentModeSelect.value; const text = textInput.value.trim(); @@ -707,6 +723,9 @@ document.addEventListener('DOMContentLoaded', function() { // Clear previous error errorMessage.textContent = ''; downloadBtn.style.display = 'none'; + if (mode !== 'vcard') { + updateVCardPreview(''); + } let qrText = ''; @@ -811,6 +830,7 @@ document.addEventListener('DOMContentLoaded', function() { const hasIdentity = firstName.trim() || lastName.trim() || org.trim(); if (!hasIdentity) { + updateVCardPreview(''); errorMessage.textContent = 'Bitte geben Sie mindestens Vorname, Nachname oder Organisation an'; qrcodeCanvas.style.display = 'none'; qrcodeImg.style.display = 'none'; @@ -828,6 +848,7 @@ document.addEventListener('DOMContentLoaded', function() { address: address, note: note }); + updateVCardPreview(qrText); textInput.value = qrText; toggleClearButton(); } else if (mode === 'wifi') {