Skip to content

Commit

Permalink
simplify condition handling: allow arrays for values, allow to omit o…
Browse files Browse the repository at this point in the history
…uter array
  • Loading branch information
andreas committed Mar 1, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0b906d5 commit 7c89718
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion web/index.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 7c89718

Please sign in to comment.