Spaces:
Sleeping
Sleeping
Upload index.html
Browse files- templates/index.html +35 -29
templates/index.html
CHANGED
|
@@ -1,20 +1,19 @@
|
|
| 1 |
-
|
| 2 |
<html lang="fr">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Mariam M-0 | Solution Mathématique</title>
|
| 7 |
-
<!-- Tailwind CSS
|
| 8 |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
|
| 9 |
|
| 10 |
-
<!-- Configuration
|
| 11 |
<script>
|
| 12 |
window.MathJax = {
|
| 13 |
tex: {
|
| 14 |
inlineMath: [['$', '$']],
|
| 15 |
displayMath: [['$$', '$$']],
|
| 16 |
processEscapes: true,
|
| 17 |
-
// Chargement automatique de commandes supplémentaires (ex. environnements de tableaux)
|
| 18 |
packages: {'[+]': ['autoload','ams']}
|
| 19 |
},
|
| 20 |
options: {
|
|
@@ -31,14 +30,14 @@
|
|
| 31 |
</script>
|
| 32 |
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" id="MathJax-script" async></script>
|
| 33 |
<script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.min.js"></script>
|
|
|
|
|
|
|
| 34 |
|
| 35 |
<style>
|
| 36 |
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;700&display=swap');
|
| 37 |
-
|
| 38 |
body {
|
| 39 |
font-family: 'Space Grotesk', sans-serif;
|
| 40 |
}
|
| 41 |
-
|
| 42 |
.uploadArea {
|
| 43 |
background: #f3f4f6;
|
| 44 |
border: 2px dashed #d1d5db;
|
|
@@ -47,7 +46,6 @@
|
|
| 47 |
.uploadArea:hover {
|
| 48 |
border-color: #3b82f6;
|
| 49 |
}
|
| 50 |
-
|
| 51 |
.blue-button {
|
| 52 |
background: #3b82f6;
|
| 53 |
transition: background-color 0.2s ease;
|
|
@@ -55,7 +53,6 @@
|
|
| 55 |
.blue-button:hover {
|
| 56 |
background: #2563eb;
|
| 57 |
}
|
| 58 |
-
|
| 59 |
.loader {
|
| 60 |
width: 48px;
|
| 61 |
height: 48px;
|
|
@@ -69,7 +66,6 @@
|
|
| 69 |
0% { transform: rotate(0deg); }
|
| 70 |
100% { transform: rotate(360deg); }
|
| 71 |
}
|
| 72 |
-
|
| 73 |
.thought-box {
|
| 74 |
transition: max-height 0.3s ease-out;
|
| 75 |
max-height: 0;
|
|
@@ -78,27 +74,22 @@
|
|
| 78 |
.thought-box.open {
|
| 79 |
max-height: 500px;
|
| 80 |
}
|
| 81 |
-
|
| 82 |
#thoughtsContent, #answerContent {
|
| 83 |
max-height: 500px;
|
| 84 |
overflow-y: auto;
|
| 85 |
scroll-behavior: smooth;
|
| 86 |
white-space: pre-wrap;
|
| 87 |
}
|
| 88 |
-
|
| 89 |
.preview-image {
|
| 90 |
max-width: 300px;
|
| 91 |
max-height: 300px;
|
| 92 |
object-fit: contain;
|
| 93 |
}
|
| 94 |
-
|
| 95 |
.timestamp {
|
| 96 |
color: #3b82f6;
|
| 97 |
font-size: 0.9em;
|
| 98 |
margin-left: 8px;
|
| 99 |
}
|
| 100 |
-
|
| 101 |
-
/* Styles supplémentaires pour une meilleure présentation des tableaux */
|
| 102 |
table {
|
| 103 |
border-collapse: collapse;
|
| 104 |
width: 100%;
|
|
@@ -113,7 +104,6 @@
|
|
| 113 |
background-color: #f3f4f6;
|
| 114 |
font-weight: 600;
|
| 115 |
}
|
| 116 |
-
/* Pour un rendu responsive, ajouter éventuellement : */
|
| 117 |
.table-responsive {
|
| 118 |
overflow-x: auto;
|
| 119 |
}
|
|
@@ -161,18 +151,23 @@
|
|
| 161 |
|
| 162 |
<!-- Affichage de la solution -->
|
| 163 |
<section id="solution" class="hidden mt-8 space-y-6">
|
| 164 |
-
<div class="border-t pt-4">
|
| 165 |
-
<
|
| 166 |
-
<
|
|
|
|
|
|
|
| 167 |
<span id="timestamp" class="timestamp"></span>
|
| 168 |
-
</button>
|
| 169 |
-
<div id="thoughtsBox" class="thought-box">
|
| 170 |
-
<div id="thoughtsContent" class="p-4 text-gray-600"></div>
|
| 171 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
</div>
|
| 173 |
<div class="border-t pt-6">
|
| 174 |
<h3 class="text-xl font-bold text-gray-800 mb-4">Solution</h3>
|
| 175 |
-
<!-- Enveloppement d'éventuels tableaux dans une div responsive -->
|
| 176 |
<div id="answerContent" class="text-gray-700 table-responsive"></div>
|
| 177 |
</div>
|
| 178 |
</section>
|
|
@@ -193,6 +188,7 @@
|
|
| 193 |
const imagePreview = document.getElementById('imagePreview');
|
| 194 |
const previewImage = document.getElementById('previewImage');
|
| 195 |
const timestamp = document.getElementById('timestamp');
|
|
|
|
| 196 |
|
| 197 |
let startTime = null;
|
| 198 |
let timerInterval = null;
|
|
@@ -255,7 +251,7 @@
|
|
| 255 |
handleFileSelect(e.dataTransfer.files[0]);
|
| 256 |
});
|
| 257 |
|
| 258 |
-
// Fonction pour relancer le rendu MathJax dès que le contenu
|
| 259 |
const typesetAnswerIfReady = async () => {
|
| 260 |
if (window.mathJaxReady) {
|
| 261 |
MathJax.startup.document.elements = [document.getElementById('answerContent')];
|
|
@@ -268,11 +264,8 @@
|
|
| 268 |
|
| 269 |
// Fonction pour déclencher la mise à jour de l'affichage
|
| 270 |
const updateDisplay = async () => {
|
| 271 |
-
// Mise à jour du contenu via marked
|
| 272 |
thoughtsContent.innerHTML = marked.parse(thoughtsBuffer);
|
| 273 |
answerContent.innerHTML = marked.parse(answerBuffer);
|
| 274 |
-
|
| 275 |
-
// Lancer le rendu MathJax
|
| 276 |
await typesetAnswerIfReady();
|
| 277 |
updateTimeout = null;
|
| 278 |
};
|
|
@@ -283,7 +276,7 @@
|
|
| 283 |
updateTimeout = setTimeout(updateDisplay, 200);
|
| 284 |
};
|
| 285 |
|
| 286 |
-
// Configuration de marked
|
| 287 |
marked.setOptions({
|
| 288 |
gfm: true,
|
| 289 |
breaks: true
|
|
@@ -346,7 +339,6 @@
|
|
| 346 |
}
|
| 347 |
}
|
| 348 |
}
|
| 349 |
-
// Planifier la mise à jour dé-bouncée
|
| 350 |
scheduleUpdate();
|
| 351 |
};
|
| 352 |
|
|
@@ -354,7 +346,6 @@
|
|
| 354 |
while (true) {
|
| 355 |
const { done, value } = await reader.read();
|
| 356 |
if (done) {
|
| 357 |
-
// Traitement du contenu restant dans le buffer
|
| 358 |
if (buffer) {
|
| 359 |
const data = JSON.parse(buffer.slice(5));
|
| 360 |
if (data.content) {
|
|
@@ -378,6 +369,21 @@
|
|
| 378 |
stopTimer();
|
| 379 |
}
|
| 380 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 381 |
});
|
| 382 |
</script>
|
| 383 |
</body>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
<html lang="fr">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Mariam M-0 | Solution Mathématique</title>
|
| 7 |
+
<!-- Tailwind CSS -->
|
| 8 |
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
|
| 9 |
|
| 10 |
+
<!-- Configuration de MathJax -->
|
| 11 |
<script>
|
| 12 |
window.MathJax = {
|
| 13 |
tex: {
|
| 14 |
inlineMath: [['$', '$']],
|
| 15 |
displayMath: [['$$', '$$']],
|
| 16 |
processEscapes: true,
|
|
|
|
| 17 |
packages: {'[+]': ['autoload','ams']}
|
| 18 |
},
|
| 19 |
options: {
|
|
|
|
| 30 |
</script>
|
| 31 |
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" id="MathJax-script" async></script>
|
| 32 |
<script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.min.js"></script>
|
| 33 |
+
<!-- Bibliothèque pour l'export en PDF -->
|
| 34 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
|
| 35 |
|
| 36 |
<style>
|
| 37 |
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;700&display=swap');
|
|
|
|
| 38 |
body {
|
| 39 |
font-family: 'Space Grotesk', sans-serif;
|
| 40 |
}
|
|
|
|
| 41 |
.uploadArea {
|
| 42 |
background: #f3f4f6;
|
| 43 |
border: 2px dashed #d1d5db;
|
|
|
|
| 46 |
.uploadArea:hover {
|
| 47 |
border-color: #3b82f6;
|
| 48 |
}
|
|
|
|
| 49 |
.blue-button {
|
| 50 |
background: #3b82f6;
|
| 51 |
transition: background-color 0.2s ease;
|
|
|
|
| 53 |
.blue-button:hover {
|
| 54 |
background: #2563eb;
|
| 55 |
}
|
|
|
|
| 56 |
.loader {
|
| 57 |
width: 48px;
|
| 58 |
height: 48px;
|
|
|
|
| 66 |
0% { transform: rotate(0deg); }
|
| 67 |
100% { transform: rotate(360deg); }
|
| 68 |
}
|
|
|
|
| 69 |
.thought-box {
|
| 70 |
transition: max-height 0.3s ease-out;
|
| 71 |
max-height: 0;
|
|
|
|
| 74 |
.thought-box.open {
|
| 75 |
max-height: 500px;
|
| 76 |
}
|
|
|
|
| 77 |
#thoughtsContent, #answerContent {
|
| 78 |
max-height: 500px;
|
| 79 |
overflow-y: auto;
|
| 80 |
scroll-behavior: smooth;
|
| 81 |
white-space: pre-wrap;
|
| 82 |
}
|
|
|
|
| 83 |
.preview-image {
|
| 84 |
max-width: 300px;
|
| 85 |
max-height: 300px;
|
| 86 |
object-fit: contain;
|
| 87 |
}
|
|
|
|
| 88 |
.timestamp {
|
| 89 |
color: #3b82f6;
|
| 90 |
font-size: 0.9em;
|
| 91 |
margin-left: 8px;
|
| 92 |
}
|
|
|
|
|
|
|
| 93 |
table {
|
| 94 |
border-collapse: collapse;
|
| 95 |
width: 100%;
|
|
|
|
| 104 |
background-color: #f3f4f6;
|
| 105 |
font-weight: 600;
|
| 106 |
}
|
|
|
|
| 107 |
.table-responsive {
|
| 108 |
overflow-x: auto;
|
| 109 |
}
|
|
|
|
| 151 |
|
| 152 |
<!-- Affichage de la solution -->
|
| 153 |
<section id="solution" class="hidden mt-8 space-y-6">
|
| 154 |
+
<div class="border-t pt-4 flex justify-between items-center">
|
| 155 |
+
<div>
|
| 156 |
+
<button id="thoughtsToggle" type="button" class="p-2">
|
| 157 |
+
<span class="font-medium text-gray-700">Processus de Réflexion</span>
|
| 158 |
+
</button>
|
| 159 |
<span id="timestamp" class="timestamp"></span>
|
|
|
|
|
|
|
|
|
|
| 160 |
</div>
|
| 161 |
+
<!-- Bouton d'export en PDF -->
|
| 162 |
+
<button id="exportPdf" type="button" class="blue-button py-2 px-4 text-white font-medium rounded-lg">
|
| 163 |
+
Exporter en PDF
|
| 164 |
+
</button>
|
| 165 |
+
</div>
|
| 166 |
+
<div id="thoughtsBox" class="thought-box">
|
| 167 |
+
<div id="thoughtsContent" class="p-4 text-gray-600"></div>
|
| 168 |
</div>
|
| 169 |
<div class="border-t pt-6">
|
| 170 |
<h3 class="text-xl font-bold text-gray-800 mb-4">Solution</h3>
|
|
|
|
| 171 |
<div id="answerContent" class="text-gray-700 table-responsive"></div>
|
| 172 |
</div>
|
| 173 |
</section>
|
|
|
|
| 188 |
const imagePreview = document.getElementById('imagePreview');
|
| 189 |
const previewImage = document.getElementById('previewImage');
|
| 190 |
const timestamp = document.getElementById('timestamp');
|
| 191 |
+
const exportPdf = document.getElementById('exportPdf');
|
| 192 |
|
| 193 |
let startTime = null;
|
| 194 |
let timerInterval = null;
|
|
|
|
| 251 |
handleFileSelect(e.dataTransfer.files[0]);
|
| 252 |
});
|
| 253 |
|
| 254 |
+
// Fonction pour relancer le rendu MathJax dès que le contenu est mis à jour
|
| 255 |
const typesetAnswerIfReady = async () => {
|
| 256 |
if (window.mathJaxReady) {
|
| 257 |
MathJax.startup.document.elements = [document.getElementById('answerContent')];
|
|
|
|
| 264 |
|
| 265 |
// Fonction pour déclencher la mise à jour de l'affichage
|
| 266 |
const updateDisplay = async () => {
|
|
|
|
| 267 |
thoughtsContent.innerHTML = marked.parse(thoughtsBuffer);
|
| 268 |
answerContent.innerHTML = marked.parse(answerBuffer);
|
|
|
|
|
|
|
| 269 |
await typesetAnswerIfReady();
|
| 270 |
updateTimeout = null;
|
| 271 |
};
|
|
|
|
| 276 |
updateTimeout = setTimeout(updateDisplay, 200);
|
| 277 |
};
|
| 278 |
|
| 279 |
+
// Configuration de marked
|
| 280 |
marked.setOptions({
|
| 281 |
gfm: true,
|
| 282 |
breaks: true
|
|
|
|
| 339 |
}
|
| 340 |
}
|
| 341 |
}
|
|
|
|
| 342 |
scheduleUpdate();
|
| 343 |
};
|
| 344 |
|
|
|
|
| 346 |
while (true) {
|
| 347 |
const { done, value } = await reader.read();
|
| 348 |
if (done) {
|
|
|
|
| 349 |
if (buffer) {
|
| 350 |
const data = JSON.parse(buffer.slice(5));
|
| 351 |
if (data.content) {
|
|
|
|
| 369 |
stopTimer();
|
| 370 |
}
|
| 371 |
});
|
| 372 |
+
|
| 373 |
+
// Export de la solution au format PDF
|
| 374 |
+
exportPdf.addEventListener('click', () => {
|
| 375 |
+
// On peut par exemple exporter l'élément "solution"
|
| 376 |
+
const element = document.getElementById('solution');
|
| 377 |
+
// Options d'export (adapter selon vos besoins)
|
| 378 |
+
const opt = {
|
| 379 |
+
margin: 0.5,
|
| 380 |
+
filename: 'solution.pdf',
|
| 381 |
+
image: { type: 'jpeg', quality: 0.98 },
|
| 382 |
+
html2canvas: { scale: 2 },
|
| 383 |
+
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
|
| 384 |
+
};
|
| 385 |
+
html2pdf().set(opt).from(element).save();
|
| 386 |
+
});
|
| 387 |
});
|
| 388 |
</script>
|
| 389 |
</body>
|