Spaces:
Sleeping
Sleeping
Rename templates/viewer.html to templates/index.html
Browse files- templates/index.html +43 -0
- templates/viewer.html +0 -252
templates/index.html
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<title>Traduction Yipunu</title>
|
5 |
+
<style>
|
6 |
+
.translation-container {
|
7 |
+
border: 1px solid #ddd;
|
8 |
+
padding: 10px;
|
9 |
+
margin: 10px;
|
10 |
+
display: flex;
|
11 |
+
justify-content: space-between;
|
12 |
+
align-items: center;
|
13 |
+
}
|
14 |
+
</style>
|
15 |
+
</head>
|
16 |
+
<body>
|
17 |
+
<h1>Traductions Yipunu</h1>
|
18 |
+
{% for translation in translations %}
|
19 |
+
<div class="translation-container">
|
20 |
+
<div>
|
21 |
+
<p><strong>Français:</strong> {{ translation.fr }}</p>
|
22 |
+
<p><strong>Yipunu:</strong> {{ translation.yi }}</p>
|
23 |
+
<p>
|
24 |
+
Likes: {{ translation.likes }} | Dislikes: {{ translation.dislikes }}
|
25 |
+
</p>
|
26 |
+
</div>
|
27 |
+
<div>
|
28 |
+
<a href="{{ url_for('vote', id=translation.id, action='like') }}">Like</a>
|
29 |
+
<a href="{{ url_for('vote', id=translation.id, action='dislike') }}">Dislike</a>
|
30 |
+
|
31 |
+
{% if not translation.feedback_sent %}
|
32 |
+
<form action="{{ url_for('submit_feedback', id=translation.id) }}" method="POST">
|
33 |
+
<textarea name="feedback" placeholder="Laissez votre avis"></textarea>
|
34 |
+
<button type="submit">Envoyer avis</button>
|
35 |
+
</form>
|
36 |
+
{% else %}
|
37 |
+
<p>Feedback envoyé</p>
|
38 |
+
{% endif %}
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
{% endfor %}
|
42 |
+
</body>
|
43 |
+
</html>
|
templates/viewer.html
DELETED
@@ -1,252 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
-
<head>
|
4 |
-
<meta charset="UTF-8">
|
5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title>Visualiseur de PDF</title>
|
7 |
-
<style>
|
8 |
-
body {
|
9 |
-
font-family: Arial, sans-serif;
|
10 |
-
margin: 0;
|
11 |
-
padding: 0;
|
12 |
-
display: flex;
|
13 |
-
flex-direction: column;
|
14 |
-
min-height: 100vh;
|
15 |
-
}
|
16 |
-
|
17 |
-
#pdf-container {
|
18 |
-
flex-grow: 1;
|
19 |
-
overflow-y: auto;
|
20 |
-
padding: 10px;
|
21 |
-
background-color: #f8f9fa;
|
22 |
-
}
|
23 |
-
|
24 |
-
.page {
|
25 |
-
margin-bottom: 20px;
|
26 |
-
text-align: center;
|
27 |
-
border: 1px solid #ddd;
|
28 |
-
background-color: #fff;
|
29 |
-
padding: 10px;
|
30 |
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
31 |
-
position: relative; /* Pour positionner l'indicateur de chargement */
|
32 |
-
}
|
33 |
-
|
34 |
-
.page img {
|
35 |
-
max-width: 100%;
|
36 |
-
height: auto;
|
37 |
-
display: block; /* Empêche l'espace sous l'image */
|
38 |
-
}
|
39 |
-
|
40 |
-
.page button {
|
41 |
-
margin-top: 10px;
|
42 |
-
padding: 10px 15px;
|
43 |
-
background-color: #007bff;
|
44 |
-
color: white;
|
45 |
-
border: none;
|
46 |
-
border-radius: 4px;
|
47 |
-
cursor: pointer;
|
48 |
-
}
|
49 |
-
|
50 |
-
.page button:hover {
|
51 |
-
background-color: #0056b3;
|
52 |
-
}
|
53 |
-
|
54 |
-
.loading-indicator {
|
55 |
-
position: absolute;
|
56 |
-
top: 50%;
|
57 |
-
left: 50%;
|
58 |
-
transform: translate(-50%, -50%);
|
59 |
-
border: 4px solid rgba(0, 0, 0, 0.1);
|
60 |
-
border-top: 4px solid #007bff;
|
61 |
-
border-radius: 50%;
|
62 |
-
width: 30px;
|
63 |
-
height: 30px;
|
64 |
-
animation: spin 1s linear infinite;
|
65 |
-
display: none; /* Masqué par défaut */
|
66 |
-
}
|
67 |
-
|
68 |
-
.page.loading .loading-indicator {
|
69 |
-
display: block; /* Affiché pendant le chargement */
|
70 |
-
}
|
71 |
-
|
72 |
-
.page .error-message {
|
73 |
-
color: red;
|
74 |
-
margin-top: 10px;
|
75 |
-
}
|
76 |
-
|
77 |
-
#navigation {
|
78 |
-
background-color: #eee;
|
79 |
-
padding: 10px;
|
80 |
-
text-align: center;
|
81 |
-
border-bottom: 1px solid #ccc;
|
82 |
-
position: sticky; /* Barre de navigation fixe en haut */
|
83 |
-
top: 0;
|
84 |
-
z-index: 10; /* S'assurer qu'elle est au-dessus du contenu */
|
85 |
-
}
|
86 |
-
|
87 |
-
#navigation button {
|
88 |
-
padding: 8px 12px;
|
89 |
-
margin: 0 5px;
|
90 |
-
background-color: #007bff;
|
91 |
-
color: white;
|
92 |
-
border: none;
|
93 |
-
border-radius: 4px;
|
94 |
-
cursor: pointer;
|
95 |
-
}
|
96 |
-
|
97 |
-
#navigation button:disabled {
|
98 |
-
opacity: 0.6;
|
99 |
-
cursor: default;
|
100 |
-
}
|
101 |
-
|
102 |
-
@keyframes spin {
|
103 |
-
0% { transform: translate(-50%, -50%) rotate(0deg); }
|
104 |
-
100% { transform: translate(-50%, -50%) rotate(360deg); }
|
105 |
-
}
|
106 |
-
</style>
|
107 |
-
</head>
|
108 |
-
<body>
|
109 |
-
<div id="navigation">
|
110 |
-
<button id="prevPage">Page Précédente</button>
|
111 |
-
<span>Page <span id="currentPage">1</span> / <span id="totalPagesSpan">210</span></span>
|
112 |
-
<button id="nextPage">Page Suivante</button>
|
113 |
-
<button id="gotoPage">Aller à la page:</button>
|
114 |
-
<input type="number" id="pageNumberInput" min="1" value="1">
|
115 |
-
</div>
|
116 |
-
|
117 |
-
<div id="pdf-container">
|
118 |
-
<!-- Les pages PDF seront ajoutées ici dynamiquement -->
|
119 |
-
</div>
|
120 |
-
|
121 |
-
<script>
|
122 |
-
// Configuration de l'application
|
123 |
-
const totalPages = 210;
|
124 |
-
const lowResEndpoint = "/low_res/"; // Endpoint Flask pour les images basse résolution
|
125 |
-
const highResEndpoint = "/high_res/"; // Endpoint Flask pour les images haute résolution
|
126 |
-
let currentPage = 1;
|
127 |
-
|
128 |
-
// Références aux éléments
|
129 |
-
const pdfContainer = document.getElementById("pdf-container");
|
130 |
-
const prevPageButton = document.getElementById("prevPage");
|
131 |
-
const nextPageButton = document.getElementById("nextPage");
|
132 |
-
const currentPageSpan = document.getElementById("currentPage");
|
133 |
-
const totalPagesSpan = document.getElementById("totalPagesSpan");
|
134 |
-
const gotoPageButton = document.getElementById("gotoPage");
|
135 |
-
const pageNumberInput = document.getElementById("pageNumberInput");
|
136 |
-
|
137 |
-
totalPagesSpan.textContent = totalPages;
|
138 |
-
|
139 |
-
// Fonction pour afficher un indicateur de chargement
|
140 |
-
function showLoadingIndicator(pageDiv) {
|
141 |
-
const loadingIndicator = document.createElement('div');
|
142 |
-
loadingIndicator.className = 'loading-indicator';
|
143 |
-
pageDiv.appendChild(loadingIndicator);
|
144 |
-
pageDiv.classList.add('loading');
|
145 |
-
}
|
146 |
-
|
147 |
-
// Fonction pour masquer l'indicateur de chargement
|
148 |
-
function hideLoadingIndicator(pageDiv) {
|
149 |
-
const loadingIndicator = pageDiv.querySelector('.loading-indicator');
|
150 |
-
if (loadingIndicator) {
|
151 |
-
pageDiv.removeChild(loadingIndicator);
|
152 |
-
}
|
153 |
-
pageDiv.classList.remove('loading');
|
154 |
-
}
|
155 |
-
|
156 |
-
// Fonction pour charger une page spécifique
|
157 |
-
function loadPage(pageNumber) {
|
158 |
-
const pageDiv = document.getElementById(`page-${pageNumber}`);
|
159 |
-
if (!pageDiv) return; // Vérifier si l'élément existe
|
160 |
-
|
161 |
-
showLoadingIndicator(pageDiv);
|
162 |
-
|
163 |
-
const img = new Image();
|
164 |
-
img.src = `${lowResEndpoint}${pageNumber}`;
|
165 |
-
img.alt = `Page ${pageNumber}`;
|
166 |
-
img.onload = () => {
|
167 |
-
hideLoadingIndicator(pageDiv);
|
168 |
-
pageDiv.innerHTML = ''; // Nettoyer le contenu précédent
|
169 |
-
pageDiv.appendChild(img);
|
170 |
-
|
171 |
-
const button = document.createElement("button");
|
172 |
-
button.innerText = "Télécharger en haute résolution";
|
173 |
-
button.onclick = () => downloadHighRes(pageNumber);
|
174 |
-
pageDiv.appendChild(button);
|
175 |
-
};
|
176 |
-
img.onerror = () => {
|
177 |
-
hideLoadingIndicator(pageDiv);
|
178 |
-
const errorMsg = document.createElement('p');
|
179 |
-
errorMsg.className = 'error-message';
|
180 |
-
errorMsg.innerText = `Erreur de chargement de la page ${pageNumber}`;
|
181 |
-
pageDiv.appendChild(errorMsg);
|
182 |
-
};
|
183 |
-
}
|
184 |
-
|
185 |
-
// Fonction pour télécharger une image en haute résolution
|
186 |
-
function downloadHighRes(pageNumber) {
|
187 |
-
const highResUrl = `${highResEndpoint}${pageNumber}`;
|
188 |
-
window.open(highResUrl, "_blank");
|
189 |
-
}
|
190 |
-
|
191 |
-
// Initialisation de l'Intersection Observer pour le lazy loading
|
192 |
-
function initLazyLoading() {
|
193 |
-
const observer = new IntersectionObserver(entries => {
|
194 |
-
entries.forEach(entry => {
|
195 |
-
if (entry.isIntersecting) {
|
196 |
-
const pageNumber = parseInt(entry.target.id.split('-')[1]);
|
197 |
-
loadPage(pageNumber);
|
198 |
-
observer.unobserve(entry.target);
|
199 |
-
}
|
200 |
-
});
|
201 |
-
});
|
202 |
-
|
203 |
-
for (let pageNumber = 1; pageNumber <= totalPages; pageNumber++) {
|
204 |
-
const pageDiv = document.createElement('div');
|
205 |
-
pageDiv.className = 'page';
|
206 |
-
pageDiv.id = `page-${pageNumber}`;
|
207 |
-
pdfContainer.appendChild(pageDiv);
|
208 |
-
observer.observe(pageDiv);
|
209 |
-
}
|
210 |
-
}
|
211 |
-
|
212 |
-
// Gestion de la navigation
|
213 |
-
function updateNavigation() {
|
214 |
-
currentPageSpan.textContent = currentPage;
|
215 |
-
prevPageButton.disabled = currentPage === 1;
|
216 |
-
nextPageButton.disabled = currentPage === totalPages;
|
217 |
-
}
|
218 |
-
|
219 |
-
function goToPage(pageNumber) {
|
220 |
-
if (pageNumber >= 1 && pageNumber <= totalPages) {
|
221 |
-
currentPage = pageNumber;
|
222 |
-
updateNavigation();
|
223 |
-
const pageDiv = document.getElementById(`page-${pageNumber}`);
|
224 |
-
if (pageDiv) {
|
225 |
-
pageDiv.scrollIntoView({ behavior: 'smooth' });
|
226 |
-
}
|
227 |
-
}
|
228 |
-
}
|
229 |
-
|
230 |
-
prevPageButton.addEventListener('click', () => {
|
231 |
-
goToPage(currentPage - 1);
|
232 |
-
|
233 |
-
});
|
234 |
-
|
235 |
-
nextPageButton.addEventListener('click', () => {
|
236 |
-
goToPage(currentPage + 1);
|
237 |
-
});
|
238 |
-
|
239 |
-
gotoPageButton.addEventListener('click', () => {
|
240 |
-
const pageNumber = parseInt(pageNumberInput.value);
|
241 |
-
goToPage(pageNumber);
|
242 |
-
});
|
243 |
-
|
244 |
-
// Initialiser le visualiseur
|
245 |
-
window.onload = () => {
|
246 |
-
initLazyLoading();
|
247 |
-
updateNavigation();
|
248 |
-
goToPage(currentPage);
|
249 |
-
};
|
250 |
-
</script>
|
251 |
-
</body>
|
252 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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