1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

simplify condition handling: allow arrays for values, allow to omit outer array

This commit is contained in:
andreas
2022-03-01 15:44:08 +01:00
parent 0b906d55c2
commit 7c89718735

View File

@@ -391,12 +391,19 @@ function checkCondition(element){
let condition=getConditions(name);
if (! condition) return;
let visible=false;
if (! condition instanceof Array) condition=[condition];
condition.forEach(function(cel){
let lvis=true;
for (let k in cel){
let item=document.querySelector('[name='+k+']');
if (item){
if (item.value != cel[k]) lvis=false;
let compare=cel[k];
if (compare instanceof Array){
if (compare.indexOf(item.value) < 0) lvis=false;
}
else{
if (item.value != cel[k]) lvis=false;
}
}
}
if (lvis) visible=true;