summaryrefslogtreecommitdiff
path: root/rannak/endPage/main.js
blob: 0cfc56b501092ccb6e0ff85f63a60f0cf3e24b53 (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
const spans = document.querySelectorAll("span");

if (localStorage.roll != undefined){

    let roll = localStorage.roll;
    spans[0].innerHTML = roll;
    delete localStorage.roll;

    if (roll == 'Kaitseliitlase'){
        document.querySelector('h3').innerHTML = 'Soomusmasinate teekond:';
        spans[1].innerHTML = 'Asukoht: ' + localStorage.asula;
        //spans[2].innerHTML = 'Soomusmasinad möödusid sinust: ' + localStorage.kaugus ' km kauguselt.';
        spans[2].innerHTML = `Soomusmasinad möödusid sinust: ${localStorage.kaugus}  km kauguselt.`

        delete localStorage.asula;
        delete localStorage.kaugus;
    }

    else if (roll == 'Direktori'){
        document.querySelector('h3').innerHTML = 'Balti keti andmed:';
        spans[3].innerHTML = 'Balti keti pikkus: ' + localStorage.teekond;
        spans[1].innerHTML = 'Asula: ' + localStorage.asula;
        spans[2].innerHTML = 'Kaugus: ' + localStorage.kaugus;

        console.log(localStorage.teekond);

        delete localStorage.asula;
        delete localStorage.kaugus;
        delete localStorage.teekond;
    }
}