Каталог файловtilda-t835-stepform-1.0.js
701function t835_adjustHeightOnResize(rec) {702 window.addEventListener('resize', function () {703 t835_debounceAdjustheight(rec);704 });705}706 707function t835_debounce(callee, timeoutMs) {708 var timeoutId;709 return function () {710 var args = Array.prototype.slice.call(arguments);711 clearTimeout(timeoutId);712 timeoutId = setTimeout(function () {
История файла и сравнение версий
callee.apply(null, args);
718function t835_adjustStepToHeight(rec) { 719 var MIN_VALID_DIFFERENCE = 30; 720 var MIN_POSSIBLE_DIFFERENCE = 1; 722 var stepWrapper = rec.querySelector('.t835__quiz-form-wrapper'); 723 var stepContainer = rec.querySelector('.t835__quiz-nofixedheight'); 724 var stepHeight = stepWrapper ? stepWrapper.offsetHeight : 0; 725 if (stepHeight <= 0 || !stepContainer) return; 727 var oldHeight = parseInt(getComputedStyle(stepContainer).height, 10); 728 var heightDiff = Math.abs(oldHeight - stepHeight); 730 // если изменение незанчительное, то ничего не делаем 731 if (MIN_POSSIBLE_DIFFERENCE < heightDiff && heightDiff < MIN_VALID_DIFFERENCE) { 735 // если высота стала больше - скрывайем overflow ради анимации 736 if (stepHeight > oldHeight) { 737 stepContainer.style.overflow = 'hidden'; 738 setTimeout(function () { 739 stepContainer.style.overflow = ''; 743 stepContainer.style.height = stepHeight + 'px'; 746function t835_getNextAll(element) { 747 var nextElements = []; 748 var nextElement = element; 750 while (nextElement.nextElementSibling) { 751 if (nextElement.nextElementSibling.classList.contains('t-input-group')) { 752 nextElements.push(nextElement.nextElementSibling); 754 nextElement = nextElement.nextElementSibling; 761function t835_onSuccess(form) { 763 t_forms__onSuccess(form); 766// Polyfill: Element.matches 767if (!Element.prototype.matches) { 768 Element.prototype.matches = 769 Element.prototype.matchesSelector || 770 Element.prototype.msMatchesSelector || 771 Element.prototype.mozMatchesSelector || 772 Element.prototype.webkitMatchesSelector || 773 Element.prototype.oMatchesSelector; 776// Polyfill: Element.closest 777if (!Element.prototype.closest) { 778 Element.prototype.closest = function (s) { 780 while (el && el.nodeType === 1) { 781 if (Element.prototype.matches.call(el, s)) { 784 el = el.parentElement || el.parentNode;