From 0c2eea73ecb9641558a63ba45adcefb3eb3fe69a Mon Sep 17 00:00:00 2001 From: Greg Date: Sat, 10 May 2025 19:47:02 +0200 Subject: [PATCH] Toggle V2 --- static/app.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/static/app.js b/static/app.js index 649ff6a..debb7f7 100644 --- a/static/app.js +++ b/static/app.js @@ -159,17 +159,15 @@ function renderTable() { }, 0); } -window.onload = () => { +document.addEventListener('DOMContentLoaded', () => { fetchData(); - document.addEventListener('DOMContentLoaded', () => { - const toggleBtn = document.getElementById('toggle-matches-btn'); - if (toggleBtn) { - toggleBtn.textContent = 'Show All Matches'; - toggleBtn.onclick = () => { - showAllMatches = !showAllMatches; - toggleBtn.textContent = showAllMatches ? 'Show Future Matches' : 'Show All Matches'; - renderTable(); - }; - } - }); -}; + const toggleBtn = document.getElementById('toggle-matches-btn'); + if (toggleBtn) { + toggleBtn.textContent = 'Show All Matches'; + toggleBtn.onclick = () => { + showAllMatches = !showAllMatches; + toggleBtn.textContent = showAllMatches ? 'Show Future Matches' : 'Show All Matches'; + renderTable(); + }; + } +});