","height":"640","popupHref":"#p15","bgcolor":"#4f4f4f","bgcolorOpacity":"80","closecolor":"#e84a4a","width":"10"}settingsend-->
`); } if (!codeWrap) 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; if (screenMax && windowWidth > parseInt(screenMax, 10)) return; popup.style.display = 'block'; codeWrap.style.display = 'block'; t868_setHeight(rec); if (window.innerWidth < 640) { setIframeHeight(rec); } setTimeout(function() { popupContainer.classList.add('t-popup__container-animated'); popup.classList.add('t-popup_show') }, 100); document.body.classList.add('t-body_popupshowed'); popup.addEventListener('click', function(event) { var container = event.target.closest('.t-popup__container'); if (!container) t868_closePopup(rec) }); var closeButton = rec.querySelector('.t-popup__close'); if (closeButton) { closeButton.addEventListener('click', function() { t868_closePopup(rec); }) } var buttons = rec.querySelectorAll('a[href*="#"]'); Array.prototype.forEach.call(buttons, function(button) { button.addEventListener('click', function() { var url = button.getAttribute('href'); if (url.indexOf('#order') !== -1) { var popupContainer = rec.querySelector('.t-popup__container'); setTimeout(function() { while (popupContainer.firstChild) { popupContainer.removeChild(popupContainer.firstChild) } }, 600) } if (!url || url.substring(0, 7) !== '#price:') { t868_closePopup(rec); if (!url || url.substring(0, 7) === '#popup:') { setTimeout(function() { document.body.classList.add('t-body_popupshowed') }, 300) } } }) }); document.addEventListener('keydown', function(event) { if (event.keyCode === 27) { t868_closePopup(rec) } }) } function t868_closePopup(rec) { var popup = rec.querySelector('.t-popup'); var codeWrap = rec.querySelector('.t868 .t868__code-wrap'); document.body.classList.remove('t-body_popupshowed'); popup.classList.remove('t-popup_show'); setTimeout(function() { if (!popup.classList.contains('.t-popup_show')) { popup.style.display = 'none'; if (codeWrap) { codeWrap.style.display = 'none' } } }, 300) } function t868_setHeight(rec) { var videoCarier = rec.querySelector('.t868__video-carier'); if (!videoCarier) return; var paddingLeft = parseInt(videoCarier.style.paddingLeft, 10) || 0; var paddingRight = parseInt(videoCarier.style.paddingRight, 10) || 0; var height = (videoCarier.clientWidth - (paddingLeft + paddingRight)) / (16 / 9); videoCarier.style.height = height; Array.prototype.forEach.call(videoCarier.closest, function(parent) { parent.style.height = height }) } function setIframeHeight(rec) { rec.querySelector("iframe").style.height = window.innerHeight - 130 + "px"; } function t_popup__resizePopup(t) { var e, o, p = document.getElementById("rec" + t); !p || (e = p.querySelector(".t-popup__container")) && (o = getComputedStyle(e, null), t = parseInt(o.paddingTop) || 0, o = parseInt(o.paddingBottom) || 0, t = e.clientHeight - (t + o), o = 120, 364 !== (p = Number(p.getAttribute("data-record-type"))) && 365 !== p || (o = 30), 868 !== p && 331 !== p && 358 !== p && 1013 !== p && 746 !== p || (o = 0), t > window.innerHeight - o ? e.classList.add("t-popup__container-static") : e.classList.remove("t-popup__container-static")) } })()