101}102103104function t806__clickStartButton(recid) {105var rec = document.querySelector('#rec' + recid);106var questionNumber = 1;107var buttonStart = rec.querySelector('.t806__start-btn');108109buttonStart.addEventListener('click', function (event) {110var testStart = this.closest('.t806__start');111112testStart.style.display = 'none';
var currentQuestion = testStart.nextElementSibling; currentQuestion.style.display = 'block'; t806__showNumber(recid, questionNumber); t806_fixcontentheight(recid); t806_scrollToTop(rec); t806__runLazyLoad(); event.preventDefault(); });}function t806__runLazyLoad() { if (window.lazy === 'y' || document.getElementById('allrecords').getAttribute('data-tilda-lazy') === 'yes') { t_onFuncLoad('t_lazyload_update', function () { t_lazyload_update(); }); }}function t806__changeRadio(recid, rightAnswers) { var rec = document.querySelector('#rec' + recid); var radioInputs = rec.querySelectorAll('.t806__input[type="radio"]'); var questions = rec.querySelectorAll('.t806__question'); if (questions.length === 0) return; var lastQuestion = questions[questions.length - 1]; lastQuestion.classList.add('t806__lastquestion'); Array.prototype.forEach.call(radioInputs, function (radioInput) { radioInput.addEventListener('change', function () { var counter = rec.querySelector('.t806__counter'); var rightAnswersCount = counter.getAttribute('data-count'); var question = this.closest('.t806__question'); var answers = this.closest('.t806__answers'); var inputs = question.querySelectorAll('.t806__input'); var buttonWrapper = answers.nextElementSibling; var buttonResult = buttonWrapper.querySelector('.t806__btn_result'); var buttonNext = buttonWrapper.querySelector('.t806__btn_next'); var buttonsVote = answers.querySelectorAll('.t806__answer .t-vote__btn-res'); var currentRightAnswer = rightAnswers[question.getAttribute('data-question-num') - 1]; currentRightAnswer = currentRightAnswer.split(',')[0]; var rightAnswersCount = counter.getAttribute('data-count'); if (this.getAttribute('type') === 'radio') { var checkedRadio = this.value; answers.classList.add('t806__answers_answered'); if (question.classList.contains('t806__lastquestion')) { buttonResult.classList.add('t806__btn_show'); } else { buttonNext.classList.add('t806__btn_show'); } Array.prototype.forEach.call(inputs, function (input) { input.setAttribute('disabled', true); }); if (+checkedRadio === +currentRightAnswer) { rightAnswersCount++; counter.setAttribute('data-count', rightAnswersCount); } var radioInputChecked = question.querySelector('.t806__input:checked'); if (Number(radioInputChecked.value) !== Number(currentRightAnswer)) { var radioInputCheckedWrapper = radioInputChecked.closest('.t806__answer'); radioInputCheckedWrapper.classList.add('t806__answer_wrong'); } var details = radioInputChecked.parentNode.nextElementSibling; details.style.display = 'block'; var currentAnswer = question.querySelector('.t806__input[value="' + currentRightAnswer + '"]'); if (currentAnswer) { var currentAnswerWrapper = currentAnswer.closest('.t806__answer'); currentAnswerWrapper.classList.add('t806__answer_correct'); } Array.prototype.forEach.call(buttonsVote, function (buttonVote) { buttonVote.classList.add('t806__answer-vote_show'); });