6801var el_popup = popupElement;68026803// TODO ST-2949_4: cannot find name / missing jQuery types (TS2304, TS2592)6804// @ts-expect-error ST-2949_46805if (window.jQuery && el_popup instanceof jQuery) {6806if (el_popup.length === 0) {6807return;6808}6809el_popup = el_popup[0];6810}68116812if (!el_popup) return;
var prodSliderElement = el_popup.querySelector('.js-catalog-prod-slider'); // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2 var galleryArr; if (!product.gallery) { if (prodSliderElement) prodSliderElement.innerHTML = ''; return; } if (typeof product.gallery === 'string') { galleryArr = JSON.parse(product.gallery); } else { galleryArr = product.gallery; } if (galleryArr.length === 0) { if (prodSliderElement) prodSliderElement.innerHTML = ''; return; } var initGallery = function () { var params = { recid: recid, el_popup: el_popup, product: product, options: options, // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2 galleryArr: galleryArr, }; var isMobileDevice = window.isMobile || ('ontouchend' in document && navigator.userAgent.indexOf('AppleWebKit') !== -1); var windowWidth = isMobileDevice ? document.documentElement.clientWidth : window.innerWidth; if ( (options.galleryStyle && windowWidth > GALLERY_BREAKPOINT) || (options.popup_opts.mobileGalleryStyle && windowWidth <= GALLERY_BREAKPOINT) ) { // TODO ST-2949_4: cannot find name / missing jQuery types (TS2304, TS2592) // @ts-expect-error ST-2949_4 t_catalog__loadCatalogSlds().then(() => t_catalog__initCustomGallery(params)); } else { // если была ранее другая галерея, то убираем фиксацию во время скролла текста/правой колонки if (options.galleryStyle) { var prodInfo = el_popup.querySelector('.t-catalog__prod-popup__info'); if (prodInfo) { prodInfo.classList.remove('t-catalog__prod-popup__col_fixed'); } } t_catalog__initDefaultGallery(params); } }; initGallery(); // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 if (window.t_catalog_drawProdPopup_resizeGalleryEvent) { // @ts-expect-error ST-2949_1 window.removeEventListener('resize', window.t_catalog_drawProdPopup_resizeGalleryEvent); } // @ts-expect-error ST-2949_1 window.t_catalog_drawProdPopup_resizeGalleryEvent = function () { var isMobileDevice = window.isMobile || ('ontouchend' in document && navigator.userAgent.indexOf('AppleWebKit') !== -1); var windowWidth = isMobileDevice ? document.documentElement.clientWidth : window.innerWidth; var desktopGalleryClass = '.js-catalog-desktop-custom-gallery'; var mobileGalleryClass = '.js-catalog-mobile-custom-gallery'; var galleryStyle = options.galleryStyle || ''; var validGalleryStyles = ['col1_fixed', 'col2_fixed']; var desktopGalleryStyle = galleryStyle && validGalleryStyles.indexOf(galleryStyle) !== -1; var isDesktopGallery = desktopGalleryStyle && windowWidth > GALLERY_BREAKPOINT; var mobileGalleryStyle = options.popup_opts.mobileGalleryStyle || ''; var isMobileGallery = mobileGalleryStyle && windowWidth <= GALLERY_BREAKPOINT; if ( (options.galleryStyle && windowWidth >= GALLERY_BREAKPOINT) || (options.popup_opts.mobileGalleryStyle && windowWidth < GALLERY_BREAKPOINT) ) { // не инициализируем галерею повторно, если кастомная уже есть if ( (prodSliderElement.querySelector(desktopGalleryClass) && isDesktopGallery) || (prodSliderElement.querySelector(mobileGalleryClass) && isMobileGallery) ) return; } else {