Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +8 -19
templates/index.html
CHANGED
@@ -32,9 +32,11 @@
|
|
32 |
</form>
|
33 |
<button id="backButton" style="display: none; margin-top: 10px;">Back to Main</button>
|
34 |
</div>
|
35 |
-
|
36 |
-
<
|
37 |
-
|
|
|
|
|
38 |
{% if has_articles %}
|
39 |
<div id="articlesContainer">
|
40 |
{% for category, articles in categorized_articles.items() %}
|
@@ -179,9 +181,6 @@
|
|
179 |
}
|
180 |
}
|
181 |
}
|
182 |
-
// Hide spinner once articles are updated
|
183 |
-
const loadingContainer = document.getElementById('loadingContainer');
|
184 |
-
if (loadingContainer) loadingContainer.style.display = 'none';
|
185 |
}
|
186 |
setTimeout(updateArticles, 2000);
|
187 |
})
|
@@ -196,12 +195,9 @@
|
|
196 |
.then(response => response.json())
|
197 |
.then(data => {
|
198 |
if (data.status === 'complete') {
|
199 |
-
//
|
200 |
-
if (!document.getElementById('articlesContainer')) {
|
201 |
-
window.location.reload();
|
202 |
-
}
|
203 |
} else {
|
204 |
-
setTimeout(checkLoadingStatus, 2000);
|
205 |
}
|
206 |
})
|
207 |
.catch(error => {
|
@@ -215,17 +211,10 @@
|
|
215 |
tiles.forEach(tile => {
|
216 |
lastUpdate = Math.max(lastUpdate, parseFloat(tile.dataset.lastUpdate) || 0);
|
217 |
});
|
218 |
-
|
219 |
-
// Show spinner initially if loading
|
220 |
-
const loadingContainer = document.getElementById('loadingContainer');
|
221 |
-
if (loadingContainer && !document.getElementById('articlesContainer')) {
|
222 |
-
loadingContainer.style.display = 'block';
|
223 |
-
}
|
224 |
-
|
225 |
updateArticles();
|
226 |
|
227 |
// Start checking loading status if loading is active
|
228 |
-
if (loadingContainer) {
|
229 |
checkLoadingStatus();
|
230 |
}
|
231 |
|
|
|
32 |
</form>
|
33 |
<button id="backButton" style="display: none; margin-top: 10px;">Back to Main</button>
|
34 |
</div>
|
35 |
+
{% if loading %}
|
36 |
+
<div class="loading-container" id="loadingContainer">
|
37 |
+
<span class="loading-spinner"></span>
|
38 |
+
</div>
|
39 |
+
{% endif %}
|
40 |
{% if has_articles %}
|
41 |
<div id="articlesContainer">
|
42 |
{% for category, articles in categorized_articles.items() %}
|
|
|
181 |
}
|
182 |
}
|
183 |
}
|
|
|
|
|
|
|
184 |
}
|
185 |
setTimeout(updateArticles, 2000);
|
186 |
})
|
|
|
195 |
.then(response => response.json())
|
196 |
.then(data => {
|
197 |
if (data.status === 'complete') {
|
198 |
+
window.location.reload(); // Refresh the page when loading is complete
|
|
|
|
|
|
|
199 |
} else {
|
200 |
+
setTimeout(checkLoadingStatus, 2000); // Check again after 2 seconds
|
201 |
}
|
202 |
})
|
203 |
.catch(error => {
|
|
|
211 |
tiles.forEach(tile => {
|
212 |
lastUpdate = Math.max(lastUpdate, parseFloat(tile.dataset.lastUpdate) || 0);
|
213 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
updateArticles();
|
215 |
|
216 |
// Start checking loading status if loading is active
|
217 |
+
if (document.getElementById('loadingContainer')) {
|
218 |
checkLoadingStatus();
|
219 |
}
|
220 |
|