changing state select dropdown activates state

This commit is contained in:
iou1name 2019-11-21 09:39:35 -05:00
parent 53656b1f05
commit 57d618a3e0

View File

@ -338,8 +338,7 @@ function state_solid_amount(radio) {
}
function state_select(select) {
let device = select.parentElement.parentElement.parentElement;
let sub_devices = device.querySelector('.sub_devices');
let device = select.closest('.device');
if (select.value === 'solid') {
select.parentElement.querySelector('.state_solid').style.display = 'block';
select.parentElement.querySelector('.state_rainbow').style.display = 'none';
@ -348,19 +347,17 @@ function state_select(select) {
select.parentElement.querySelector('.state_solid').style.display = 'none';
select.parentElement.querySelector('.state_rainbow').style.display = 'block';
select.parentElement.querySelector('.state_america').style.display = 'none';
for (let sub_device of sub_devices.children) {
let input = sub_device.firstElementChild.firstElementChild;
input.disabled = true;
}
} else if (select.value === 'america') {
select.parentElement.querySelector('.state_solid').style.display = 'none';
select.parentElement.querySelector('.state_rainbow').style.display = 'none';
select.parentElement.querySelector('.state_america').style.display = 'block';
}
let sub_devices = device.querySelector('.sub_devices');
for (let sub_device of sub_devices.children) {
let input = sub_device.firstElementChild.firstElementChild;
input.disabled = true;
}
}
neopixel_state(device);
}
/* Misc */