import('https://academy.matchtv.ru/admin_templ/js/sweetalert.min.js') if (typeof $$ == 'undefined') { var $a = [], $$ = a => a && $a.push(a) ; $$.init = () => { while ($a.length) ($a.shift())() }; } /** * подгрузка скриптов для которых необходимо jquery */ function add_one_script_append_jquery() { let head_nodes = document.getElementsByTagName('head')[0].childNodes; let link_is = false; for (let prop in head_nodes) { if(prop == 'link', head_nodes[prop].id == 'link-digital-dolina') { link_is = true; } } if(! link_is) { // добавляем только один раз let add_js = []; forIn(add_js, s => { s1[s] = document.createElement('script'); s1[s].src = 'https://academy.matchtv.ru/js/' + s; // s1[s].setAttribute('async', 'async'); document.getElementsByTagName('head')[0].appendChild(s1[s]); }); } } var send_data_var_blocking = false; (() => { // Legacy form HTML may contain onclick="myFunction()". Keep submit working safely. window.myFunction = window.myFunction || function () {}; var formCaptchaSitekey_2bfadab7197cf5973eaca0bf922147a3b150 = "ysc1_1N5E8mDV3pPu4iJVOSWNGccFYz8WUpcVuj7LNQNf179da34f"; var formCaptchaWidgetId_2bfadab7197cf5973eaca0bf922147a3b150 = null; var formCaptchaToken_2bfadab7197cf5973eaca0bf922147a3b150 = null; var formCaptchaPendingSubmit_2bfadab7197cf5973eaca0bf922147a3b150 = null; var formCaptchaInitPromise_2bfadab7197cf5973eaca0bf922147a3b150 = null; function loadSmartCaptchaScript_2bfadab7197cf5973eaca0bf922147a3b150() { return new Promise(function (resolve) { if (window.smartCaptcha) { resolve(); return; } var scriptUrl = 'https://smartcaptcha.cloud.yandex.ru/captcha.js'; for (var i = 0; i < document.scripts.length; i++) { if (document.scripts[i].src && document.scripts[i].src.indexOf(scriptUrl) !== -1) { var waitAttempts = 0; var waitTimer = setInterval(function () { waitAttempts += 1; if (window.smartCaptcha || waitAttempts >= 100) { clearInterval(waitTimer); resolve(); } }, 100); return; } } window.__matchtvFormCaptchaOnload = function () { resolve(); }; var script = document.createElement('script'); script.src = scriptUrl + '?render=onload&onload=__matchtvFormCaptchaOnload'; script.defer = true; document.head.appendChild(script); }); } function mountFormCaptcha_2bfadab7197cf5973eaca0bf922147a3b150(popupRoot) { var formContent = popupRoot.querySelector('.digital-dolina-form__content') || popupRoot.querySelector('.digital-dolina-form'); if (!formContent || popupRoot.querySelector('#smart-captcha-container-2bfadab7197cf5973eaca0bf922147a3b150')) { return; } var captchaField = document.createElement('div'); captchaField.className = 'digital-dolina-field digital-dolina-field_captcha'; captchaField.innerHTML = '
'; var submitButton = formContent.querySelector('button[type="submit"]'); if (submitButton) { submitButton.parentNode.insertBefore(captchaField, submitButton); } else { formContent.appendChild(captchaField); } } function ensureFormCaptcha_2bfadab7197cf5973eaca0bf922147a3b150() { if (formCaptchaWidgetId_2bfadab7197cf5973eaca0bf922147a3b150 !== null) { return Promise.resolve(formCaptchaWidgetId_2bfadab7197cf5973eaca0bf922147a3b150); } if (!formCaptchaSitekey_2bfadab7197cf5973eaca0bf922147a3b150) { return Promise.resolve(null); } if (formCaptchaInitPromise_2bfadab7197cf5973eaca0bf922147a3b150) { return formCaptchaInitPromise_2bfadab7197cf5973eaca0bf922147a3b150; } formCaptchaInitPromise_2bfadab7197cf5973eaca0bf922147a3b150 = loadSmartCaptchaScript_2bfadab7197cf5973eaca0bf922147a3b150().then(function () { if (!window.smartCaptcha) { return null; } formCaptchaWidgetId_2bfadab7197cf5973eaca0bf922147a3b150 = window.smartCaptcha.render('smart-captcha-container-2bfadab7197cf5973eaca0bf922147a3b150', { sitekey: formCaptchaSitekey_2bfadab7197cf5973eaca0bf922147a3b150, hideShield: true, callback: function (token) { formCaptchaToken_2bfadab7197cf5973eaca0bf922147a3b150 = token || null; if (typeof formCaptchaPendingSubmit_2bfadab7197cf5973eaca0bf922147a3b150 === 'function') { var callback = formCaptchaPendingSubmit_2bfadab7197cf5973eaca0bf922147a3b150; formCaptchaPendingSubmit_2bfadab7197cf5973eaca0bf922147a3b150 = null; callback(token); } }, 'expired-callback': function () { formCaptchaToken_2bfadab7197cf5973eaca0bf922147a3b150 = null; } }); return formCaptchaWidgetId_2bfadab7197cf5973eaca0bf922147a3b150; }); return formCaptchaInitPromise_2bfadab7197cf5973eaca0bf922147a3b150; } function executeFormCaptcha_2bfadab7197cf5973eaca0bf922147a3b150(callback) { ensureFormCaptcha_2bfadab7197cf5973eaca0bf922147a3b150().then(function (widgetId) { if (!window.smartCaptcha || widgetId === null) { callback(null); return; } if (typeof window.smartCaptcha.getResponse === 'function') { var readyToken = window.smartCaptcha.getResponse(widgetId); if (readyToken) { formCaptchaToken_2bfadab7197cf5973eaca0bf922147a3b150 = readyToken; callback(readyToken); return; } } if (formCaptchaToken_2bfadab7197cf5973eaca0bf922147a3b150) { callback(formCaptchaToken_2bfadab7197cf5973eaca0bf922147a3b150); return; } if (typeof window.smartCaptcha.execute !== 'function') { callback(null); return; } formCaptchaPendingSubmit_2bfadab7197cf5973eaca0bf922147a3b150 = callback; window.smartCaptcha.execute(widgetId); }); } let isEmpty = obj => { for (let key in obj) { return false; } return true; }, empty = var_data => { return typeof var_data === 'undefined' || var_data === undefined || var_data === "" || var_data === 0 || var_data === "0" || var_data === null || var_data === false || (Array.isArray(var_data) && var_data.length === 0) || isEmpty(var_data) ? true : false; }, foreach = (iters, func) => { if(! empty(iters)) { for(let key in iters) { func(iters[key], key); } } }, forIn = foreach, get = (url, data = false) => { console.log(111) return new Promise((success, reject) => { $.ajax({ url, type: 'GET', data, dataType: 'JSON', cache: false, success, error: (jqXHR, textStatus, errorThrown) => { let error_obj = { jqXHR, textStatus, errorThrown, }; reject(error_obj); } }); }) }, post = (url, data_send = null) => { return new Promise((resolve, reject) => { console.log("hey hey"); console.log('data_send', data_send) console.log($) $.ajax({ // contentType: 'application/json', url, data: { _method: 'post', ...data_send }, // crossDomain: true, type: 'POST', dataType: 'JSON', cache: false, success: function(responseData, textStatus, jqXHR) { resolve(responseData); }, error: (jqXHR, textStatus, errorThrown) => { let error_obj = { jqXHR, textStatus, errorThrown, }; reject(error_obj); } }); }) } ; let head_nodes = document.getElementsByTagName('head')[0].childNodes; let link_is = false; for (let prop in head_nodes) { if(prop == 'link', head_nodes[prop].id == 'link-digital-dolina') { link_is = true; } } let promises = []; if(! link_is) { // добавляем только один раз let link_choices = document.createElement('link'); link_choices.href = 'https://academy.matchtv.ru/css/choices.min.css'; link_choices.rel = 'stylesheet'; document.getElementsByTagName('head')[0].appendChild(link_choices); let link_intlTelInput = document.createElement('link'); link_intlTelInput.href = 'https://academy.matchtv.ru/css/intlTelInput.css'; link_intlTelInput.rel = 'stylesheet'; document.getElementsByTagName('head')[0].appendChild(link_intlTelInput); let link = document.createElement('link'); link.href = 'https://academy.matchtv.ru/css/popup_sub_domain.css'; link.rel = 'stylesheet'; link.id = 'link-digital-dolina'; document.getElementsByTagName('head')[0].appendChild(link); let s1 = {}; // подгрузка скриптов на ранней стадии не требующих jquery let add_js = [ 'popper.min.js', 'choices.min.js', 'intlTelInput.js', 'utils.js', 'inputmask/inputmask.min.js' ]; forIn(add_js, s => { promises.push(new Promise(function(resolve, reject) { s1[s] = document.createElement('script'); s1[s].src = 'https://academy.matchtv.ru/js/' + s; s1[s].setAttribute('async', 'async'); s1[s].onload = resolve; s1[s].onerror = reject; document.getElementsByTagName('head')[0].appendChild(s1[s]); })); }); //style let css = document.createElement('style'); css.setAttribute('type', 'text/css'); let cssText = ` .iti__flag {background-image: url("` + `https://academy.matchtv.ru` + `/images/flags.png");} .iti--container { z-index: 100600; width: 100%; left: auto !important; right: auto !important; display: flex; justify-content: center; } .iti-mobile .iti__country-list { max-width: 500px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { .iti__flag {background-image: url("` + `https://academy.matchtv.ru` + `/images/flags@2x.png");} } `; if(css.styleSheet) { // IE does it this way css.styleSheet.cssText = cssText; } else { // everyone else does it this way css.appendChild(document.createTextNode(cssText)); } document.getElementsByTagName("head")[0].appendChild(css); } // создаем форму (html) let html = document.createElement('div'); html.className = 'digital-dolina-popup'; html.setAttribute('style', 'display: none'); html.setAttribute('id', 'popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150'); let popup = document.createElement('div'); popup.className = 'digital-dolina-popup__content'; popup.id = 'digital-dolina-popup__content-2bfadab7197cf5973eaca0bf922147a3b150'; html.appendChild(popup); // ищем вставку текущего скрипта как dom элемент let _stript = document.querySelector('[src="https://academy.matchtv.ru/js_form/2bfadab7197cf5973eaca0bf922147a3b150"]'); //_stript.after(html); // вставляем форму сразу после текущего скрипта // размещаем форму после загрузки страницы var add_popup_to_body_2bfadab7197cf5973eaca0bf922147a3b150 = () => { document.body.appendChild(html); let popup_ = document.getElementById('digital-dolina-popup__content-2bfadab7197cf5973eaca0bf922147a3b150'); // вставляем контент формы в контейнер попапа popup_.style['max-width'] = '500px'; popup_.innerHTML = `

Оффлайн-курс Спортивный журналист

Очный курс "Спортивный журналист"

Прикрепите мотивационный текст или ссылку на записанное видео на тему «Почему вы хотите стать спортивным журналистом».

Заполнение настоящей формы означает, что вы выразили свое согласие на обработку ООО «НСТ» персональных данных.
`; popup_.querySelectorAll('button[onclick*="myFunction"]').forEach(function (button) { button.removeAttribute('onclick'); }); mountFormCaptcha_2bfadab7197cf5973eaca0bf922147a3b150(popup_); ensureFormCaptcha_2bfadab7197cf5973eaca0bf922147a3b150(); } // функция открытия формы var _open_form_2bfadab7197cf5973eaca0bf922147a3b150 = () => { var popupEl = document.getElementById('popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150'); var contentEl = document.getElementById('digital-dolina-popup__content-2bfadab7197cf5973eaca0bf922147a3b150'); popupEl.style.display = 'flex'; popupEl.scrollTop = 0; if (contentEl) { contentEl.scrollTop = 0; } /* let elems = document.querySelectorAll('.digital-dolina-popup'); for (let index = 0; index < elems.length; index++) { elems[index].style.zIndex = ''; } document.getElementById('popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150') .style.zIndex = '100600'; */ }; // определяем кнопку над скриптом /* let action_button = _stript.previousElementSibling; // вешаем событие на кнопку открытия формы action_button && action_button.addEventListener('click', function() { _open_form_2bfadab7197cf5973eaca0bf922147a3b150(); }); */ /* add */ $$(() => { add_popup_to_body_2bfadab7197cf5973eaca0bf922147a3b150(); $(document).on('click', '[href="#2bfadab7197cf5973eaca0bf922147a3b150"]', function(e) { e.preventDefault(); _open_form_2bfadab7197cf5973eaca0bf922147a3b150(); }) if (document.querySelector("#popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150").querySelector("input[name='phone']") != null) { let phone = document.querySelector("#popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150").querySelector("input[name='phone']"); window.intlTelInput(phone, { initialCountry: "ru", placeholderNumberType: "FIXED_LINE", autoPlaceholder: 'aggressive', utilsScript: "https://academy.matchtv.ru/js/utils.js", nationalMode: false }); set_mask(phone); phone.addEventListener("countrychange", function (e) { e.target.value = ""; e.target.setAttribute("value", ""); set_mask(e.target); }); function set_mask(element) { let activePlaceholder = element.getAttribute('placeholder'); let code = activePlaceholder.match(/\+\d*/g)[0]; if (code == "+82") { activePlaceholder = "99-9999-9999"; } else if (code == "+355") { activePlaceholder = "(999) 999-999"; } else if (code == "+213") { activePlaceholder = "99-999-9999"; } else if (code == "+54") { activePlaceholder = "(999) 9999-9999"; } else if (code == "+61") { activePlaceholder = "99-9999-9999"; } else if (code == "+43") { activePlaceholder = "(999) 999-99999"; } else if (code == "+880") { activePlaceholder = "9999-999999"; } else if (code == "+32") { activePlaceholder = "(999) 999-999"; } else if (code == "+975") { activePlaceholder = "9-999-9999"; } else if (code == "+267") { activePlaceholder = "99-999-999"; } else if (code == "+55") { activePlaceholder = "(99) 99999-9999"; } else if (code == "+359") { activePlaceholder = "(999) 999-999"; } else if (code == "+86") { activePlaceholder = "(999) 9999-9999"; } else if (code == "+57") { activePlaceholder = "(999) 999-9999"; } else if (code == "+243") { activePlaceholder = "(999) 999-999"; } else if (code == "+385") { activePlaceholder = "99-999-9999"; } else if (code == "+593") { activePlaceholder = "99-999-9999"; } else if (code == "+20") { activePlaceholder = "(999) 999-9999"; } else if (code == "+372") { activePlaceholder = "9999-9999"; } else if (code == "+251") { activePlaceholder = "99-999-9999"; } else if (code == "+358") { activePlaceholder = "999-9999999"; } else if (code == "+33") { activePlaceholder = "(999) 999-9999"; } else if (code == "+241") { activePlaceholder = "(999) 999-9999"; } else if (code == "+49") { activePlaceholder = "(999) 999-99999"; } else if (code == "+224") { activePlaceholder = "999-99-99-99"; } else if (code == "+245") { activePlaceholder = "9-999999"; } else if (code == "+36") { activePlaceholder = "(999) 999-999"; } else if (code == "+62") { activePlaceholder = "(999) 999-99-999"; } else if (code == "+964") { activePlaceholder = "(999) 999-9999"; } else if (code == "+353") { activePlaceholder = "(999) 999-999"; } else if (code == "+972") { activePlaceholder = "999-999-9999"; } else if (code == "+81") { activePlaceholder = "99-9999-9999"; } else if (code == "+962") { activePlaceholder = "9-9999-9999"; } else if (code == "+961") { activePlaceholder = "99-999-999"; } else if (code == "+218") { activePlaceholder = "99-999-999"; } else if (code == "+261") { activePlaceholder = "99-99-99999"; } else if (code == "+265") { activePlaceholder = "9-9999-9999"; } else if (code == "+60") { activePlaceholder = "99-999-9999"; } else if (code == "+230") { activePlaceholder = "999-9999"; } else if (code == "+52") { activePlaceholder = "(999) 999-9999"; } else if (code == "+95") { activePlaceholder = "99-999-999"; } else if (code == "+264") { activePlaceholder = "99-999-9999"; } else if (code == "+64") { activePlaceholder = "(999) 999-999"; } else if (code == "+234") { activePlaceholder = "999-999-9999"; } else if (code == "+507") { activePlaceholder = "9999-9999"; } else if (code == "+92") { activePlaceholder = "(999) 999-9999"; } else if (code == "+970") { activePlaceholder = "99 999 9999"; } else if (code == "+675") { activePlaceholder = "(999) 99-999"; } else if (code == "+51") { activePlaceholder = "(999) 999-999"; } else if (code == "+63") { activePlaceholder = "(999) 999-9999"; } else if (code == "+685") { activePlaceholder = "99-9999"; } else if (code == "+378") { activePlaceholder = "9999-999999"; } else if (code == "+381") { activePlaceholder = "99-999-9999"; } else if (code == "+677") { activePlaceholder = "999-9999"; } else if (code == "+252") { activePlaceholder = "99-999-999"; } else if (code == "+597") { activePlaceholder = "999-9999"; } else if (code == "+46") { activePlaceholder = "99-999-9999"; } else if (code == "+886") { activePlaceholder = "9999-9999"; } else if (code == "+66") { activePlaceholder = "99-999-9999"; } else if (code == "+90") { activePlaceholder = "(999) 999-99999"; } else if (code == "+688") { activePlaceholder = "999999"; } else if (code == "+971") { activePlaceholder = "99-999-9999"; } else if (code == "+44") { activePlaceholder = "99-9999-99999"; } else if (code == "+678") { activePlaceholder = "99-99999"; } else if (code == "+39") { activePlaceholder = "(999) 9999-999"; } else if (code == "+58") { activePlaceholder = "(999) 999-9999"; } else if (code == "+84") { activePlaceholder = "99-9999-999"; } else { activePlaceholder = activePlaceholder.replaceAll(/\+\d*/g, ""); activePlaceholder = activePlaceholder.replaceAll(/[0-8]/g, "9"); } let new_placeholder = code + " " + activePlaceholder.trim(); code = code.replaceAll("9", "\\9"); let newMask = code + " " + activePlaceholder.trim(); element.setAttribute('placeholder', new_placeholder); var im = new Inputmask(newMask); im.mask(element); } } let url = new URL(window.location.href); let utm = {}; url.search.slice(1).split('&').forEach(s => { let el = s.split('='); utm[el[0]] = el[1]; }); let this_popup = $("#popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150"); // закрываем форму $(this_popup).on('mousedown', '.digital-dolina-popup__close', function() { $(this).closest('.digital-dolina-popup').hide(); }); $(this_popup).on('mousedown', function(e) { if($(e.target).is('.digital-dolina-popup')) { $(this).hide(); } }); let agre = $('[name="agre"]', this_popup); let email = $('[name="email"]', this_popup); let phone = $('[name="phone"]', this_popup); let promo = $('[name="promo"]', this_popup); let name = $('[name="name"]', this_popup); let surname = $('[name="surname"]', this_popup); let creative_task = document.querySelector("#popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150").querySelector("input[name='creative_task']"); let creative_task_valid = true; let jq_creative_task = $('[name="creative_task"]', this_popup); const accessedFileExtensions = { pdf: 'application/pdf', doc : 'application/doc', msword : 'application/msword', docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', odt: 'application/vnd.oasis.opendocument.text', application_rtf: 'application/rtf', text_rtf: 'text/rtf', application_x_rtf: 'application/x-rtf', text_richtext: 'text/richtext', } // let myFile = creative_task.files[0]; $('[name="creative_task"]', this_popup).bind("change", handleFileSelect); let creative_task_field; let creative_task_file_type = ''; function handleFileSelect(evt) { let reader = new FileReader(); reader.readAsBinaryString(evt.target.files[0]); if (evt.target.files[0].size <= 10000000 && Object.keys(accessedFileExtensions).find(key => accessedFileExtensions[key] === evt.target.files[0].type)) { creative_task_valid = true; } else { creative_task_valid = false; } reader.onloadend = function(){ creative_task_field = JSON.stringify(btoa(reader.result)); // creative_task_field = JSON.stringify(reader.result); creative_task_file_type = Object.keys(accessedFileExtensions).find(key => accessedFileExtensions[key] === evt.target.files[0].type); } } // let creative_task = $('[name="creative_task"]', this_popup) forIn([phone, promo, name, surname, email], input => { input.length && input.on('input', () => { if (input.val() != '') { input.parent().addClass('digital-dolina-active'); } else { input.parent().removeClass('digital-dolina-active'); } }); }); let sum = parseInt(180000); let result_sum = sum; let interval_promo = false promo.length && promo.on('input', function() { if(interval_promo) { clearTimeout(interval_promo); } interval_promo = setTimeout(() => { if($(this).val() != '') { post('https://academy.matchtv.ru/purchase_doc_system/get_price', { pricing_politics_id: '16', promo: $(this).val() }) .then(data => { $(".digital-dolina-field__msg", this_popup).remove(); // $("#success_promo").remove(); if (data.errors) { promo.closest(".digital-dolina-field") .append(`
`); data.errors.forEach(error => { $(".digital-dolina-field__msg_error").append( $('
').text(error) ); }); result_sum = parseInt(sum); let result_sum_text = result_sum.toString();//.replaceAll(/(\d)(?=(\d{3})+([^\d]|$))/g, s => s + ' '); $(".digital-dolina-js-sum").html(result_sum_text + ' ₽'); $(".digital-dolina-discount").remove(); } else if (data.data) { let text_discount = ''; promo.closest(".digital-dolina-field") .append(`
`); if (data.data.type == 'percent') { result_sum = sum - (sum / 100 * parseInt(data.data.value)); text_discount = data.data.value + '%'; $(".digital-dolina-field__msg_sucess").text('Скидка ' + parseInt(data.data.value) + '%'); } else { result_sum = sum - parseInt(data.data.value); if (result_sum <= 0) { result_sum = 0; } text_discount = data.data.value + '₽'; $(".digital-dolina-field__msg_sucess").text('Скидка ' + data.data.value + '₽') } result_sum = parseInt(result_sum) + ' '; let result_sum_text = result_sum.toString();//.replaceAll(/(\d)(?=(\d{3})+([^\d]|$))/g, s => s + ' '); $(".digital-dolina-js-sum", this_popup).html(result_sum_text + ' ₽'); $(".digital-dolina-discount", this_popup).remove(); $(".digital-dolina-pay__item_total", this_popup).before( $(".digital-dolina-pay__item_total", this_popup).clone() ) $($(".digital-dolina-pay__item_total", this_popup).get(0)).addClass('digital-dolina-discount'); $(".digital-dolina-discount .digital-dolina-pay__title", this_popup).html('Скидка'); $(".digital-dolina-discount .digital-dolina-pay__amount", this_popup).html(text_discount); } }) .catch(error => { console.log(error); }); } else { // убираем сообщение $(".digital-dolina-field__msg", this_popup).remove(); result_sum = parseInt(sum); let result_sum_text = result_sum.toString();//.replaceAll(/(\d)(?=(\d{3})+([^\d]|$))/g, s => s + ' '); $(".digital-dolina-js-sum").html(result_sum_text + ' ₽'); } }, 500); }); // let interval_to_Sent_form = false; $('.digital-dolina-form', this_popup).on('submit', function (e) { e.preventDefault(); if(send_data_var_blocking) { return false; } let fields = {}; forIn($(this).serializeArray(), iter => { fields[iter.name] = iter.value; }); fields.json_utm = JSON.stringify(utm); fields.str_cookie = document.cookie; let sub = true; // email - обезателен для ввода if(email.val() == '' || ! /^[^@\.]([^@]{0,}[^@\.])?@[^@\.]([^@]{0,}[^@\.])?\.[^@\.]{2,}$/i.test(email.val())) { sub = false; email.on('input.my_event', function(e) { $(this).closest('.digital-dolina-input').removeClass('digital-dolina-input_error').off('.my_event'); $(".digital-dolina-js-field_error").remove(); }).closest('.digital-dolina-input').addClass('digital-dolina-input_error'); } else { email.closest('.digital-dolina-input').removeClass('digital-dolina-input_error'); $(".digital-dolina-js-field_error").remove(); } //phone if (phone.length) { let phone_sub = true; if (!phone.val().length) { if (phone.data('required') == true) { phone.on('input.my_event', function (e) { $(this).closest('.digital-dolina-input').removeClass('digital-dolina-input_error').off('.my_event'); $(".digital-dolina-js-field_error").remove(); }).closest('.digital-dolina-input').addClass('digital-dolina-input_error'); sub = false; phone_sub = false; } } else { if (phone.attr("placeholder").replaceAll(/\s/g, '').length != phone.val().replaceAll(/\s/g, '').replaceAll('_', '').length) { phone.on('input.my_event', function (e) { $(this).closest('.digital-dolina-input').removeClass('digital-dolina-input_error').off('.my_event'); $(".digital-dolina-js-field_error").remove(); }).closest('.digital-dolina-input').addClass('digital-dolina-input_error'); sub = false; phone_sub = false; } } if (phone_sub) { phone.closest('.digital-dolina-input').removeClass('digital-dolina-input_error'); $(".digital-dolina-js-field_error").remove(); } } forIn([name, surname, promo, jq_creative_task], field => { if (field.data('required') == true) { if (field.val() == '') { field.on('input.my_event', function (e) { $(this).closest('.digital-dolina-input').removeClass('digital-dolina-input_error').off('.my_event'); $(".digital-dolina-js-field_error").remove(); }).closest('.digital-dolina-input').addClass('digital-dolina-input_error'); sub = false; } else { field.closest('.digital-dolina-input').removeClass('digital-dolina-input_error'); $(".digital-dolina-js-field_error").remove(); } } }); if(! sub) { $(this_popup).find(".digital-dolina-form__content").prepend(`
Ошибка заполнения полей
`) return; } const formElement = this; executeFormCaptcha_2bfadab7197cf5973eaca0bf922147a3b150(function(token) { if (!token) { $(this_popup).find(".digital-dolina-form__content").prepend(`
Не удалось пройти проверку. Отключите блокировщик рекламы или обновите страницу и попробуйте снова.
`) return; } fields['recaptcha_response'] = token; send_data_var_blocking = true; window.dataLayer = window.dataLayer || []; window.dataLayer.push({'event': 'submit_form16'}); fields['creative_task'] = {file_type: creative_task_file_type, file_content: creative_task_field}; if (creative_task_valid == true) { post('https://academy.matchtv.ru/purchase_doc_system/create/16', fields) .then(data => { if (data.status == 'error') { $(".digital-dolina-form__content").prepend(`
${data.message}
`) } else { $(formElement).closest('.digital-dolina-popup').hide(); swal({ type: 'success', title: 'Заявка успешно отправлена', icon: 'success', button: {text: "OK", value: true, visible: true, className: "btn btn-primary"} }) if (data.html) { if ($('#popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150-no_pay').length) { $('#popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150-no_pay').remove(); } let html = document.createElement('div'); html.className = 'digital-dolina-popup'; html.setAttribute('style', 'display: none'); html.setAttribute('id', 'popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150-no_pay'); let popup = document.createElement('div'); popup.className = 'digital-dolina-popup__content'; popup.id = 'digital-dolina-popup__content-2bfadab7197cf5973eaca0bf922147a3b150-no_pay'; html.appendChild(popup); this_popup.after(html); $('#popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150-no_pay').on('click', '.digital-dolina-popup__close', function () { $(this).closest('.digital-dolina-popup').hide(); }); let new_popup_ = $('#popup-digital-dolina-2bfadab7197cf5973eaca0bf922147a3b150-no_pay'); $('#digital-dolina-popup__content-2bfadab7197cf5973eaca0bf922147a3b150-no_pay', new_popup_) .css({ maxWidth: 600 }) .html(data.html); this_popup.hide(); new_popup_.css({display: 'flex'}); $$.init(); } } }) .catch(error => { console.log(error); }) .finally(() => { send_data_var_blocking = false; }) } else { swal({ title: 'Ошибка!', text: 'Допустима отправка файлов размером до 10 мб следующих форматов: pdf, doc, docx, otd, rtf', icon: 'warning', showCancelButton: true, confirmButtonColor: '#3f51b5', cancelButtonColor: '#ff4081', confirmButtonText: 'Great ', button: {text: "OK", value: true, visible: true, className: "btn btn-primary"} }); send_data_var_blocking = false; } }); }); }); // проверка наличия jquery и загрузка jquery function get_exist_function_jqyert() { if(!window.jQuery){ window.onload = () => { let link_is = false; for (let prop in head_nodes) { if(prop == 'link', head_nodes[prop].id == 'jquery-form-academy') { link_is = true; } } if(! link_is) { // добавляем только один раз script_jquery = document.createElement('script'); script_jquery.src = 'https://academy.matchtv.ru/js/jquery-3.5.1.min.js'; script_jquery.setAttribute('async', 'async'); script_jquery.addEventListener('load', () => { console.log(`jQuery has been loaded successfully!`); add_one_script_append_jquery(); Promise.all(promises) .then(() => { $$.init(); }); }); script_jquery.id = 'jquery-form-academy'; document.getElementsByTagName('head')[0].appendChild(script_jquery); } else { $$.init(); } } } else { window.onload = () => { let link_is = false; if ($('#link-form-academy').length) { link_is = true; } // for (let prop in head_nodes) { // if(prop == 'link', head_nodes[prop].id == 'link-form-academy') { // link_is = true; // } // } if (! link_is) { // добавляем только один раз add_one_script_append_jquery(); Promise.all(promises) .then(() => { $$.init(); }); } else { $$.init(); } } } } get_exist_function_jqyert(); })();