From 3c64a840a69b2685722765feadf0fec6e571b157 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Sat, 6 May 2023 12:09:56 +0300 Subject: fixed vids and else Former-commit-id: d0b098f6e7522ec2791cb3786f3b7926d9b1aae1 --- rannak/mangud/arimees/muusika/script.js | 41 +++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'rannak/mangud/arimees/muusika/script.js') diff --git a/rannak/mangud/arimees/muusika/script.js b/rannak/mangud/arimees/muusika/script.js index 0bcaae0..85d0292 100644 --- a/rannak/mangud/arimees/muusika/script.js +++ b/rannak/mangud/arimees/muusika/script.js @@ -4,8 +4,12 @@ document.addEventListener('DOMContentLoaded', () => { }); -const selectors = document.querySelectorAll('select'); +allPohjendatud = false; +allSelected = false; + +// EventListenres +const selectors = document.querySelectorAll('select'); for(el of selectors){ el.addEventListener('change', () => { @@ -16,13 +20,46 @@ for(el of selectors){ } if (selected.length == 6) + allSelected = true; + else + allSelected = false; + + if (allPohjendatud && allSelected) + moveOnEnable(); + }); +} + + + +const pohjendused = document.querySelectorAll('textarea'); +for(el of pohjendused){ + el.addEventListener('input', () => { + + let pohjendatud = new Array(); + for (el of pohjendused){ + if (!pohjendatud.includes(el) && el.value != '') + pohjendatud.push(el); + } + + if (pohjendatud.length == 6) + allPohjendatud = true; + else + allPohjendatud = false; + + if (allPohjendatud && allSelected) moveOnEnable(); }); } -// If All Else Done + + + + + + +// If All Done function moveOnEnable(){ const btn = document.querySelector(".moveOn"); -- cgit v1.2.3