From 3d0202b4faaef7ff0900bcfefca4c88907a2b6d4 Mon Sep 17 00:00:00 2001 From: stilbruch Date: Sat, 23 Apr 2022 15:08:27 -0500 Subject: Update record workout page --- app/static/js/record.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'app/static') diff --git a/app/static/js/record.js b/app/static/js/record.js index fedbdd7..75aa148 100644 --- a/app/static/js/record.js +++ b/app/static/js/record.js @@ -1,9 +1,42 @@ +// Register 'Enter' listeners on all inputs +Array.from(document.getElementsByClassName('input')) + .filter(e => e.type == 'number') + .forEach(e => e.addEventListener('keyup', function(event) { + if (event.key == 'Enter') { + console.log("ENTER"); + } + })) + +function checkSet(row) { + // Disable input editing + row.children[1].firstChild.disabled = true; + row.children[2].firstChild.disabled = true; + + // Add is-success to inputs + row.children[1].firstChild.classList.add('is-success') + row.children[2].firstChild.classList.add('is-success') +} + +function uncheckSet(row) { + // Re-enable input editing + row.children[1].firstChild.disabled = false; + row.children[2].firstChild.disabled = false; + + // Remove is-success from inputs + row.children[1].firstChild.classList.remove('is-success') + row.children[2].firstChild.classList.remove('is-success') +} + // Called when the check at the end of a set line is clicked function onClickSetCheck(elem) { if (elem.classList.contains('is-success')) { elem.classList.remove('is-success'); + + uncheckSet(elem.parentElement.parentElement); } else { elem.classList.add('is-success'); + + checkSet(elem.parentElement.parentElement); } } -- cgit v1.2.3