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/partorg/plakat/script.js | 117 +++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 rannak/mangud/partorg/plakat/script.js (limited to 'rannak/mangud/partorg/plakat/script.js') diff --git a/rannak/mangud/partorg/plakat/script.js b/rannak/mangud/partorg/plakat/script.js new file mode 100644 index 0000000..4d4ee36 --- /dev/null +++ b/rannak/mangud/partorg/plakat/script.js @@ -0,0 +1,117 @@ +document.addEventListener('DOMContentLoaded', () => { + let btn = document.querySelector('.modalButton'); + btn.click(); +}); + + + + + + + + + +// FROM HERE TODO + + +// Init Setup - to access later +let dingDong = document.querySelector(".addedText"); +dingDong.style.top = "50%"; +dingDong.style.left = "50%"; + + +// Position +const ules = document.querySelectorAll(".ules"); +const alla = document.querySelectorAll(".alla"); +const vasak = document.querySelectorAll(".vasak"); +const parem = document.querySelectorAll(".parem"); + +ules.forEach(el => { + el.addEventListener("click" , e => { + let theText = e.target.parentElement.parentElement.parentElement.childNodes[1].childNodes[1]; + let curTop = theText.style["top"]; + curTop = curTop.substring(0, curTop.length-1) + + if (Number(curTop) >= 5) + theText.style["top"] = Number(curTop)-5+"%"; + }); +}) + +alla.forEach(el => { + el.addEventListener("click" , e => { + let theText = e.target.parentElement.parentElement.parentElement.childNodes[1].childNodes[1]; + let curTop = theText.style["top"]; + curTop = curTop.substring(0, curTop.length-1) + + if (Number(curTop) <= 85) + theText.style["top"] = Number(curTop)+5+"%"; + }); +}) + +vasak.forEach(el => { + el.addEventListener("click", e => { + let theText = e.target.parentElement.parentElement.parentElement.childNodes[1].childNodes[1]; + let curLeft = theText.style["left"]; + curLeft = curLeft.substring(0, curLeft.length-1) + + console.log("Vasak"); + console.log(theText.innerHTML); + + if (Number(curLeft) >= 5) + theText.style["left"] = Number(curLeft)-5+"%"; + }); +}) + +parem.forEach(el => { + el.addEventListener("click", e => { + let theText = e.target.parentElement.parentElement.parentElement.childNodes[1].childNodes[1]; + let curLeft = theText.style["left"]; + curLeft = curLeft.substring(0, curLeft.length-1) + + if (Number(curLeft) >= 5) + theText.style["left"] = Number(curLeft)+5+"%"; + }); +}) + + + + +// Muuda Text button + +const muudaBtn = document.querySelector(".muuda"); + +muudaBtn.addEventListener("click", e => { + console.log(e); +}); + + + + + + + + + + + +function checkIfAllGood(){ + let rightDone = []; + + for (let j=0; j < lists.length; j++){ + const list = lists[j]; + if (list.className.includes("startBasket")) + continue; + else if (list.children.length == 1){ + if (list.id == list.children[0].id){ + if (!rightDone.includes(list.id)) + rightDone.push(list.id); + } + } + } // For loop end + + if (rightDone.length == 6) { + const btn = document.querySelector(".moveOn"); + btn.disabled = false; + btn.onclick = () => location.href = ""; + } +} -- cgit v1.2.3