Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

tilda-zero-forms-1.0.js

Код файла
Версия от 04.12.2026, 04:03:53 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
3801		}3802		// placeholder-атрибут — чистый текст, animField лишь его визуальная копия3803		animField.textContent = placeholder;3804		input.insertAdjacentElement('afterend', animField);3805		input.removeAttribute('placeholder');3806	});3807 3808	if (window.t_zeroForms__isiOS && window.t_zeroForms__iOSMajorVersion < 13) {3809		//BBOnly - border-bottom only (input style: only border-bottom)3810		var textareaNotBBOnly = zeroForm.querySelectorAll('textarea:not(.t-input_bbonly)');3811		var textareaBBOnly = zeroForm.querySelectorAll('textarea.t-input_bbonly');
История файла и сравнение версий
  • 04.12.2026, 04:03:53 · 56c3b845
3812 Array.prototype.forEach.call(textareaNotBBOnly, function (textarea) {
3813 textarea.style.paddingLeft = '17px';
3814 });
3815 Array.prototype.forEach.call(textareaBBOnly, function (textarea) {
3816 textarea.style.textIndent = '-3px';
3817 });
3818 }
3819}
3820
3821/* ============= support functions for help create elements ============= */
3822
3823function t_zeroForms__appendAttributes(input, inputPreferences) {
3824 if (inputPreferences.secondaryClassName) input.classList.add(inputPreferences.secondaryClassName);
3825 if (inputPreferences.placeholder) input.placeholder = inputPreferences.placeholder;
3826 if (inputPreferences.require) input.setAttribute('data-tilda-req', '1');
3827}
3828
3829/**
3830 * set inputStyles params to input styles
3831 *
3832 * @param {HTMLInputElement | HTMLSelectElement} input
3833 * @param {Object} inputStyles
3834 */
3835function t_zeroForms__appendStylesToField(input, inputStyles) {
3836 if (!input.classList.contains('t-input-inline-styles')) input.classList.add('t-input-inline-styles');
3837 for (var k in inputStyles) {
3838 input.style[k] = inputStyles[k];
3839 }
3840 if (!input.classList.contains('t-input-phonemask__wrap')) return;
3841 var phoneMaskSelect = input.querySelector('.t-input-phonemask__select-code');
3842 if (phoneMaskSelect) phoneMaskSelect.style.fontSize = inputStyles.fontSize;
3843 if (phoneMaskSelect) phoneMaskSelect.style.fontWeight = inputStyles.fontWeight;
3844 var phoneMaskInput = input.querySelector('.t-input-phonemask');
3845 if (phoneMaskInput) phoneMaskInput.style.fontSize = inputStyles.fontSize;
3846 if (phoneMaskInput) phoneMaskInput.style.fontWeight = inputStyles.fontWeight;
3847}
3848
3849/**
3850 * set styles for indicator inside checkbox, radio or img-select
3851 *
3852 * @param {string} recid - record ID
3853 * @param {string} formID - current form ID
3854 * @param {string} color - color for current style
3855 * @param {'checkbox' | 'radio' | 'img-select'} type
3856 * @param field
3857 */
3858function t_zeroForms__setIndicatorStyles(recid, formID, color, type, field) {
3859 if (!color || !field) return;
3860 var selector = '.t-' + type + '__indicator:after';
3861 var currentStyle = type === 'checkbox' ? 'border-color' : 'background-color';
3862 var styles = document.createElement('style');
3863 var mainSelector = t_zeroForms__createSelector(recid, formID, selector);
3864 styles.textContent = mainSelector + '{' + currentStyle + ':' + color + ';}';
3865 field.appendChild(styles);
3866}
3867
3868/**
3869 * get input placeholder styles
3870 *
3871 * @param {string} formID - current form
3872 * @param {formObj} formObj
3873 * @param {string} recid - record ID
3874 * @param {HTMLElement} zeroForm
3875 * @returns {string}
3876 */
3877function t_zeroForms__createInputPlaceholderStyles(formID, formObj, recid, zeroForm) {
3878 var postfixList = [
3879 '::-webkit-input-placeholder',
3880 '::-moz-placeholder',
3881 ':-moz-placeholder',
3882 ':-ms-input-placeholder',
3883 ];
3884 var elements = ['input', 'textarea'];
3885 var selector = t_zeroForms__createSelector(recid, formID, '');
3886
3887 var styles = '';
3888 elements.forEach(function (element) {
3889 postfixList.forEach(function (postfix) {
3890 styles += selector + element + postfix + '{color:' + formObj.inputcolor + ';opacity:0.5;}';
3891 });
3892 });
3893 var stylesID = 't-zero-placeholder-' + recid + '-' + formID;
3894 t_zeroForms__addInlineTag({ tag: 'style', id: stylesID, content: styles, zeroForm });
3895}
3896
3897/**
3898 * Загружает tilda-ресурс по переданному пути.
3899 * onError вызывается, если ресурс не загрузился, в том числе когда его раньше добавила другая форма.
3900 * @param {{ recId: string, id: string, path: string, type: 'script' | 'link', onError?: () => void }} options
Предыдущие 100 строкСледующие 100 строк