Kim jesteś ze Scooby-Doo? (2023)

Majvela 8 lat temu

19

Zaznacz poprawną odpowiedź, aby przejść do następnego pytania.

'; var ad_code2 = '

Reklama

'; var ad_code3 = '

Reklama

'; var ad_code4 = '

Reklama

'; }else{ var ad_code = '

Reklama

'; var ad_code2 = '

Reklama

<\/div>'; var ad_code3 = '

Reklama

'; var ad_code4 = '

Reklama

<\/div>'; } var quizData = {"title":"Kim jeste\u015b ze Scooby-Doo?","description":"Daphne, Kud\u0142aty, a mo\u017ce Scooby?","type":"person","thumb":"http:\/\/filing.pl\/wp-content\/uploads\/2015\/02\/filing_images_a0de515a1056.jpg","timetoanswer":"100","questions":[{"text":"Jaki jeste\u015b?","type":"text","id":"38826","image":"http:\/\/filing.pl\/wp-content\/uploads\/2015\/02\/filing_images_bb30c31fb33d.jpg","result_text":"","result_image":"","answers":[{"id":"161670","text":"Wiecznie g\u0142odny","correct":"0","result":"44296,44296,44297,44297","image":""},{"id":"161671","text":"Strachliwy","correct":"0","result":"44296,44296,44297,44297","image":""},{"id":"161672","text":"Odwa\u017cny","correct":"0","result":"44298,44298","image":""},{"id":"161673","text":"Uroczy","correct":"0","result":"44296,44300,44300","image":""},{"id":"161674","text":"Inteligentny","correct":"0","result":"44298,44299,44299","image":""}]},{"text":"Gdzie najch\u0119tniej sp\u0119dzi\u0142by\u015b wolny weekend?","type":"text","id":"38827","image":"http:\/\/filing.pl\/wp-content\/uploads\/2015\/02\/filing_images_17632081f9bc.jpg","result_text":"","result_image":"","answers":[{"id":"161675","text":"W restauracji","correct":"0","result":"44296,44296,44297,44297","image":""},{"id":"161676","text":"W skate parku","correct":"0","result":"44296,44297,44298","image":""},{"id":"161677","text":"W salonie pi\u0119kno\u015bci","correct":"0","result":"44300,44300","image":""},{"id":"161678","text":"W bibliotece","correct":"0","result":"","image":""},{"id":"161679","text":"W domu","correct":"0","result":"44296,44297,44297","image":""}]},{"text":"Co najch\u0119tniej by\u015b zjad\u0142?","type":"text","id":"38828","image":"http:\/\/filing.pl\/wp-content\/uploads\/2015\/02\/filing_images_d85b2362e758.jpg","result_text":"","result_image":"","answers":[{"id":"161680","text":"Hamburgera","correct":"0","result":"44296,44297,44297","image":""},{"id":"161681","text":"Co\u015b lekkiego","correct":"0","result":"44298,44299,44300,44300","image":""},{"id":"161682","text":"Domowe wypieki","correct":"0","result":"44296,44297,44298,44299,44299","image":""},{"id":"161683","text":"Scooby chrupki","correct":"0","result":"44296,44296","image":""},{"id":"161684","text":"Co\u015b z grila","correct":"0","result":"44296,44297,44298,44298","image":""}]},{"text":"Jakie zwierz\u0119 najch\u0119tniej by\u015b przygarn\u0105\u0142?","type":"text","id":"38829","image":"http:\/\/filing.pl\/wp-content\/uploads\/2015\/02\/filing_images_cd4490ff035d.jpeg","result_text":"","result_image":"","answers":[{"id":"161685","text":"Sowe","correct":"0","result":"44299,44299","image":""},{"id":"161686","text":"Psa","correct":"0","result":"44297,44297","image":""},{"id":"161687","text":"Kota","correct":"0","result":"44300,44300","image":""},{"id":"161688","text":"\u017badne","correct":"0","result":"44296,44296","image":""},{"id":"161689","text":"Inne","correct":"0","result":"44298,44298","image":""}]},{"text":"Jaki masz styl?","type":"text","id":"38830","image":"http:\/\/filing.pl\/wp-content\/uploads\/2015\/02\/filing_images_422150444c59.jpg","result_text":"","result_image":"","answers":[{"id":"161690","text":"Uroczy","correct":"0","result":"44300,44300","image":""},{"id":"161691","text":"Wygodny","correct":"0","result":"44298,44298","image":""},{"id":"161692","text":"Nie obchodzi mnie to jak si\u0119 ubieram","correct":"0","result":"44296,44296","image":""},{"id":"161693","text":"Zawsze tak samo","correct":"0","result":"44297,44297","image":""},{"id":"161694","text":"Byleby by\u0142o mi ciep\u0142o","correct":"0","result":"44299,44299","image":""}]},{"text":"Czy kiedykolwiek ogl\u0105da\u0142e\u015b Scooby-Doo?","type":"text","id":"38831","image":"http:\/\/filing.pl\/wp-content\/uploads\/2015\/02\/filing_images_d78d4cda2421.jpeg","result_text":"","result_image":"","answers":[{"id":"161695","text":"Oczywi\u015bcie! Nie przegapi\u0142em \u017cadnego odcinka!","correct":"0","result":"44296,44296,44297,44297","image":""},{"id":"161696","text":"Mo\u017ce kiedy\u015b...","correct":"0","result":"44298,44298,44299","image":""},{"id":"161697","text":"Nie","correct":"0","result":"44300,44300","image":""}]}],"results":[{"title":"Scooby Doo","id":"44296","description":"Kim jesteś ze Scooby-Doo? (2)","from":"0","to":"0"},{"title":"Kud\u0142aty","id":"44297","description":"Kim jesteś ze Scooby-Doo? (3)","from":"0","to":"0"},{"title":"Fred","id":"44298","description":"Kim jesteś ze Scooby-Doo? (4)","from":"0","to":"0"},{"title":"Velma","id":"44299","description":"Kim jesteś ze Scooby-Doo? (5)","from":"0","to":"0"},{"title":"Daphne","id":"44300","description":"Kim jesteś ze Scooby-Doo? (6)","from":"0","to":"0"}]}; var postid = 89688; var quiz_id = 1121; var started = false; try{ var img=new Image(); img.src=quizData.questions[0].image; }catch (e) {} function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; } function str_pad_left(string,pad,length) { return (new Array(length+1).join(pad)+string).slice(-length); } jQuery(document).ready(function($) { var $qu = $('.question-container.empty'); var $a = $('.answer-container.empty'); var $ai = $('.answer-container-img.empty'); var $ex = $('.explanation-container.empty'); var $r = $('.result-container.empty'); var progressTimeout; var start; $('#quiz').addClass(quizData.type); function progress(timeleft, timetotal, $element) { var progressBarWidth = timeleft * $element.width() / timetotal; if(timeleft >= 0) { $element.find('div').animate({ width: progressBarWidth }, 500).html(timeleft); progressTimeout = setTimeout(function() { progress(timeleft - 1, timetotal, $element); }, 1000); }else if(timeleft<0){ $('.question:not(.empty):visible .answer').addClass('wrong').each(function () { if($(this).data('correct')=="0"){ $(this).click(); return false; } }); } } function progressQuestions(answered, total, $element) { var progressBarWidth = answered * $element.width() / total; if(answered >= 0) { $element.find('div').animate({ width: progressBarWidth }, 500).html(answered + '/' + total); } } if(quizData.type==='timetest'){ $('#quiz').hide(); $('.time-for .time').text(quizData.timetoanswer); $('#start-quiz').show(); $('.start-quiz-button-wrapper').before('

'); $('#start-quiz').show().find('.start-quiz-button').html('Rozpocznij'); $('.letters-warning').show(); $('.start-quiz-button-wrapper').before('

'); }); $('#quiz .questions-container').append($tmpq); $('#quiz').append('

'); var c = document.getElementById('ad1'); if(c!=null) $(c).append(ad_code4); var $q = $('#question-1'); $q.find('.question-content').sticky({topSpacing:ts, getWidthFrom:'#quiz'}); var chances = 3; var points = 0; $('.gallery .answer:not(.disabled)').click(function () { var $t = $(this); if (!started) { try { __gaTracker('send', 'event', 'quiz', 'start', window.location.pathname); gtag('event', 'quiz_start', { 'page': window.location.pathname }); } catch (err) { console.log(err); } started = true; } if ($t.hasClass('disabled') || $t.hasClass('correct') || $t.hasClass('wrong')) return false; var result; $t.parent().find('.answer').removeClass('checked'); //$t.addClass('active checked'); if($q.data('qid')==$t.data('qid')){ if(chances<0) chances = 0; points+=chances; var stars; switch (chances){ case 1: stars = ''; break; case 2: stars = ''; break; case 3: stars = ''; break; default: stars = ''; break; } stars = '

'+stars+'

'; if(chances==0){ $t.addClass('wrongcorrect'); } chances = 3; var i = $q.data('curq'); i++; $t.addClass('correct'); setTimeout(function(){ $t.removeClass('correct'); $t.addClass('disabled'); setTimeout(function() { $('.starbox').css('max-height', '0'); },300); setTimeout(function() { $('.question-container .sticky-wrapper').height($q.find('.question-content').height()+10); },1000); },800); if(quizData.questions.length>i){ v = quizData.questions[i]; $q.data('curq', i); $q.data('qid', v.id); $q.find('.question-content .text').html(v.text); $q.find('.question-content .text').prepend(stars); setTimeout(function() { $('.starbox').css('max-height', '50px'); },10); }else{ var s = Math.round((points/(quizData.questions.length*3))*100); var final; if(s<31){ final = quizData.results[0]; }else if(s<71){ final = quizData.results[1]; }else{ final = quizData.results[2]; } $('.result-container .result-content').html(final.description.replace(/(?:\r\n|\r|\n)/g, '
')); $('.result-container .result-title').prepend('

Twój wynik: '+ s + '%

'); $('.result-container .result-title h2').html(final.title); $('html, body').animate({ scrollTop: $('#quiz').offset().top - 80 }, 1000); setTimeout(function(){ $('#result.result-container').show(); $('#question-1').hide(400,function(){ $('.score b span').prop('Counter',0).animate({ Counter: $('#result .score b span').text() }, { duration: 4000, easing: 'swing', step: function (now) { $('#result .score b span').text(Math.ceil(now)); } }); }); },800); $('.answer:not(.disabled)').off('click'); try { if(!Cookies.get('seensuper')) { $('.postvote[data-toggle="tooltip"]').tooltip('show'); Cookies.set('seensuper', 'true', {expires: Infinity}); } $(document).trigger('optad360_inter'); startCollectionCountdown(); __gaTracker('send', 'event', 'quiz', 'end', window.location.pathname); gtag('event', 'quiz_end', { 'page': window.location.pathname }); } catch (err) { console.log(err); } } }else{ chances--; if(chances==0){ $wc = $('.answer:data(qid)').filter(function(){ return $(this).data('qid')==$q.data('qid')}); setTimeout(function() { if(postid!=2180907) { $('html, body').animate({ scrollTop: $wc.offset().top - window.innerHeight / 2 }, 400).promise().then(function () { $wc.trigger('click'); }); }else{ $wc.trigger('click'); } },600); } $t.addClass('wrong'); setTimeout(function(){ $t.removeClass('wrong'); },600); } $('.question_box_done:last').next('.question_box').addClass('question_box_done'); }); }else{ var allLettersLength = 0; $.each(quizData.questions, function (i, v) { var $tmpq = $qu.clone().removeClass('empty'); $tmpq.show(); $tmpq.attr('id', 'question-' + (i + 1)); if (v.image.length > 0) $tmpq.find('.question-content .image').append('Kim jesteś ze Scooby-Doo? (7)'); if ((v.result_image != null || v.result_text != null) && (v.result_image.length>0 || v.result_text.length>0)){ var $tmpe = $ex.clone().removeClass('empty'); if(v.result_image!=null && v.result_image.length>0){ $tmpe.find('.image').append('Kim jesteś ze Scooby-Doo? (8)'); } if(v.result_text!=null){ $tmpe.find('.text').text(v.result_text); } $tmpq.append($tmpe); } $tmpq.find('.question-content .text').append(v.text); var cols = 3; switch (v.answers.length) { case 2: $tmpq.find('.question-answers').addClass('col-2'); cols = 2; break; default: $tmpq.find('.question-answers').addClass('col-3'); cols = 3; break; } if ($(window).width() < 690) cols = 2; if (v.type === "text" || quizData.type === 'letters') { if(quizData.type === 'letters'){ var words = v.answers[0].text.trim().toUpperCase().split(' '); var $words = $('

'); for(var j = 0; j < words.length; j++){ var word = words[j]; var $word = $('

'); for(var k = 0; k < word.length; k++){ var $letter = $('

'); $letter.data('correct', word[k]); $word.append($letter); } $words.append($word); } $tmpq.find('.question-answers .answers-inner').append($words); var letters = v.answers[0].text.trim().toUpperCase().replace(/ /g, ''); allLettersLength += letters.length; v.phraseToGuess = letters; var m = 16; while(letters.length>m){ m+=8; } var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; for ( j = letters.length; j < m; j++ ) { letters += characters.charAt(Math.floor(Math.random() * characters.length)); } letters = shuffleArray(letters.split('')); var $lettersAvailable= $('

'); for(j = 0; j < letters.length; j++){ $letter = $('

'+letters[j]+'

').attr('data-letter', letters[j]); $lettersAvailable.append($letter); } $tmpq.find('.question-answers .answers-inner').append($lettersAvailable); $tmpq.find('.question-answers .answers-inner').append('

'); }else { var long = false; $.each(v.answers, function (i, v) { var $tmpa = $a.clone().removeClass('empty').show(); $tmpa.attr('id', 'answer-' + (i + 1)); $tmpa.data('results', v.result); $tmpa.data('correct', v.correct); $tmpa.data('id', v.id); $tmpa.find('.text').append(v.text); if (v.text.length > 30) { long = true; } $tmpq.find('.question-answers .answers-inner').append($tmpa); if ((i + 1) % cols == 0) $tmpq.find('.question-answers .answers-inner').append('

'); }); if (long) { $tmpq.find('.question-answers').addClass('long-answers'); } } } else { $.each(v.answers, function (i, v) { var $tmpa = $ai.clone().removeClass('empty').show(); $tmpa.attr('id', 'answer-' + (i + 1)); $tmpa.data('results', v.result); $tmpa.data('correct', v.correct); $tmpa.data('id', v.id); $tmpa.find('.image img').attr('src', v.image.replace('http:', '')); $tmpa.find('.text').append(v.text); if (jQuery("

" + v.text + "

").text().length == 0) { $tmpa.find('.text').remove(); } $tmpq.find('.question-answers .answers-inner').append($tmpa); if ((i + 1) % cols == 0) $tmpq.find('.question-answers .answers-inner').append('

'); }); if (v.type == "longtext") { $tmpq.find('.question-answers').addClass('long-answers'); } if (v.type == "noanswers") { $tmpq.addClass('noanswers'); } } $('.question_boxes_inner').append('

' + (i + 1) + '

'); if(quizData.type === "survive" && i > 0){ $tmpq.hide(); } if((quizData.type === "timetest" || quizData.type === "letters") && i > 0){ $tmpq.hide(); } $('#quiz .questions-container').append($tmpq); if (i === 1 && quizData.questions.length > 3) { if(!$tmpq.hasClass('noanswers')) { $('#quiz .questions-container').append("

"); // $('#quiz .questions-container').append('

'); } else { $('.question:not(.noanswers):not(.empty):last').after("

"); // $('.question:not(.noanswers):not(.empty):last').after('

'); } } if (i === 3 && quizData.questions.length > 5) { if(!$tmpq.hasClass('noanswers')) $('#quiz .questions-container').append('

'); else $('.question:not(.noanswers):not(.empty):last').after('

'); var a = document.getElementById('ad1'); if(a!=null) { $(a).append('

'); // $(a).append('

'); } } if (i === 5 && quizData.questions.length > 7) { if(!$tmpq.hasClass('noanswers')) $('#quiz .questions-container').append('

'); else $('.question:not(.noanswers):not(.empty):last').after('

'); var b = document.getElementById('ad2'); if(b!=null) { if(!($(b).next().hasClass('text-align-center') || $(b).prev().hasClass('text-align-center'))) $(b).append(ad_code); } } if(i>6 && i%2!==0 && i+2 < quizData.questions.length){ if(!$tmpq.hasClass('noanswers')) $('#quiz .questions-container').append('

'); else $('.question:not(.noanswers):not(.empty):last').after('

'); } if (i === quizData.questions.length - 1) {// $('#quiz .questions-container').append('

'); var c = document.getElementById('ad3'); if(c!=null) { $(c).append(ad_code2); } } if (i == Math.floor(quizData.questions.length * 0.5) && $(window).width() < 690) { $('#quiz .questions-container').append('

'); } }); if(quizData.type==='letters'){ } if(quizData.type==='survive' || quizData.type==='timetest' || quizData.type==='letters'){ $('#ad1,#ad2,#ad3,.optad-container').hide(); } try { var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; if(typeof window._qasp == 'undefined') { window._qasp = _qasp || []; }else{ if(width<690){ window._qasp[1][0] = 'setFastPAID'; }else{ window._qasp[1][0] = 'setFastPAID';//.push(['setFastPAID', 'sadsameQuizy']); } } }catch(err){ console.log(err); } $('.question_box:first-child').addClass('question_box_done'); $('#quiz').on('click', '.quiz-nav', function (e) { e.preventDefault(); if ($('.question:visible').prev('.question').length > 0) { $('.question:visible').hide().prev('.question').show(); $('.question_box_done:last-child').removeClass('question_box_done'); } return false; }); var tipsUsed = 0; function checkLetters($words){ $words.removeClass('incorrect'); $correct = 0; $words.find('.letter').each(function () { if($(this).data('correct')===$(this).text()){ $correct++; } }); if($correct===$words.find('.letter').length){ if($words.parents('.question').hasClass('questionad')){ $words.parents('.question').find('.text').html('Narysuj nowe hasło:'); $words.parents('.question').find('.question-answers').remove(); var $video = $('.video-question'); $video.attr('src', '/wp-content/themes/filing/img/kalambury-video/start.mp4'); $video.attr('autoplay', true); $video.attr('loop', true); $video.off('ended'); $video.on('ended', function (){ this.play(); }); return; } $words.parents('.question').addClass('answered'); setTimeout(function () { var $curq = $('#quiz .question:not(.empty):visible').hide(); $curq.nextAll('.question:first').show().addClass('fadeIn animated'); $('html, body').animate({ scrollTop: $('#quiz').offset().top - 80 }, 1000); progressQuestions($('#quiz .question.answered').length+1, quizData.questions.length, $('#progressBar')); if ($('#quiz .question:not(.empty):not(.noanswers)').length === $('#quiz .question.answered').length) { var s = Math.round((allLettersLength-tipsUsed)/allLettersLength*100); var final; if(s<65){ final = quizData.results[0]; }else if(s<85){ final = quizData.results[1]; }else{ final = quizData.results[2]; } try { if(!Cookies.get('seensuper')) { $('.postvote[data-toggle="tooltip"]').tooltip('show'); Cookies.set('seensuper', 'true', {expires: Infinity}); } $(document).trigger('optad360_inter'); startCollectionCountdown(); __gaTracker('send', 'event', 'quiz', 'end', window.location.pathname); gtag('event', 'quiz_end', { 'page': window.location.pathname }); } catch (err) { console.log(err); } $('#progressBar').hide(); $('.result-container .result-content').html(final.description.replace(/(?:\r\n|\r|\n)/g, '
')); $('.result-container .result-title').prepend('

Twój wynik: '+ s + '%

'); $('.result-container .result-title h2').html(final.title); $('#result.result-container').show(); $('.score b span').prop('Counter',0).animate({ Counter: $('#result .score b span').text() }, { duration: 4000, easing: 'swing', step: function (now) { $('#result .score b span').text(Math.ceil(now)); } }); } },1000); // $('html, body').animate({ // scrollTop: $('#quiz').offset().top - 100 // }, 1000); }else if($words.find('.letter').length===$words.find('.letter.filled').length){ $words.addClass('incorrect'); } } $(document).on('click', '.question:not(.answered) .lettersAvailable .letter:not(.emptied)', function () { var $letter = $(this).parent().parent().find('.words .letter:not(.filled)').first(); if($letter.length===0){ return; } $letter.text($(this).text()).addClass('filled'); $letter.data('letterIndex', $(this).attr('data-index')); $(this).addClass('emptied'); $(this).data('word', $letter.attr('data-word')); $(this).data('letterindex', $letter.attr('data-index')); $(this).html(''); checkLetters($(this).parent().parent().find('.words').first()); }); $(document).on('click', '.question:not(.answered) .words .letter.filled:not(.locked)', function () { $index = $(this).data('letterIndex'); $(this).parents('.words').removeClass('incorrect'); var $letter = $(this).parent().parent().parent().find('.lettersAvailable .letter[data-index='+$index+']').first(); $letter.removeClass('emptied').text($(this).text()); $(this).removeClass('filled'); $(this).html(''); }); $(document).on('click', '.question:not(.answered) .gettip', function () { var random = Math.floor(Math.random()*$(this).parent().find('.words .letter:not(.filled)').length); var $letter = $(this).parent().find('.words .letter:not(.filled)').eq(random); if($letter.length>0){ tipsUsed++; var correct = $letter.data('correct'); var $letterAvailable = $(this).parent().find('.lettersAvailable .letter[data-letter="'+correct+'"]:not(.emptied)').first(); if($letterAvailable.length===0){ $letterAvailable = $(this).parent().parent().parent().find('.lettersAvailable .letter[data-letter="'+correct+'"]:not(.locked)').first(); var wordIndex = $letterAvailable.data('word'); var letterIndex = $letterAvailable.data('letterindex'); var $letterInWord = $(this).parent().parent().parent().find('.words .letter[data-word='+wordIndex+'][data-index='+letterIndex+']:not(.locked)').first(); var index = $letterInWord.data('letterIndex'); $letterAvailable = $letterInWord.parent().parent().parent().find('.lettersAvailable .letter[data-index='+index+']').first(); $letterAvailable.removeClass('emptied').text($letterInWord.text()); $letterInWord.removeClass('filled'); $letterInWord.html(''); } $letter.text($letterAvailable.text()).addClass('filled locked'); $letter.data('letterIndex', $letterAvailable.attr('data-index')); $letterAvailable.addClass('emptied locked'); $letterAvailable.html(''); checkLetters($(this).parent().find('.words').first()); return; } var incorrects = []; $(this).parent().find('.words .letter:not(.locked)').each(function (i, el) { if($(this).data('correct')!==$(this).text()){ incorrects.push(i); } }); random = Math.floor(Math.random()*incorrects.length); var $el = $(this).parent().find('.words .letter:not(.locked)').eq(incorrects[random]); index = $el.data('letterIndex'); $letter = $el.parent().parent().parent().find('.lettersAvailable .letter[data-index='+index+']').first(); $letter.removeClass('emptied').text($el.text()); $el.removeClass('filled'); $el.html(''); correct = $el.data('correct'); $letterAvailable = $el.parent().parent().parent().find('.lettersAvailable .letter[data-letter="'+correct+'"]:not(.emptied)').first(); if($letterAvailable.length===0){ $letterAvailable = $el.parent().parent().parent().find('.lettersAvailable .letter[data-letter="'+correct+'"]:not(.locked)').first(); wordIndex = $letterAvailable.data('word'); letterIndex = $letterAvailable.data('letterindex'); $letterInWord = $el.parent().parent().parent().find('.words .letter[data-word='+wordIndex+'][data-index='+letterIndex+']:not(.locked)').first(); index = $letterInWord.data('letterIndex'); $letter = $letterInWord.parent().parent().parent().find('.lettersAvailable .letter[data-index='+index+']').first(); $letter.removeClass('emptied').text($letterInWord.text()); $letterInWord.removeClass('filled'); $letterInWord.html(''); } $el.text($letterAvailable.text()).addClass('filled locked'); $el.data('letterIndex', $letterAvailable.attr('data-index')); $letterAvailable.addClass('emptied locked'); $letterAvailable.html(''); checkLetters($(this).parent().find('.words').first()); }); $('#quiz .answer:not(.disabled)').click(function () { if (!started) { try { __gaTracker('send', 'event', 'quiz', 'start', window.location.pathname); gtag('event', 'quiz_start', { 'page': window.location.pathname }); } catch (err) { console.log(err); } started = true; } if ($(this).hasClass('disabled')) return false; var result; if (!(quizData.type === "story" || quizData.type === "survive" || quizData.type === "timetest" || quizData.type === "letters")){ $('#missing-answers').show(); } $qexp = $(this).parents('.question').find('.explanation'); $(this).parent().find('.answer').removeClass('checked'); $(this).addClass('active checked'); $(this).parents('.question').addClass('answered'); if (quizData.type === "trivia") { $(this).parent().find('.answer').addClass('disabled'); if ($(this).data('correct') == "1") { $(this).addClass('correct'); $qexp.addClass('correct'); } else { $(this).addClass('wrong'); $qexp.addClass('wrong'); $(this).parent().find('.answer').each(function () { if ($(this).data('correct') == "1") $(this).addClass('correct'); }); } $qexp.show(); } if (quizData.type === "timetest") { $(this).parent().find('.answer').addClass('disabled'); if ($(this).data('correct') == "1") { $(this).addClass('correct'); } else { $(this).addClass('wrong'); $(this).parent().find('.answer').each(function () { if ($(this).data('correct') == "1") $(this).addClass('correct'); }); } setTimeout(function () { var $curq = $('.question:not(.empty):visible').hide(); $curq.nextAll('.question:first').show().addClass('fadeIn animated'); progress(quizData.timetoanswer, quizData.timetoanswer, $('#progressBar')); $('html, body').animate({ scrollTop: $('#progressBar').offset().top - 100 }, 1000); }, 1000); clearTimeout(progressTimeout); } if (quizData.type === "survive") { $(this).parent().find('.answer').addClass('disabled'); if ($(this).data('correct') == "1") { $(this).addClass('correct'); var nq = $('.question:not(:visible):not(.empty)').first(); nq.show(); if(nq.next().hasClass('text-align-center') || nq.next().hasClass('optad-container')){ nq.next().show(); } } else { try { if(!Cookies.get('seensuper')) { $('.postvote[data-toggle="tooltip"]').tooltip('show'); Cookies.set('seensuper', 'true', {expires: Infinity}); } $(document).trigger('optad360_inter'); startCollectionCountdown(); __gaTracker('send', 'event', 'quiz', 'end', window.location.pathname); gtag('event', 'quiz_end', { 'page': window.location.pathname }); } catch (err) { console.log(err); } $('.under-quiz-note.survive').hide(); $(this).addClass('wrong'); if($(this).data("results").length>0){ var final = getObjects(quizData.results, 'id', $(this).data("results")); if(final[0].description.length>0) $('.result-container .result-content').html(final[0].description.replace(/(?:\r\n|\r|\n)/g, '
')+' Spróbuj ponownie!'); $('.result-container .result-title h2').html(' Spróbuj ponownie ' +final[0].title); $('.result-container').show(); }else{ var final = quizData.results[0]; if(final.description.length>0) $('.result-container .result-content').html(final.description.replace(/(?:\r\n|\r|\n)/g, '
')+' Spróbuj ponownie!'); $('.result-container .result-title h2').html(' Spróbuj ponownie ' +final.title); $('.result-container').show(); } $('html, body').animate({ scrollTop: $('#result').offset().top - 80 }, 1000); } } $('.question_box_done:last').next('.question_box').addClass('question_box_done'); if ($('#quiz .question:not(.empty):not(.noanswers)').length === $('#quiz .checked').length) { if(quizData.type==='timetest'){ setTimeout(showResult, 1000); }else { showResult(); } }else{ $('#missing-answers span').text(quizData.questions.length-$('.question.answered').length); } }); $('#missing-answers a').click(function (e) { e.preventDefault(); $('html, body').animate({ scrollTop: $('.question:not(.answered):first').offset().top - 80 }, 1000); }); } function startCollectionCountdown(){ if($("#next_quiz").length>0){ var timer = null; var seconds = 5; var observer = new IntersectionObserver(function(entries) { if(entries[0].isIntersecting === true) { seconds = 5; timer = setInterval(function () { $('#next_quiz .next-countdown').text(" ("+seconds+")"); if (--seconds < 0) { clearInterval(timer); window.location = $('#next_quiz').attr('href'); } }, 1000); }else{ clearInterval(timer); } }, { threshold: [1] }); observer.observe(document.querySelector("#next_quiz")); } } function showResult() { try { if(!Cookies.get('seensuper')) { $('.postvote[data-toggle="tooltip"]').tooltip('show'); Cookies.set('seensuper', 'true', {expires: Infinity}); } $(document).trigger('optad360_inter'); startCollectionCountdown(); __gaTracker('send', 'event', 'quiz', 'end', window.location.pathname); gtag('event', 'quiz_end', { 'page': window.location.pathname }); } catch (err) { console.log(err); } if (quizData.type === "survive"){ $('.under-quiz-note.survive').hide(); if(!$('.result-container').is(':visible')) { var final = quizData.results[1]; $('.result-container .result-content').html(final.description.replace(/(?:\r\n|\r|\n)/g, '
')); $('.result-container .result-title h2').html(final.title); $('.result-container').show(); } }else if (quizData.type === "person" || quizData.type==="story") { var r = {}; for (res in quizData.results) { r[quizData.results[res].id] = 0; } $('.answer.checked').each(function () { var rr = $(this).data('results'); rr = rr.split(','); for (var tmp in rr) { r[rr[tmp]]++; } }); var b = 0; for (var k in r) { if (r[k] > b) { b = r[k]; result = k; } } var final = getObjects(quizData.results, 'id', result); $('.result-container .result-content').html(final[0].description.replace(/(?:\r\n|\r|\n)/g, '
')); $('.result-container .result-title h2').html(final[0].title); $('.result-container').show(); } else { var s = 0; var final; $('.answer.checked').each(function () { if ($(this).data('correct') == "1") { s++; } }); $.each(quizData.results, function (i, v) { if (parseInt(v.from) <= s && parseInt(v.to) >= s) { final = v; return false; } }); $('.result-container .result-content').html(final.description.replace(/(?:\r\n|\r|\n)/g, '
')); $('.result-container .result-title h2').html('Twój wynik: ' + s + '/' + $('#quiz .question:not(.empty)').length + ' ' + final.title); if(quizData.type==="timetest"){ var end = performance.now(); var time = (end - start)/1000; var minutes = Math.floor(time / 60); var seconds = Math.round(time - minutes * 60); var finalTime = str_pad_left(minutes,'0',2)+':'+str_pad_left(seconds,'0',2); $('#progressBar').hide(); $('.result-container .result-title h2').html('Twój wynik: ' + s + '/' + $('#quiz .question:not(.empty)').length + ' Twój czas: ' + finalTime + '

' + final.title); } $('.result-container').show().addClass('fadeIn animated'); } $('#missing-answers').hide(); $('html, body').animate({ scrollTop: $('#result').offset().top - 80 }, 1000); $('.answer:not(.disabled)').off('click'); } function getObjects(obj, key, val) { var objects = []; for (var i in obj) { if (!obj.hasOwnProperty(i)) continue; if (typeof obj[i] == 'object') { objects = objects.concat(getObjects(obj[i], key, val)); } else if (i == key && obj[key] == val) { objects.push(obj); } } return objects; } });

Zauważyłeś literówkę lub błąd? Napisz do nas.

References

Top Articles
Latest Posts
Article information

Author: Patricia Veum II

Last Updated: 09/07/2023

Views: 6418

Rating: 4.3 / 5 (44 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Patricia Veum II

Birthday: 1994-12-16

Address: 2064 Little Summit, Goldieton, MS 97651-0862

Phone: +6873952696715

Job: Principal Officer

Hobby: Rafting, Cabaret, Candle making, Jigsaw puzzles, Inline skating, Magic, Graffiti

Introduction: My name is Patricia Veum II, I am a vast, combative, smiling, famous, inexpensive, zealous, sparkling person who loves writing and wants to share my knowledge and understanding with you.