Spaces:
Running
Running
Add 2 files
Browse files- index.html +97 -9
- prompts.txt +2 -1
index.html
CHANGED
|
@@ -5,6 +5,8 @@
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Application Trilingue - Bac Scientifique</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
|
|
|
|
|
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
<style>
|
| 10 |
.rtl {
|
|
@@ -155,7 +157,7 @@
|
|
| 155 |
<p class="text-sm">Terme général : Vₙ = 2 × 3ⁿ</p>
|
| 156 |
</div>
|
| 157 |
|
| 158 |
-
<button class="mt-3 bg-blue-100 hover:bg-blue-200 text-blue-800 px-3 py-1 rounded text-sm w-full dark:bg-blue-900 dark:text-blue-200">
|
| 159 |
<i class="fas fa-download mr-1"></i> Télécharger le PDF
|
| 160 |
</button>
|
| 161 |
</div>
|
|
@@ -197,7 +199,7 @@
|
|
| 197 |
<p class="text-sm mt-1">Exemple : Un objet de 2kg soumis à une force de 10N a une accélération de 5m/s²</p>
|
| 198 |
</div>
|
| 199 |
|
| 200 |
-
<button class="mt-3 bg-red-100 hover:bg-red-200 text-red-800 px-3 py-1 rounded text-sm w-full dark:bg-red-900 dark:text-red-200">
|
| 201 |
<i class="fas fa-download mr-1"></i> Télécharger le PDF
|
| 202 |
</button>
|
| 203 |
</div>
|
|
@@ -240,7 +242,7 @@
|
|
| 240 |
<p class="text-sm mt-1">FEM = E°(Cu²⁺/Cu) - E°(Zn²⁺/Zn) = +0,34 - (-0,76) = 1,10V</p>
|
| 241 |
</div>
|
| 242 |
|
| 243 |
-
<button class="mt-3 bg-yellow-100 hover:bg-yellow-200 text-yellow-800 px-3 py-1 rounded text-sm w-full dark:bg-yellow-900 dark:text-yellow-200">
|
| 244 |
<i class="fas fa-download mr-1"></i> Télécharger le PDF
|
| 245 |
</button>
|
| 246 |
</div>
|
|
@@ -282,10 +284,10 @@
|
|
| 282 |
|
| 283 |
<div class="bg-green-50 p-3 rounded dark:bg-gray-700">
|
| 284 |
<h5 class="font-medium text-green-800 dark:text-green-300">Brins direct et retardé :</h5>
|
| 285 |
-
<p class="text-sm">Le brin direct
|
| 286 |
</div>
|
| 287 |
|
| 288 |
-
<button class="mt-3 bg-green-100 hover:bg-green-200 text-green-800 px-3 py-1 rounded text-sm w-full dark:bg-green-900 dark:text-green-200">
|
| 289 |
<i class="fas fa-download mr-1"></i> Télécharger le PDF
|
| 290 |
</button>
|
| 291 |
</div>
|
|
@@ -572,6 +574,9 @@
|
|
| 572 |
</footer>
|
| 573 |
|
| 574 |
<script>
|
|
|
|
|
|
|
|
|
|
| 575 |
// Objet de traductions étendu avec les nouvelles sections
|
| 576 |
const translations = {
|
| 577 |
fr: {
|
|
@@ -599,7 +604,9 @@
|
|
| 599 |
modeToggleLight: "Mode Sombre",
|
| 600 |
modeToggleDark: "Mode Clair",
|
| 601 |
viewCourse: "Voir le cours",
|
| 602 |
-
downloadPDF: "Télécharger le PDF"
|
|
|
|
|
|
|
| 603 |
},
|
| 604 |
en: {
|
| 605 |
headerTitle: "Educational Application - Scientific Baccalaureate",
|
|
@@ -626,7 +633,9 @@
|
|
| 626 |
modeToggleLight: "Dark Mode",
|
| 627 |
modeToggleDark: "Light Mode",
|
| 628 |
viewCourse: "View Course",
|
| 629 |
-
downloadPDF: "Download PDF"
|
|
|
|
|
|
|
| 630 |
},
|
| 631 |
ar: {
|
| 632 |
headerTitle: "تطبيق تعليمي - البكالوريا العلمية",
|
|
@@ -653,10 +662,81 @@
|
|
| 653 |
modeToggleLight: "الوضع الداكن",
|
| 654 |
modeToggleDark: "الوضع الفاتح",
|
| 655 |
viewCourse: "عرض الدرس",
|
| 656 |
-
downloadPDF: "تحميل PDF"
|
|
|
|
|
|
|
| 657 |
}
|
| 658 |
};
|
| 659 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 660 |
// Fonction de mise à jour de l'interface en fonction de la langue sélectionnée
|
| 661 |
function updateLanguage(lang) {
|
| 662 |
document.getElementById("headerTitle").innerText = translations[lang].headerTitle;
|
|
@@ -687,7 +767,7 @@
|
|
| 687 |
});
|
| 688 |
|
| 689 |
// Mettre à jour les boutons "Télécharger le PDF"
|
| 690 |
-
document.querySelectorAll('.
|
| 691 |
btn.innerHTML = `<i class="fas fa-download mr-1"></i> ${translations[lang].downloadPDF}`;
|
| 692 |
});
|
| 693 |
|
|
@@ -833,6 +913,14 @@
|
|
| 833 |
});
|
| 834 |
});
|
| 835 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 836 |
// Initialisation par défaut en français
|
| 837 |
updateLanguage("fr");
|
| 838 |
</script>
|
|
|
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Application Trilingue - Bac Scientifique</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
| 9 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"></script>
|
| 10 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 11 |
<style>
|
| 12 |
.rtl {
|
|
|
|
| 157 |
<p class="text-sm">Terme général : Vₙ = 2 × 3ⁿ</p>
|
| 158 |
</div>
|
| 159 |
|
| 160 |
+
<button class="mt-3 bg-blue-100 hover:bg-blue-200 text-blue-800 px-3 py-1 rounded text-sm w-full dark:bg-blue-900 dark:text-blue-200 download-pdf-btn" data-subject="math">
|
| 161 |
<i class="fas fa-download mr-1"></i> Télécharger le PDF
|
| 162 |
</button>
|
| 163 |
</div>
|
|
|
|
| 199 |
<p class="text-sm mt-1">Exemple : Un objet de 2kg soumis à une force de 10N a une accélération de 5m/s²</p>
|
| 200 |
</div>
|
| 201 |
|
| 202 |
+
<button class="mt-3 bg-red-100 hover:bg-red-200 text-red-800 px-3 py-1 rounded text-sm w-full dark:bg-red-900 dark:text-red-200 download-pdf-btn" data-subject="physics">
|
| 203 |
<i class="fas fa-download mr-1"></i> Télécharger le PDF
|
| 204 |
</button>
|
| 205 |
</div>
|
|
|
|
| 242 |
<p class="text-sm mt-1">FEM = E°(Cu²⁺/Cu) - E°(Zn²⁺/Zn) = +0,34 - (-0,76) = 1,10V</p>
|
| 243 |
</div>
|
| 244 |
|
| 245 |
+
<button class="mt-3 bg-yellow-100 hover:bg-yellow-200 text-yellow-800 px-3 py-1 rounded text-sm w-full dark:bg-yellow-900 dark:text-yellow-200 download-pdf-btn" data-subject="chemistry">
|
| 246 |
<i class="fas fa-download mr-1"></i> Télécharger le PDF
|
| 247 |
</button>
|
| 248 |
</div>
|
|
|
|
| 284 |
|
| 285 |
<div class="bg-green-50 p-3 rounded dark:bg-gray-700">
|
| 286 |
<h5 class="font-medium text-green-800 dark:text-green-300">Brins direct et retardé :</h5>
|
| 287 |
+
<p class="text-sm">Le brin direct ème synthétisé continûment alors que le brin retardé est synthétisé sous forme de fragments d'Okazaki.</p>
|
| 288 |
</div>
|
| 289 |
|
| 290 |
+
<button class="mt-3 bg-green-100 hover:bg-green-200 text-green-800 px-3 py-1 rounded text-sm w-full dark:bg-green-900 dark:text-green-200 download-pdf-btn" data-subject="biology">
|
| 291 |
<i class="fas fa-download mr-1"></i> Télécharger le PDF
|
| 292 |
</button>
|
| 293 |
</div>
|
|
|
|
| 574 |
</footer>
|
| 575 |
|
| 576 |
<script>
|
| 577 |
+
// Initialisation de jsPDF
|
| 578 |
+
const { jsPDF } = window.jspdf;
|
| 579 |
+
|
| 580 |
// Objet de traductions étendu avec les nouvelles sections
|
| 581 |
const translations = {
|
| 582 |
fr: {
|
|
|
|
| 604 |
modeToggleLight: "Mode Sombre",
|
| 605 |
modeToggleDark: "Mode Clair",
|
| 606 |
viewCourse: "Voir le cours",
|
| 607 |
+
downloadPDF: "Télécharger le PDF",
|
| 608 |
+
pdfTitle: "Cours de {subject}",
|
| 609 |
+
pdfGenerated: "Généré par l'Application Éducative"
|
| 610 |
},
|
| 611 |
en: {
|
| 612 |
headerTitle: "Educational Application - Scientific Baccalaureate",
|
|
|
|
| 633 |
modeToggleLight: "Dark Mode",
|
| 634 |
modeToggleDark: "Light Mode",
|
| 635 |
viewCourse: "View Course",
|
| 636 |
+
downloadPDF: "Download PDF",
|
| 637 |
+
pdfTitle: "{subject} Course",
|
| 638 |
+
pdfGenerated: "Generated by Educational App"
|
| 639 |
},
|
| 640 |
ar: {
|
| 641 |
headerTitle: "تطبيق تعليمي - البكالوريا العلمية",
|
|
|
|
| 662 |
modeToggleLight: "الوضع الداكن",
|
| 663 |
modeToggleDark: "الوضع الفاتح",
|
| 664 |
viewCourse: "عرض الدرس",
|
| 665 |
+
downloadPDF: "تحميل PDF",
|
| 666 |
+
pdfTitle: "درس {subject}",
|
| 667 |
+
pdfGenerated: "تم إنشاؤه بواسطة التطبيق التعليمي"
|
| 668 |
}
|
| 669 |
};
|
| 670 |
|
| 671 |
+
// Fonction pour générer un PDF à partir du contenu du cours
|
| 672 |
+
function generatePDF(subject) {
|
| 673 |
+
const lang = document.getElementById("languageSelect").value;
|
| 674 |
+
const contentElement = document.getElementById(`${subject}-content`);
|
| 675 |
+
|
| 676 |
+
// Créer un nouveau document PDF
|
| 677 |
+
const doc = new jsPDF();
|
| 678 |
+
|
| 679 |
+
// Titre du PDF
|
| 680 |
+
const title = translations[lang].pdfTitle.replace('{subject}', translations[lang][`nav${subject.charAt(0).toUpperCase() + subject.slice(1)}`] || subject);
|
| 681 |
+
doc.setFontSize(18);
|
| 682 |
+
doc.text(title, 105, 20, { align: 'center' });
|
| 683 |
+
|
| 684 |
+
// Contenu du cours
|
| 685 |
+
doc.setFontSize(12);
|
| 686 |
+
let y = 40;
|
| 687 |
+
|
| 688 |
+
// Parcourir tous les éléments de contenu
|
| 689 |
+
const elements = contentElement.querySelectorAll('h4, p, h5, li, div');
|
| 690 |
+
|
| 691 |
+
elements.forEach(element => {
|
| 692 |
+
// Ignorer les boutons et certains éléments
|
| 693 |
+
if (element.classList.contains('download-pdf-btn')) return;
|
| 694 |
+
|
| 695 |
+
// Traiter différemment selon le type d'élément
|
| 696 |
+
if (element.tagName === 'H4') {
|
| 697 |
+
doc.setFontSize(14);
|
| 698 |
+
doc.setTextColor(0, 0, 0);
|
| 699 |
+
doc.setFont(undefined, 'bold');
|
| 700 |
+
doc.text(element.textContent, 15, y);
|
| 701 |
+
y += 10;
|
| 702 |
+
}
|
| 703 |
+
else if (element.tagName === 'H5') {
|
| 704 |
+
doc.setFontSize(12);
|
| 705 |
+
doc.setTextColor(0, 0, 0);
|
| 706 |
+
doc.setFont(undefined, 'bold');
|
| 707 |
+
doc.text(element.textContent, 15, y);
|
| 708 |
+
y += 7;
|
| 709 |
+
}
|
| 710 |
+
else if (element.tagName === 'P' || element.tagName === 'LI') {
|
| 711 |
+
doc.setFontSize(10);
|
| 712 |
+
doc.setTextColor(0, 0, 0);
|
| 713 |
+
doc.setFont(undefined, 'normal');
|
| 714 |
+
|
| 715 |
+
// Gérer le texte long avec splitTextToSize
|
| 716 |
+
const textLines = doc.splitTextToSize(element.textContent, 180);
|
| 717 |
+
doc.text(textLines, 15, y);
|
| 718 |
+
y += 7 * textLines.length;
|
| 719 |
+
}
|
| 720 |
+
|
| 721 |
+
// Ajouter un espace après chaque élément
|
| 722 |
+
y += 5;
|
| 723 |
+
|
| 724 |
+
// Nouvelle page si nécessaire
|
| 725 |
+
if (y > 280) {
|
| 726 |
+
doc.addPage();
|
| 727 |
+
y = 20;
|
| 728 |
+
}
|
| 729 |
+
});
|
| 730 |
+
|
| 731 |
+
// Pied de page
|
| 732 |
+
doc.setFontSize(10);
|
| 733 |
+
doc.setTextColor(100);
|
| 734 |
+
doc.text(translations[lang].pdfGenerated, 105, 290, { align: 'center' });
|
| 735 |
+
|
| 736 |
+
// Enregistrer le PDF
|
| 737 |
+
doc.save(`${subject}_course.pdf`);
|
| 738 |
+
}
|
| 739 |
+
|
| 740 |
// Fonction de mise à jour de l'interface en fonction de la langue sélectionnée
|
| 741 |
function updateLanguage(lang) {
|
| 742 |
document.getElementById("headerTitle").innerText = translations[lang].headerTitle;
|
|
|
|
| 767 |
});
|
| 768 |
|
| 769 |
// Mettre à jour les boutons "Télécharger le PDF"
|
| 770 |
+
document.querySelectorAll('.download-pdf-btn').forEach(btn => {
|
| 771 |
btn.innerHTML = `<i class="fas fa-download mr-1"></i> ${translations[lang].downloadPDF}`;
|
| 772 |
});
|
| 773 |
|
|
|
|
| 913 |
});
|
| 914 |
});
|
| 915 |
|
| 916 |
+
// Gestion du téléchargement des PDF
|
| 917 |
+
document.querySelectorAll('.download-pdf-btn').forEach(button => {
|
| 918 |
+
button.addEventListener('click', function() {
|
| 919 |
+
const subject = this.getAttribute('data-subject');
|
| 920 |
+
generatePDF(subject);
|
| 921 |
+
});
|
| 922 |
+
});
|
| 923 |
+
|
| 924 |
// Initialisation par défaut en français
|
| 925 |
updateLanguage("fr");
|
| 926 |
</script>
|
prompts.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
Enrichir le contenu de cette application par des exemples des cours
|
|
|
|
|
|
| 1 |
+
Enrichir le contenu de cette application par des exemples des cours
|
| 2 |
+
Permettre le fonctionnement de téléchargement des cours pdf
|