Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +16 -8
templates/index.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
-
<meta name="
|
6 |
<title>News Feed Hub</title>
|
7 |
<style>
|
8 |
body { font-family: Arial, sans-serif; margin: 20px; background-color: #f5f5f5; color: #333; }
|
@@ -32,11 +32,9 @@
|
|
32 |
</form>
|
33 |
<button id="backButton" style="display: none; margin-top: 10px;">Back to Main</button>
|
34 |
</div>
|
35 |
-
{% if loading %}
|
36 |
-
<
|
37 |
-
|
38 |
-
</div>
|
39 |
-
{% endif %}
|
40 |
{% if has_articles %}
|
41 |
<div id="articlesContainer">
|
42 |
{% for category, articles in categorized_articles.items() %}
|
@@ -181,6 +179,9 @@
|
|
181 |
}
|
182 |
}
|
183 |
}
|
|
|
|
|
|
|
184 |
}
|
185 |
setTimeout(updateArticles, 2000);
|
186 |
})
|
@@ -214,10 +215,17 @@
|
|
214 |
tiles.forEach(tile => {
|
215 |
lastUpdate = Math.max(lastUpdate, parseFloat(tile.dataset.lastUpdate) || 0);
|
216 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
updateArticles();
|
218 |
|
219 |
// Start checking loading status if loading is active
|
220 |
-
if (
|
221 |
checkLoadingStatus();
|
222 |
}
|
223 |
|
@@ -277,4 +285,4 @@
|
|
277 |
});
|
278 |
</script>
|
279 |
</body>
|
280 |
-
</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>News Feed Hub</title>
|
7 |
<style>
|
8 |
body { font-family: Arial, sans-serif; margin: 20px; background-color: #f5f5f5; color: #333; }
|
|
|
32 |
</form>
|
33 |
<button id="backButton" style="display: none; margin-top: 10px;">Back to Main</button>
|
34 |
</div>
|
35 |
+
<div class="loading-container" id="loadingContainer" {% if not loading %}style="display: none;"{% endif %}>
|
36 |
+
<span class="loading-spinner"></span>
|
37 |
+
</div>
|
|
|
|
|
38 |
{% if has_articles %}
|
39 |
<div id="articlesContainer">
|
40 |
{% for category, articles in categorized_articles.items() %}
|
|
|
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 |
})
|
|
|
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 |
|
|
|
285 |
});
|
286 |
</script>
|
287 |
</body>
|
288 |
+
</html>
|