diff options
| author | stilbruch <stilbruch@protonmail.com> | 2022-05-09 14:52:06 -0500 |
|---|---|---|
| committer | stilbruch <stilbruch@protonmail.com> | 2022-05-09 14:52:06 -0500 |
| commit | 5ee44a802512ee98c1330e936e5ec2b3f23659e7 (patch) | |
| tree | 38529604007ae2f2e28112786f859097c9eb8af9 /app | |
| parent | 52f6fb00d7c375fba37b0ab7172630e766bf963a (diff) | |
| download | Strengthy-5ee44a802512ee98c1330e936e5ec2b3f23659e7.tar.xz Strengthy-5ee44a802512ee98c1330e936e5ec2b3f23659e7.zip | |
Start set class for record screen
Diffstat (limited to 'app')
| -rw-r--r-- | app/static/js/record.js | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/app/static/js/record.js b/app/static/js/record.js index 62091d3..68538ca 100644 --- a/app/static/js/record.js +++ b/app/static/js/record.js @@ -13,6 +13,13 @@ class Timer { this.finished = false; } + static fromElem(elem) { + if (!elem.timer) { + elem.timer = new Timer(elem); + } + return elem.timer; + } + setIcon(c) { this.icon.classList.remove(...this.icon.classList); this.icon.classList.add('fa'); @@ -87,6 +94,40 @@ class Timer { } } +class Set { + constructor(row) { + this.row = row; + if (row.dataset.isTimer) { + this.timer = Timer.fromElem(row.children[1].children[0].children[0]); + } else { + this.lbsInput = row.children[1].children[0]; + this.repsInput = row.children[2].children[0]; + } + } + + static fromRow(row) { + if (!row.set) { + row.set = new Set(row); + } + return row.set; + } + + // TODO + reset() { + } + + check() { + if (self.timer) { + self.timer.finish(); + } else { + this.lbsInput.disabled = true; + this.repsInput.disabled = true; + } + + // TODO finish + } +} + // Get an arrayt of all inputs allInputs = Array.from(document.getElementsByClassName('input')).filter(e => e.type == 'number'); @@ -95,8 +136,6 @@ document.getElementById("form").addEventListener('submit', (el) => { Array.from(event.target.getElementsByTagName('input')).forEach(i => i.disabled = false); }); -// Attach a timer to all - function setReset(row, index, values=true) { if (row.dataset.isTimer) { let timerButton = row.children[1].children[0].children[0]; |
