801window.addEventListener('orientationchange', function () {802// setTimeout need to wait when viewport will be updated803setTimeout(function () {804animationUpdate();805}, 300);806});807} else {808window.addEventListener('resize', animationUpdate);809}810811var zeroBlocks = document.querySelectorAll('.t396');812Array.prototype.forEach.call(zeroBlocks, function (zeroBlock) {
zeroBlock.addEventListener('displayChanged', animationUpdate); }); // fix for Safari to update animation if user reloading page and pageYOffset !== 0 if (window.t_animationSBS__isSafari) { window.addEventListener('scroll', reinitAnimationAfterPageLoad); function reinitAnimationAfterPageLoad() { if (window.pageYOffset !== 0) animationUpdate(); window.removeEventListener('scroll', reinitAnimationAfterPageLoad); } } // all types of animation, exept 'on Scroll' t_animationSBS__triggerNoScrollAnimation(animatedObject, elOrBlockOnScreenList); // only for 'on Scroll' animation var scrollAnimationEl = document.querySelectorAll('[data-animate-sbs-event="scroll"]'); if (scrollAnimationEl.length) { t_animationSBS__triggerScrollAnim(animatedObject); t_animationSBS__checkFrame(animatedObject); } window.addEventListener('load', function () { t_animationSBS__changeElValues(animatedObject); }); // if window is not loaded too long, update values by setTimeout setTimeout(function () { if (document.readyState !== 'complete') t_animationSBS__changeElValues(animatedObject); }, 3000);}function t_animationSBS__getAnimElsOnView(elements) { return elements.filter(function (el) { var eventAttribute = 'data-animate-sbs-event'; return el.getAttribute(eventAttribute) === 'intoview' || el.getAttribute(eventAttribute) === 'blockintoview'; });}function t_animationSBS__getAllBreakpoints() { var artboardList = Array.prototype.slice.call(document.querySelectorAll('.r .t396__artboard')); var breakpoints = []; artboardList.forEach(function (artBoard) { var resObj = t_animationSBS__getResOpts(artBoard); var uniqueBreakpoints = resObj.breakpoints.filter(function (item) { return breakpoints.indexOf(item) === -1; }); breakpoints = breakpoints.concat(uniqueBreakpoints); if (breakpoints.indexOf(resObj.resMax) === -1) breakpoints.push(resObj.resMax); }); return breakpoints.sort(function (a, b) { return b - a; });}function t_animationSBS__getCurrentRes(breakpoints, isMobile) { var isMobileDevice = isMobile || ('ontouchend' in document && navigator.userAgent.indexOf('AppleWebKit') !== -1); var windowWidth = isMobileDevice ? document.documentElement.clientWidth : window.innerWidth; return breakpoints.find(function (item) { return windowWidth > item; });}function t_animationSBS__updateAnimatedObjectState(animatedObject, key, value) { animatedObject[key] = value;}function t_animationSBS__setKeyForAnimatedObject(animatedObject, key, value) { if (animatedObject[key]) return; t_animationSBS__updateAnimatedObjectState(animatedObject, key, value);}/** * create resize observer to update animation, when user open dropdown list, or click * 'show more' button in catalog; or change resolution. * * @param {Object} resolutionObj * @param {Function} callback */function t_animationSBS__createResizeObserver(resolutionObj, callback) { var getClientRects = document.body.getClientRects(); var initHeight = getClientRects[0].height; var sbsResizeObserver = new ResizeObserver(function (entries) { entries.forEach(function (entry) { // do nothing, if body get overflow: hidden, when opens popup if ( !document.body.classList.contains('t-body_scroll-locked') &&