mirror of
https://forge.chapril.org/tykayn/book_generator
synced 2025-06-20 01:34:43 +02:00
⚡ - sauvegarde automatique de l'avancement du livre
This commit is contained in:
parent
de532abbb7
commit
375fbb3a7a
1814 changed files with 334236 additions and 0 deletions
95
index.html
Normal file
95
index.html
Normal file
|
@ -0,0 +1,95 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Éditeur de Livre</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
.sidebar {
|
||||
height: 100vh;
|
||||
background-color: #f8f9fa;
|
||||
padding: 20px;
|
||||
border-right: 1px solid #dee2e6;
|
||||
}
|
||||
.editor {
|
||||
height: 100vh;
|
||||
padding: 20px;
|
||||
}
|
||||
#editor-content {
|
||||
width: 100%;
|
||||
height: calc(100vh - 100px);
|
||||
font-family: monospace;
|
||||
padding: 15px;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 4px;
|
||||
resize: none;
|
||||
}
|
||||
.word-count {
|
||||
background-color: #e9ecef;
|
||||
padding: 15px;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Sidebar -->
|
||||
<div class="col-md-3 col-lg-2 sidebar">
|
||||
<h4>Statistiques</h4>
|
||||
<div class="word-count">
|
||||
<h5>Mots aujourd'hui</h5>
|
||||
<p id="words-today" class="h3">{{ words_today }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="col-md-9 col-lg-10 editor">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h2>Éditeur de Livre</h2>
|
||||
<button id="update-btn" class="btn btn-primary">Mettre à jour</button>
|
||||
</div>
|
||||
<textarea id="editor-content">{{ content }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
// Mise à jour du contenu
|
||||
document.getElementById('update-btn').addEventListener('click', async () => {
|
||||
const content = document.getElementById('editor-content').value;
|
||||
try {
|
||||
const response = await fetch('/update', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
body: `content=${encodeURIComponent(content)}`
|
||||
});
|
||||
if (response.ok) {
|
||||
alert('Contenu mis à jour avec succès !');
|
||||
}
|
||||
} catch (error) {
|
||||
alert('Erreur lors de la mise à jour');
|
||||
}
|
||||
});
|
||||
|
||||
// Mise à jour automatique du compteur de mots
|
||||
async function updateWordCount() {
|
||||
try {
|
||||
const response = await fetch('/words_today');
|
||||
const data = await response.json();
|
||||
document.getElementById('words-today').textContent = data.words;
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la mise à jour du compteur de mots');
|
||||
}
|
||||
}
|
||||
|
||||
// Mise à jour toutes les 30 secondes
|
||||
setInterval(updateWordCount, 30000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue