From 03f99c33287e99e4db9e4cb4d3877fcf4114b877 Mon Sep 17 00:00:00 2001 From: Rasmus Luha Date: Sat, 24 Sep 2022 19:56:37 +0300 Subject: =?UTF-8?q?rists=C3=B5na=20numbrid=20ja=20enter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rannak/mangud/perenaine/ristsona/index.html | 222 +++++++++++++++------------- rannak/mangud/perenaine/ristsona/script.js | 28 ++-- 2 files changed, 132 insertions(+), 118 deletions(-) (limited to 'rannak/mangud/perenaine') diff --git a/rannak/mangud/perenaine/ristsona/index.html b/rannak/mangud/perenaine/ristsona/index.html index cd4fc21..f947eb7 100644 --- a/rannak/mangud/perenaine/ristsona/index.html +++ b/rannak/mangud/perenaine/ristsona/index.html @@ -17,7 +17,7 @@

Lahenda ristsõna. Lahenduseks on kuulus Eesti roog, mille retsepti jaoks vajalikud - koostiosad ongi vaja leida (vms?) + koostiosad ongi vaja leida.

@@ -82,86 +82,102 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - + + + + - - - + + + - + - - + + - + - - + + - + - + - + - + - + - + - + - + @@ -184,104 +200,104 @@ - - + + - + - + - - - + + + - - + + - - - + + + - - - + + + - - + + - - - + + + - - - + + + - + - - + + - - - - - - - + + + + + + + - + - - + + - - - - - - - - + + + + + + + + - + - - + + - - - - - - - - + + + + + + + + - +
8H8.
4.H10.
4V1.V6. E10S9.S12.
1KK3. O6SS R9MM I12KK
U3P2.P R5. O7. N U B11. A
R2MM O S5ÕÕ O7PP E N U11HH R
J G N P P U
O A A U L
N N R K
E D O
E O
S R
diff --git a/rannak/mangud/perenaine/ristsona/script.js b/rannak/mangud/perenaine/ristsona/script.js index 121bfab..cacda18 100644 --- a/rannak/mangud/perenaine/ristsona/script.js +++ b/rannak/mangud/perenaine/ristsona/script.js @@ -12,13 +12,9 @@ function message(msg, color){ function õigeVastus(nr, vastus){ message("Õige!", "green"); - console.log(nr); let tähed = document.querySelectorAll("."+vastus); for (let i = 0; i < tähed.length; i++) { - if (i == 0) - tähed[i].childNodes[1].style.display = "inline"; - else tähed[i].childNodes[0].style.display = "inline"; } @@ -26,8 +22,6 @@ function õigeVastus(nr, vastus){ õiged.push(nr); counter++; } - console.log(counter); - console.log(õiged); if (counter >= 12) moveOnEnable(); } @@ -37,23 +31,18 @@ function valeVastus(tähed, nr, vastus){ message("Vale pakumine, proovi uuesti", "red"); for (let i = 0; i < tähed.length; i++) { - if (i == 0) - tähed[i].childNodes[1].style.display = "none"; - else tähed[i].childNodes[0].style.display = "none"; } if (õiged.includes(nr)) { delete õiged[õiged.indexOf(nr)]; counter--; - console.log(counter) } } function kontrolliVastus(nr, vastus){ nr += ''; // dont know, andis errorit - console.log(nr); switch (nr) { case "1": @@ -167,9 +156,6 @@ function kontrolliVastus(nr, vastus){ - - - function getInputValue() { // Selecting the input element and get its value let inputVal = document.getElementById("inputId").value; @@ -185,7 +171,19 @@ function getInputValue() { -// Button func +// Button funcs + +function enterSubmit(){ + document.getElementById('inputId') + .addEventListener('keyup', event => { + if (event.code === 'Enter') + { + event.preventDefault(); + getInputValue(); + } + }); +} +enterSubmit() function moveOnEnable(){ const btn = document.querySelector(".moveOn"); -- cgit v1.2.3