enable mode selection

This commit is contained in:
lubiana 2025-06-11 21:42:33 +02:00
parent 04c85e10ba
commit 1353a57990
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
3 changed files with 31 additions and 158 deletions

View file

@ -68,6 +68,27 @@ function initNumberInputs(container = document) {
}
document.addEventListener('DOMContentLoaded', function() {
// Store and retrieve radio button state
const radioButtons = document.querySelectorAll('input[name="mode"]');
// Load saved state on page load
const savedMode = localStorage.getItem('selectedMode');
if (savedMode) {
const radioToCheck = document.getElementById(savedMode);
if (radioToCheck) {
radioToCheck.checked = true;
}
}
// Save state when radio button changes
radioButtons.forEach(radio => {
radio.addEventListener('change', function() {
if (this.checked) {
localStorage.setItem('selectedMode', this.id);
}
});
});
// Bootstrap Modal handling
const htmxModal = document.getElementById('htmxModal');
if (htmxModal) {