1/*2* Скрипт отвечает за работу полей с типом file (<input type="file"/>)3* Подменяет стандартный тег input file с набором стилей в конструкцию с dropdown для отображения загруженного списка файлов4* В данном списке мы можем удалять файлы в момент и после загрузки, видеть размер файла и его имя5* После чего добавленные файлы можем отправлять с формой на выбранный в настройках облачный сервис с указанным api key сервиса.6*/78window.t_upwidget__browserLang = (window.navigator.userLanguage || window.navigator.language).toUpperCase().slice(0, 2);910/**11* Language override based on attribute
*/t_onReady(function() { var allrecords = document.getElementById('allrecords'); if (allrecords) { var projectLang = allrecords.getAttribute('data-tilda-project-lang'); } if (projectLang) { window.tUpwidgetProjectLang = projectLang; }});// All method for IE// Array.prototype.someif (!Array.prototype.some) { Array.prototype.some = function(fn) { 'use strict'; if (this == null) { throw new TypeError('Array.prototype.some called on null or undefined'); } if (typeof fn !== 'function') { throw new TypeError(); } var t = Object(this); var len = t.length >>> 0; var thisArg = arguments.length >= 2 ? arguments[1] : void 0; for (var i = 0; i < len; i++) { if (i in t && fn.call(thisArg, t[i], i, t)) { return true; } } return false; };}// Element.matches()(function(e) { var matches = e.matches || e.matchesSelector || e.webkitMatchesSelector || e.mozMatchesSelector || e.msMatchesSelector || e.oMatchesSelector; !matches ? (e.matches = e.matchesSelector = function matches(selector) { var matches = document.querySelectorAll(selector); var th = this; return Array.prototype.some.call(matches, function(e) { return e === th; }); }) : (e.matches = e.matchesSelector = matches);})(Element.prototype);// Element.closest()if (!Element.prototype.closest) { Element.prototype.closest = function (s) { var el = this; while (el && el.nodeType === 1) { if (Element.prototype.matches.call(el, s)) { return el; } el = el.parentElement || el.parentNode; } return null; };}// String.prototype.trim()if (!String.prototype.trim) { (function() { String.prototype.trim = function() { return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); }; })();}/** * Method ready for ie * * @param {Function} fn - callback function */function t_onReady(fn) { if (document.readyState != 'loading') { fn(); } else { document.addEventListener('DOMContentLoaded', fn); }}/** * Method remove() for IE8+ *