diff --git a/assets/items/AUDIO/BANKA.mp3 b/assets/items/AUDIO/BANKA.mp3 new file mode 100644 index 0000000..c0faac5 Binary files /dev/null and b/assets/items/AUDIO/BANKA.mp3 differ diff --git a/assets/items/AUDIO/CHROBAK.mp3 b/assets/items/AUDIO/CHROBAK.mp3 new file mode 100644 index 0000000..a3e0552 Binary files /dev/null and b/assets/items/AUDIO/CHROBAK.mp3 differ diff --git a/assets/items/AUDIO/CIZMY.mp3 b/assets/items/AUDIO/CIZMY.mp3 new file mode 100644 index 0000000..84b342d Binary files /dev/null and b/assets/items/AUDIO/CIZMY.mp3 differ diff --git a/assets/items/AUDIO/MEC.mp3 b/assets/items/AUDIO/MEC.mp3 new file mode 100644 index 0000000..bbf9051 Binary files /dev/null and b/assets/items/AUDIO/MEC.mp3 differ diff --git a/assets/items/AUDIO/STENA.mp3 b/assets/items/AUDIO/STENA.mp3 new file mode 100644 index 0000000..6cad940 Binary files /dev/null and b/assets/items/AUDIO/STENA.mp3 differ diff --git a/assets/items/AUDIO/TEHLA.mp3 b/assets/items/AUDIO/TEHLA.mp3 new file mode 100644 index 0000000..9e82ebd Binary files /dev/null and b/assets/items/AUDIO/TEHLA.mp3 differ diff --git a/assets/items/BANKA.png b/assets/items/BANKA.png new file mode 100644 index 0000000..1c1fee4 Binary files /dev/null and b/assets/items/BANKA.png differ diff --git a/assets/items/CHROBAK.png b/assets/items/CHROBAK.png new file mode 100644 index 0000000..edc5fc4 Binary files /dev/null and b/assets/items/CHROBAK.png differ diff --git a/assets/items/CIZMY.png b/assets/items/CIZMY.png new file mode 100644 index 0000000..e6c7a9a Binary files /dev/null and b/assets/items/CIZMY.png differ diff --git a/assets/items/MEC.png b/assets/items/MEC.png new file mode 100644 index 0000000..41ddfdf Binary files /dev/null and b/assets/items/MEC.png differ diff --git a/assets/items/STENA.png b/assets/items/STENA.png new file mode 100644 index 0000000..5cfff77 Binary files /dev/null and b/assets/items/STENA.png differ diff --git a/assets/items/TEHLA.png b/assets/items/TEHLA.png new file mode 100644 index 0000000..0aee8ec Binary files /dev/null and b/assets/items/TEHLA.png differ diff --git a/index.css b/index.css index 80902ef..ddd4ec9 100644 --- a/index.css +++ b/index.css @@ -41,7 +41,6 @@ width: 64px; height: 64px; opacity: 0; - right: -30%; background-image: url("assets/fail.png"); } diff --git a/index.html b/index.html index 4a40d13..ac4b743 100644 --- a/index.html +++ b/index.html @@ -1,3 +1,4 @@ + WAAAAAA @@ -32,25 +33,20 @@ + +
+ +
+
- -
- -
-
- -
- -
- diff --git a/index.js b/index.js index 73fddf5..9a9cc79 100644 --- a/index.js +++ b/index.js @@ -5,17 +5,22 @@ var cntdrag = 1; let data_tabl = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; let words = [ - "AHOJ", - "CAU", - "TEST" + "BANKA", + "CHROBAK", + "CIZMY", + "MEC", + "STENA", + "TEHLA" ]; function makeSpaceWord(word){ let length = word.length; for (var i = 0; i < length; i++) { - $("#lettersky").append('
'); - $("#imagesky").append('
'); + $("#lettersky").append('
'); + $("#imagesky").append('
'); } + $("#lettersky").append('
'); + $("#imagesky").append('
'); } let prefix = "assets/"; @@ -36,41 +41,62 @@ function cleanup(){ function checkAnswers() { let good = "background-image: url(\"assets/good.png\");"; let fail = "background-image: url(\"assets/fail.png\");"; - let lettersrc = $('#letterplace').attr("datacode"); - let imagesrc = $('#imageplace').attr("datacode"); - if (audiosrc == lettersrc) { - $('#letterstatus').attr('style', good); - $('#letterstatus').animate({opacity:1}, "slow"); - setTimeout(function (){ - $('#letterstatus').animate({opacity:0}, "slow"); - }); - } - else { - $('#letterstatus').attr('style', fail); - $('#letterstatus').animate({opacity:1}, "slow"); - setTimeout(function (){ - $('#letterstatus').animate({opacity:0}, "slow"); - }); - } - if (audiosrc == imagesrc) { + // $('#letterstatus').attr('style', good); + // $('#letterstatus').animate({opacity:1}, "slow"); + // setTimeout(function (){ + // $('#letterstatus').animate({opacity:0}, "slow"); + // }); + var imagecodes = ""; + var lettercodes = ""; + let vzorcodes = $("#currentvzor").attr("datacode"); + + + $(".finalimageplace").find("img").each(function (){ + imagecodes = imagecodes + $(this).attr("datacode"); + }); + + $(".finalletterplace").find("img").each(function (){ + lettercodes = lettercodes + $(this).attr("datacode"); + }); + + if (vzorcodes == imagecodes) + { $('#imagestatus').attr('style', good); $('#imagestatus').animate({opacity:1}, "slow"); setTimeout(function (){ $('#imagestatus').animate({opacity:0}, "slow"); }); } - else { + else{ $('#imagestatus').attr('style', fail); $('#imagestatus').animate({opacity:1}, "slow"); setTimeout(function (){ $('#imagestatus').animate({opacity:0}, "slow"); }); } - if (audiosrc == imagesrc && audiosrc == lettersrc){ + + if (vzorcodes == lettercodes) + { + $('#letterstatus').attr('style', good); + $('#letterstatus').animate({opacity:1}, "slow"); + setTimeout(function (){ + $('#letterstatus').animate({opacity:0}, "slow"); + }); + } + else{ + $('#letterstatus').attr('style', fail); + $('#letterstatus').animate({opacity:1}, "slow"); + setTimeout(function (){ + $('#letterstatus').animate({opacity:0}, "slow"); + }); + } + + if (vzorcodes == imagecodes && vzorcodes == lettercodes){ cleanup(); generatePair(); } + console.log("Vzor:" + vzorcodes + "\nLettercodes:" + lettercodes + "\nImagecodes:" + imagecodes); } function getRandomInt(min, max) { @@ -106,9 +132,21 @@ function showImages() { let letterpath = prefix + "letters/" + data_tabl[i] + ".png"; let audiopath = prefix + "audio/" + data_tabl[i] + ".ogg"; - images.push("
"); + images.push( + "
" + + "" + + "" + + "" + + "
" + ); ranid += 1; - letters.push("
"); + letters.push( + "
" + + "" + + "
" + ); ranid += 1; } randomize(images).forEach(function (value, index, array){ @@ -123,19 +161,62 @@ function showImages() { $(this).on("click", function (e){ let datacode = $(this).attr("datacode"); document.getElementById("audplay"+ datacode).play(); - }) }); } +function generateItem(word){ + let vzorplace = $("#vzoritem"); + + let datacode = "datacode=\"" + word + "\" " + + let imagesrc = "src=\"assets/items/" + word +".png\" " + let imageid = "id=\"currentvzor\" "; + + let audioid = "id = \"audplayitem" + word + "\" "; + let audiosrc = "src=\"assets/items/AUDIO/" + word +".mp3\" " + + let sourceid = "id=\"audioitemholderak" + word +"\" " + let sourceclass = "class=\"holderak\" " + let sourcetype = "type=\"audio/mpeg\" " + + let sourceend = ""; + let audioend = ""; + let imageend = ""; + let itemend = "
"; + + let itemid = "id = \"itemholderak" + word + "\" "; + let itemclass = "class=\"itemholderak holderak\""; + + let itempart = "
"; + + let imagepart = ""; + + let audiopart = "