Каталог файловtilda-animation-sbs-1.0.js
4801 * @param {AnimationEvent} e - event4802 */4803function t_animationSBS__freezeTabOpenAnimation(e) {4804 const el = e.currentTarget;4805 if (e.target !== el.wrapperEl || e.animationName !== el.uniqueID || el.loop.includes('loop')) return;4806 // Не замораживаем новый запуск событиями от отменённой или уже нулевой анимации.4807 if (e.type === 'animationcancel' ? el.wrapperEl.getClientRects().length > 0 : e.elapsedTime === 0) return;4808 el.classList.add('t-sbs-anim_tabopen-finished');4809}4810 4811/**
История файла и сравнение версий
* @param {AnimatedHTML} el - animated element
4814function t_animationSBS__playTabOpenAnimation(el) { 4815 if (el.loop === 'once' && el.classList.contains('t-sbs-anim_started')) return; 4816 el.classList.remove('t-sbs-anim_tabopen-finished'); 4817 t_animationSBS__playAnimation(el, false); 4821 * @param {AnimatedHTML[]} elsIntoView - filtered AnimatedHTML, which has event from editor 4822 * 'element on Screen' - 'intoview' or 4823 * 'block on Screen' - 'blockintoview'. 4825function t_animationSBS__updateIntoViewElsState(elsIntoView) { 4826 if (!elsIntoView || !elsIntoView.length) return; 4827 elsIntoView.forEach(function (el) { 4828 if (!el?.isConnected) return; 4829 var trigger = window.pageYOffset + el.triggerOffset; 4830 var isAfterStart = el.animType === 'blockintoview' ? trigger >= el.parentRecTopPos : trigger >= el.topOffset; 4831 // to equal working in edit and published mode find parent as el.closest('.t396').parentElement 4832 var parentEl = el.closest('.t396').parentElement; 4833 var hiddenClasses = ['t397__off', 't395__off', 't400__off']; 4834 var isParentHidden = hiddenClasses.some(function (className) { 4835 return parentEl.classList.contains(className); 4837 if (!isAfterStart || isParentHidden) return; 4838 if (!el.classList.contains('t-sbs-anim_started')) el.classList.add('t-sbs-anim_started'); 4843 * window.tn_scale_factor used for old sites 4845 * @param {HTMLElement} el - current element 4846 * @returns {number} - scale factor 4848function t_animationSBS__getZoom(el) { 4849 if (typeof el.scaleFactor !== 'undefined') return el.scaleFactor; 4850 var artboard = el.closest('.t396__artboard'); 4851 if (!artboard) return 1; 4852 var abID = artboard.getAttribute('data-artboard-recid'); 4854 artboard.classList.contains('t396__artboard_scale') || 4855 (!window.animationSBS__isOldPage && 4856 typeof t396_ab__getFieldValue !== 'undefined' && 4857 t396_ab__getFieldValue(artboard, 'upscale') === 'window') 4859 return abID && window.tn['ab' + abID] 4860 ? window.tn['ab' + abID].scaleFactor || window.tn_scale_factor 4861 : window.tn_scale_factor; 4866// BELOW FUNCTIONS ARE USED FOR SUPPORT OLD SITES 4867// WITH CUSTOM CODE FOR MOBILE ANIMATION 4870// ======================================================================================== 4872 * for old sites - wrap atom elements 4875function t_animateSbs__wrapAtomEls() { 4876 var wrappingEls = document.querySelectorAll('[data-animate-sbs-event]'); 4877 Array.prototype.forEach.call(wrappingEls, function (wrappingEl) { 4878 var atomElement = wrappingEl.querySelector('.tn-atom'); 4879 if (atomElement && !atomElement.closest('.tn-atom__sbs-anim-wrapper')) { 4880 t_animationSBS__wrapEl(atomElement, 'tn-atom__sbs-anim-wrapper'); 4881 var elType = wrappingEl.getAttribute('data-elem-type'); 4882 // getPropertyValue returns border-radius value in px. If it cannot setted, will return '0px' 4883 var elBorderRadius = window.getComputedStyle(wrappingEl).getPropertyValue('border-radius'); 4884 if (elType === 'shape' && t_animationSBS__hasBorderRadius(elBorderRadius)) { 4885 var animWrapper = wrappingEl.querySelector('.tn-atom__sbs-anim-wrapper'); 4886 if (animWrapper) animWrapper.style.borderRadius = elBorderRadius; 4893 * for old sites - cache elements info 4895 * @param {{els, mode}} opts - options 4898function t_animateSbs__cashElsInfo(opts) { 4899 var elements = opts.els; 4900 opts.triggerElemsAttrName = opts.mode === 'edit' ? 'data-field-sbstrgels-value' : 'data-animate-sbs-trgels';