This commit is contained in:
Matthew Frost 2023-11-19 02:50:13 +01:00
parent 88df77b712
commit 9b52af980b

View file

@ -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>