Docfile commited on
Commit
6c087d6
·
verified ·
1 Parent(s): 9938510

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +13 -15
templates/index.html CHANGED
@@ -612,10 +612,12 @@
612
  afficherSauvegardes();
613
  }
614
 
615
- function afficherSauvegardes() {
 
616
  const sauvegardes = JSON.parse(localStorage.getItem('mariam_ai_sauvegardes') || '[]');
617
  const backupsList = document.getElementById('backups-list');
618
  backupsList.innerHTML = '';
 
619
  if (sauvegardes.length === 0) {
620
  backupsList.innerHTML = `
621
  <div class="bg-blue-50 rounded-lg p-8 text-center">
@@ -662,7 +664,7 @@
662
  </button>
663
  </div>
664
  </div>
665
- <div class="text-sm text-gray-700 backup-content prose max-w-none mt-3" style="display: none;">${marked.parse(sauvegarde.contenu)}</div>
666
  `;
667
  backupsList.appendChild(sauvegardeDiv);
668
 
@@ -672,24 +674,21 @@
672
  // Ignorer les clics sur les boutons
673
  if (e.target.tagName === "BUTTON" || e.target.closest('button')) return;
674
 
675
- const allContents = document.querySelectorAll('.backup-content');
676
- allContents.forEach(content => {
677
- if (content !== backupContentDiv) {
678
- content.classList.remove('backup-content-expanded');
679
- content.style.display = 'none'; // Masquer les autres contenus
680
  }
681
  });
682
 
683
- backupContentDiv.classList.toggle('backup-content-expanded');
684
-
685
- // Basculer l'affichage (display) en fonction de l'état
686
- if (backupContentDiv.classList.contains('backup-content-expanded')) {
687
- backupContentDiv.style.display = 'block'; // Afficher le contenu
688
  setTimeout(() => {
689
  MathJax.typesetPromise([backupContentDiv]);
690
- }, 300);
691
  } else {
692
- backupContentDiv.style.display = 'none'; // Masquer le contenu
693
  }
694
  });
695
 
@@ -747,7 +746,6 @@
747
  });
748
  }
749
 
750
-
751
  async function submitFrancaisForm() {
752
  const form = document.getElementById('francais-form');
753
  const output = document.getElementById('francais-output');
 
612
  afficherSauvegardes();
613
  }
614
 
615
+
616
+ function afficherSauvegardes() {
617
  const sauvegardes = JSON.parse(localStorage.getItem('mariam_ai_sauvegardes') || '[]');
618
  const backupsList = document.getElementById('backups-list');
619
  backupsList.innerHTML = '';
620
+
621
  if (sauvegardes.length === 0) {
622
  backupsList.innerHTML = `
623
  <div class="bg-blue-50 rounded-lg p-8 text-center">
 
664
  </button>
665
  </div>
666
  </div>
667
+ <div class="backup-content mt-4 text-sm text-gray-700 prose max-w-none border-t border-gray-100 pt-3" style="display: none;">${marked.parse(sauvegarde.contenu)}</div>
668
  `;
669
  backupsList.appendChild(sauvegardeDiv);
670
 
 
674
  // Ignorer les clics sur les boutons
675
  if (e.target.tagName === "BUTTON" || e.target.closest('button')) return;
676
 
677
+ // Fermer tous les autres éléments ouverts
678
+ document.querySelectorAll('.backup-content').forEach(content => {
679
+ if (content !== backupContentDiv && content.style.display === 'block') {
680
+ content.style.display = 'none';
 
681
  }
682
  });
683
 
684
+ // Basculer l'affichage du contenu actuel
685
+ if (backupContentDiv.style.display === 'none') {
686
+ backupContentDiv.style.display = 'block';
 
 
687
  setTimeout(() => {
688
  MathJax.typesetPromise([backupContentDiv]);
689
+ }, 100);
690
  } else {
691
+ backupContentDiv.style.display = 'none';
692
  }
693
  });
694
 
 
746
  });
747
  }
748
 
 
749
  async function submitFrancaisForm() {
750
  const form = document.getElementById('francais-form');
751
  const output = document.getElementById('francais-output');