From 9b52af980bdd30d84c8187d452d8f593785dc0c0 Mon Sep 17 00:00:00 2001 From: Matthew Frost <m.frost@mattronix.nl> Date: Sun, 19 Nov 2023 02:50:13 +0100 Subject: [PATCH] aux --- app/templates/index.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/templates/index.html b/app/templates/index.html index bc90a15..7b45ff2 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -232,6 +232,7 @@ // Search outlet const searchInput = document.getElementById('searchInput'); + searchInput.value = localStorage.getItem('searchValue') || ''; // Set the value from localStorage if available searchInput.addEventListener('input', () => { const searchValue = searchInput.value.toLowerCase(); const outlets = document.getElementsByClassName('outlet'); @@ -246,10 +247,13 @@ outlet.style.display = 'none'; } } + + localStorage.setItem('searchValue', searchValue); // Store the value in localStorage }); // Filter outlets by state const stateFilter = document.getElementById('stateFilter'); + stateFilter.value = localStorage.getItem('filterValue') || ''; // Set the value from localStorage if available stateFilter.addEventListener('change', () => { const filterValue = stateFilter.value; const outlets = document.getElementsByClassName('outlet'); @@ -264,6 +268,8 @@ outlet.style.display = 'none'; } } + + localStorage.setItem('filterValue', filterValue); // Store the value in localStorage }); // Refresh powerbars and their states @@ -274,8 +280,6 @@ // Initial fetch and render fetchPowerbars(); - // Refresh every 5 seconds - setInterval(refreshPowerbars, 5000); </script> </body> </html>