Каталог файловtilda-catalog-1.2.js
201 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)202 // @ts-expect-error ST-2949_1203 Object.keys(window.tCatalogInit).length > BLOCKS_COUNT_FOR_LAZY_INIT;204 205 if (shouldUseLazyObserver) {206 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)207 // @ts-expect-error ST-2949_1208 window.tCatalogInit[recid] = 'lazy';209 var recordObserver = new IntersectionObserver(210 function (entries, observer) {211 entries.forEach(function (entry) {
История файла и сравнение версий
if (entry.isIntersecting) {
213 var target = entry.target; 214 observer.unobserve(target); 215 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 216 // @ts-expect-error ST-2949_1 217 if (window.tCatalogInit[recid] === 'lazy') { 218 t_catalog_lazyInit(recid, options); 219 // @ts-expect-error ST-2949_1 220 window.tCatalogInit[recid] = true; 226 rootMargin: '150px 0px', 229 recordObserver.observe(rec); 231 t_catalog_lazyInit(recid, options); 236// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) 237// @ts-expect-error ST-2949_2 238function t_catalog_lazyInit(recid, opt) { 239 var options = opt || {}; 240 var rec = document.getElementById('rec' + recid); 242 document.getElementById('allrecords') !== document.querySelector('.t-catalog__product-snippet') && 243 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) 244 // @ts-expect-error ST-2949_3 245 document.getElementById('allrecords').contains(document.querySelector('.t-catalog__product-snippet')); 246 // ST-2522: сбрасывает внешние отступы кнопок в карточке товара. 247 // Класс только если в блоке есть новый шаблон карточки — старые опубликованные страницы его не получают. 248 if (t_catalog__getCardTemplateNode(rec)) { 249 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) 250 // @ts-expect-error ST-2949_3 251 const catalogRoot = rec.querySelector('.t-catalog'); 253 catalogRoot.classList.add('t-catalog_card-template'); 258 t_catalog_initRouting(); 261 if (!window.tCatalogDict) { 262 t_catalog__setGlobalDictObj(); 265 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) 266 // @ts-expect-error ST-2949_3 267 var el_store = rec.querySelector('.js-catalog'); 268 if (rec && !t_catalog_productTemplate__initPopupShell(rec, options)) { 269 var prodPopup = t_catalog_get_productPopup_html(recid, options); 271 el_store.insertAdjacentHTML('beforeend', prodPopup); 275 options.isPublishedPage = t_catalog__isPublishedMode(); 276 options.needGetPartInfo = true; 277 // draw product popup if we have it in URL 278 if (options.isPublishedPage) { 279 t_catalog_checkUrl(options, recid); 281 var recParent = document.getElementById('record' + recid); 282 if (recParent && !options.isPublishedPage) { 283 var off = recParent.getAttribute('off'); 289 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) 290 // @ts-expect-error ST-2949_3 291 var gridPreloader = rec.querySelector('.js-catalog-grid-cont-preloader'); 292 if (options.storepart === '') { 293 // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) 294 // @ts-expect-error ST-2949_1 295 gridPreloader.style.display = 'none'; 296 if (options.sidebar) { 297 // TODO ST-2949_3: null / undefined (TS18047, TS18048, TS2531, TS2722, TS2454, TS2538) 298 // @ts-expect-error ST-2949_3 299 var tCatalogGridContainer = rec.querySelector('.t-catalog__grid-cont'); 300 if (tCatalogGridContainer) {