Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +0 -9
templates/index.html
CHANGED
@@ -87,11 +87,9 @@
|
|
87 |
<script>
|
88 |
let lastUpdate = 0;
|
89 |
let expandedCategories = new Set();
|
90 |
-
|
91 |
function getArticleKey(article) {
|
92 |
return `${article.title}|${article.link}|${article.published}`;
|
93 |
}
|
94 |
-
|
95 |
function toggleCategory(category) {
|
96 |
const spinner = document.getElementById(`spinner-${category}`);
|
97 |
const tilesDiv = document.getElementById(`category-${category}`);
|
@@ -146,7 +144,6 @@
|
|
146 |
});
|
147 |
}
|
148 |
}
|
149 |
-
|
150 |
function updateArticles() {
|
151 |
fetch('/get_updates')
|
152 |
.then(response => response.json())
|
@@ -226,7 +223,6 @@
|
|
226 |
setTimeout(updateArticles, 2000);
|
227 |
});
|
228 |
}
|
229 |
-
|
230 |
function checkLoadingStatus() {
|
231 |
fetch('/check_loading')
|
232 |
.then(response => response.json())
|
@@ -242,19 +238,16 @@
|
|
242 |
setTimeout(checkLoadingStatus, 2000);
|
243 |
});
|
244 |
}
|
245 |
-
|
246 |
document.addEventListener('DOMContentLoaded', () => {
|
247 |
const tiles = document.querySelectorAll('.tiles');
|
248 |
tiles.forEach(tile => {
|
249 |
lastUpdate = Math.max(lastUpdate, parseFloat(tile.dataset.lastUpdate) || 0);
|
250 |
});
|
251 |
updateArticles();
|
252 |
-
|
253 |
// Start checking loading status if loading is active
|
254 |
if (document.getElementById('loadingContainer')) {
|
255 |
checkLoadingStatus();
|
256 |
}
|
257 |
-
|
258 |
const form = document.getElementById('searchForm');
|
259 |
const backButton = document.getElementById('backButton');
|
260 |
form.addEventListener('submit', (event) => {
|
@@ -272,7 +265,6 @@
|
|
272 |
backButton.style.display = 'block';
|
273 |
const existingContent = document.querySelectorAll('.category-section');
|
274 |
existingContent.forEach(section => section.remove());
|
275 |
-
|
276 |
const categoriesHtml = Object.entries(data.categorized_articles).map(([cat, articles]) => {
|
277 |
const seenKeys = new Set();
|
278 |
const uniqueArticles = articles.filter(article => {
|
@@ -316,7 +308,6 @@
|
|
316 |
alert('Failed to perform search. Please try again.');
|
317 |
});
|
318 |
});
|
319 |
-
|
320 |
backButton.addEventListener('click', () => {
|
321 |
window.location.href = '/';
|
322 |
});
|
|
|
87 |
<script>
|
88 |
let lastUpdate = 0;
|
89 |
let expandedCategories = new Set();
|
|
|
90 |
function getArticleKey(article) {
|
91 |
return `${article.title}|${article.link}|${article.published}`;
|
92 |
}
|
|
|
93 |
function toggleCategory(category) {
|
94 |
const spinner = document.getElementById(`spinner-${category}`);
|
95 |
const tilesDiv = document.getElementById(`category-${category}`);
|
|
|
144 |
});
|
145 |
}
|
146 |
}
|
|
|
147 |
function updateArticles() {
|
148 |
fetch('/get_updates')
|
149 |
.then(response => response.json())
|
|
|
223 |
setTimeout(updateArticles, 2000);
|
224 |
});
|
225 |
}
|
|
|
226 |
function checkLoadingStatus() {
|
227 |
fetch('/check_loading')
|
228 |
.then(response => response.json())
|
|
|
238 |
setTimeout(checkLoadingStatus, 2000);
|
239 |
});
|
240 |
}
|
|
|
241 |
document.addEventListener('DOMContentLoaded', () => {
|
242 |
const tiles = document.querySelectorAll('.tiles');
|
243 |
tiles.forEach(tile => {
|
244 |
lastUpdate = Math.max(lastUpdate, parseFloat(tile.dataset.lastUpdate) || 0);
|
245 |
});
|
246 |
updateArticles();
|
|
|
247 |
// Start checking loading status if loading is active
|
248 |
if (document.getElementById('loadingContainer')) {
|
249 |
checkLoadingStatus();
|
250 |
}
|
|
|
251 |
const form = document.getElementById('searchForm');
|
252 |
const backButton = document.getElementById('backButton');
|
253 |
form.addEventListener('submit', (event) => {
|
|
|
265 |
backButton.style.display = 'block';
|
266 |
const existingContent = document.querySelectorAll('.category-section');
|
267 |
existingContent.forEach(section => section.remove());
|
|
|
268 |
const categoriesHtml = Object.entries(data.categorized_articles).map(([cat, articles]) => {
|
269 |
const seenKeys = new Set();
|
270 |
const uniqueArticles = articles.filter(article => {
|
|
|
308 |
alert('Failed to perform search. Please try again.');
|
309 |
});
|
310 |
});
|
|
|
311 |
backButton.addEventListener('click', () => {
|
312 |
window.location.href = '/';
|
313 |
});
|