3801}3802// placeholder-атрибут — чистый текст, animField лишь его визуальная копия3803animField.textContent = placeholder;3804input.insertAdjacentElement('afterend', animField);3805input.removeAttribute('placeholder');3806});38073808if (window.t_zeroForms__isiOS && window.t_zeroForms__iOSMajorVersion < 13) {3809//BBOnly - border-bottom only (input style: only border-bottom)3810var textareaNotBBOnly = zeroForm.querySelectorAll('textarea:not(.t-input_bbonly)');3811var textareaBBOnly = zeroForm.querySelectorAll('textarea.t-input_bbonly');
Array.prototype.forEach.call(textareaNotBBOnly, function (textarea) { textarea.style.paddingLeft = '17px'; }); Array.prototype.forEach.call(textareaBBOnly, function (textarea) { textarea.style.textIndent = '-3px'; }); }}/* ============= support functions for help create elements ============= */function t_zeroForms__appendAttributes(input, inputPreferences) { if (inputPreferences.secondaryClassName) input.classList.add(inputPreferences.secondaryClassName); if (inputPreferences.placeholder) input.placeholder = inputPreferences.placeholder; if (inputPreferences.require) input.setAttribute('data-tilda-req', '1');}/** * set inputStyles params to input styles * * @param {HTMLInputElement | HTMLSelectElement} input * @param {Object} inputStyles */function t_zeroForms__appendStylesToField(input, inputStyles) { if (!input.classList.contains('t-input-inline-styles')) input.classList.add('t-input-inline-styles'); for (var k in inputStyles) { input.style[k] = inputStyles[k]; } if (!input.classList.contains('t-input-phonemask__wrap')) return; var phoneMaskSelect = input.querySelector('.t-input-phonemask__select-code'); if (phoneMaskSelect) phoneMaskSelect.style.fontSize = inputStyles.fontSize; if (phoneMaskSelect) phoneMaskSelect.style.fontWeight = inputStyles.fontWeight; var phoneMaskInput = input.querySelector('.t-input-phonemask'); if (phoneMaskInput) phoneMaskInput.style.fontSize = inputStyles.fontSize; if (phoneMaskInput) phoneMaskInput.style.fontWeight = inputStyles.fontWeight;}/** * set styles for indicator inside checkbox, radio or img-select * * @param {string} recid - record ID * @param {string} formID - current form ID * @param {string} color - color for current style * @param {'checkbox' | 'radio' | 'img-select'} type * @param field */function t_zeroForms__setIndicatorStyles(recid, formID, color, type, field) { if (!color || !field) return; var selector = '.t-' + type + '__indicator:after'; var currentStyle = type === 'checkbox' ? 'border-color' : 'background-color'; var styles = document.createElement('style'); var mainSelector = t_zeroForms__createSelector(recid, formID, selector); styles.textContent = mainSelector + '{' + currentStyle + ':' + color + ';}'; field.appendChild(styles);}/** * get input placeholder styles * * @param {string} formID - current form * @param {formObj} formObj * @param {string} recid - record ID * @param {HTMLElement} zeroForm * @returns {string} */function t_zeroForms__createInputPlaceholderStyles(formID, formObj, recid, zeroForm) { var postfixList = [ '::-webkit-input-placeholder', '::-moz-placeholder', ':-moz-placeholder', ':-ms-input-placeholder', ]; var elements = ['input', 'textarea']; var selector = t_zeroForms__createSelector(recid, formID, ''); var styles = ''; elements.forEach(function (element) { postfixList.forEach(function (postfix) { styles += selector + element + postfix + '{color:' + formObj.inputcolor + ';opacity:0.5;}'; }); }); var stylesID = 't-zero-placeholder-' + recid + '-' + formID; t_zeroForms__addInlineTag({ tag: 'style', id: stylesID, content: styles, zeroForm });}/** * Загружает tilda-ресурс по переданному пути. * onError вызывается, если ресурс не загрузился, в том числе когда его раньше добавила другая форма. * @param {{ recId: string, id: string, path: string, type: 'script' | 'link', onError?: () => void }} options