Spaces:
Running
Running
Update templates/philosophie.html
Browse files- templates/philosophie.html +66 -10
templates/philosophie.html
CHANGED
@@ -7,6 +7,8 @@
|
|
7 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
8 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.all.min.js"></script>
|
9 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.3.0/marked.min.js"></script>
|
|
|
|
|
10 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.min.css" rel="stylesheet">
|
11 |
<script src="https://cdn.tailwindcss.com"></script>
|
12 |
<style>
|
@@ -19,6 +21,9 @@
|
|
19 |
outline: none;
|
20 |
font-size: 15px;
|
21 |
background-color: #f1f1f1;
|
|
|
|
|
|
|
22 |
}
|
23 |
|
24 |
.active, .collapsible:hover {
|
@@ -117,7 +122,7 @@
|
|
117 |
</select>
|
118 |
<div class="absolute inset-y-0 right-0 flex items-center px-4 pointer-events-none">
|
119 |
<svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
120 |
-
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-
|
121 |
</svg>
|
122 |
</div>
|
123 |
</div>
|
@@ -196,9 +201,9 @@
|
|
196 |
</div>
|
197 |
</div>
|
198 |
|
199 |
-
|
200 |
$(document).ready(function() {
|
201 |
-
// Configuration de marked
|
202 |
marked.setOptions({
|
203 |
breaks: true,
|
204 |
gfm: true,
|
@@ -208,6 +213,8 @@
|
|
208 |
smartypants: true
|
209 |
});
|
210 |
|
|
|
|
|
211 |
// Configuration des notifications
|
212 |
const Toast = Swal.mixin({
|
213 |
toast: true,
|
@@ -220,6 +227,8 @@
|
|
220 |
}
|
221 |
});
|
222 |
|
|
|
|
|
223 |
// Animation des boutons
|
224 |
function addButtonAnimation(buttonId) {
|
225 |
$(`#${buttonId}`).on('mousedown', function() {
|
@@ -319,10 +328,28 @@
|
|
319 |
return;
|
320 |
}
|
321 |
|
322 |
-
// Animation de chargement
|
323 |
Swal.fire({
|
324 |
title: 'Génération en cours',
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
});
|
327 |
|
328 |
const data = {
|
@@ -377,7 +404,22 @@
|
|
377 |
|
378 |
}
|
379 |
|
380 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
function updateSavedDissertationsList() {
|
382 |
const dissertationsList = $('#dissertations-list');
|
383 |
dissertationsList.empty(); // Vider la liste actuelle
|
@@ -391,17 +433,32 @@
|
|
391 |
|
392 |
|
393 |
|
394 |
-
savedDissertations.forEach(diss => {
|
|
|
395 |
|
396 |
-
const collapsible = $(
|
|
|
397 |
const content = $('<div class="content prose prose-violet max-w-none p-4"></div>').html(marked.parse(diss.content)); // Convertir en HTML
|
|
|
|
|
398 |
dissertationsList.append(collapsible, content);
|
399 |
|
400 |
// Gestionnaire d'événement pour chaque section repliable
|
401 |
-
collapsible.click(function() {
|
|
|
|
|
|
|
|
|
|
|
402 |
content.slideToggle("fast");
|
403 |
collapsible.toggleClass("active");
|
404 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
});
|
406 |
}
|
407 |
|
@@ -476,6 +533,5 @@
|
|
476 |
});
|
477 |
</script>
|
478 |
|
479 |
-
|
480 |
</body>
|
481 |
</html>
|
|
|
7 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
8 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.all.min.js"></script>
|
9 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.3.0/marked.min.js"></script>
|
10 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
|
11 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/locale/fr.js"></script>
|
12 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.min.css" rel="stylesheet">
|
13 |
<script src="https://cdn.tailwindcss.com"></script>
|
14 |
<style>
|
|
|
21 |
outline: none;
|
22 |
font-size: 15px;
|
23 |
background-color: #f1f1f1;
|
24 |
+
display: flex;
|
25 |
+
justify-content: space-between;
|
26 |
+
align-items: center;
|
27 |
}
|
28 |
|
29 |
.active, .collapsible:hover {
|
|
|
122 |
</select>
|
123 |
<div class="absolute inset-y-0 right-0 flex items-center px-4 pointer-events-none">
|
124 |
<svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
125 |
+
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-11.414z" clip-rule="evenodd" />
|
126 |
</svg>
|
127 |
</div>
|
128 |
</div>
|
|
|
201 |
</div>
|
202 |
</div>
|
203 |
|
204 |
+
<script>
|
205 |
$(document).ready(function() {
|
206 |
+
// Configuration de marked
|
207 |
marked.setOptions({
|
208 |
breaks: true,
|
209 |
gfm: true,
|
|
|
213 |
smartypants: true
|
214 |
});
|
215 |
|
216 |
+
moment.locale('fr'); // Configuration de moment.js en français
|
217 |
+
|
218 |
// Configuration des notifications
|
219 |
const Toast = Swal.mixin({
|
220 |
toast: true,
|
|
|
227 |
}
|
228 |
});
|
229 |
|
230 |
+
|
231 |
+
|
232 |
// Animation des boutons
|
233 |
function addButtonAnimation(buttonId) {
|
234 |
$(`#${buttonId}`).on('mousedown', function() {
|
|
|
328 |
return;
|
329 |
}
|
330 |
|
331 |
+
// Animation de chargement sophistiquée
|
332 |
Swal.fire({
|
333 |
title: 'Génération en cours',
|
334 |
+
html: `
|
335 |
+
<div class="space-y-4">
|
336 |
+
<div class="flex justify-center">
|
337 |
+
<div class="w-16 h-16 relative">
|
338 |
+
<div class="absolute inset-0 rounded-full border-4 border-violet-200 animate-ping"></div>
|
339 |
+
<div class="absolute inset-0 rounded-full border-4 border-violet-500 animate-pulse"></div>
|
340 |
+
</div>
|
341 |
+
</div>
|
342 |
+
<div class="text-gray-600">
|
343 |
+
<p class="animate-pulse">Analyse philosophique en cours...</p>
|
344 |
+
<p class="text-sm mt-2 text-gray-500">Veuillez patienter quelques instants</p>
|
345 |
+
</div>
|
346 |
+
</div>
|
347 |
+
`,
|
348 |
+
allowOutsideClick: false,
|
349 |
+
showConfirmButton: false,
|
350 |
+
customClass: {
|
351 |
+
popup: 'rounded-2xl'
|
352 |
+
}
|
353 |
});
|
354 |
|
355 |
const data = {
|
|
|
404 |
|
405 |
}
|
406 |
|
407 |
+
|
408 |
+
|
409 |
+
// Fonction pour supprimer une dissertation sauvegardée
|
410 |
+
function deleteDissertation(index) {
|
411 |
+
let savedDissertations = JSON.parse(localStorage.getItem('dissertations')) || [];
|
412 |
+
savedDissertations.splice(index, 1);
|
413 |
+
localStorage.setItem('dissertations', JSON.stringify(savedDissertations));
|
414 |
+
updateSavedDissertationsList();
|
415 |
+
Toast.fire({
|
416 |
+
icon: 'success',
|
417 |
+
title: 'Dissertation supprimée avec succès'
|
418 |
+
});
|
419 |
+
|
420 |
+
}
|
421 |
+
|
422 |
+
// Fonction pour afficher les dissertations sauvegardées (avec sections repliables et suppression)
|
423 |
function updateSavedDissertationsList() {
|
424 |
const dissertationsList = $('#dissertations-list');
|
425 |
dissertationsList.empty(); // Vider la liste actuelle
|
|
|
433 |
|
434 |
|
435 |
|
436 |
+
savedDissertations.forEach((diss, index) => {
|
437 |
+
const date = moment(diss.timestamp).format('LLL');
|
438 |
|
439 |
+
const collapsible = $(`<button class="collapsible rounded-xl border border-gray-100 flex justify-between w-full"><span>${diss.title}</span><span class="text-gray-500 text-sm">${date}</span></button>`);
|
440 |
+
const deleteButton = $('<button class="text-red-500 hover:text-red-700 ml-2">Supprimer</button>');
|
441 |
const content = $('<div class="content prose prose-violet max-w-none p-4"></div>').html(marked.parse(diss.content)); // Convertir en HTML
|
442 |
+
|
443 |
+
collapsible.append(deleteButton); // Ajouter le bouton supprimer
|
444 |
dissertationsList.append(collapsible, content);
|
445 |
|
446 |
// Gestionnaire d'événement pour chaque section repliable
|
447 |
+
collapsible.click(function(event) {
|
448 |
+
// Empêcher la propagation de l'événement click sur le bouton "Supprimer"
|
449 |
+
if (event.target === deleteButton[0]) {
|
450 |
+
return;
|
451 |
+
}
|
452 |
+
|
453 |
content.slideToggle("fast");
|
454 |
collapsible.toggleClass("active");
|
455 |
});
|
456 |
+
|
457 |
+
deleteButton.click(function() {
|
458 |
+
// Supprimer la dissertation correspondante
|
459 |
+
deleteDissertation(index);
|
460 |
+
|
461 |
+
});
|
462 |
});
|
463 |
}
|
464 |
|
|
|
533 |
});
|
534 |
</script>
|
535 |
|
|
|
536 |
</body>
|
537 |
</html>
|