3301if (xhr.readyState === xhr.DONE && xhr.status === 200) {3302if (!window.dev) {3303sessionStorage.setItem(pattern, xhr.responseText);3304}3305onDone(JSON.parse(xhr.responseText));3306}33073308tcart__updateDelivery();3309that.deliveryState.currentRequest = null;3310};33113312if (typeof onFail === 'function') {
function onError(error) { xhr.isTimeout = error.type === 'timeout'; onFail(xhr); that.deliveryState.currentRequest = null; } xhr.ontimeout = onError; xhr.onerror = onError; } if (apiURL[type]) { xhr.open('POST', apiURL[type]); } xhr.timeout = 30000; xhr.send(data); that.deliveryState.currentRequest = xhr; }, /* Creating a new input field */ createInput: function ( inputTypeAttr, inputLabel, inputPlaceholder, defaultValue, inputIdentificator, serviceIdentificator, inputClasses, name, hidden, groupStyle, required, inputModeAttr, tildaInputRule ) { const label = inputLabel || ''; const placeholder = inputPlaceholder || ''; const serviceId = serviceIdentificator || ''; const inputType = inputTypeAttr || ''; const inputMode = inputModeAttr || ''; const tildaRule = tildaInputRule || ''; const isRequired = required ? 1 : 0; const classes = inputClasses + ' t-input' || 't-input'; var div = document.createElement('div'); div.classList.add('t-input-group'); div.classList.add('t-input-group_in'); if (groupStyle) { div.style.cssText = groupStyle; } if (hidden) { div.setAttribute('hidden', ''); } div.setAttribute('data-input-lid', ''); var title = document.createElement('div'); title.classList.add('t-input-title'); title.classList.add('t-descr'); title.classList.add('t-descr_md'); title.setAttribute('data-redactor-toolbar', 'no'); title.setAttribute('field', ''); title.appendChild(document.createTextNode(label)); div.appendChild(title); var inputWrapper = document.createElement('div'); inputWrapper.classList.add('t-input-block'); var input = document.createElement('input'); classes.split(' ').forEach(function (className) { if (className !== '') { input.classList.add(className); } }); if (tildaRule) { input.setAttribute('data-tilda-rule', tildaRule); } // Подсказка по вводу значений, https://developer.mozilla.org/ru/docs/Web/HTML/Global_attributes/inputmode if (inputMode) { input.setAttribute('inputmode', inputMode); } // Ограничение на ввод, https://developer.mozilla.org/ru/docs/Web/HTML/Element/input/number if (inputType) { input.setAttribute('type', inputType); } input.setAttribute('data-service-id', serviceId); input.name = name.toLowerCase(); input.value = defaultValue || ''; input.placeholder = placeholder; input.autocomplete = navigator.userAgent.search(/Chrome/) !== -1 ? 'no' : 'off';