summaryrefslogtreecommitdiff
path: root/app/static
diff options
context:
space:
mode:
Diffstat (limited to 'app/static')
-rw-r--r--app/static/js/record.js33
1 files changed, 33 insertions, 0 deletions
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);
}
}