Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -277,7 +277,7 @@ def search_page():
|
|
| 277 |
.search-box input[type="text"] {{
|
| 278 |
width: 100%; padding: 12px 20px; font-size: 16px;
|
| 279 |
border: 1px solid #dfe1e5; border-radius: 24px;
|
| 280 |
-
box-shadow: 0 1px 6px rgba(
|
| 281 |
}}
|
| 282 |
.search-box input[type="submit"] {{
|
| 283 |
background-color: #f8f9fa; border: 1px solid #f8f9fa;
|
|
@@ -378,21 +378,22 @@ def search_page():
|
|
| 378 |
}}
|
| 379 |
async function checkLinks() {{
|
| 380 |
const links = document.querySelectorAll('.search-result a');
|
| 381 |
-
const
|
| 382 |
-
const url =
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
link.textContent += ' [Broken Link]';
|
| 388 |
link.classList.add('broken');
|
| 389 |
-
}}
|
| 390 |
-
}} catch (error) {{
|
| 391 |
-
link.textContent += ' [Broken Link]';
|
| 392 |
-
link.classList.add('broken');
|
| 393 |
-
}}
|
| 394 |
}});
|
| 395 |
-
await Promise.all(
|
| 396 |
}}
|
| 397 |
window.onload = function() {{
|
| 398 |
hideProgress();
|
|
|
|
| 277 |
.search-box input[type="text"] {{
|
| 278 |
width: 100%; padding: 12px 20px; font-size: 16px;
|
| 279 |
border: 1px solid #dfe1e5; border-radius: 24px;
|
| 280 |
+
box-shadow: 0 1px 6px rgba(0,0,0,0.28);
|
| 281 |
}}
|
| 282 |
.search-box input[type="submit"] {{
|
| 283 |
background-color: #f8f9fa; border: 1px solid #f8f9fa;
|
|
|
|
| 378 |
}}
|
| 379 |
async function checkLinks() {{
|
| 380 |
const links = document.querySelectorAll('.search-result a');
|
| 381 |
+
const checkPromises = Array.from(links).map(link => {{
|
| 382 |
+
const url = link.href; // Directly use href without encodeURIComponent initially
|
| 383 |
+
return fetch('/check-url?url=' + encodeURIComponent(url))
|
| 384 |
+
.then(response => response.json())
|
| 385 |
+
.then(data => {{
|
| 386 |
+
if (data.broken) {{
|
| 387 |
+
link.textContent += ' [Broken Link]';
|
| 388 |
+
link.classList.add('broken');
|
| 389 |
+
}}
|
| 390 |
+
}})
|
| 391 |
+
.catch(() => {{
|
| 392 |
link.textContent += ' [Broken Link]';
|
| 393 |
link.classList.add('broken');
|
| 394 |
+
}});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
}});
|
| 396 |
+
await Promise.all(checkPromises);
|
| 397 |
}}
|
| 398 |
window.onload = function() {{
|
| 399 |
hideProgress();
|