From 61f75569eb9464fbf0403f3af41d940e5cc79478 Mon Sep 17 00:00:00 2001 From: Rasmus Luha Date: Sat, 14 Jan 2023 00:06:13 +0200 Subject: salakood mang --- rannak/mangud/kaitseliitlane/salakood/index.html | 259 +++++++++++++++++++++ .../kaitseliitlane/salakood/pildid/avatar.jpg | Bin 0 -> 137594 bytes rannak/mangud/kaitseliitlane/salakood/script.js | 141 +++++++++++ rannak/mangud/kaitseliitlane/salakood/style.css | 152 ++++++++++++ 4 files changed, 552 insertions(+) create mode 100644 rannak/mangud/kaitseliitlane/salakood/index.html create mode 100644 rannak/mangud/kaitseliitlane/salakood/pildid/avatar.jpg create mode 100644 rannak/mangud/kaitseliitlane/salakood/script.js create mode 100644 rannak/mangud/kaitseliitlane/salakood/style.css (limited to 'rannak/mangud/kaitseliitlane/salakood') diff --git a/rannak/mangud/kaitseliitlane/salakood/index.html b/rannak/mangud/kaitseliitlane/salakood/index.html new file mode 100644 index 0000000..26502a6 --- /dev/null +++ b/rannak/mangud/kaitseliitlane/salakood/index.html @@ -0,0 +1,259 @@ + + + + + + Salakood + + + + + + + + + + + +
+

Salakood

+ +

+ Kaitseliitlane edastab meile salakirjas teate, mille on koostanud 4 torni valvavat kaitseliitlast. +
+ Kas need 4 saatsid selle äkki Soome YLES raadiole? +

+ +
+ +
+ +
+ +
+ + + + +
+
+
Kood
+ 25-A | + 24-B | + 23-C | + 22-D | + 21-E | + 20-F | + 19-G | + 18-H | + 17-I | + 16-J | + 15-K | + 14-L | + 13-M | + 12-N | + 11-O | + 10-P | + 9-R | + 8-S | + 7-T | + 6-U | + 5-V | + 4-Õ | + 3-Ä | + 2-Ö | + 1-Ü +
+ +
+ + +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
71191217911212257174.30.
52514525132181722211521815687
22.151199682114.211421157219,
92525221711142151711142113258.
141720717221142152514.
111461511922159171771714171221.
+ +
+ + + + + + + + + diff --git a/rannak/mangud/kaitseliitlane/salakood/pildid/avatar.jpg b/rannak/mangud/kaitseliitlane/salakood/pildid/avatar.jpg new file mode 100644 index 0000000..37ae271 Binary files /dev/null and b/rannak/mangud/kaitseliitlane/salakood/pildid/avatar.jpg differ diff --git a/rannak/mangud/kaitseliitlane/salakood/script.js b/rannak/mangud/kaitseliitlane/salakood/script.js new file mode 100644 index 0000000..1945187 --- /dev/null +++ b/rannak/mangud/kaitseliitlane/salakood/script.js @@ -0,0 +1,141 @@ +document.addEventListener('DOMContentLoaded', () => { + let btn = document.querySelector('.modalButton'); + btn.click(); +}); + + +let counter = 0; + + +function message(msg, color){ + messageBox = document.querySelector(".infoTxt"); + messageBox.innerHTML = msg; + messageBox.style.color = color; +} + + + + + +// Grid event added +function clickEventAdder(){ + for (let node of document.querySelectorAll("td")) { + + node.addEventListener("click", () => { + + if (!node.classList.contains("selected")) + node.classList.add("selected"); + + let curNode = node; + for (let node of document.querySelectorAll("td")) { + if (node != curNode && node.classList.contains("selected")) + node.classList.remove("selected"); + } + }); + + } // outerFor +} // FuncEnd +clickEventAdder(); + + + + + + +function getInputValue() { + // Selecting the input element and get its value + let inputVal = document.getElementById("inputId").value; + + if (inputVal == "") + message("Palun vali täht.", "red"); + else + kontrolliVastus(inputVal.toLowerCase()); +} + +let koodid = {"a": 25, + "b": 24, + "c": 23, + "d": 22, + "e": 21, + "f": 20, + "g": 19, + "h": 18, + "i": 17, + "j": 16, + "k": 15, + "l": 14, + "m": 13, + "n": 12, + "o": 11, + "p": 10, + "r": 9, + "s": 8, + "t": 7, + "u": 6, + "v": 5, + "õ": 4, + "ä": 3, + "ö": 2, + "ü": 1, + }; + +function kontrolliVastus(vastus){ + + let toCheck = document.querySelector(".selected"); + + if (toCheck.classList.contains("done")) + message("Juba Õige!", "lime"); + + else if (toCheck.innerHTML == "") + message("Siin on tühik.", "lime"); + + else if (koodid[vastus] == toCheck.innerHTML){ + message("Õige!", "lime"); + toCheck.innerHTML = vastus.toUpperCase(); + toCheck.classList.add("done"); + counter += 1; + + if (counter >= 90) { + moveOnEnable(); + message("Tubli, kõik valmis
Kogu Sõnum: TORNI RÜNNATI 4.30. VALVAME SIDEKESKUST 22. KORRUSEL. ELEKTER, RAADIOSIDE OLEMAS. LIFTID ÜLEVAL. OLUKORD KRIITILINE.", "lime"); + + for (let node of document.querySelectorAll("td")) { + if (node.classList.contains("selected")) + node.classList.remove("selected"); + } + } + + } + + else + message("Proovi uuesti.", "red"); + +} + + +function enterSubmit(){ + document.getElementById('inputId') + .addEventListener('keyup', event => { + if (event.code === 'Enter') + { + event.preventDefault(); + getInputValue(); + } + }); +} +enterSubmit() + + + +// If Done + +function moveOnEnable(){ + const btn = document.querySelector(".moveOn"); + btn.disabled = false; + btn.onclick = () => location.href = "#"; + + // Proovi btn + const subButton = document.querySelector(".subBtn"); + subButton.disabled = true; + +} diff --git a/rannak/mangud/kaitseliitlane/salakood/style.css b/rannak/mangud/kaitseliitlane/salakood/style.css new file mode 100644 index 0000000..537477f --- /dev/null +++ b/rannak/mangud/kaitseliitlane/salakood/style.css @@ -0,0 +1,152 @@ +* { + box-sizing: border-box; +} + +body{ + background-color: #212121 !important; +} + +.moveOn{ + display: inline-block; + border: none; + padding: 6px 12px; + margin-botton: 0; + font-size: 1rem; + font-weight: normal; + text-align: center; + cursor: pointer; + border-radius: 4px; + background-color: #4BB543; + color: white; +} + +button:disabled{ + opacity: 0.5; + cursor: not-allowed; +} + +/* Retsept Lõpus*/ + +.retsept { + margin-top: 5%; + width:60%; + color: #AFFF80; + text-align: center; + font-size: 1.2rem; +} + + + +/* Modal Stuff */ + +.avatar { + border-radius: 20px; + width: 100% !important; + max-width: 15rem !important; +} + +.modalHeaderWrapper{ + text-align: center; + margin: 0 !important; + width: 100% !important; +} + + + +.closeModalButton { + border-radius: 50px; +} + +.modalButton{ + position: absolute; + top: 0; + right: 0; + padding: 6px; + padding: 9px 25px; + background-color: rgba(0,136,169,1) !important; + border: none !important; + border-radius: 50px !important; + cursor: pointer !important; + transition: all 0.3 ease 0 !important; + margin: 3% !important; + font-size: 1.2rem !important; +} + +.modalButton:hover{ + background-color: rgba(0,136,169,0.8) !important; +} + + +/* Input Box styles */ + +input { + width: 7ch; +} + +.inputBox{ + margin-top: 10px !important; +} + +.subBtn{ + display: inline-block; + border: none; + padding: 3px 6px; + margin-botton: 0; + font-size: .95rem; + font-weight: normal; + text-align: center; + cursor: pointer; + border-radius: 2px; + color: white; + background-color: #93bdbd; +} + +.subDisabled{ + cursor: not-allowed; +} + + +/* Koodi Styles*/ + +.infoWrapper{ + color: white; + margin: 1rem; +} + + + +/* Main */ + +.main { + display: flex; + justify-content: center; + align-items: center; +} + +td { + border: 4px solid white !important; + width: 4rem !important; + height: 4rem !important; + font-weight: bold; +} + + + +.done { + color: #bd1393; +} + +.selected { + background: lime; +} + + + + + + +@media screen and (min-width: 1900px) { + .main { + margin-top: 5rem; + } +} -- cgit v1.2.3