Каталог файловtilda-animation-sbs-1.0.js
401 * 2. если overflow: visible не задан, создаём специальный стиль, который задаёт402 * overflow-x: hidden для родительской записи артборда с анимируемым по скроллу элементом.403 */404function t_animationSBS__processHorizontalScroll() {405 const scrollAnimationSelector = '[data-animate-sbs-event="scroll"]';406 const scrollingElements = Array.from(document.querySelectorAll(scrollAnimationSelector));407 if (!scrollingElements.length) return;408 409 const artboardsWithScrollingElements = scrollingElements.map(el => el.closest('.t396__artboard'));410 const hasOverflowVisible = artboardsWithScrollingElements.some(artboard => {411
История файла и сравнение версий
const artBoardOverflow = artboard.getAttribute('data-artboard-ovrflw');
412 return ['visible', 'visibleX'].includes(artBoardOverflow); 415 if (hasOverflowVisible) { 416 t396__setOverflowToAllRecords(); 418 t_animationSBS__generateOverflowStyles(); 419 scrollingElements.forEach(fadeInLeftElement => { 420 const parentRecord = fadeInLeftElement.closest('.r'); 421 parentRecord.classList.add('t-animation-sbs__overflow-x'); 426function t_animationSBS__generateOverflowStyles() { 427 if (document.getElementById('sbs-animation-block-overflow')) return; 428 const styles = document.createElement('style'); 429 styles.id = 'sbs-animation-block-overflow'; 430 styles.innerHTML = '.t-animation-sbs__overflow-x { overflow-x: hidden; }'; 431 document.head.appendChild(styles); 435 * as our script is async, we should wait, when zeroblock will be rendered. 436 * For new sites we can use artBoardRendered custom event, but for old - only setTimeout. 438 * @param {Function} callback 440function t_animationSBS__isZeroBlocksRendered(callback) { 441 var zeroArtBoards = t_animationSBS__getArtboards('396'); 442 var aliasArtBoards = t_animationSBS__getArtboards('121'); 444 var artBoards = [...zeroArtBoards, ...aliasArtBoards]; 445 if (!artBoards.length) return; 447 var isTimerInited = false; 449 artBoards.every(function (artboard) { 450 return artboard.classList.contains('rendered'); 455 // check for old-version sites 457 if (document.querySelectorAll('script[src*="tilda-blocks-2"], script[src*="tilda-blocks-1"]').length) { 458 t_animationSBS__backwardCompatibilityWait(artBoards, Date.now(), callback); 460 var renderedList = artBoards.filter(function (artboard) { 461 return artboard.classList.contains('rendered'); 463 artBoards.forEach(function (artboard) { 464 if (artboard.classList.contains('rendered')) return; 465 artboard.addEventListener('artBoardRendered', function () { 466 renderedList.push(artboard); 467 if (renderedList.length === artBoards.length && !isTimerInited) callback(); 471 // if by some reason all zero blocks can't be rendered (custom code), 472 // wait 3s and try to init animation script 473 setTimeout(function() { 474 isTimerInited = true; 475 if (renderedList.length === artBoards.length) return; 484 * @param {'396' | '121'} recType 485 * @returns {HTMLElement[]} - artboards 487function t_animationSBS__getArtboards(recType) { 488 const selector = `.r[data-record-type="${recType}"]:not(.t397__off, .t395__off, .t400__off) .t396__artboard, .r[data-parenttplid="${recType}"]:not(.t397__off, .t395__off, .t400__off) .t396__artboard`; 489 return Array.from(document.querySelectorAll(selector)); 492function t_animationSBS__backwardCompatibilityWait(artBoards, time, callback) { 494 artBoards.every(function (artboard) { 495 return artboard.classList.contains('rendered'); 500 if (Date.now() - time > 10000) {