<script type="text/javascript">
(function(){
//Для работы кода необходимо в переменной ya_counter_id записать идентификатор счетчика вашего сайта в Яндекс.Метрике
var ya_counter_id = '11111111'; // Изменить на идентификатор счетчика вашего сайта в Яндекс.Метрике
var ya_client_id = '';
var fields = [];
var setYaClientId = function (){
var intervalYaClientId = setInterval(function(){
try {
var inputs_tmp = document.querySelectorAll('input[value="ClientID"]');
for (var i = 0; i < inputs_tmp.length; i++) {
var element = inputs_tmp[i];
while(element.parentNode) {
if (element.classList.contains('form_field') || element.classList.contains('form-field') || element.classList.contains('step')) {
element.style.display="none";
if (element.classList.contains('step')) {
element.classList.remove('step');
element.removeAttribute('data-step-id');
element.removeAttribute('tabindex');
var elementContainer = element;
while(elementContainer.parentNode) {
if (elementContainer.classList.contains('container')) {
var quiz_progresses = elementContainer.getElementsByClassName('quiz-progress');
for (var j = 0; j < quiz_progresses.length; j++) {
var total = quiz_progresses[j].getAttribute('data-total');
total--;
quiz_progresses[j].setAttribute('data-total', total);
var progress_text_total = quiz_progresses[j].querySelectorAll('span.total');
for (var k = 0; k < progress_text_total.length; k++) {
progress_text_total[k].innerHTML = total;
}
}
var component_quiz = elementContainer.getElementsByClassName('component-quiz');
for (var j = 0; j < component_quiz.length; j++) {
var total = component_quiz[j].getAttribute('data-total-steps');
total--;
component_quiz[j].setAttribute('data-total-steps', total);
}
var quiz_submit_array = elementContainer.querySelectorAll('a.quiz-submit');
var quiz_submit = quiz_submit_array[quiz_submit_array.length - 1];
var quiz_next_array = elementContainer.querySelectorAll('a.quiz-next');
var quiz_next_last = quiz_next_array[quiz_next_array.length - 1];
quiz_next_last.classList.remove('quiz-next');
quiz_next_last.classList.add('quiz-submit');
quiz_next_last.setAttribute('data-quiz-action', quiz_submit.getAttribute('data-quiz-action'));
quiz_next_last.setAttribute('data-modal-id', quiz_submit.getAttribute('data-modal-id'));
break;
}
elementContainer = elementContainer.parentNode;
}
} else if (element.classList.contains('form_field') || element.classList.contains('form-field')) {
var elementContainer = element;
while(elementContainer.parentNode) {
if (elementContainer.classList.contains('form-fields') || elementContainer.classList.contains('form_fields')) {
var count = elementContainer.getAttribute('data-count');
count--;
elementContainer.setAttribute('data-count', count);
break;
}
elementContainer = elementContainer.parentNode;
}
}
fields.push(element);
break;
}
element = element.parentNode;
}
}
if (typeof window['yaCounter'+ya_counter_id] !== "undefined" && typeof window['yaCounter'+ya_counter_id].getClientID !== "undefined") {
ya_client_id = window['yaCounter'+ya_counter_id].getClientID();
if (!ya_client_id)
return;
for (var i = 0; i < fields.length; i++) {
var inputs = fields[i].getElementsByTagName('input');
for (var j = 0; j < inputs.length; j++) {
if (inputs[j].classList.contains('form_field_text_input') || inputs[j].classList.contains('form-field-text--input') || inputs[j].classList.contains('form-field-text-input')) {
inputs[j].value = ya_client_id;
}
}
}
clearInterval(intervalYaClientId);
}
} catch(err) {
}
}, 1500);
};
setYaClientId();
})();
</script>