diff options
author | Rasmus <rasmus.luha@gmail.com> | 2023-05-14 16:12:01 +0300 |
---|---|---|
committer | Rasmus <rasmus.luha@gmail.com> | 2023-05-14 16:12:01 +0300 |
commit | 62caa37da257987c9585ac57ab64bb12ea481d0b (patch) | |
tree | c3d6ec3389258db0b807286ac008f7dcd8653636 /rannak/mangud/arimees | |
parent | 3c64a840a69b2685722765feadf0fec6e571b157 (diff) |
fixes
Former-commit-id: 09885e5cd344caaee9cdc2005b7e88dcc5206213
Diffstat (limited to 'rannak/mangud/arimees')
-rw-r--r-- | rannak/mangud/arimees/pood/index.html | 20 | ||||
-rw-r--r-- | rannak/mangud/arimees/pood/script.js | 23 |
2 files changed, 26 insertions, 17 deletions
diff --git a/rannak/mangud/arimees/pood/index.html b/rannak/mangud/arimees/pood/index.html index 16233d2..2e72724 100644 --- a/rannak/mangud/arimees/pood/index.html +++ b/rannak/mangud/arimees/pood/index.html @@ -256,70 +256,70 @@ <td></td> <td></td> <td></td> - <td></td> + <td class="summa"></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> - <td></td> + <td class="summa"></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> - <td></td> + <td class="summa"></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> - <td></td> + <td class="summa"></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> - <td></td> + <td class="summa"></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> - <td></td> + <td class="summa"></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> - <td></td> + <td class="summa"></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> - <td></td> + <td class="summa"></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> - <td></td> + <td class="summa"></td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> - <td></td> + <td class="summa"></td> </tr> </table> diff --git a/rannak/mangud/arimees/pood/script.js b/rannak/mangud/arimees/pood/script.js index 20efbe8..985255e 100644 --- a/rannak/mangud/arimees/pood/script.js +++ b/rannak/mangud/arimees/pood/script.js @@ -35,6 +35,9 @@ for (let i=0;i < cells.length; i++){ let origText = input.parentElement.getAttribute('data-text'); let curText = this.value; + sums = document.querySelectorAll(".summa"); + console.log(sums); + if (origText != curText){ td.removeAttribute('data-clicked'); td.removeAttribute('data-text'); @@ -42,26 +45,32 @@ for (let i=0;i < cells.length; i++){ td.style.cssText = 'padding: .5rem .5rem'; + totalSumma = 0; + sums.forEach(el => { + totalSumma += Number(el.innerHTML); + }); // Can move on? for (cell of cells){ - if (cell.textContent == '') - return; + if (totalSumma >= 12000) + moveOnEnable(); + else if (cell.textContent == '') + return; } moveOnEnable(); } + else { td.removeAttribute('data-clicked'); td.removeAttribute('data-text'); td.innerHTML = origText; td.style.cssText = 'padding: .5rem .5rem'; - } - - // Here Check if Done - //TODO + sums.forEach(el => { + console.log(el); + }); + } - } // onblur func end |