Current Path : /var/www/axolotl/data/www/yar.axolotls.ru/bitrix/js/salescenter/componentanimation/ |
Current File : /var/www/axolotl/data/www/yar.axolotls.ru/bitrix/js/salescenter/componentanimation/animation.min.js |
(function(){BX.namespace("BX.Salescenter");if(window.BX.Salescenter.ComponentAnimation){return}BX.Salescenter.ComponentAnimation={showClass:"salescenter-cashbox-page-show",hideClass:"salescenter-cashbox-page-hide",invisibleClass:"salescenter-cashbox-page-invisible",animations:[],animate:function(n){n=n||{};var e=n.node||null;var i=new BX.Promise;n.transition=n.transition||BX.easing.transitions.linear;if(!BX.type.isElementNode(e)){i.reject();return i}var t=n.duration||300;var o=null;for(var a in BX.Salescenter.ComponentAnimation.animations){if(BX.Salescenter.ComponentAnimation.animations[a].node==e){o=BX.Salescenter.ComponentAnimation.animations[a];break}}if(o===null){var s=new BX.easing({duration:t,start:n.start,finish:n.finish,transition:n.transition,step:n.step,complete:function(){for(var t in BX.Salescenter.ComponentAnimation.animations){if(BX.Salescenter.ComponentAnimation.animations[t].node==e){BX.Salescenter.ComponentAnimation.animations[t].easing=null;BX.Salescenter.ComponentAnimation.animations[t].node=null;BX.Salescenter.ComponentAnimation.animations.splice(t,1);break}}e=null;o=null;n.complete.call(this);if(i){i.fulfill()}}});o={node:e,easing:s};o.easing.animate();BX.Salescenter.ComponentAnimation.animations.push(o)}else{o.easing.stop(true);n.duplicate.call(this);if(i){i.reject()}}return i},animateShowHide:function(n){n=n||{};var e=n.node||null;n.transition=n.transition||BX.easing.transitions.linear;if(!BX.type.isElementNode(e)){var i=new BX.Promise;i.reject();return i}var t=BX.hasClass(e,BX.Salescenter.ComponentAnimation.invisibleClass);var o=typeof n.way=="undefined"||n.way===null?t:!!n.way;if(t!=o){var i=new BX.Promise;i.resolve();return i}var a=n.toShow||{};var s=n.toHide||{};return BX.Salescenter.ComponentAnimation.animate({node:e,duration:n.duration,start:!o?a:s,finish:o?a:s,transition:n.transition,complete:function(){BX[!o?"addClass":"removeClass"](e,BX.Salescenter.ComponentAnimation.invisibleClass);e.style.cssText="";if(BX.type.isFunction(n.complete)){n.complete.call(this)}},duplicate:function(){BX[o?"addClass":"removeClass"](e,BX.Salescenter.ComponentAnimation.invisibleClass);e.style.cssText="";if(BX.type.isFunction(n.duplicate)){n.duplicate.call(this)}},step:function(n){if(typeof n.opacity!="undefined"){e.style.opacity=n.opacity/100}if(typeof n.height!="undefined"){e.style.height=n.height+"px"}if(typeof n.width!="undefined"){e.style.width=n.width+"px"}}})},fadeSlideToggleByClass:function(n,e,i,t){return BX.Salescenter.ComponentAnimation.animateShowHide({node:n,duration:i,toShow:{opacity:100,height:BX.Salescenter.ComponentAnimation.getInvisibleSize(n).height},toHide:{opacity:0,height:0},complete:t,way:e})},getInvisibleSize:function(n){var e=BX.hasClass(n,BX.Salescenter.ComponentAnimation.invisibleClass);if(e){BX.removeClass(n,BX.Salescenter.ComponentAnimation.invisibleClass)}var i=BX.pos(n);if(e){BX.addClass(n,BX.Salescenter.ComponentAnimation.invisibleClass)}return i},smoothScroll:function(n){var e=BX.GetWindowScrollPos().scrollTop,i=BX.pos(n).top-Math.round(BX.GetWindowInnerSize().innerHeight/2),t=e<i,o=Math.abs(i-e),a=Math.round(o/100)>20?20:Math.round(o/100),s=4*a,l=t?e+s:e-s,r=0;if(t){for(var m=e;m<i;m+=s){setTimeout("window.scrollTo(0,"+l+")",r*a);l+=s;if(l>i){l=i}r++}}else{for(var m=e;m>i;m-=s){setTimeout("window.scrollTo(0,"+l+")",r*a);l-=s;if(l<i){l=i}r++}}},smoothShowHide:function(n){if(!n.classList.contains(BX.Salescenter.ComponentAnimation.showClass)){setTimeout(function(){BX.removeClass(n,BX.Salescenter.ComponentAnimation.invisibleClass)},100);BX.Salescenter.ComponentAnimation.smoothShow(n)}else{BX.Salescenter.ComponentAnimation.smoothHide(n);BX.addClass(n,BX.Salescenter.ComponentAnimation.invisibleClass)}},smoothShow:function(n){BX.removeClass(n,BX.Salescenter.ComponentAnimation.hideClass);BX.addClass(n,BX.Salescenter.ComponentAnimation.showClass)},smoothHide:function(n){BX.removeClass(n,BX.Salescenter.ComponentAnimation.showClass);BX.addClass(n,BX.Salescenter.ComponentAnimation.hideClass)}}})(window); //# sourceMappingURL=animation.map.js