diff options
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 |