Skip to content

Commit

Permalink
Make checkbox for running analysis on loaded page exclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfspetrovs committed May 9, 2021
1 parent 74732ce commit 42d5bb6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
<div id="messages" class="status-board"></div>
<div id="control-board">
<div>
<input type="checkbox" id="FBA-run-on-load" name="FBA-run-on-load" value="1" checked>
<input type="checkbox" id="FBA-run-on-load" name="FBA-run-on-load" onclick="clearOther(this)" value="1" checked>
<label for="FBA-run-on-load">Run on loaded page</label><br>
<button id="FBA-button" class="control-button">Run FBA</button>
</div>
<div>
<input type="checkbox" id="FVA-run-on-load" name="FVA-run-on-load" value="1">
<input type="checkbox" id="FVA-run-on-load" name="FVA-run-on-load" onclick="clearOther(this)" value="1">
<label for="FVA-run-on-load">Run on loaded page</label><br>
<button id="FVA-button" class="control-button">Run FVA</button>
</div>
Expand Down
7 changes: 7 additions & 0 deletions src/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,3 +561,10 @@ function createFVALegend({
svgStyle.node().innerHTML = legendCSS;
return svg
}

function clearOther(x, selector="div#control-board input") {
if (x.checked === true) {
document.querySelectorAll(selector).forEach(a => a.checked = false);
x.checked = true;
}
}

0 comments on commit 42d5bb6

Please sign in to comment.