// Функции для cookie function setCookie(name, value, options) { options = options || {}; var expires = options.expires; if (typeof expires == "number" && expires) { var d = new Date(); d.setTime(d.getTime() + expires * 1000); expires = options.expires = d; } if (expires && expires.toUTCString) { options.expires = expires.toUTCString(); } value = encodeURIComponent(value); var updatedCookie = name + "=" + value; for (var propName in options) { updatedCookie += "; " + propName; var propValue = options[propName]; if (propValue !== true) { updatedCookie += "=" + propValue; } } document.cookie = updatedCookie; } function getCookie(name) { var matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : undefined; } function deleteCookie(name) { setCookie(name, "", { expires: -1 }); } $(document).ready(function() { // Инфо окно function infoshow() { var element = document.getElementById("block-info"); var currentPosition = element.offsetTop;//Получаем текущее положение блока, который будет выплывать requestAnimationFrame(function anim(time) { if (currentPosition < 46) { currentPosition = currentPosition + 3; } element.style.top = currentPosition + "px"; requestAnimationFrame(anim); }); } function infohide() { setTimeout(function () { var element = document.getElementById("block-info"); var currentPosition = 46; requestAnimationFrame(function anim(time) { if (currentPosition >= -43) { currentPosition = currentPosition - 3; } element.style.top = currentPosition + "px"; requestAnimationFrame(anim); }); }, 4000); deleteCookie("info_g"); deleteCookie("info_b"); } const cook_g = getCookie("info_g"); const cook_b = getCookie("info_b"); if (cook_g != null) { $("#block-info > p").attr("style", "background: green;").html(cook_g); infoshow(); infohide(); deleteCookie("info_g"); } if (cook_b != null) { $("#block-info > p").attr("style", "background: red;").html(cook_b); infoshow(); infohide(); deleteCookie("info_b"); } // Маска для input $(".input-phone").mask("+7 (999) 999-99-99"); // Вывод специальностей $('.form-study').on("click", function(){ const value = $(this).val(); $('.doc-soc-'+value).show(); $.post("/ajax/form_study", {soc: value}, function (data) { $('#speciality').html(data); }); }); let downFile = function (name) { $.post("/ajax/down", {name: name}, function (data) { }); } }); // Конец