/* cookie.JS ========================================================*/ include('/js/jquery.cookie.js'); /* Easing library ========================================================*/ include('/js/jquery.easing.1.3.js'); /* ToTop ========================================================*/ ; // todo NEXT rewrite to smth much more simple, and get rid of easing above (function ($) { var o = $('html'); if (o.hasClass('desktop')) { window.toTop = function (options) { var defaults = { text: '', min: 500, scrollSpeed: 800, containerID: 'toTop', containerClass: 'toTop fa fa-angle-up', easingType: 'linear' }; var settings = $.extend(defaults, options); var containerIDhash = '#' + settings.containerID; var containerHoverIDHash = '#' + settings.containerHoverID; $('body').append('' + settings.text + ''); $(containerIDhash).hide().click(function () { $('html, body').stop().animate({scrollTop: 0}, settings.scrollSpeed, settings.easingType); $('#' + settings.containerHoverID, this).stop().animate({'opacity': 0}, settings.inDelay, settings.easingType); return false; }) $(window).scroll(function () { var sd = $(window).scrollTop(); if (typeof document.body.style.maxHeight === "undefined") { $(containerIDhash).css({ 'position': 'absolute', 'top': $(window).scrollTop() + $(window).height() - 50 }); } if (sd > settings.min) $(containerIDhash).stop(true, true).fadeIn(600); else $(containerIDhash).fadeOut(800); }); } window.toTop({ easingType: 'easeOutQuart', containerClass: 'toTop fa fa-angle-up' }); // $(document).ready(function () { // $().UItoTop({ // easingType: 'easeOutQuart', // containerClass: 'toTop fa fa-angle-up' // }); // }); } })(jQuery); /* Copyright Year ========================================================*/ ; (function ($) { // todo NOW rewrite to php solution var currentYear = (new Date).getFullYear(); $(document).ready(function () { $("#copyright-year").text((new Date).getFullYear()); }); })(jQuery); /* Google Map ========================================================*/ ; (function ($) { window.initMap = () => { document.querySelector(".s-map")?.classList.add("s-map--initialized"); var o = $('#google-map'); if (o.length > 0) { o.googleMap({ styles: [{ "featureType": "administrative", "elementType": "labels.text.fill", "stylers": [ { "color": "#444444" } ] }, { "featureType": "landscape", "elementType": "all", "stylers": [ { "color": "#f2f2f2" } ] }, { "featureType": "poi", "elementType": "all", "stylers": [ { "visibility": "off" } ] }, { "featureType": "road", "elementType": "all", "stylers": [ { "saturation": -100 }, { "lightness": 45 } ] }, { "featureType": "road.highway", "elementType": "all", "stylers": [ { "visibility": "simplified" } ] }, { "featureType": "road.arterial", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit", "elementType": "all", "stylers": [ { "visibility": "off" } ] }, { "featureType": "water", "elementType": "all", "stylers": [ { "color": "#46bcec" }, { "visibility": "on" } ] }] }); } }; $(document).ready(function () { $('a[href^="#google-map"], a[href^="."]').click(function () { // если в href начинается с # или ., то ловим клик var scroll_el = $(this).attr('href'); // возьмем содержимое атрибута href window.initializeGoogleMap(); if ($(scroll_el).length != 0) { // проверим существование элемента чтобы избежать ошибки $('html, body').animate({scrollTop: $(scroll_el).offset().top}, 1000); // анимируем скроолинг к элементу scroll_el } return false; // выключаем стандартное действие }); $('#map_preview').click(() => { window.initializeGoogleMap(); }); }); window.initializeGoogleMap = () => { var o = document.getElementById("google-map"); if (o) { include('//maps.google.com/maps/api/js?sensor=false&key=AIzaSyBFUUUCxXx7XpA5miJzxeVQ-RTbtCugdUc&callback=initMap'); include('/js/jquery.rd-google-map.js'); } }; }) (jQuery); /* Mailform =============================================*/ ;(function ($) { var o = $('.rd-mailform'); if (o.length > 0) { const cb = () => { var o = $('.rd-mailform'); if (o.length) { o.rdMailForm({ validator: { 'constraints': { '@LettersOnly': { message: 'Используйте только буквы' }, '@NumbersOnly': { message: 'Используйте только цифры' }, '@NotEmpty': { message: 'Поле не может быть пустым!' }, '@Email': { message: 'Введите валидный Email' }, '@Phone': { message: 'Enter valid phone number!' }, '@Date': { message: 'Use MM/DD/YYYY format!' }, '@SelectRequired': { message: 'Please choose an option!' } } } }, { 'MF000': 'Заявка отправлена', 'MF001': 'Recipients are not set!', 'MF002': 'Form will not work locally!', 'MF003': 'Please, define email field in your form!', 'MF004': 'Please, define type of your form!', 'MF254': 'Something went wrong with PHPMailer!', 'MF255': 'There was an error submitting the form!' }); } var o2 = $('.rd-mailform-2'); if (o2.length) { o2.rdMailForm({ validator: { 'constraints': { '@LettersOnly': { message: 'Please use letters only!' }, '@NumbersOnly': { message: 'Используйте только цифры' }, '@NotEmpty': { message: 'Поле не может быть пустым!' }, '@Email': { message: 'Enter valid e-mail address!' }, '@Phone': { message: 'Enter valid phone number!' }, '@Date': { message: 'Use MM/DD/YYYY format!' }, '@SelectRequired': { message: 'Please choose an option!' } } } }, { 'MF000': 'Заявка отправлена', 'MF001': 'Recipients are not set!', 'MF002': 'Form will not work locally!', 'MF003': 'Please, define email field in your form!', 'MF004': 'Please, define type of your form!', 'MF254': 'Something went wrong with PHPMailer!', 'MF255': 'There was an error submitting the form!' }); } }; include('/js/mailform/jquery.form.min.js', () => { include('/js/mailform/jquery.rd-mailform.min.js', cb); }); } })(jQuery); /* Orientation tablet fix ========================================================*/ $(function () { // Menu Android if (window.orientation != undefined) { var regM = /ipod|ipad|iphone/gi, result = navigator.userAgent.match(regM); if (!result) { $('.sf-menus li').each(function () { if ($(">ul", this)[0]) { $(">a", this).toggle( function () { return false; }, function () { window.location.href = $(this).attr("href"); } ); } }) } } }); // todo LATER if some css depends on event and js => it can be added to the DOM the same way as js files