From c525b29ceb91c0abacfe9916aafb1b0b48d47880 Mon Sep 17 00:00:00 2001 From: Rasmus Luha Date: Fri, 24 Feb 2023 17:31:06 +0200 Subject: =?UTF-8?q?Soome=20m=C3=A4ng=20added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rannak/mangud/arimees/soome/script.js | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 rannak/mangud/arimees/soome/script.js (limited to 'rannak/mangud/arimees/soome/script.js') diff --git a/rannak/mangud/arimees/soome/script.js b/rannak/mangud/arimees/soome/script.js new file mode 100644 index 0000000..25ffedd --- /dev/null +++ b/rannak/mangud/arimees/soome/script.js @@ -0,0 +1,66 @@ +document.addEventListener('DOMContentLoaded', () => { + let btn = document.querySelector('.modalButton'); + btn.click(); +}); + + +let map = {}; +map["Moikka"] = "tere"; +map["puhuda"] = "rääkida"; +map["Pulma"] = "probleem"; +map["ostoksille"] = "ostlema"; +map["halba"] = "odavat"; +map["pibod"] = "kootudsuusamütsid"; +map["Tpaitad"] = "t-särgid"; +//map["kesähousut"] = "t-särgid"; +map["puserod"] = "sametistdressipluusid" +map["takkid"] = "joped" +map["purukummi"] = "nätsu" +map["pulma"] = "probleemi"; +map["kassi"] = "koti"; +map["puhelin"] = "telefon"; +map["kaikkiKunnossa"] = "kõikkorras"; +map["KaikkiParhaat"] = "kõikehead"; + + +let total = Object.keys(map).length; +rightOnes = new Array(); + + +const words = document.querySelectorAll("span"); + +for (let w of words){ + w.addEventListener('DOMSubtreeModified', () => { + + sone = w.id; + + let x = w.innerText.replace(/\s/g, ""); + let ignoringSpaces = x.toLowerCase(); + + if (ignoringSpaces == map[sone]) { + + let index = rightOnes.indexOf(sone); + if (index == -1) { + rightOnes.push(sone); + } + + w.setAttribute("contenteditable", false); + w.style.color = "lime"; + } + + + if (rightOnes.length == total) + moveOnEnable(); + }); +} + + + +// If All Else Done + +function moveOnEnable(){ + const btn = document.querySelector(".moveOn"); + btn.disabled = false; + btn.onclick = () => location.href = ""; +} + -- cgit v1.2.3