<main class="grid" id="grid">
{% for s in services %}
- <a class="card{% if s.lan %} is-lan{% endif %}" href="{{ s.href }}" rel="noopener noreferrer"{% if s.lan %} data-lan="true"{% endif %}>
+ <a class="card{% if s.lan %} is-lan{% endif %}"
+ href="{{ s.href }}"
+ rel="noopener noreferrer"
+ {% if s.lan %} data-lan="true"{% endif %}>
{% if s.icon %}<div class="tile-icon">{% lucide s.icon, class="tile-glyph" %}</div>{% endif %}
<div class="tile-body">
<h3>{{ s.name }}</h3>
const input = document.getElementById('filter');
const cards = Array.from(document.querySelectorAll('.grid a.card')); // anchors
- // ... your existing code (empty node, apply(), etc.) ...
-
input.addEventListener('keydown', (e) => {
if (e.key !== 'Enter') return;
if (visible.length === 1) {
window.location.href = visible[0].href;
}
- // Optional: if multiple, jump to the first one (comment out if you don't want this)
- // else if (visible.length > 0) {
- // window.location.href = visible[0].href;
- // }
});
-
- // ... keep your existing apply() and initial call ...
})();
</script>
const TIMEOUT_MS = 1500;
const lanCards = Array.from(document.querySelectorAll('.card[data-lan="true"]'));
- const allChips = Array.from(document.querySelectorAll('.chip'));
-
- function reveal() {
- // show all chips at once (no flash before this)
- allChips.forEach(c => c.classList.remove('chip--pending'));
- }
-
- // If there are no LAN-only items, just reveal chips (all green)
- if (!lanCards.length) { reveal(); return; }
+ if (!lanCards.length) { return; }
- // Decide home/away by CORS-validated fetch
const ctrl = new AbortController();
const to = setTimeout(() => ctrl.abort(), TIMEOUT_MS);
if (res.ok) {
// Home: ensure LAN-only cards are NOT red
lanCards.forEach(card => card.classList.remove('is-lan'));
- } else {
- // Away: keep LAN-only cards red (leave is-lan on)
+ // Re-run current filter so visibility matches the query (if any)
+ const input = document.getElementById('filter');
+ if (input) input.dispatchEvent(new Event('input', { bubbles: true }));
}
- reveal();
})
.catch(() => {
clearTimeout(to);
- // Timeout / away: keep LAN-only cards red
- reveal();
});
})();
</script>