summaryrefslogtreecommitdiff
path: root/rannak/mangud/direktor/loosung/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'rannak/mangud/direktor/loosung/script.js')
-rw-r--r--rannak/mangud/direktor/loosung/script.js124
1 files changed, 124 insertions, 0 deletions
diff --git a/rannak/mangud/direktor/loosung/script.js b/rannak/mangud/direktor/loosung/script.js
new file mode 100644
index 0000000..191d743
--- /dev/null
+++ b/rannak/mangud/direktor/loosung/script.js
@@ -0,0 +1,124 @@
+document.addEventListener('DOMContentLoaded', () => {
+ let btn = document.querySelector('.modalButton');
+ btn.click();
+});
+
+
+// To Know when to move on
+changedArr = new Array();
+
+
+
+
+// Loosung Font
+let fontPick = document.querySelector("#fontPick");
+fontPick.addEventListener("change", () => {
+
+ let loosung = document.querySelector("#loosung");
+ let val = fontPick.value;
+ loosung.style.fontFamily = val;
+
+ if (!changedArr.includes("font"))
+ changedArr.push("font");
+
+ CheckIfAllGood();
+
+});
+
+
+
+// Loosung Size
+let fontSize = document.querySelector("#fontSize");
+fontSize.addEventListener("change", () => {
+
+
+ let loosung = document.querySelector("#loosung");
+ let val = fontSize.value;
+ let newSize = parseInt(val)/10;
+
+
+ if (val > 50)
+ loosung.style.fontSize="5rem";
+
+ else if (val < 10)
+ loosung.style.fontSize="1rem";
+
+ else
+ loosung.style.fontSize = newSize+"rem";
+
+
+ if (!changedArr.includes("size"))
+ changedArr.push("size");
+
+ CheckIfAllGood();
+
+});
+
+
+
+
+// Loosung Color
+let fontColor = document.querySelector("#fontColor");
+fontColor.addEventListener("change", () => {
+
+ let loosung = document.querySelector("#loosung");
+ let val = fontColor.value;
+ loosung.style.color = val;
+
+
+ if (!changedArr.includes("color"))
+ changedArr.push("color");
+
+ CheckIfAllGood();
+
+});
+
+
+
+
+// Reset BTN
+let resetBtn = document.querySelector("#resetBtn");
+resetBtn.addEventListener("click", () => {
+
+ let loosung = document.querySelector("#loosung");
+ loosung.style.color= "#fff";
+ loosung.style.fontSize= "2rem";
+ loosung.style.fontFamily= "inherit";
+
+ fontPick.value = "tavaline";
+ fontColor.value = "#ffffff";
+ fontSize.value = 20;
+
+ loosung.innerHTML = "Muuda Loosung enda omaks!";
+ changedArr = new Array();
+});
+
+
+document.querySelector("#loosung").addEventListener("input", () => {CheckIfAllGood()})
+
+
+
+
+// Funcs //
+
+function CheckIfAllGood(){
+ //let radioBtn = document.querySelector("input[name='sundmuseValik']:checked");
+ let loosung = document.querySelector("#loosung");
+
+
+ if (document.querySelector("input[name='sundmuseValik']:checked") != null &&
+ changedArr.length >= 3 && loosung.innerHTML != "Muuda loosung enda omaks!"){
+ moveOnEnable();
+ }
+
+ return false
+}
+
+
+// If Done
+function moveOnEnable(){
+ const btn = document.querySelector(".moveOn");
+ btn.disabled = false;
+ btn.onclick = () => location.href = "";
+}
+