diff options
Diffstat (limited to 'rannak/mangud/arimees/pood/script.js')
-rw-r--r-- | rannak/mangud/arimees/pood/script.js | 23 |
1 files changed, 16 insertions, 7 deletions
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 |