-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathindex.js
32 lines (27 loc) · 873 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* Code for the home page protocol picker.
*/
function update() {
// show matching instructions
// console.log($('.instruction'))
let showed = false;
for (instr of $('.instruction')) {
let parts = instr.id.split('-')
let me = parts[1]
let them = parts[2]
// console.log(me, them, $(`#me-${me}`)[0].checked, $(`#them-${them}`)[0].checked)
if ($(`#me-${me}`)[0].checked && $(`#them-${them}`)[0].checked) {
instr.style.display = 'block'
document.getElementById('front-instructions')
.scrollIntoView({behavior: 'smooth', block: 'nearest'})
showed = true;
} else {
instr.style.display = 'none'
}
}
document.getElementById('front-instruction-placeholder').style.display =
(showed) ? 'none' : 'block'
}
// addEventListener('DOMContentLoaded', () => {
// $('input').on('change', update)
// })