wip
This commit is contained in:
50
js/tilda-blocks-page32755375.min.js
vendored
Normal file
50
js/tilda-blocks-page32755375.min.js
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
window.isMobile=!1;if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){window.isMobile=!0}
|
||||
function t450_showMenu(recid){var rec=document.getElementById('rec'+recid);if(!rec)return;var menu=rec.querySelector('.t450');var overlay=rec.querySelector('.t450__overlay');var menuElements=rec.querySelectorAll('.t450__overlay, .t450__close, a[href*="#"]');if(typeof t_triggerEvent==='function')t_triggerEvent(document.body,'popupShowed');document.body.classList.add('t450__body_menushowed');if(menu)menu.classList.add('t450__menu_show');if(overlay)overlay.classList.add('t450__menu_show');if(menu){menu.addEventListener('clickedAnchorInTooltipMenu',function(){t450_closeMenu(menu,overlay)})}
|
||||
Array.prototype.forEach.call(menuElements,function(element){element.addEventListener('click',function(){if(element.closest('.tooltipstered, .t-menusub__target-link, .t794__tm-link, .t966__tm-link, .t978__tm-link'))
|
||||
return;if(element.href&&(element.href.substring(0,7)==='#price:'||element.href.substring(0,9)==='#submenu:'))
|
||||
return;t450_closeMenu(menu,overlay)})});document.addEventListener('keydown',function(e){if(e.keyCode===27){document.body.classList.remove('t390__body_popupshowed');var popups=document.querySelectorAll('.t390');Array.prototype.forEach.call(popups,function(popup){popup.classList.remove('t390__popup_show')})}});rec.addEventListener('click',function(e){if(e.target.closest('.t966__tm-link, .t978__tm-link, .t-menusub__target-link')){t450_checkSize(recid);if(e.target.closest('.t978__tm-link')){setTimeout(function(){var hookLink=e.target.closest('.t978__tm-link');var menuBlock=hookLink.nextElementSibling;var submenuLinks=menuBlock?menuBlock.querySelectorAll('.t978__menu-link'):[];Array.prototype.forEach.call(submenuLinks,function(link){link.addEventListener('click',function(){t450_checkSize(recid)})})},300)}}});menu.addEventListener('menuOverflow',function(){t450_checkSize(recid)});t450_highlight(recid)}
|
||||
function t450_closeMenu(menu,overlay){if(typeof t_triggerEvent==='function')t_triggerEvent(document.body,'popupHidden');document.body.classList.remove('t450__body_menushowed');if(menu)menu.classList.remove('t450__menu_show');if(overlay)overlay.classList.remove('t450__menu_show')}
|
||||
function t450_checkSize(recid){var rec=document.getElementById('rec'+recid);var menu=rec?rec.querySelector('.t450'):null;if(!menu)return;var container=menu.querySelector('.t450__container');var topContainer=menu.querySelector('.t450__top');var rightContainer=menu.querySelector('.t450__rightside');setTimeout(function(){var topContainerHeight=topContainer?topContainer.offsetHeight:0;var rightContainerHeight=rightContainer?rightContainer.offsetHeight:0;var containerPaddingTop=container?window.getComputedStyle(container).paddingTop:'0';var containerPaddingBottom=container?window.getComputedStyle(container).paddingBottom:'0';containerPaddingTop=parseInt(containerPaddingTop,10);containerPaddingBottom=parseInt(containerPaddingBottom,10);if(topContainerHeight+rightContainerHeight+containerPaddingTop+containerPaddingBottom>document.documentElement.clientHeight){menu.classList.add('t450__overflowed')}else{menu.classList.remove('t450__overflowed')}},300)}
|
||||
function t450_appearMenu(recid){var rec=document.getElementById('rec'+recid);var burger=rec?rec.querySelector('.t450__menu__content'):null;if(!burger)return;var burgerAppearOffset=burger?burger.getAttribute('data-appearoffset'):'';var burgerHideOffset=burger?burger.getAttribute('data-hideoffset'):'';if(burgerAppearOffset){burgerAppearOffset=t450_appearMenuParseNumber(burgerAppearOffset);if(window.pageYOffset>=burgerAppearOffset){if(burger.classList.contains('t450__beforeready')){burger.classList.remove('t450__beforeready')}}else{burger.classList.add('t450__beforeready')}}
|
||||
if(burgerHideOffset){burgerHideOffset=t450_appearMenuParseNumber(burgerHideOffset);var scrollHeight=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight);if(window.pageYOffset+window.innerHeight>=scrollHeight-burgerHideOffset){if(!burger.classList.contains('t450__beforeready')){burger.classList.add('t450__beforeready')}}else if(burgerAppearOffset){if(window.pageYOffset>=burgerAppearOffset){burger.classList.remove('t450__beforeready')}}else{burger.classList.remove('t450__beforeready')}}}
|
||||
function t450_appearMenuParseNumber(string){if(string.indexOf('vh')>-1){string=Math.floor(window.innerHeight*(parseInt(string)/100))}
|
||||
return parseInt(string,10)}
|
||||
function t450_initMenu(recid){var rec=document.getElementById('rec'+recid);var menu=rec?rec.querySelector('.t450'):null;var overlay=rec?rec.querySelector('.t450__overlay'):null;var burger=rec?rec.querySelector('.t450__burger_container'):null;var menuLinks=rec?rec.querySelectorAll('.t-menu__link-item.t450__link-item_submenu'):[];var hook=menu?menu.getAttribute('data-tooltip-hook'):'';if(hook){document.addEventListener('click',function(e){if(e.target.closest('a[href="'+hook+'"]')){e.preventDefault();t450_closeMenu(menu,overlay);t450_showMenu(recid);t450_checkSize(recid)}})}
|
||||
if(burger){burger.addEventListener('click',function(){t450_closeMenu(menu,overlay);t450_showMenu(recid);t450_checkSize(recid)})}
|
||||
window.addEventListener('resize',function(){t450_checkSize(recid)});if(!window.isMobile)return;Array.prototype.forEach.call(menuLinks,function(link){link.addEventListener('click',function(){t450_checkSize(recid)})})}
|
||||
function t450_highlight(recid){var url=window.location.href;var pathname=window.location.pathname;var hash=window.location.hash;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='/'}
|
||||
var shouldBeActiveElements=document.querySelectorAll(".t450__menu a[href='"+url+"'], "+".t450__menu a[href='"+url+"/'], "+".t450__menu a[href='"+pathname+"'], "+".t450__menu a[href='/"+pathname+"'], "+".t450__menu a[href='"+pathname+"/'], "+".t450__menu a[href='/"+pathname+"/']"+(hash?", .t450__menu a[href='"+hash+"']":'')+(hash&&pathname==='/'?", .t450__menu a[href='/"+hash+"']":'')+(hash&&pathname!=='/'?", .t450__menu a[href='/"+pathname+hash+"'], .t450__menu a[href='"+pathname+hash+"']":''));var rec=document.getElementById('rec'+recid);var menuLinks=rec?rec.querySelectorAll('.t450__menu a'):[];Array.prototype.forEach.call(menuLinks,function(link){if(link.getAttribute('data-highlighted-by-user')!=='y')link.classList.remove('t-active')});Array.prototype.forEach.call(shouldBeActiveElements,function(link){link.classList.add('t-active')})}
|
||||
function t796_init(recId){var rec=document.getElementById('rec'+recId);if(!rec)return;var container=rec.querySelector('.t796');if(!container)return;var windowWidth=window.innerWidth;var screenMin=rec.getAttribute('data-screen-min');var screenMax=rec.getAttribute('data-screen-max');if(screenMin&&windowWidth<parseInt(screenMin,10))return!1;if(screenMax&&windowWidth>parseInt(screenMax,10))return!1;var shapeBorder=rec.querySelector('.t796__shape-border');var shapeRecId=container.getAttribute('data-shape-rec-ids');if(shapeRecId){shapeRecId=shapeRecId.split(',');for(var i=0;i<shapeRecId.length;i++){var shapeId=shapeRecId[i];var currentRec=document.querySelector('#rec'+shapeId);var currentShape=shapeBorder.cloneNode(!0);t796_setColor(rec,currentShape);t796_addDivider(currentRec,currentShape)}}else{var excludesBlocks=['215','316','390','651','702','706','708','750','756','766','825','862','868','943','945','674','1040',];var excludes=excludesBlocks.map(function(tplid){return `[data-record-type="${tplid}"],[data-parenttplid="${tplid}"]`}).join(',');excludes=`:not(${excludes})`;var recs=[];if(shapeBorder.classList.contains('t796__shape-border_top')||shapeBorder.classList.contains('t796__shape-border_top-flip')){recs=t796__nextAll(rec,excludes)}
|
||||
if(shapeBorder.classList.contains('t796__shape-border_bottom')||shapeBorder.classList.contains('t796__shape-border_bottom-flip')){recs=t796__prevAll(rec,excludes)}
|
||||
if(recs.length!==0){var currentShape=shapeBorder.cloneNode(!0);t796_setColor(rec,currentShape);t796_addDivider(recs[0],currentShape)}}}
|
||||
function t796_setColor(rec,shape){if(shape.getAttribute('data-fill-color'))return;var nearestBlock;if(shape.classList.contains('t796__shape-border_bottom')||shape.classList.contains('t796__shape-border_bottom-flip')){var nextBlock=rec.nextElementSibling;if(nextBlock){nearestBlock=nextBlock.matches('.r')?nextBlock:!1}}else{var prevBlock=rec.previousElementSibling;if(prevBlock){nearestBlock=prevBlock.matches('.r')?prevBlock:!1}}
|
||||
if(!nearestBlock)return;var fillColor=nearestBlock.getAttribute('data-bg-color');if(!fillColor)return;var svg=shape.querySelector('.t796__svg');if(svg)svg.style.fill=fillColor}
|
||||
function t796_addDivider(rec,shape){if(!rec)return;rec.setAttribute('data-animationappear','off');rec.classList.remove('r_hidden');var covers=rec.querySelectorAll('.t-cover');var zeroBlock=rec.querySelector('.t396');if(covers.length>0||zeroBlock){if(covers.length>0){Array.prototype.forEach.call(covers,function(cover){shape=covers.length>1?shape.cloneNode(!0):shape;var showLayers=cover.querySelectorAll('.t557__snow-layer');if(showLayers.length>0)shape.style.zIndex=1;var coverFilter=cover.querySelector('.t-cover__filter');if(coverFilter)coverFilter.insertAdjacentElement('afterend',shape);shape.style.display='block'})}
|
||||
if(zeroBlock){zeroBlock.insertAdjacentElement('afterend',shape);rec.style.position='relative';var zeroFilter=zeroBlock.querySelector('.t396__filter');if(zeroFilter){var zIndex=1;var zeroArtboard=zeroBlock.querySelector('.t396__artboard');var isVisible=getComputedStyle(zeroArtboard,null).overflow==='visible';if(!isVisible)zIndex=99;shape.style.zIndex=zIndex}
|
||||
shape.style.display='block'}}else{var wrapper=rec;var recordType=rec.getAttribute('data-parenttplid')||rec.getAttribute('data-record-type');if(!wrapper)return!0;wrapper.appendChild(shape);wrapper.style.position='relative';var excludesBlocks=['125','331','554','746','754','776','778','786','858','896','897','924','915','943','945','951','1004','1025','1241',];if(excludesBlocks.indexOf(recordType)===-1){var notZIndexBlocks=['983'];var firstDiv=wrapper.querySelector('div');firstDiv.style.position='relative';firstDiv.classList.add('t796_cont-near-shape-divider');if(notZIndexBlocks.indexOf(recordType)!==-1){firstDiv.style.zIndex=0}else{firstDiv.style.zIndex='1'}}
|
||||
var blocks=['195','246','279','675','694','734','823','938','1241'];if(blocks.indexOf(recordType)!==-1){shape.style.zIndex=1}
|
||||
shape.style.display='block'}}
|
||||
function t796__nextAll(element,selector){var nextElements=[];var nextElement=element;while(nextElement.nextElementSibling){nextElement=nextElement.nextElementSibling;if(nextElement.id==='t-footer'){var footerElements=nextElement.querySelectorAll('.r');if(footerElements.length!==0){nextElement=footerElements[0];if(nextElement.matches(selector)){nextElements.push(nextElement)}
|
||||
nextElements=nextElements.concat(t796__nextAll(nextElement,selector))}}else if(nextElement.matches(selector)){nextElements.push(nextElement)}}
|
||||
return nextElements}
|
||||
function t796__prevAll(element,selector){var prevElements=[];var prevElement=element;while(prevElement.previousElementSibling){prevElement=prevElement.previousElementSibling;if(prevElement.id==='t-header'){var headerElements=prevElement.querySelectorAll('.r');if(headerElements.length!==0){prevElement=headerElements[headerElements.length-1];if(prevElement.matches(selector)){prevElements.push(prevElement)}
|
||||
prevElements=prevElements.concat(t796__prevAll(prevElement,selector))}}else if(prevElement.matches(selector)){prevElements.push(prevElement)}}
|
||||
return prevElements}
|
||||
if(!Element.prototype.matches){Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.oMatchesSelector}
|
||||
function t670_init(recid,isEditMode){var rec=document.getElementById('rec'+recid);if(!rec)return;var image=rec.querySelector('.t-img');if(image){if(image.complete){t670_addImageEvents(recid,isEditMode)}else{image.addEventListener('load',function(){t670_addImageEvents(recid,isEditMode)});image.addEventListener('error',function(){t670_addImageEvents(recid,isEditMode)})}}else{t670_addImageEvents(recid,isEditMode)}}
|
||||
const t670_postMessages={youtube:{pause:'{"event":"command","func":"pauseVideo","args":""}',play:'{"event":"command","func":"playVideo","args":""}',},rutube:{pause:'{"type":"player:pause","data":"{}"}',play:'{"type":"player:play","data":"{}"}',},vimeo:{pause:'{"method":"pause","value":"true"}',play:'{"method":"play","value":"true"}',},};function t670_addImageEvents(recid,isEditMode){var rec=document.getElementById('rec'+recid);t670_imageHeight(rec);t670_show(rec);t670_hide(rec);t670_addArrowHandlers(rec);t_onFuncLoad('t_sldsInit',function(){t_sldsInit(recid)});if(isEditMode){t_onFuncLoad('t_slds_UpdateSliderHeight',function(){t_slds_UpdateSliderHeight(recid)});t_onFuncLoad('t_slds_UpdateSliderArrowsHeight',function(){t_slds_UpdateSliderArrowsHeight(recid)})}
|
||||
var wrapper=rec.querySelector('.t670');if(wrapper){wrapper.addEventListener('displayChanged',function(){t_onFuncLoad('t_slds_updateSlider',function(){t_slds_updateSlider(recid)});t_onFuncLoad('t_slds_positionArrows',function(){t_slds_positionArrows(recid)})})}}
|
||||
function t670_handleRutube(videoWrap,videoLazy){var videoId=videoLazy.getAttribute('data-videolazy-id');if(videoId)videoId=videoId.replace(/[^\w-]/g,'');if(!videoId)return;var videoHash=videoLazy.getAttribute('data-videolazy-hash');if(videoHash)videoHash=videoHash.replace(/[^\w-]/g,'');var existingIframe=videoWrap.querySelector('iframe.t670__rutube-iframe');if(!existingIframe){var src='https://rutube.ru/play/embed/'+videoId+'/?autoplay=1&muted=1&playsinline=1';if(videoHash)src+='&p='+videoHash;videoWrap.innerHTML='';var iframe=document.createElement('iframe');iframe.className='t670__rutube-iframe';iframe.setAttribute('allow','autoplay; fullscreen');iframe.setAttribute('allowfullscreen','');iframe.setAttribute('frameborder','0');iframe.style.width='100%';iframe.style.height='100%';iframe.style.display='block';iframe.src=src;videoWrap.appendChild(iframe)}else{try{existingIframe.contentWindow.postMessage(t670_postMessages.rutube.play,'*')}catch(e){console.warn('Failed to send play message to Rutube iframe:',e)}}}
|
||||
function t670_show(rec){var playBtns=rec.querySelectorAll('.t670__play');Array.prototype.forEach.call(playBtns,function(play){var itemWrap=play.closest('.t670__imgwrapper');var image=itemWrap.querySelector('.t-slds__bgimg');var videoWrap=itemWrap.querySelector('.t670__wrap-video');var videoLazy=videoWrap.querySelector('.t-video-lazyload');play.addEventListener('click',function(event){event.preventDefault();videoWrap.style.display='block';image.style.opacity=0;var type=videoLazy.getAttribute('data-videolazy-type');if(type==='rutube'){t670_handleRutube(videoWrap,videoLazy)}else{t_onFuncLoad('t_video_lazyload__addVideo',function(){t_video_lazyload__addVideo(videoLazy)})}})})}
|
||||
function t670_pauseVideo(videoWrap){if(!videoWrap)return;var iframe=videoWrap.querySelector('iframe');if(iframe&&iframe.contentWindow&&iframe.src){var videoSRC=iframe.src;if(videoSRC.indexOf('&enablejsapi=1')!==-1){iframe.contentWindow.postMessage(t670_postMessages.youtube.pause,'*')}
|
||||
if(videoSRC.indexOf('rutube')!==-1){iframe.contentWindow.postMessage(t670_postMessages.rutube.pause,'*')}
|
||||
if(videoSRC.indexOf('vimeo')!==-1&&videoSRC.indexOf('&api=1')!==-1){iframe.contentWindow.postMessage(t670_postMessages.vimeo.pause,'*')}}
|
||||
var videoEl=videoWrap.querySelector('video');if(videoEl&&typeof videoEl.pause==='function'){try{videoEl.pause()}catch(e){console.warn('t670: Failed to pause video element:',e)}}}
|
||||
function t670_hide(rec){var videoWraps=rec.querySelectorAll('.t670__wrap-video');rec.addEventListener('updateSlider',function(){Array.prototype.forEach.call(videoWraps,function(videoWrap){t670_pauseVideo(videoWrap);var hasIframe=videoWrap.querySelector('iframe');if(!hasIframe){videoWrap.style.display='none'}})})}
|
||||
function t670_addArrowHandlers(rec){if(!rec)return;if(rec.t670ArrowsInitialized){return}
|
||||
rec.t670ArrowsInitialized='true';rec.addEventListener('click',function(event){var arrow=event.target.closest('.t-slds__arrow_wrapper');if(!arrow)return;t670_pauseAllVideos(rec)})}
|
||||
function t670_pauseAllVideos(rec){if(!rec)return;var videoWraps=rec.querySelectorAll('.t670__wrap-video');Array.prototype.forEach.call(videoWraps,function(videoWrap){t670_pauseVideo(videoWrap);var hasIframe=videoWrap.querySelector('iframe');if(!hasIframe){videoWrap.style.display='none';var imgWrapper=videoWrap.closest('.t670__imgwrapper');if(imgWrapper){var bgImg=imgWrapper.querySelector('.t-slds__bgimg');if(bgImg){bgImg.style.opacity=1}}}})}
|
||||
function t670_imageHeight(rec){var images=rec.querySelectorAll('.t670__separator');Array.prototype.forEach.call(images,function(img){var width=parseInt(img.getAttribute('data-slider-image-width'))||0;var height=parseInt(img.getAttribute('data-slider-image-height'))||0;var ratio=height/width;var padding=ratio*100;img.style.paddingBottom=padding+'%'})}
|
||||
Reference in New Issue
Block a user