From 7c89718735dc20812291ad36ee23e742d3829f4c Mon Sep 17 00:00:00 2001 From: andreas Date: Tue, 1 Mar 2022 15:44:08 +0100 Subject: [PATCH] simplify condition handling: allow arrays for values, allow to omit outer array --- web/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/index.js b/web/index.js index a87ea24..6cf3fcb 100644 --- a/web/index.js +++ b/web/index.js @@ -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;