summaryrefslogtreecommitdiff
path: root/rannak/mangud/arimees/muusika/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'rannak/mangud/arimees/muusika/script.js')
-rw-r--r--rannak/mangud/arimees/muusika/script.js41
1 files changed, 39 insertions, 2 deletions
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");