diff options
Diffstat (limited to 'rannak/kaart/js')
-rwxr-xr-x[-rw-r--r--] | rannak/kaart/js/kaart.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/rannak/kaart/js/kaart.js b/rannak/kaart/js/kaart.js index f0921b5..e905fb5 100644..100755 --- a/rannak/kaart/js/kaart.js +++ b/rannak/kaart/js/kaart.js @@ -55,6 +55,8 @@ const zoom = (direction) => { }; + + // Event Listeners document.getElementById("left-button").onclick = () => pan("left"); @@ -67,24 +69,29 @@ document.getElementById("zoom-out-button").onclick = () => zoom("out"); + + + // ******************** Other Stuff **************************** // const riigid = document.querySelectorAll("svg path") -// Praegu Eesti, Portugal, Holland -const leitavad = ["EE", "PT", "NL"] + +const leitavad = ["IS", "LV", "LT", "UA", "HU", "Russian Federation", "France"] let leitud = []; // Add click listener for (let i = 0; i < riigid.length; i++){ - if (leitavad.includes(riigid[i].id)){ + if (leitavad.includes(riigid[i].id) || leitavad.includes(riigid[i].className.baseVal)){ riigid[i].addEventListener("click", e => { e.target.style.fill = "#00FF00"; - if (!leitud.includes(e.target.id)) - leitud.push(riigid[i].id); + if (!leitud.includes(i)) + leitud.push(i); if (leitavad.length == leitud.length) moveOnEnable(); + + console.log(leitud.length); }) } else{ |