amine_dubs commited on
Commit
b77135a
·
1 Parent(s): 8315bcd
Files changed (2) hide show
  1. static/script.js +8 -5
  2. templates/index.html +1 -1
static/script.js CHANGED
@@ -444,7 +444,6 @@ window.onload = function() {
444
  // Show the original text
445
  if (docInputText) {
446
  docInputText.textContent = data.original_text;
447
-
448
  // Apply RTL styling based on source language
449
  if (data.detected_source_lang && sourceLang === 'auto') {
450
  applyRtlStyling(data.detected_source_lang, docInputText);
@@ -452,17 +451,21 @@ window.onload = function() {
452
  applyRtlStyling(sourceLang, docInputText);
453
  }
454
  }
455
-
456
  // Show the translated text
457
  if (docOutput) {
458
  docOutput.textContent = data.translated_text;
459
-
460
  // Apply RTL styling based on target language
461
  applyRtlStyling(targetLang, docOutput);
462
  }
463
-
464
  // Show the document result container
465
- if (docResult) docResult.style.display = 'block';
 
 
 
 
 
466
  })
467
  .catch(error => {
468
  console.error('Error during document translation:', error);
 
444
  // Show the original text
445
  if (docInputText) {
446
  docInputText.textContent = data.original_text;
 
447
  // Apply RTL styling based on source language
448
  if (data.detected_source_lang && sourceLang === 'auto') {
449
  applyRtlStyling(data.detected_source_lang, docInputText);
 
451
  applyRtlStyling(sourceLang, docInputText);
452
  }
453
  }
454
+
455
  // Show the translated text
456
  if (docOutput) {
457
  docOutput.textContent = data.translated_text;
 
458
  // Apply RTL styling based on target language
459
  applyRtlStyling(targetLang, docOutput);
460
  }
461
+
462
  // Show the document result container
463
+ if (docResult) {
464
+ docResult.classList.remove('hidden');
465
+ }
466
+ // Update filename and detected language
467
+ if (docFilename) docFilename.textContent = data.original_filename || '';
468
+ if (docSourceLang) docSourceLang.textContent = (data.detected_source_lang ? getLanguageName(data.detected_source_lang) : getLanguageName(sourceLang));
469
  })
470
  .catch(error => {
471
  console.error('Error during document translation:', error);
templates/index.html CHANGED
@@ -207,7 +207,7 @@
207
  </div>
208
 
209
  <div class="document-result-area">
210
- <div id="doc-result" class="document-panels">
211
  <div class="panel source-panel">
212
  <div class="panel-header">
213
  <span class="panel-title">Original Document</span>
 
207
  </div>
208
 
209
  <div class="document-result-area">
210
+ <div id="doc-result" class="document-panels hidden">
211
  <div class="panel source-panel">
212
  <div class="panel-header">
213
  <span class="panel-title">Original Document</span>