* Если на странице нет t_loadJsFile (редактор Zero Block), скрипт маски должен подключить тот, кто инициализирует поле.
314 * @returns {Promise<void>} 316async function t_contactMethod__loadPhoneMask() { 317 if (typeof window.t_onFuncLoad === 'function') { 318 await t_contactMethod__waitForFunc('t_loadJsFile'); 319 const src = 'https://static.tildacdn.' + t_contactMethod__getRootZone() + '/js/tilda-phone-mask-1.1.min.js'; 320 await new Promise(resolve => window.t_loadJsFile(src, resolve)); 323 await t_contactMethod__waitForFunc('t_form_phonemask__mulitple__load'); 327 * @param {Element} valueGroup 329function t_contactMethod__isHybridValueGroup(valueGroup) { 330 if (!valueGroup) return; 332 return valueGroup.classList.contains('t-contact-method__hybrid'); 336 * @param {Element} valueGroup 337 * @param {InputType} type 338 * @param {{ silent?: boolean }} params 340function t_contactMethod__resetInputValue(valueGroup, type, params) { 341 const { silent = false } = params || {}; 342 const input = t_contactMethod__getInputElement(valueGroup, type); 344 const oldValue = input.value; 347 input.value = newValue; 348 input.classList.remove('t-input_has-content'); 350 if (oldValue !== newValue && !silent) { 351 input.dispatchEvent(new Event('change', { bubbles: true })); 356 * @param {Element} inputGroup 357 * @param {InputType} type 359function t_contactMethod__getInputElement(inputGroup, type) { 360 return type === 'phone' ? inputGroup.querySelector('.t-input-phonemask') : inputGroup.querySelector('.js-username-input'); 365 * @param {Element} parent 367function t_contactMethod__getPhoneInputElements(parent) { 368 const phoneValueHolder = parent ? parent.querySelector('.js-phonemask-result') : null; 369 const phoneMaskHolder = parent ? t_contactMethod__getInputElement(parent, 'phone') : null; 370 const phoneISOHolder = parent ? parent.querySelector('.js-phonemask-result-iso') : null; 373 valueHolder: phoneValueHolder, 374 maskHolder: phoneMaskHolder, 375 isoHolder: phoneISOHolder, 379function t_contactMethod__getValueGroup(inputGroup, contactMethod) { 380 return inputGroup.querySelector(`.t-contact-method__${contactMethod}-value`); 384 * @param {ContactMethod} contactMethod 385 * @returns {InputType} 387function t_contactMethod__getDefaultInputTypeForContactMethod(contactMethod) { 388 if (['phone', 'whatsapp', 'viber'].includes(contactMethod)) { 394/** @param {Element} element */ 395function t_contactMethod__isHidden(element) { 396 return element && element.classList.contains('t-contact-method__hidden'); 399/** @param {Element} element */ 400function t_contactMethod__hide(element) {