1(function($){'use strict';class SFQuiz{constructor(container){this.$container=$(container);this.$form=this.$container.find('.sf-quiz-form');this.$results=this.$container.find('.sf-quiz-results');this.quizData=JSON.parse(this.$container.find('.sf-quiz-data').text());this.init()} 2init(){this.bindEvents();this.initProgressTracking()} 3bindEvents(){this.$form.on('submit',(e)=>{e.preventDefault();this.calculateAndShowResults()});this.$form.find('input[type="radio"]').on('change',(e)=>{this.updateProgress();this.checkFormCompletion();this.scrollToNextQuestion($(e.target))});this.$container.find('.sf-quiz-reset-btn').on('click',()=>{this.resetQuiz()});this.$container.find('.sf-quiz-answer').on('mouseenter',function(){$(this).addClass('sf-quiz-answer-hover')}).on('mouseleave',function(){$(this).removeClass('sf-quiz-answer-hover')})} 4initProgressTracking(){this.$form.find('.sf-quiz-question').each(function(){$(this).addClass('sf-quiz-question-unanswered')})} 5updateProgress(){const totalQuestions=this.$form.find('.sf-quiz-question').length;const answeredQuestions=this.$form.find('.sf-quiz-question').filter(function(){return $(this).find('input[type="radio"]:checked').length>0}).length;this.$form.find('.sf-quiz-question').each(function(){const $question=$(this);const isAnswered=$question.find('input[type="radio"]:checked').length>0;if(isAnswered){$question.removeClass('sf-quiz-question-unanswered').addClass('sf-quiz-question-answered')}else{$question.removeClass('sf-quiz-question-answered').addClass('sf-quiz-question-unanswered')}});console.log(`Progress: ${answeredQuestions}/${totalQuestions} questions answered`)} 6checkFormCompletion(){const totalQuestions=this.$form.find('.sf-quiz-question').length;const answeredQuestions=this.$form.find('input[type="radio"]:checked').length;const $submitBtn=this.$container.find('.sf-quiz-submit-btn');if(answeredQuestions===totalQuestions){$submitBtn.removeClass('sf-quiz-submit-disabled').addClass('sf-quiz-submit-enabled');$('html, body').animate({scrollTop:$submitBtn.offset().top-120},500)}else{$submitBtn.removeClass('sf-quiz-submit-enabled').addClass('sf-quiz-submit-disabled')}} 7scrollToNextQuestion($radioInput){const $currentQuestion=$radioInput.closest('.sf-quiz-question');const $allQuestions=this.$form.find('.sf-quiz-question');const currentIndex=$allQuestions.index($currentQuestion);let $nextQuestion=null;for(let i=currentIndex+1;i<$allQuestions.length;i++){const $question=$allQuestions.eq(i);const isAnswered=$question.find('input[type="radio"]:checked').length>0;if(!isAnswered){$nextQuestion=$question;break}} 8if($nextQuestion&&$nextQuestion.length){setTimeout(()=>{$('html, body').animate({scrollTop:$nextQuestion.offset().top-120},400)},300)}} 9calculateAndShowResults(){let totalScore=0;this.$form.find('input[type="radio"]:checked').each(function(){totalScore+=parseInt($(this).val())});console.log('Total Score:',totalScore);const resultInterval=this.findResultInterval(totalScore);if(!resultInterval){alert('Chyba pri vyhodnocovanà kvÃzu. Skúste to prosÃm znova.');return} 10this.displayResults(totalScore,resultInterval)} 11findResultInterval(score){const intervals=this.quizData.resultIntervals;for(let i=0;i<intervals.length;i++){const interval=intervals[i];const minScore=parseInt(interval.min_score);const maxScore=parseInt(interval.max_score);if(score>=minScore&&score<=maxScore){return interval}} 12return null} 13displayResults(score,resultInterval){this.$form.fadeOut(300);this.$results.find('.sf-quiz-score-value').text(score);const resultHTML=this.buildResultHTML(score,resultInterval);this.$results.find('.sf-quiz-result-content').html(resultHTML);setTimeout(()=>{this.$results.fadeIn(500);$('html, body').animate({scrollTop:this.$results.offset().top-120},500);this.animateScoreCircle()},400)} 14buildResultHTML(score,interval){const title=interval.result_title||'';const description=interval.description||'';let html='<div class="sf-quiz-result-box">';if(title){html+=`<h3 class="sf-quiz-result-title">${title}</h3>`} 15if(description){html+=`<div class="sf-quiz-result-description">${description}</div>`} 16html+='</div>';return html} 17animateScoreCircle(){const $scoreValue=this.$results.find('.sf-quiz-score-value');const finalScore=parseInt($scoreValue.text());const duration=1500;const steps=30;const increment=finalScore/steps;let currentScore=0;$scoreValue.text('0');const interval=setInterval(()=>
17{currentScore+=increment;if(currentScore>=finalScore){$scoreValue.text(finalScore);clearInterval(interval)}else{$scoreValue.text(Math.floor(currentScore))}},duration/steps)} 18resetQuiz(){this.$form[0].reset();this.$form.find('.sf-quiz-question').removeClass('sf-quiz-question-answered').addClass('sf-quiz-question-unanswered');this.$container.find('.sf-quiz-submit-btn').removeClass('sf-quiz-submit-enabled').addClass('sf-quiz-submit-disabled');this.$results.fadeOut(300);setTimeout(()=>{this.$form.fadeIn(500);$('html, body').animate({scrollTop:this.$container.offset().top-120},500)},400)}} 19$(document).ready(function(){$('.sf-quiz-container').each(function(){new SFQuiz(this)})})})(jQuery)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.