2-Sprachen (DE,EN)
This commit is contained in:
60
js/master.js
60
js/master.js
@@ -33,7 +33,7 @@ function updateConnectionStatus(isConnected) {
|
||||
if (isConnected) {
|
||||
statusIndicator.classList.remove('disconnected');
|
||||
statusIndicator.classList.add('connected');
|
||||
connectionText.textContent = '✓ Verbunden mit Signatur-Station';
|
||||
connectionText.textContent = t('master.connectedToStation');
|
||||
|
||||
// Enable PDF selection
|
||||
pdfInput.disabled = false;
|
||||
@@ -42,7 +42,7 @@ function updateConnectionStatus(isConnected) {
|
||||
} else {
|
||||
statusIndicator.classList.remove('connected');
|
||||
statusIndicator.classList.add('disconnected');
|
||||
connectionText.textContent = '⏳ Warte auf Signatur-Station...';
|
||||
connectionText.textContent = t('master.waitingForStation');
|
||||
|
||||
// Disable PDF selection
|
||||
pdfInput.disabled = true;
|
||||
@@ -358,7 +358,8 @@ async function renderAllPages(pdfBytes) {
|
||||
// Add page separator
|
||||
const separator = document.createElement('div');
|
||||
separator.className = 'pdf-page-separator';
|
||||
separator.textContent = `Seite ${pageNum} von ${numPages}`;
|
||||
const pageText = currentLanguage === 'de' ? 'Seite' : 'Page';
|
||||
separator.textContent = `${pageText} ${pageNum} ${currentLanguage === 'de' ? 'von' : 'of'} ${numPages}`;
|
||||
container.appendChild(separator);
|
||||
|
||||
// Create canvas for this page
|
||||
@@ -404,7 +405,8 @@ function updatePageNavigation() {
|
||||
|
||||
if (totalPages > 1) {
|
||||
pageNav.style.display = 'flex';
|
||||
pageInfo.textContent = `Seite ${currentPageNum} von ${totalPages}`;
|
||||
const pageText = currentLanguage === 'de' ? 'Seite' : 'Page';
|
||||
pageInfo.textContent = `${pageText} ${currentPageNum} ${currentLanguage === 'de' ? 'von' : 'of'} ${totalPages}`;
|
||||
prevBtn.disabled = currentPageNum <= 1;
|
||||
nextBtn.disabled = currentPageNum >= totalPages;
|
||||
|
||||
@@ -591,7 +593,7 @@ async function showSignatureOverlay(signatureDataUrl) {
|
||||
}
|
||||
|
||||
document.getElementById('statusMessage').className = 'status signed';
|
||||
document.getElementById('statusMessage').textContent = '✅ Unterschrift erhalten! Unterschrift oben sichtbar. Ziehe sie auf das PDF.';
|
||||
document.getElementById('statusMessage').textContent = t('master.signatureReceived');
|
||||
document.getElementById('downloadButton').disabled = true;
|
||||
document.getElementById('downloadHint').style.display = 'none';
|
||||
|
||||
@@ -903,10 +905,19 @@ function updateTextInputWithDate() {
|
||||
const textInput = document.getElementById('textInput');
|
||||
if (textInput) {
|
||||
const currentDate = getCurrentDateString();
|
||||
textInput.value = `Abgeholt am ${currentDate} durch:`;
|
||||
if (currentLanguage === 'de') {
|
||||
textInput.value = `Abgeholt am ${currentDate} durch:`;
|
||||
} else {
|
||||
textInput.value = `Picked up on ${currentDate} by:`;
|
||||
}
|
||||
// Update overlay text immediately
|
||||
updateTextInOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
// Make function globally accessible for i18n.js
|
||||
window.updateTextInputWithDate = updateTextInputWithDate;
|
||||
|
||||
function updateTextInOverlay() {
|
||||
const textInput = document.getElementById('textInput');
|
||||
const text = textInput ? textInput.value : '';
|
||||
@@ -923,6 +934,9 @@ function updateTextInOverlay() {
|
||||
}
|
||||
}
|
||||
|
||||
// Make function globally accessible for i18n.js
|
||||
window.updateTextInOverlay = updateTextInOverlay;
|
||||
|
||||
function removeSignatureOverlay() {
|
||||
// Only remove the overlay, keep signedPdfBytes intact
|
||||
const overlay = document.getElementById('signatureOverlay');
|
||||
@@ -965,7 +979,7 @@ function removeSignature() {
|
||||
placeholderContent.style.display = 'flex';
|
||||
|
||||
document.getElementById('statusMessage').className = 'status waiting';
|
||||
document.getElementById('statusMessage').textContent = 'Warte auf Unterschrift von der Signatur-Station...';
|
||||
document.getElementById('statusMessage').textContent = t('master.waitingForSignature');
|
||||
document.getElementById('downloadButton').disabled = true;
|
||||
document.getElementById('downloadHint').style.display = 'none';
|
||||
signatureDataUrl = null;
|
||||
@@ -987,7 +1001,7 @@ document.getElementById('placeSignatureButton').addEventListener('click', async
|
||||
// Show loading state
|
||||
const btn = document.getElementById('placeSignatureButton');
|
||||
const originalText = btn.textContent;
|
||||
btn.textContent = '⏳ PDF wird erstellt...';
|
||||
btn.textContent = '⏳ ' + (currentLanguage === 'de' ? 'PDF wird erstellt...' : 'PDF is being created...');
|
||||
btn.disabled = true;
|
||||
|
||||
// Add signature to PDF
|
||||
@@ -1002,7 +1016,7 @@ document.getElementById('placeSignatureButton').addEventListener('click', async
|
||||
|
||||
// Update status
|
||||
document.getElementById('statusMessage').className = 'status ready';
|
||||
document.getElementById('statusMessage').textContent = '✅ PDF wurde erstellt! Bereit zum Download.';
|
||||
document.getElementById('statusMessage').textContent = t('master.pdfCreated');
|
||||
|
||||
// Enable download
|
||||
document.getElementById('downloadButton').disabled = false;
|
||||
@@ -1098,7 +1112,7 @@ document.getElementById('downloadButton').addEventListener('click', async () =>
|
||||
|
||||
// Reset place signature button
|
||||
const placeBtn = document.getElementById('placeSignatureButton');
|
||||
placeBtn.textContent = '✓ Unterschrift platzieren & PDF erstellen';
|
||||
placeBtn.textContent = t('master.placeSignature');
|
||||
placeBtn.disabled = false;
|
||||
|
||||
// Reset page navigation and scrollable state
|
||||
@@ -1165,7 +1179,7 @@ function resetToStart() {
|
||||
|
||||
// Reset status message
|
||||
document.getElementById('statusMessage').className = 'status waiting';
|
||||
document.getElementById('statusMessage').textContent = 'Warte auf Unterschrift von der Signatur-Station...';
|
||||
document.getElementById('statusMessage').textContent = t('master.waitingForSignature');
|
||||
|
||||
// Clear all data
|
||||
removeSignature();
|
||||
@@ -1222,5 +1236,29 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// Update translations when language changes (called from i18n.js)
|
||||
window.updateDynamicTranslationsCustom = function() {
|
||||
// Update page info if visible
|
||||
if (totalPages > 0) {
|
||||
const pageInfo = document.getElementById('pageInfo');
|
||||
if (pageInfo) {
|
||||
const pageText = currentLanguage === 'de' ? 'Seite' : 'Page';
|
||||
pageInfo.textContent = `${pageText} ${currentPageNum} ${currentLanguage === 'de' ? 'von' : 'of'} ${totalPages}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Re-translate connection status
|
||||
const statusIndicator = document.getElementById('statusIndicator');
|
||||
if (statusIndicator) {
|
||||
const isConnected = statusIndicator.classList.contains('connected');
|
||||
updateConnectionStatus(isConnected);
|
||||
}
|
||||
|
||||
// Update text input default value
|
||||
if (typeof updateTextInputWithDate === 'function') {
|
||||
updateTextInputWithDate();
|
||||
}
|
||||
};
|
||||
|
||||
// Connect WebSocket on load
|
||||
connectWebSocket();
|
||||
|
||||
Reference in New Issue
Block a user