function t121_init(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var wrapperBlock = rec.querySelector('.t121'); var videoLazy = rec.querySelector('.t-video-lazyload'); if (videoLazy) { t_onFuncLoad('t_video_lazyload__setHeight', function () { var videoHeight = videoLazy.getAttribute('data-videolazy-height'); if (videoHeight !== '540px') return; t_video_lazyload__setHeight(videoLazy); window.addEventListener('resize', function () { t_video_lazyload__setHeight(videoLazy); }); if (!wrapperBlock) return; wrapperBlock.addEventListener('displayChanged', function () { t_video_lazyload__setHeight(videoLazy); }); }); } var videoCarrier = rec.querySelector('.t-video-carier'); if (!videoCarrier) return; var screenMin = rec.getAttribute('data-screenmin'); var screenMax = rec.getAttribute('data-screenmax'); var isLoad = false; if (window.innerWidth < parseInt(screenMin, 10) || window.innerWidth > parseInt(screenMax, 10)) return; window.addEventListener( 'scroll', t_throttle(function () { if (!isLoad) { var videoCarrierOffsetTop = videoCarrier.getBoundingClientRect().top + window.pageYOffset; var videoCarrierHeight = parseInt(window.getComputedStyle(videoCarrier).height, 10); var windowScrollTop = window.pageYOffset; var windowHeight = window.innerHeight; if ( windowScrollTop + windowHeight > videoCarrierOffsetTop - 500 && windowScrollTop < videoCarrierOffsetTop + videoCarrierHeight + 501 ) { t_onFuncLoad('processYoutubeVideo', function () { processYoutubeVideo(videoCarrier, videoCarrier.style.height); }); isLoad = true; } } }) ); var event = document.createEvent('HTMLEvents'); event.initEvent('scroll', true, false); window.dispatchEvent(event); } function t071_unifyHeights(recid) { $('#rec' + recid + ' .t071 .t-container').each(function () { var highestBox = 0; $('.t071__wrapper', this).each(function () { if ($(this).height() > highestBox) highestBox = $(this).height(); }); if ($(window).width() >= 960) { $('.t071__wrapper', this).css('height', highestBox); } else { $('.t071__wrapper', this).css('height', 'auto'); } }); } function t106_init(recId) { t_onFuncLoad('t_card__moveClickOnCard', function () { t_card__moveClickOnCard(recId); }); t_onFuncLoad('t_card__addFocusOnTab', function () { t_card__addFocusOnTab(recId); }); } function t113_highlight(recid) { var url = window.location.href; var pathname = window.location.pathname; if (url.substr(url.length - 1) == '/') { url = url.slice(0, -1); } if (pathname.substr(pathname.length - 1) == '/') { pathname = pathname.slice(0, -1); } if (pathname.charAt(0) == '/') { pathname = pathname.slice(1); } if (pathname == '') { pathname = '/'; } $(".t113__list_item a[href='" + url + "']").addClass('t-active'); $(".t113__list_item a[href='" + url + "/']").addClass('t-active'); $(".t113__list_item a[href='" + pathname + "']").addClass('t-active'); $(".t113__list_item a[href='/" + pathname + "']").addClass('t-active'); $(".t113__list_item a[href='" + pathname + "/']").addClass('t-active'); $(".t113__list_item a[href='/" + pathname + "/']").addClass('t-active'); } function t113_showMenu(recid, pageid) { var $flagmenudo = '2ok'; $(window).bind('scroll', function () { if ($(window).scrollTop() > 200) { if ($flagmenudo != '1ok') { $flagmenudo = '1'; } } else { if ($flagmenudo != '2ok') { $flagmenudo = '2'; } } if ($flagmenudo == '1') { $('.t113').addClass('t113__fixed'); $('.t113').css('display', 'none'); $('.t113').fadeIn('slow'); $('#rec' + recid) .find('.t113__space') .hide(); $flagmenudo = '1ok'; } if ($flagmenudo == '2') { $('.t113').removeClass('t113__fixed'); $('#rec' + recid) .find('.t113__space') .show(); $flagmenudo = '2ok'; } }); var current_path = window.location.pathname.split('/').pop(); if (current_path == 'page' + pageid + '.html') { $('#t113linktopage' + pageid).css('opacity', '.7'); } } function t113_setWidth(recid) { var t113timer; var el = $('#rec' + recid); $(window).resize(function () { if (t113timer) { window.clearTimeout(t113timer); } t113timer = window.setTimeout(function () { if ($(window).width() > 640) { var w1 = el.find('div[data-hook-left]').width() + 20 + 50; el.find('.t113__list').css('padding-right', w1 + 'px'); } else { el.find('.t113__list').css('padding-right', 10 + 'px'); } }, 100); }); $(window).resize(); } function t126_unifyHeights() { $('.t126 .t-container').each(function () { var highestBox = 0; $('.t126__title', this).each(function () { $(this).css('height', 'auto'); if ($(this).height() > highestBox) highestBox = $(this).height(); }); if ($(window).width() >= 960) { $('.t126__title', this).css('height', highestBox); } else { $('.t126__title', this).css('height', 'auto'); } var highestBox = 0; $('.t126__descr', this).each(function () { if ($(this).height() > highestBox) highestBox = $(this).height(); }); if ($(window).width() >= 960) { $('.t126__descr', this).css('height', highestBox); } else { $('.t126__descr', this).css('height', 'auto'); } }); } function t131_unifyHeights() { $('.t131 .t-container').each(function () { var highestBox = 0; $('.t131__title', this).each(function () { if ($(this).height() > highestBox) highestBox = $(this).height(); }); if ($(window).width() >= 960) { $('.t131__title', this).css('height', highestBox); } else { $('.t131__title', this).css('height', 'auto'); } highestBox = 0; $('.t131__descr', this).each(function () { if ($(this).height() > highestBox) highestBox = $(this).height(); }); if ($(window).width() >= 960) { $('.t131__descr', this).css('height', highestBox); } else { $('.t131__descr', this).css('height', 'auto'); } }); } function t132_unifyHeights() { var wrappers = document.querySelectorAll('.t132__box .t132__wrappper'); for (var i = 0; i < wrappers.length; i++) { var wrapper = wrappers[i]; var textWrapper = wrapper.querySelector('a div'); var wrapperWidth = wrapper.offsetWidth - 1; var wrapperHeight = wrapper.offsetHeight - 40; textWrapper.style.width = wrapperWidth + 'px'; textWrapper.style.height = wrapperHeight + 'px'; } } function t214__updateLazyLoad(recid) { var scrollContainer = document.querySelector('#rec' + recid + ' .t214__container_mobile-flex'); var currentMode = document.querySelector('.t-records').getAttribute('data-tilda-mode'); if (scrollContainer && currentMode !== 'edit' && currentMode !== 'preview') { scrollContainer.addEventListener( 'scroll', t_throttle(function () { if ( window.lazy === 'y' || document.getElementById('allrecords').getAttribute('data-tilda-lazy') === 'yes' ) { t_onFuncLoad('t_lazyload_update', function () { t_lazyload_update(); }); } }) ); } } if (!window.yashare2scriptLoaded) { var scriptService = document.createElement('script'); scriptService.src = 'https://yastatic.net/share2/share.js'; scriptService.type = 'text/javascript'; scriptService.charset = 'UTF-8'; //document.documentElement.appendChild(scriptService); window.yashare2scriptLoaded = true; } function t179_init(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var playBtn = rec.querySelector('.t179__playbutton'); var errorScreen = rec.querySelector('.t179__error-screen'); var videoWrap = rec.querySelector('.t179__wrap-video'); playBtn.addEventListener( 'click', function () { playBtn.remove(); videoWrap.style.display = 'block'; if (!errorScreen) { t_onFuncLoad('t_video_lazyload__addVideo', function () { var video = videoWrap.querySelector('.t-video-lazyload'); t_video_lazyload__addVideo(video); }); } }, { once: true } ); } function t190_init(recId) { var rec = document.getElementById('rec' + recId); if (!rec) return; rec.addEventListener('click', function (e) { if (e.target.closest('.t190__button')) { t190_scrollToTop(); } }); } function t190_scrollToTop() { var duration = 700; var start = (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0); var change = 0 - start; var currentTime = 0; var increment = 16; /* same amount of milliseconds as requestAnimationFrame */ document.body.setAttribute('data-scrollable', 'true'); var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); if (isSafari) { t190__animateScrollPolyfill(0); } else { t190__animateScroll(); } /* easeInOutCubic animation included in the library */ function t190__easeInOutCubic(currentTime) { if ((currentTime /= duration / 2) < 1) { return (change / 2) * currentTime * currentTime * currentTime + start; } else { return (change / 2) * ((currentTime -= 2) * currentTime * currentTime + 2) + start; } } function t190__animateScroll() { currentTime += increment; window.scrollTo(0, t190__easeInOutCubic(currentTime)); if (currentTime < duration) { setTimeout(t190__animateScroll, increment); } else { document.body.removeAttribute('data-scrollable'); } } } function t190__animateScrollPolyfill(target) { var documentHeight = Math.max( document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight ); var bottomViewportPoint = documentHeight - document.documentElement.clientHeight; if (target > bottomViewportPoint) target = bottomViewportPoint; if (target === window.pageYOffset) return false; var currentPosition = window.pageYOffset; var step = (target - currentPosition) / 30; var difference = window.pageYOffset; var timerID = setInterval(function () { difference += step; window.scrollTo(0, difference); document.body.setAttribute('data-scrollable', 'true'); if ( (target - currentPosition < 0 && window.pageYOffset <= target) || (target - currentPosition > 0 && window.pageYOffset >= target) ) { clearInterval(timerID); document.body.removeAttribute('data-scrollable'); } }, 10); } function t199_showMenu(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var menuList = rec.querySelectorAll('.t199__js__menu'); var togglerList = rec.querySelectorAll('.t199__js__menu-toggler'); var burger = rec.querySelector('.t-menuburger'); var burgerOpenClass = 't-menuburger-opened'; Array.prototype.forEach.call(menuList, function (menu) { var menuItemList = menu.querySelectorAll('.t199__menu-item'); Array.prototype.forEach.call(menuItemList, function (menuItem) { var href = menuItem.getAttribute('href'); if (href && href.indexOf('#') !== -1 && href.substring(0, 9) !== '#submenu:') { menuItem.addEventListener('click', function () { document.body.classList.remove('t199__is__menu'); }); } }); var menuLinkList = menu.querySelectorAll('.t199__menu-item-wrap .t-menusub__link-item'); Array.prototype.forEach.call(menuLinkList, function (menuLink) { menuLink.addEventListener('click', function () { document.body.classList.remove('t199__is__menu'); }); }); }); Array.prototype.forEach.call(togglerList, function (toggler) { toggler.addEventListener('click', function (e) { e.stopPropagation(); e.preventDefault(); document.body.classList.toggle('t199__is__menu'); burger.classList.contains(burgerOpenClass) ? burger.classList.remove(burgerOpenClass) : burger.classList.add(burgerOpenClass); }); }); document.addEventListener('click', function (e) { if (!e.target.closest('.t199__js__menu') && !e.target.closest('.t-menusub__menu--fullscreen__nav-arrow')) { document.body.classList.remove('t199__is__menu'); } }); var allMenu = document.querySelectorAll('.t199__mmenu'); Array.prototype.forEach.call(allMenu, function (menu) { menu.addEventListener('clickedAnchorInTooltipMenu', function () { document.body.classList.remove('t199__is__menu'); }); }); } function t199_positionHeader(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var header = rec.querySelector('.t199__js__header'); var bgColor = header ? header.style.backgroundColor || window.getComputedStyle(header).backgroundColor : ''; t199_positionHeaderOnScroll(header, bgColor); window.addEventListener('scroll', function () { t199_positionHeaderOnScroll(header, bgColor); }); } function t199_positionHeaderOnScroll(header, bgColor) { if (window.pageYOffset <= 0) { if (header) header.classList.remove('t199__is__active'); if (header) header.style.backgroundColor = bgColor; } else if (header && !header.classList.contains('t199__is__active')) { header.classList.add('t199__is__active'); header.style.backgroundColor = ''; } } function t204_init(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; t_onFuncLoad('t_menuWidgets__init', function () { t_menuWidgets__init(recid); }); var allRec = document.getElementById('allrecords'); var burger = rec.querySelector('.t204__burger'); var menu = rec.querySelector('.t204__menu'); var closeElements = rec.querySelectorAll('.t204__closelayer, .t204__close'); var links = rec.querySelectorAll('.t204__item a'); var isLazy = allRec ? allRec.getAttribute('data-tilda-lazy') === 'yes' : false; if (menu) menu.style.transition = '0.3s ease all'; if (menu) menu.style.opacity = '0'; if (menu) menu.style.right = '-300px'; document.addEventListener('keydown', function (e) { if (e.keyCode === 27) { t204_hideMenu(recid); } }); if (burger) { burger.addEventListener('click', function () { t204_showMenu(recid); if (window.lazy === 'y' || isLazy) { t_onFuncLoad('t_lazyload_update', function () { t_lazyload_update(); }); } }); burger.addEventListener('clickedAnchorInTooltipMenu', function () { t204_hideMenu(recid); }); } Array.prototype.forEach.call(closeElements, function (element) { element.addEventListener('click', function () { t204_hideMenu(recid); }); }); Array.prototype.forEach.call(links, function (link) { link.addEventListener('click', function () { if (link.closest('.t794__tm-link, .t978__tm-link, .t966__tm-link')) return; t204_hideMenu(recid); }); }); } function t204_showMenu(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var menu = rec.querySelector('.t204__menu'); var closeLayer = rec.querySelector('.t204__closelayer'); if (typeof t_triggerEvent === 'function') t_triggerEvent(document.body, 'popupShowed'); document.body.classList.add('t204__body_menushowed'); if (menu) menu.style.visibility = 'visible'; if (menu) menu.style.opacity = '1'; if (menu) menu.style.right = '0'; if (closeLayer) closeLayer.style.visibility = 'visible'; } function t204_hideMenu(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var menu = rec.querySelector('.t204__menu'); var closeLayer = rec.querySelector('.t204__closelayer'); if (typeof t_triggerEvent === 'function') t_triggerEvent(document.body, 'popupHidden'); document.body.classList.remove('t204__body_menushowed'); if (menu) menu.style.visibility = 'hidden'; if (menu) menu.style.opacity = '0'; if (menu) menu.style.right = '-300px'; if (closeLayer) closeLayer.style.visibility = 'hidden'; } /* old function */ function t204_clickBurger(recid) { var allRec = document.getElementById('allrecords'); var burger = document.getElementById('t204__burger'); var closeLayer = document.getElementById('t204__closelayer'); var isLazy = allRec ? allRec.getAttribute('data-tilda-lazy') === 'yes' : false; if (burger && burger.closest('#rec' + recid)) { burger.addEventListener('click', function () { t204_showMenu(recid); if (window.lazy === 'y' || isLazy) { t_onFuncLoad('t_lazyload_update', function () { t_lazyload_update(); }); } }); } if (closeLayer && closeLayer.closest('#rec' + recid)) { closeLayer.addEventListener('click', function () { t204_hideMenu(recid); }); } var menuList = document.querySelectorAll('.t204__burger'); Array.prototype.forEach.call(menuList, function (menu) { menu.addEventListener('clickedAnchorInTooltipMenu', function () { t204_hideMenu(recid); }); }); } function t213_init(recId) { var rec = document.getElementById('rec' + recId); if (!rec) return; var container = document.getElementById('t213-marker' + recId); if (!container) return; var minScreenWidth = rec.getAttribute('data-screen-min'); var maxScreenWidth = rec.getAttribute('data-screen-max'); var windowWidth = window.innerWidth; if (minScreenWidth && windowWidth < parseInt(minScreenWidth, 10)) return; if (maxScreenWidth && windowWidth > parseInt(maxScreenWidth, 10)) return; var timer; var bgColor = container.getAttribute('data-bg-color'); var documentBody = document.body; documentBody.style.transition = 'background-color 1s linear'; if (window.t213higher === undefined) { window.t213higher = 1000000; } var containerOffsetTop = container.getBoundingClientRect().top + window.pageYOffset; if (window.t213higher > containerOffsetTop) { window.t213higher = containerOffsetTop; window.t213higher_id = recId; } var bodyDefBgColor = getComputedStyle(documentBody, null).backgroundColor || ''; var timerCount = 0; function t213__scrollEvent() { if (timer) { window.clearTimeout(timer); if (timerCount >= 15) { t213_timer_do(container, bgColor, bodyDefBgColor, recId); } timerCount++; } timer = window.setTimeout(function () { t213_timer_do(container, bgColor, bodyDefBgColor, recId); timerCount = 0; }, 100); } window.addEventListener('scroll', t213__scrollEvent); t213__scrollEvent(); } function t213_timer_do(container, bgColor, bodyDefBgColor, recId) { var top = container.getBoundingClientRect().top + window.pageYOffset; var scrollTop = window.pageYOffset; var windowHeight = window.innerHeight; var documentBody = document.body; if (scrollTop + windowHeight >= top) { documentBody.style.backgroundColor = bgColor; } else if (window.t213higher_id == recId) { documentBody.style.backgroundColor = bodyDefBgColor; } } function t219_showcomments(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var disqusButton = rec.querySelector('.t-btn'); var disqusTitle = rec.querySelector('.t219__blocktitle'); if (disqusButton) disqusButton.style.display = 'none'; if (disqusTitle) disqusTitle.style.display = 'block'; var disqusDataShortname = rec.querySelector('.t219__disqusthread'); if (!disqusDataShortname) return; var disqusShortname = disqusDataShortname.getAttribute('data-disqus-shortname'); var disqus = document.createElement('script'); disqus.type = 'text/javascript'; disqus.async = true; if (disqusShortname.indexOf('.disqus.com') !== -1) { disqus.src = '//' + disqusShortname + '/embed.js'; } else { disqus.src = '//' + disqusShortname + '.disqus.com/embed.js'; } (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(disqus); } function t223_initThumbnail(rec) { t_onFuncLoad('t223_setThumbnailHeight', function () { t223_setThumbnailHeight(rec); }); t_onFuncLoad('t223_setThumbnail', function () { t223_setThumbnail(rec); }); t_onFuncLoad('t223_setYouTubeIframeHeight', function () { t223_setYouTubeIframeHeight(rec); }); } function t223_setThumbnail(rec) { var thumbnails = rec.querySelectorAll('.t223__video-thumbnail'); if (!thumbnails.length) return; Array.prototype.forEach.call(thumbnails, function (thumbnail) { var blockTop = thumbnail.getBoundingClientRect().top; var windowHeight = document.documentElement.clientHeight; var scrollDiffHeigth = 400; if (window.pageYOffset > blockTop - windowHeight - scrollDiffHeigth) { var youTubeID = thumbnail.getAttribute('data-youtube-id').trim(); thumbnail.style.backgroundImage = 'url("https://img.youtube.com/vi/' + youTubeID + '/sddefault.jpg")'; thumbnail.addEventListener('click', function (event) { event.preventDefault(); var youTubeWrapper = thumbnail.parentNode; var youTubeIframe = ''; thumbnail.innerHTML = youTubeIframe; t223_setYouTubeIframeHeight(rec); }); } }); } function t223_setThumbnailHeight(rec) { var thumbnail = rec.querySelectorAll('.t223__video-thumbnail'); if (!thumbnail.length) return; Array.prototype.forEach.call(thumbnail, function (image) { var imageWidth = image.offsetWidth; var computedHeight = imageWidth / (16 / 9); image.style.height = computedHeight + 'px'; }); } function t223_setYouTubeIframeHeight(rec) { var youTubeIframes = rec.querySelectorAll('iframe'); if (!youTubeIframes.length) return; Array.prototype.forEach.call(youTubeIframes, function (youTubeIframe) { var iframeParent = youTubeIframe.parentNode; var iframeParentWidth = iframeParent.offsetWidth; var computedHeight = iframeParentWidth / (16 / 9); youTubeIframe.height = computedHeight; }); } /** * Wrapper for @t226_floating_inner_init function. * SetTimeout is needed to wait while other scripts are being executed. * When the event loop reaches @t226_floating_init, a check will take place: is it a block with text or an image? * If there is an image, we need to wait again while image has been loaded. * If there is a text, run the function immediately. * But we need second SetTimeout for case when an image will load faster than text. * * To remove this wrapper, need to call function from HTML not on ready() but on window.onload */ function t226_floating_init(elementOnInput) { setTimeout(function () { var element = elementOnInput[0] ? elementOnInput[0] : elementOnInput; var image = element.querySelector('img'); if (image) { image.onload = function () { t226_floating_inner_init(element); }; } else { t226_floating_inner_init(element); } }, 100); } function t226_floating_inner_init(element) { setTimeout(function () { var localWindow = window; var column = element.parentNode; var elementDimensions = t226_getElementDimension(element); element.style.maxWidth = elementDimensions.width + 'px'; element.style.width = '100%'; column.style.minHeight = elementDimensions.height + 'px'; var timer; var timerCount = 0; var timerReact = 5; localWindow.addEventListener('scroll', function () { if (timer) { window.clearTimeout(timer); if (timerCount >= timerReact) { t226_floating_scroll(element, localWindow, column); timerCount = 0; } timerCount++; } timer = window.setTimeout(function () { t226_floating_scroll(element, localWindow, column); timerCount = 0; }, 50); }); localWindow.addEventListener('resize', function () { localWindow.dispatchEvent(new CustomEvent('scroll')); }); localWindow.dispatchEvent(new CustomEvent('scroll')); }, 100); } function t226_floating_scroll(element, localWindow, column) { var windowWidth = localWindow.innerWidth; var elementDimensions = t226_getElementDimension(element); var columnDimensions = t226_getElementDimension(column); if (windowWidth <= 1024) { element.classList.remove('t226__fixedTop'); element.classList.remove('t226__fixedBottom'); element.classList.remove('t226__floating'); return ''; } element.style.maxWidth = columnDimensions.width + 'px'; if (columnDimensions.height < elementDimensions.height && columnDimensions.height > 0) { column.style.height = element.style.height; } var elementHeight = elementDimensions.height; var columnTop = column.getBoundingClientRect().top + window.pageYOffset; var columnHeight = columnDimensions.height; var columnBottom = columnTop + columnHeight; var windowTop = localWindow.pageYOffset; if (windowTop + elementHeight + 50 >= columnBottom) { element.classList.add('t226__fixedBottom'); element.classList.remove('t226__fixedTop'); element.classList.remove('t226__floating'); } else if (windowTop + 50 > columnTop) { element.classList.add('t226__floating'); element.classList.remove('t226__fixedBottom'); element.classList.remove('t226__fixedTop'); } else { element.classList.add('t226__fixedTop'); element.classList.remove('t226__fixedBottom'); element.classList.remove('t226__floating'); } } function t226_getElementDimension(element) { return { height: Math.round(parseFloat(getComputedStyle(element).height.replace('px', ''), 10)), width: Math.round(parseFloat(getComputedStyle(element).width.replace('px', ''), 10)), }; } function t228__init(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var menuBlock = rec.querySelector('.t228'); var mobileMenu = rec.querySelector('.t228__mobile'); var menuSubLinkItems = rec.querySelectorAll('.t-menusub__link-item'); var rightBtn = rec.querySelector('.t228__right_buttons_but .t-btn'); var mobileMenuPosition = mobileMenu ? mobileMenu.style.position || window.getComputedStyle(mobileMenu).position : ''; var mobileMenuDisplay = mobileMenu ? mobileMenu.style.display || window.getComputedStyle(mobileMenu).display : ''; var isFixedMobileMenu = mobileMenuPosition === 'fixed' && mobileMenuDisplay === 'block'; var overflowEvent = document.createEvent('Event'); var noOverflowEvent = document.createEvent('Event'); overflowEvent.initEvent('t228_overflow', true, true); noOverflowEvent.initEvent('t228_nooverflow', true, true); if (menuBlock) { menuBlock.addEventListener('t228_overflow', function () { t228_checkOverflow(recid); }); menuBlock.addEventListener('t228_nooverflow', function () { t228_checkNoOverflow(recid); }); } rec.addEventListener('click', function (e) { var targetLink = e.target.closest('.t-menusub__target-link'); if (targetLink && window.isMobile && window.innerWidth <= 980) { if (targetLink.classList.contains('t-menusub__target-link_active')) { if (menuBlock) menuBlock.dispatchEvent(overflowEvent); } else { if (menuBlock) menuBlock.dispatchEvent(noOverflowEvent); } } var currentLink = e.target.closest( '.t-menu__link-item:not(.tooltipstered):not(.t-menusub__target-link):not(.t794__tm-link):not(.t966__tm-link):not(.t978__tm-link):not(.t978__menu-link)' ); if (currentLink && mobileMenu && isFixedMobileMenu) mobileMenu.click(); }); Array.prototype.forEach.call(menuSubLinkItems, function (linkItem) { linkItem.addEventListener('click', function () { if (mobileMenu && isFixedMobileMenu) mobileMenu.click(); }); }); if (rightBtn) { rightBtn.addEventListener('click', function () { if (mobileMenu && isFixedMobileMenu) mobileMenu.click(); }); } if (menuBlock) { menuBlock.addEventListener('showME601a', function () { var menuLinks = rec.querySelectorAll('.t966__menu-link'); Array.prototype.forEach.call(menuLinks, function (menuLink) { menuLink.addEventListener('click', function () { if (mobileMenu && isFixedMobileMenu) mobileMenu.click(); }); }); }); } t_onFuncLoad('t_throttle', function () { var onResizeThrottled = t_throttle(function () { t228_setWidth(recid); }, 50); window.addEventListener('resize', onResizeThrottled); }); } function t228_checkOverflow(recid) { var rec = document.getElementById('rec' + recid); var menu = rec ? rec.querySelector('.t228') : null; if (!menu) return; var mobileContainer = document.querySelector('.t228__mobile_container'); var mobileContainerHeight = t228_getFullHeight(mobileContainer); var windowHeight = document.documentElement.clientHeight; var menuPosition = menu.style.position || window.getComputedStyle(menu).position; if (menuPosition === 'fixed') { menu.classList.add('t228__overflow'); menu.style.setProperty('height', windowHeight - mobileContainerHeight + 'px', 'important'); } } function t228_checkNoOverflow(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return false; var menu = rec.querySelector('.t228'); var menuPosition = menu ? menu.style.position || window.getComputedStyle(menu).position : ''; if (menuPosition === 'fixed') { if (menu) menu.classList.remove('t228__overflow'); if (menu) menu.style.height = 'auto'; } } function t228_setWidth(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var menuCenterSideList = rec.querySelectorAll('.t228__centerside'); Array.prototype.forEach.call(menuCenterSideList, function (menuCenterSide) { menuCenterSide.classList.remove('t228__centerside_hidden'); }); if (window.innerWidth <= 980) return; var menuBlocks = rec.querySelectorAll('.t228'); Array.prototype.forEach.call(menuBlocks, function (menu) { var maxWidth; var centerWidth = 0; var paddingWidth = 40; var leftSide = menu.querySelector('.t228__leftside'); var rightSide = menu.querySelector('.t228__rightside'); var menuList = menu.querySelector('.t228__list'); var mainContainer = menu.querySelector('.t228__maincontainer'); var leftContainer = menu.querySelector('.t228__leftcontainer'); var rightContainer = menu.querySelector('.t228__rightcontainer'); var centerContainer = menu.querySelector('.t228__centercontainer'); var centerContainerLi = centerContainer ? centerContainer.querySelectorAll('li') : []; var leftContainerWidth = t228_getFullWidth(leftContainer); var rightContainerWidth = t228_getFullWidth(rightContainer); var mainContainerWidth = mainContainer ? mainContainer.offsetWidth : 0; var dataAlign = menu.getAttribute('data-menu-items-align'); var isDataAlignCenter = dataAlign === 'center' || dataAlign === null; maxWidth = leftContainerWidth >= rightContainerWidth ? leftContainerWidth : rightContainerWidth; maxWidth = Math.ceil(maxWidth); Array.prototype.forEach.call(centerContainerLi, function (li) { centerWidth += t228_getFullWidth(li); }); leftSide.style.minWidth = ''; rightSide.style.minWidth = ''; if (mainContainerWidth - (maxWidth * 2 + paddingWidth * 2) > centerWidth + 20) { if (isDataAlignCenter) { if (leftSide) leftSide.style.minWidth = maxWidth + 'px'; if (rightSide) rightSide.style.minWidth = maxWidth + 'px'; } } else { if (leftSide) leftSide.style.minWidth = maxWidth + ''; if (rightSide) rightSide.style.minWidth = maxWidth + ''; } if (menuList && menuList.classList.contains('t228__list_hidden')) menuList.classList.remove('t228__list_hidden'); }); } function t228_getFullWidth(el) { if (!el) return 0; var marginLeft = el.style.marginLeft || window.getComputedStyle(el).marginLeft; var marginRight = el.style.marginRight || window.getComputedStyle(el).marginRight; marginLeft = parseInt(marginLeft, 10) || 0; marginRight = parseInt(marginRight, 10) || 0; return el.offsetWidth + marginLeft + marginRight; } function t228_getFullHeight(el) { if (!el) return 0; var marginTop = el.style.marginTop || window.getComputedStyle(el).marginTop; var marginBottom = el.style.marginBottom || window.getComputedStyle(el).marginBottom; marginTop = parseInt(marginTop, 10) || 0; marginBottom = parseInt(marginBottom, 10) || 0; return el.offsetHeight + marginTop + marginBottom; } function t230_init(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var wrapperBlock = rec.querySelector('.t230'); var videoLazy = rec.querySelector('.t-video-lazyload'); if (videoLazy) { t_onFuncLoad('t_video_lazyload__setHeight', function () { t_video_lazyload__setHeight(videoLazy); window.addEventListener('resize', function () { t_video_lazyload__setHeight(videoLazy); }); if (!wrapperBlock) return; wrapperBlock.addEventListener('displayChanged', function () { t_video_lazyload__setHeight(videoLazy); }); }); } } function t235__next() { var cur = parseInt($('.t235').attr('data-slide-count'), 10); var event = document.createEvent('Event'); event.initEvent('displayChanged', true, true); if (cur + 1 >= $('.r').not('[data-t263-block-notslide=yes]').size()) return; cur++; $('.r') .not('[data-t263-block-notslide=yes]') .each(function (i) { if (cur - 1 == i) { var el = $(this); var trans_out_y = '-100px'; if (el.height() + 100 > $(window).height()) trans_out_y = '0px'; el.transition( { y: trans_out_y, opacity: 0, }, 250, 'out', function () { el.css('display', 'none'); } ); } if (cur == i) { var el = $(this); el.css('display', 'none'); var trans_in_y = '50px'; if (el.height() + 100 > $(window).height()) trans_in_y = '0px'; el.transition( { y: trans_in_y, }, 1, 'ease', function () {} ); el.animate( { opacity: '0', }, 300, function () { el.css('display', 'block'); el.css('opacity', '0'); el.transition( { y: '0px', opacity: 1, }, 500, 'ease', function () {} ); $('.r').removeClass('t235__active'); el.addClass('t235__active'); var els = document.querySelectorAll( '.t117, .t121, .t132, .t223, .t226, .t228, .t229, .t230, .t268, .t279, .t341, .t346, .t347, .t349, .t351, .t353, .t384, .t385, .t386, .t396, .t400, .t404, .t409, .t410, .t412, .t418, .t422, .t425, .t428, .t433, .t448, .t456, .t477, .t478, .t480, .t486, .t498, .t504, .t506, .t509, .t511, .t517, .t518, .t519, .t520, .t532, .t533, .t538, .t539, .t544, .t545, .t552, .t554, .t569, .t570, .t577, .t592, .t598, .t599, .t601, .t604, .t605, .t609, .t615, .t616, .t650, .t659, .t670, .t675, .t686, .t688, .t694, .t698, .t700, .t726, .t728, .t730, .t734, .t738, .t740, .t744, .t754, .t760, .t762, .t764, .t774, .t776, .t778, .t780, .t786, .t798, .t799, .t801, .t813, .t814, .t822, .t826, .t827, .t829, .t842, .t843, .t849, .t850, .t851, .t856, .t858, .t859, .t860, .t881, .t889, .t902, .t912, .t923, .t937, .t959, .t979, .t982, .t983, .t989, .t994, .t1069, .t1071' ); Array.prototype.forEach.call(els, function (child) { child.dispatchEvent(event); }); if (window.lazy === 'y' || $('#allrecords').attr('data-tilda-lazy') === 'yes') { t_onFuncLoad('t_lazyload_update', function () { t_lazyload_update(); }); } } ); if (el.height() > $(window).height()) { $('#t235__scrldonwicon').fadeIn('slow', function () { $('#t235__scrldonwicon').delay(1000).fadeOut('slow'); }); } var bg = el.attr('data-bg-color'); if (bg !== undefined && bg !== 'none') { $('#allrecordstable').css('background-color', bg); } else { $('#allrecordstable').css('background-color', ''); } } }); $('.t235').attr('data-slide-count', cur); t235__update(); } function t235__prev() { var cur = parseInt($('.t235').attr('data-slide-count'), 10); var event = document.createEvent('Event'); event.initEvent('displayChanged', true, true); if (cur - 1 == -1) return; cur--; $('.r') .not('[data-t263-block-notslide=yes]') .each(function (i) { if (cur + 1 == i) { var el = $(this); el.css('display', 'none'); } if (cur == i) { var el = $(this); el.css('display', 'block'); el.css('opacity', '0'); el.transition( { y: '0px', }, 1, 'easeOutSine' ); el.animate( { opacity: '1', }, 50, function () {} ); $('.r').removeClass('t235__active'); el.addClass('t235__active'); var bg = el.attr('data-bg-color'); if (bg !== undefined && bg !== 'none') { $('#allrecordstable').css('background-color', bg); } else { $('#allrecordstable').css('background-color', ''); } var els = document.querySelectorAll( '.t117, .t121, .t132, .t223, .t226, .t228, .t229, .t230, .t268, .t279, .t341, .t346, .t347, .t349, .t351, .t353, .t384, .t385, .t386, .t396, .t400, .t404, .t409, .t410, .t412, .t418, .t422, .t425, .t428, .t433, .t448, .t456, .t477, .t478, .t480, .t486, .t498, .t504, .t506, .t509, .t511, .t517, .t518, .t519, .t520, .t532, .t533, .t538, .t539, .t544, .t545, .t552, .t554, .t569, .t570, .t577, .t592, .t598, .t599, .t601, .t604, .t605, .t609, .t615, .t616, .t650, .t659, .t670, .t675, .t686, .t688, .t694, .t698, .t700, .t726, .t728, .t730, .t734, .t738, .t740, .t744, .t754, .t760, .t762, .t764, .t774, .t776, .t778, .t780, .t786, .t798, .t799, .t801, .t813, .t814, .t822, .t826, .t827, .t829, .t842, .t843, .t849, .t850, .t851, .t856, .t858, .t859, .t860, .t881, .t889, .t902, .t912, .t923, .t937, .t959, .t979, .t982, .t983, .t989, .t994, .t1071' ); Array.prototype.forEach.call(els, function (child) { child.dispatchEvent(event); }); } }); $('.t235').attr('data-slide-count', cur); t235__update(); } function t235__galnext() { var elactive = $('.t235__active'); var tplid = elactive.attr('data-record-type'); if (tplid == '5') elactive.find('[data-slide=next]').trigger('click'); } function t235__update() { var cur = parseInt($('.t235').attr('data-slide-count'), 10); var c = cur + 1; var t = $('.r').not('[data-t263-block-notslide=yes]').size(); $('.t235__count').html(c + '/' + t); if (window.lazy === 'y' || $('#allrecords').attr('data-tilda-lazy') === 'yes') { t_onFuncLoad('t_lazyload_update', function () { t_lazyload_update(); }); } } function t235__init() { $('#allrecords').wrap( "
" ); $('#allrecords').css('width', $(window).width() + 'px'); var wnd = $(window); $('.r') .not('[data-t263-block-notslide=yes]') .each(function () { var el = $(this); el.css('padding', '0px'); if (el.height() > wnd.height() && el.find('.t396__artboard_scale').length === 0) { el.css('padding-top', '150px'); el.css('padding-bottom', '150px'); } el.css('display', 'none'); el.css('opacity', ''); el.css('background-color', ''); }); $(window).on('resize', function () { $('#allrecords').css('width', $(window).width() + 'px'); }); var cur = -1; var slideCount = $('.t235').attr('data-slide-count'); if (typeof slideCount !== 'undefined') { cur = parseInt(slideCount, 10); } else { $('.t235').attr('data-slide-count', cur); } if (!isNaN(cur)) { $('.t235') .find('.t235__next') .on('click', function () { t235__next(); }); $('.t235') .find('.t235__prev') .on('click', function () { t235__prev(); }); t235__next(); $('#tildacopy').css('display', 'none'); $('.t235').css('right', '-=100'); setTimeout(function () { $('.t235').addClass('t235_anim'); $('.t235').css('right', '+=100'); }, 800); $(document).keydown(function (e) { switch (e.which) { case 38: t235__prev(); break; case 40: t235__next(); break; case 33: t235__prev(); break; case 34: t235__next(); break; case 32: t235__next(); break; case 190: t235__galnext(); break; default: return; } if (e.which != 190) { e.preventDefault(); } }); } $('#allrecordstable').css('transition', 'background-color 500ms linear'); $('.t-cover__carrier').css('background-attachment', 'scroll'); } function t232_expandtext(recId) { var rec = document.getElementById('rec' + recId); if (!rec) return; var text = rec.querySelector('.t232__text'); if (!text) return; if (text.style.display === 'block' || !text.style.display) { text.style.display = 'none'; } else { text.style.display = 'block'; } } window.requestAnimationFrame = (function () { return ( window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60); } ); })(); function t270_scroll(hash, offset) { if (!hash) return; t270_checkLoad(hash, offset); var excludeHashes = ['#!/tproduct/', '#!/tab/', '#opencart']; if (excludeHashes.includes(hash)) { return true; } var isHistoryChangeAllowed = window.location.hash !== hash; var wrapperBlock = document.querySelector('.t270'); var dontChangeHistory = wrapperBlock ? Boolean(wrapperBlock.getAttribute('data-history-disabled')) : false; t270_scrollToEl(hash, offset); if (!dontChangeHistory && isHistoryChangeAllowed) { if (history.pushState) { history.pushState(null, null, hash); } else { window.location.hash = hash; } isHistoryChangeAllowed = false; } return true; } function t270_checkLoad(hash, offset) { if (window.t270_loadChecked) return; var sliderWrappers = document.body.querySelectorAll('.t-slds__items-wrapper'); if (!sliderWrappers.length) return; var lastWrapper = sliderWrappers[sliderWrappers.length - 1]; var sliderImgs = lastWrapper ? lastWrapper.querySelectorAll('.t-slds__bgimg') : []; var lastImg = sliderImgs[sliderImgs.length - 1]; var imageUrl = lastImg ? window.getComputedStyle(lastImg).backgroundImage : ''; imageUrl = imageUrl.substring(5, imageUrl.length - 2); var preloaderImg = document.createElement('img'); preloaderImg.src = imageUrl ? imageUrl : ''; preloaderImg.addEventListener('load', function () { t270_scroll(hash, offset); window.t270_loadChecked = true; }); } function t270_scrollToEl(hash, offset) { var SCROLL_DURATION_MS = 500; var body = document.body; if (body.getAttribute('data-scroll')) return; var scrollTargetY = t270_getTarget(hash, offset); if (isNaN(scrollTargetY)) return; var canSmoothScroll = window.CSS && window.CSS.supports('scroll-behavior', 'smooth') && 'scrollBehavior' in document.documentElement.style; // На андройде не всегда срабатывает скролл на мобильных устройствах. // Если скролл происходит через раскрытое на фулскрин меню, то скролл не сработает. // Поэтому нам нужно использовать кастомную реализацию плавного скролла на андройд. var userAgent = navigator.userAgent.toLowerCase(); var isAndroid = userAgent.indexOf('android') !== -1; if (window.isMobile && !isAndroid && canSmoothScroll) { body.setAttribute('data-scroll', 'true'); window.scrollTo({ left: 0, top: scrollTargetY, behavior: 'smooth', }); setTimeout(function () { body.removeAttribute('data-scroll'); }, SCROLL_DURATION_MS); } else { t270_smoothScrollTo(scrollTargetY, SCROLL_DURATION_MS); } } function t270_smoothScrollTo(targetY, duration = 500) { var body = document.body; var startY = window.scrollY || window.pageYOffset; var deltaY = targetY - startY; var startTime = performance.now(); function easeInOutQuad(t) { return Math.pow(t, 2); } function scroll() { var currentTime = performance.now(); var elapsedTime = Math.min((currentTime - startTime) / duration, 1); var ease = easeInOutQuad(elapsedTime); window.scrollTo(0, startY + deltaY * ease); if (elapsedTime < 1) { requestAnimationFrame(scroll); } else { body.removeAttribute('data-scroll'); body.removeAttribute('data-scrollable'); window.scrollTo(0, targetY); } } body.setAttribute('data-scroll', 'true'); body.setAttribute('data-scrollable', 'true'); requestAnimationFrame(scroll); } function t270_getTarget(hash, offset) { var target; try { if (hash.substring(0, 1) === '#') { target = document.getElementById(hash.substring(1)); } else { target = document.querySelector(hash); } } catch (event) { console.log('Exception t270: ' + event.message); return; } if (!target) { target = document.querySelector('a[name="' + hash.substr(1) + '"], div[id="' + hash.substr(1) + '"]'); if (!target) return; } target = parseInt(target.getBoundingClientRect().top + window.pageYOffset - offset, 10); target = Math.max(target, 0); return target; } window.t256showvideo = function (recid) { if (document.readyState !== 'loading') { t256_showVideo(recid); } else { document.addEventListener('DOMContentLoaded', function () { t256_showVideo(recid); }); } function t256_showVideo(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var videoContainer = rec.querySelector('.t256__video-container'); var videoCover = rec.querySelector('.t256__cover'); var videoCarrierYouTube = rec.querySelector('.t256__video-carier'); var videoCarrierVimeo = rec.querySelector('.t256__video-vimeo'); var videoCarrierHTML5 = rec.querySelector('.t256__video-html5'); if (videoCarrierYouTube) { var youTubeID = videoContainer ? videoContainer.getAttribute('data-content-popup-video-url-youtube') : ''; if (!youTubeID) return; var youTubeURL = youTubeID ? 'https://www.youtube.com/embed/' + youTubeID : ''; t256_toggleClasses(videoCover, videoContainer); videoCarrierYouTube.innerHTML = ''; } if (videoCarrierVimeo) { var vimeoID = videoContainer ? videoContainer.getAttribute('data-content-popup-video-url-vimeo') : ''; if (!vimeoID) return; var vimeoPrivacyHash = videoContainer ? videoContainer.getAttribute('data-content-popup-video-hash-vimeo') : ''; var vimeoURL = ''; if (vimeoPrivacyHash) { vimeoURL = vimeoID ? 'https://player.vimeo.com/video/' + vimeoID + '?' + vimeoPrivacyHash + '&autoplay=1' : ''; } else { vimeoURL = vimeoID ? 'https://player.vimeo.com/video/' + vimeoID + '?autoplay=1' : ''; } t256_toggleClasses(videoCover, videoContainer); videoCarrierVimeo.innerHTML = '' + ''; } if (videoCarrierHTML5) { var html5URL = videoContainer.getAttribute('data-content-popup-video-url-html5'); if (!html5URL) return; t256_toggleClasses(videoCover, videoContainer); videoCarrierHTML5.innerHTML = '' + '' + '' + ''; } } function t256_toggleClasses(videoCover, videoContainer) { document.body.classList.add('t256__overflow'); if (videoCover) videoCover.classList.add('t256__hidden'); if (videoContainer) videoContainer.classList.remove('t256__hidden'); } }; window.t256hidevideo = function (recid) { if (document.readyState !== 'loading') { t256_hideVideo(recid); } else { document.addEventListener('DOMContentLoaded', function () { t256_hideVideo(recid); }); } function t256_hideVideo(recid) { var rec = document.getElementById('rec' + recid); if (!rec) return; var videoContainer = rec.querySelector('.t256__video-container'); var videoCover = rec.querySelector('.t256__cover'); var videoCarrier = rec.querySelector('.t256__video-carier') || rec.querySelector('.t256__video-vimeo') || rec.querySelector('.t256__video-html5'); document.body.classList.remove('t256__overflow'); if (videoCover) videoCover.classList.remove('t256__hidden'); if (videoContainer) videoContainer.classList.add('t256__hidden'); if (videoCarrier) videoCarrier.innerHTML = '
'; } }; function t260_init() { $('.t260').each(function () { var el = $(this); if (el.attr('data-block-init') == 'yes') { } else { el.attr('data-block-init', 'yes'); var toggler = el.find('.t260__header'); var content = el.find('.t260__content'); toggler.click(function () { $(this).toggleClass('t260__opened'); if ($(this).hasClass('t260__opened') == true) { content.slideDown(); } else { content.slideUp(); } }); } }); } function t262_appendGoogleMap(recid, key) { var grecid = recid; if (typeof google === 'object' && typeof google.maps === 'object') { t262_handleGoogleApiReady(grecid); } else { if (window.googleapiiscalled !== true) { var runfunc = 'window.t262_handleGoogleApiReady_' + grecid + ' = function () { t262_handleGoogleApiReady("' + grecid + '") }'; eval(runfunc); var script = document.createElement('script'); script.type = 'text/javascript'; script.src = '//maps.google.com/maps/api/js?key=' + jQuery.trim(key) + '&callback=t262_handleGoogleApiReady_' + grecid; document.body.appendChild(script); window.googleapiiscalled = true; } else { setTimeout(function () { t262_appendGoogleMap(grecid, key); }, 200); } } } function t262_setMapHeight(recid) { var el = $('#rec' + recid); var map = el.find('.t262__map'); var textwrapper = el.find('.t262__col_text').height(); map.css('height', textwrapper); } function t262_handleGoogleApiReady(recid) { $('#rec' + recid) .find('.t262__map') .each(function (index, Element) { var el = $(Element); var arMarkers = window['arMapMarkers' + recid]; window.isDragMap = $isMobile ? false : true; var myLatLng = arMarkers.length > 0 ? new google.maps.LatLng(parseFloat(arMarkers[0].lat), parseFloat(arMarkers[0].lng)) : false; var myOptions = { zoom: parseInt(el.attr('data-map-zoom')), center: myLatLng, scrollwheel: false, draggable: window.isDragMap, zoomControl: true, }; var map = new google.maps.Map(Element, myOptions); var i; var mrk; var marker; var markers = []; var infowindow; var bounds = new google.maps.LatLngBounds(); for (i in arMarkers) { mrk = arMarkers[i]; myLatLng = new google.maps.LatLng(parseFloat(mrk.lat), parseFloat(mrk.lng)); marker = new google.maps.Marker({ position: myLatLng, map: map, title: mrk.title, }); bounds.extend(myLatLng); if (mrk.descr > '') { attachInfoMessage(marker, mrk.descr); } else { attachInfoMessage(marker, mrk.title); } markers[markers.length] = marker; infowindow = ''; marker = ''; } function attachInfoMessage(marker, descr) { var infowindow = new google.maps.InfoWindow({ content: $('