501function t835_createSteps(inputs) {502Array.prototype.forEach.call(inputs, function (input) {503if (!input.classList.contains('t835__t-input-group_capture')) {504var wrapper = document.createElement('div');505wrapper.classList.add('t835__screen-wrapper');506wrapper.classList.add('t-step-form__step');507input.parentNode.insertBefore(wrapper, input);508wrapper.appendChild(input);509}510});511}512
function t835_runLazyLoad() { var records = document.querySelector('.t-records:not([data-tilda-mode])'); if (records) { var allRecs = document.querySelector('#allrecords'); if (window.lazy === 'y' || allRecs.getAttribute('data-tilda-lazy') === 'yes') { t_onFuncLoad('t_lazyload_update', function () { t_lazyload_update(); }); } }}function t835_setAnswerCode(option) { var parameter = option.value.split('value::')[1].trim(); option.value = parameter;}function t835_wrapCaptureForm(rec) { var captureForm = rec.querySelector('.t835__capture-form'); var inputs = rec.querySelectorAll('.t-input-group'); var quizFormWrapper = rec.querySelector('.t835__quiz-form-wrapper'); Array.prototype.forEach.call(inputs, function (input) { var currentStepInput = input; var emailInputExist = currentStepInput.classList.contains('t-input-group_em'); var nameInputExist = currentStepInput.classList.contains('t-input-group_nm'); var phoneInputExist = currentStepInput.classList.contains('t-input-group_ph'); var checkboxInputExist = currentStepInput.classList.contains('t-input-group_cb'); var quizStepIndex = currentStepInput.getAttribute('data-step-number'); var maxCountOfCaptureFields = quizFormWrapper.classList.contains('t835__quiz-form-wrapper_withcheckbox') ? 4 : 3; if (quizStepIndex >= inputs.length - maxCountOfCaptureFields) { var isCaptureGroup = true; if (quizFormWrapper.classList.contains('t835__quiz-form-wrapper_newcapturecondition')) { var inputsGroup = t835_getNextAll(currentStepInput); Array.prototype.forEach.call(inputsGroup, function (group) { isCaptureGroup = group.classList.contains('t-input-group_cb') || group.classList.contains('t-input-group_em') || group.classList.contains('t-input-group_nm') || group.classList.contains('t-input-group_ph'); }); } if (isCaptureGroup) { if (quizFormWrapper.classList.contains('t835__quiz-form-wrapper_withcheckbox')) { if (emailInputExist || nameInputExist || phoneInputExist || checkboxInputExist) { currentStepInput.classList.add('t835__t-input-group_capture'); captureForm.appendChild(currentStepInput); } } else if (emailInputExist || nameInputExist || phoneInputExist) { currentStepInput.classList.add('t835__t-input-group_capture'); captureForm.appendChild(currentStepInput); } } } });}function t835_showCounter(rec, quizStepIndex, allStepsLength) { var counter = rec.querySelector('.t835__quiz-description-counter'); if (!counter) return; counter.innerHTML = quizStepIndex + '/' + allStepsLength;}function t835_setProgress(rec, index, allStepsLength) { var progressBar = rec.querySelector('.t835__progressbar'); var progressbarWidth = parseFloat(getComputedStyle(progressBar).width); var progress = rec.querySelector('.t835__progress'); var progressStep = progressbarWidth / allStepsLength; var percentProgressWidth = Math.abs((index * progressStep) / progressbarWidth) * 100 + '%'; if (progress) progress.style.width = percentProgressWidth;}function t835_scrollToTop(quizFormWrapper) { var topCoordinateForm = quizFormWrapper.getBoundingClientRect().top + window.pageYOffset; var blockContainer = quizFormWrapper.closest('.t835'); if (topCoordinateForm >= window.scrollY || blockContainer.classList.contains('t835_scroll-disabled')) return; // try to find fixed menu var isMenuFixed = !!document.querySelector('.t228__positionfixed'); if (isMenuFixed) { // if fixed menu is exist, find desctop version var menu = document.querySelector('.t228__positionfixed:not(.t228__mobile)');