Spaces:
Running
Running
Upload index.html
Browse files- templates/index.html +1 -45
templates/index.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
<html lang="fr">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
@@ -31,8 +31,6 @@
|
|
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 |
-
<!-- Bibliothèque html2pdf pour l'export PDF -->
|
35 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
|
36 |
|
37 |
<style>
|
38 |
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;700&display=swap');
|
@@ -177,10 +175,6 @@
|
|
177 |
<!-- Enveloppement d'éventuels tableaux dans une div responsive -->
|
178 |
<div id="answerContent" class="text-gray-700 table-responsive"></div>
|
179 |
</div>
|
180 |
-
<!-- Bouton d'exportation en PDF -->
|
181 |
-
<button id="exportPdf" class="blue-button w-full py-3 text-white font-medium rounded-lg mt-4">
|
182 |
-
Exporter en PDF
|
183 |
-
</button>
|
184 |
</section>
|
185 |
</main>
|
186 |
</div>
|
@@ -199,7 +193,6 @@
|
|
199 |
const imagePreview = document.getElementById('imagePreview');
|
200 |
const previewImage = document.getElementById('previewImage');
|
201 |
const timestamp = document.getElementById('timestamp');
|
202 |
-
const exportPdfButton = document.getElementById('exportPdf');
|
203 |
|
204 |
let startTime = null;
|
205 |
let timerInterval = null;
|
@@ -372,43 +365,6 @@
|
|
372 |
stopTimer();
|
373 |
}
|
374 |
});
|
375 |
-
|
376 |
-
// Fonction d'exportation en PDF
|
377 |
-
exportPdfButton.addEventListener('click', async () => {
|
378 |
-
// Attendre que MathJax ait terminé le rendu et ajouter un délai supplémentaire
|
379 |
-
if (window.mathJaxReady) {
|
380 |
-
await MathJax.typesetPromise();
|
381 |
-
await new Promise(resolve => setTimeout(resolve, 500)); // délai de 500ms
|
382 |
-
}
|
383 |
-
|
384 |
-
// Sélectionner la section contenant la solution
|
385 |
-
const solutionElement = document.getElementById('solution');
|
386 |
-
|
387 |
-
// Cloner l'élément et s'assurer qu'il est visible
|
388 |
-
const clone = solutionElement.cloneNode(true);
|
389 |
-
clone.style.display = 'block'; // forcer l'affichage
|
390 |
-
clone.classList.remove('hidden'); // retirer la classe masquée si présente
|
391 |
-
|
392 |
-
// Placer le clone hors écran afin de ne pas perturber la vue
|
393 |
-
clone.style.position = 'absolute';
|
394 |
-
clone.style.top = '-10000px';
|
395 |
-
document.body.appendChild(clone);
|
396 |
-
|
397 |
-
// Options de configuration pour html2pdf
|
398 |
-
const opt = {
|
399 |
-
margin: 0.5,
|
400 |
-
filename: 'solution.pdf',
|
401 |
-
image: { type: 'jpeg', quality: 0.98 },
|
402 |
-
html2canvas: { scale: 2 },
|
403 |
-
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
|
404 |
-
};
|
405 |
-
|
406 |
-
// Générer le PDF à partir du clone
|
407 |
-
await html2pdf().set(opt).from(clone).save();
|
408 |
-
|
409 |
-
// Supprimer le clone du DOM
|
410 |
-
clone.remove();
|
411 |
-
});
|
412 |
});
|
413 |
</script>
|
414 |
</body>
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
<html lang="fr">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
|
|
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');
|
|
|
175 |
<!-- Enveloppement d'éventuels tableaux dans une div responsive -->
|
176 |
<div id="answerContent" class="text-gray-700 table-responsive"></div>
|
177 |
</div>
|
|
|
|
|
|
|
|
|
178 |
</section>
|
179 |
</main>
|
180 |
</div>
|
|
|
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;
|
|
|
365 |
stopTimer();
|
366 |
}
|
367 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
});
|
369 |
</script>
|
370 |
</body>
|