summaryrefslogtreecommitdiff
path: root/rannak/mangud/arimees/soome/script.js
blob: 25ffedde999c7c1e27ac1530b8460b01abaccf6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 = "";
}