* Enables lazy loading of images in a product popup when the user scrolls the popup.
5015 * @param {string} recid - The ID of the product whose popup to enable lazy loading in. 5017function t_catalog_popup_updLazyOnScroll(recid) { 5018 // need to update lazy on scroll in popup 5019 var scrollContainer = document.querySelector('#rec' + recid + ' .t-popup'); 5020 const isPublishedMode = t_catalog__isPublishedMode(); 5021 if (scrollContainer && isPublishedMode) { 5022 t_onFuncLoad('t_throttle', function () { 5023 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) 5024 // @ts-expect-error ST-2949_3 5025 scrollContainer.addEventListener( 5027 t_throttle(function () { 5028 t_catalog_onFuncLoad('t_lazyload_update', function () { 5029 // TODO ST-2949_4: cannot find name / missing jQuery types (TS2304, TS2592) 5030 // @ts-expect-error ST-2949_4 5031 t_lazyload_update(); 5040 * Updates the URL and browser history to reflect the currently open product popup. 5042 * @param {string} recid - The ID of the product whose popup is open. 5043 * @param {Object} product - An object containing data for the product whose popup is open. 5044 * @param {boolean} isRelevantsShow - Whether the product popup is showing relevant products. 5045 * @param {CatalogOptions} options - An object containing options for the product popup. 5047function t_catalog_changeUrl(recid, product, isRelevantsShow, options) { 5048 var isiOS = /iPhone|iPad|iPod/i.test(navigator.userAgent); 5049 var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 5050 var curUrl = window.location.href; 5051 var productState = t_catalog__createProductHistoryState(product, options, isRelevantsShow, recid); 5052 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 5053 // @ts-expect-error ST-2949_1 5054 var newPageTitle = document.title + ' – ' + product.title; 5055 var hasProductPattern = !!t_catalog__findBlockProductPatternInUrl(curUrl); 5056 var shouldSyncCanonical = isiOS && isSafari; 5058 if (!hasProductPattern) { 5059 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) 5060 // @ts-expect-error ST-2949_5 5061 var newUrl = t_catalog_generateUrl(product); 5062 t_catalog__applyHistoryState(productState, newPageTitle, newUrl, { 5063 syncCanonical: shouldSyncCanonical, 5064 updateDocumentTitle: shouldSyncCanonical, 5067 if (!window.history.state || !window.history.state.productData) { 5068 t_catalog__applyHistoryState(productState, document.title, curUrl, { replace: true }); 5071 if (isRelevantsShow) { 5072 // TODO ST-2949_5: assignability, arguments, calls, return types (TS2345, TS2322, TS2554, TS2769, TS2740, TS2739, TS2353, TS2349, TS2355, TS2366, TS2774, TS18046) 5073 // @ts-expect-error ST-2949_5 5074 var relevantsUrl = t_catalog_generateUrl(product); 5075 t_catalog__applyHistoryState(productState, newPageTitle, relevantsUrl, { 5076 syncCanonical: false, 5077 updateDocumentTitle: false, 5084 * Generates a URL for the given product based on its relative path. 5086 * @param {Object} product - An object containing data for the product to generate a URL for. 5087 * @param {string} product.url - The URL of the product. 5088 * @return {string} - The generated URL for the product. 5090function t_catalog_generateUrl(product) { 5091 var currentProtocol = window.location.protocol; 5092 var currentHost = window.location.host; 5093 var relativeProductPath; 5095 relativeProductPath = product.url.split('://')[1]; 5096 relativeProductPath = relativeProductPath.split('/'); 5097 relativeProductPath.shift(); 5098 relativeProductPath = relativeProductPath.join('/'); 5100 return currentProtocol + '//' + currentHost + '/' + relativeProductPath;