Your IP : 3.136.19.41


Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/ui/ears/dist/
Upload File :
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/ui/ears/dist/ears.bundle.min.js

this.BX=this.BX||{};(function(t,e,i){"use strict";class s{constructor({target:t}){this.target=t?t:null;this.pos={top:0,left:0,x:0,y:0};this.touchInit=false;this.init()}init(){if(!this.target){console.warn("BX.UI.Ears: TouchController not initialized");return}this.target.addEventListener("mousedown",this.mouseDownHandler.bind(this));this.target.addEventListener("mousemove",this.mouseMoveHandler.bind(this));this.target.addEventListener("mouseup",this.mouseUpHandler.bind(this));this.target.addEventListener("mouseleave",this.mouseUpHandler.bind(this))}mouseDownHandler(t){this.touchInit=true;this.target.style.cursor="grabbing";this.target.style.userSelect="none";this.target.parentNode.classList.add("--grabbing");this.pos={left:this.target.scrollLeft,top:this.target.scrollTop,x:t.clientX,y:t.clientY}}mouseMoveHandler(t){if(!this.touchInit){return}const e=t.clientX-this.pos.x;const i=t.clientY-this.pos.y;this.target.scrollLeft=this.pos.left-e;this.target.scrollTop=this.pos.top-i}mouseUpHandler(){this.touchInit=false;this.target.style.cursor="grab";this.target.style.removeProperty("user-select");this.target.parentNode.classList.remove("--grabbing")}}let r=t=>t,o,l,h,n,a;class c extends i.EventEmitter{constructor(t){super(...arguments);this.setEventNamespace("BX.UI.Ears");this.container=t.container||null;this.smallSize=t.smallSize||null;this.noScrollbar=t.noScrollbar?t.noScrollbar:false;this.className=t.className?t.className:null;this.mousewheel=t.mousewheel||null;this.touchScroll=t.touchScroll||null;this.vertical=t.vertical||null;this.itemsInShow=t.itemsInShow||null;if(this.itemsInShow){this.noScrollbar=true}this.itemSize=null;this.wrapper=null;this.leftEar=null;this.rightEar=null;this.topEar=null;this.bottomEar=null;this.parentContainer=e.Type.isDomNode(this.container)?this.container.parentNode:null;this.delay=12;this.scrollTimeout=null;this.cache=new e.Cache.MemoryCache}bindEvents(){this.container.addEventListener("scroll",this.toggleEars.bind(this));if(this.mousewheel){this.container.addEventListener("wheel",this.onWheel.bind(this))}if(this.vertical){if(this.itemsInShow){this.getBottomEar().addEventListener("click",this.scrollToNext.bind(this));this.getTopEar().addEventListener("click",this.scrollToPrev.bind(this))}else{this.getBottomEar().addEventListener("mouseenter",this.scrollBottom.bind(this));this.getBottomEar().addEventListener("mouseleave",this.stopScroll.bind(this));this.getBottomEar().addEventListener("mousedown",this.stopScroll.bind(this));this.getBottomEar().addEventListener("mouseup",this.scrollBottom.bind(this));this.getTopEar().addEventListener("mouseenter",this.scrollTop.bind(this));this.getTopEar().addEventListener("mouseleave",this.stopScroll.bind(this));this.getTopEar().addEventListener("mousedown",this.stopScroll.bind(this));this.getTopEar().addEventListener("mouseup",this.scrollTop.bind(this))}}if(!this.vertical){if(this.itemsInShow){this.getRightEar().addEventListener("click",this.scrollToNext.bind(this));this.getLeftEar().addEventListener("click",this.scrollToPrev.bind(this))}else{this.getLeftEar().addEventListener("mouseenter",this.scrollLeft.bind(this));this.getLeftEar().addEventListener("mouseleave",this.stopScroll.bind(this));this.getLeftEar().addEventListener("mousedown",this.stopScroll.bind(this));this.getLeftEar().addEventListener("mouseup",this.scrollLeft.bind(this));this.getRightEar().addEventListener("mouseenter",this.scrollRight.bind(this));this.getRightEar().addEventListener("mouseleave",this.stopScroll.bind(this));this.getRightEar().addEventListener("mousedown",this.stopScroll.bind(this));this.getRightEar().addEventListener("mouseup",this.scrollRight.bind(this))}}}init(){if(!this.container){console.warn("BX.UI.Ears.Preview: 'container' is not defined");return}this.setWrapper();this.bindEvents();if(this.touchScroll){this.initTouchScroll()}setTimeout((()=>{if(this.container.scrollWidth>this.container.offsetWidth){this.toggleRightEar();let t=this.container.querySelector('[data-role="ui-ears-active"]');t?this.scrollToActiveItem(t):null}this.toggleEars()}),600);return this}scrollToPrev(){if(this.vertical){this.container.scrollTo({top:this.container.scrollTop-this.getItemSize(),behavior:"smooth"})}else{this.container.scrollTo({left:this.container.scrollLeft-this.getItemSize(),behavior:"smooth"})}}scrollToNext(){if(this.vertical){this.container.scrollTo({top:this.container.scrollTop+this.getItemSize(),behavior:"smooth"})}else{this.container.scrollTo({left:this.container.scrollLeft+this.getItemSize(),behavior:"smooth"})}}scrollToActiveItem(t){let e=t.offsetLeft-(this.container.offsetWidth/2-t.offsetWidth/2);let i=0;let s=setInterval((()=>{if(i>=e||i+this.container.offsetWidth>=this.container.scrollWidth){clearInterval(s)}this.container.scrollLeft=i+=10}),10)}onWheel(t){if(t.deltaY<0||t.deltaX>0){this.scrollRight()}else{this.scrollLeft()}clearTimeout(this.scrollTimeout);this.scrollTimeout=setTimeout((()=>this.stopScroll()),150);t.preventDefault()}getItemSize(){if(!this.itemSize){const t=this.container.firstElementChild;this.itemSize=this.vertical?this.container.firstElementChild.offsetHeight:this.container.firstElementChild.offsetWidth;let e=0;if(this.vertical){e=parseInt(window.getComputedStyle(t).marginTop)>parseInt(window.getComputedStyle(t).marginTop)?parseInt(window.getComputedStyle(t).marginTop):parseInt(window.getComputedStyle(t).marginBottom)}else{e=parseInt(window.getComputedStyle(t).marginLeft)+parseInt(window.getComputedStyle(t).marginRight)}if(e>0){this.itemSize=this.itemSize+e}}return this.itemSize}setWrapper(){this.container.classList.add("ui-ear-container");this.container.classList.add(this.vertical?"--vertical":"--horizontal");if(this.noScrollbar){this.container.classList.add("ui-ear-container-no-scrollbar")}e.Dom.append(this.getWrapper(),this.parentContainer);if(this.itemsInShow){this.container.style.setProperty(this.vertical?"height":"width",this.getItemSize()*this.itemsInShow+"px")}}getWrapper(){return this.cache.remember("wrapper",(()=>e.Tag.render(o||(o=r`
					<div class='ui-ears-wrapper ${0} ${0}'>
						${0}
						${0}
						${0}
					</div>
				`),this.smallSize?" ui-ears-wrapper-sm":"",this.className?this.className:"",this.vertical?this.getTopEar():this.getLeftEar(),this.vertical?this.getBottomEar():this.getRightEar(),this.container)))}getTopEar(){return this.cache.remember("topEar",(()=>e.Tag.render(l||(l=r`
					<div class='ui-ear ui-ear-top'></div>
				`))))}getBottomEar(){return this.cache.remember("bottomEar",(()=>e.Tag.render(h||(h=r`
					<div class='ui-ear ui-ear-bottom'></div>
				`))))}getLeftEar(){return this.cache.remember("leftEar",(()=>e.Tag.render(n||(n=r`
					<div class='ui-ear ui-ear-left'></div>
				`))))}getRightEar(){return this.cache.remember("rightEar",(()=>e.Tag.render(a||(a=r`
					<div class='ui-ear ui-ear-right'></div>
				`))))}toggleEars(){if(this.vertical){this.toggleTopEar();this.toggleBottomEar()}else{this.toggleRightEar();this.toggleLeftEar()}}toggleTopEar(){if(this.container.scrollTop>0){this.getTopEar().classList.add("ui-ear-show")}else{this.getTopEar().classList.remove("ui-ear-show")}}toggleBottomEar(){if(this.container.scrollHeight>this.container.offsetHeight&&Math.ceil(this.container.offsetHeight+this.container.scrollTop)<this.container.scrollHeight){this.getBottomEar().classList.add("ui-ear-show")}else{this.getBottomEar().classList.remove("ui-ear-show")}}toggleRightEar(){if(this.container.scrollWidth>this.container.offsetWidth&&Math.ceil(this.container.offsetWidth+this.container.scrollLeft)<this.container.scrollWidth){this.getRightEar().classList.add("ui-ear-show")}else{this.getRightEar().classList.remove("ui-ear-show")}}toggleLeftEar(){if(this.container.scrollLeft>0){this.getLeftEar().classList.add("ui-ear-show")}else{this.getLeftEar().classList.remove("ui-ear-show")}}scrollTop(){this.stopScroll("bottom");this.container.scrollTop-=10;this.emit("onEarsAreMoved");if(this.container.scrollTop<=10){this.emit("onEarsAreHidden")}this.setDelay();this.scrollInterval=setInterval(this.scrollTop.bind(this),this.delay);this.top=true}scrollBottom(){this.stopScroll("top");let t=this.container.scrollTop;this.container.scrollTop+=10;this.emit("onEarsAreMoved");if(this.container.scrollTop>=0&&t<0){this.emit("onEarsAreHidden")}this.setDelay();this.scrollInterval=setInterval(this.scrollBottom.bind(this),this.delay);this.bottom=true}scrollLeft(){this.stopScroll("right");let t=this.container.scrollLeft;this.container.scrollLeft-=10;this.emit("onEarsAreMoved");if(this.container.scrollLeft<=0&&t>0){this.emit("onEarsAreHidden")}this.setDelay();this.scrollInterval=setInterval(this.scrollLeft.bind(this),this.delay);this.left=true}scrollRight(){this.stopScroll("left");this.container.scrollLeft+=10;this.emit("onEarsAreMoved");if(this.container.scrollLeft<=10){this.emit("onEarsAreShown")}this.setDelay();this.scrollInterval=setInterval(this.scrollRight.bind(this),this.delay);this.right=true}setDelay(){if(this.container.scrollWidth<this.container.offsetWidth*1.6){this.delay=20;return}const t=this.container.scrollWidth-this.container.offsetWidth;const e=this.container.scrollLeft>t/1.3;const i=this.container.scrollLeft<t/4;if(this.container.scrollLeft===t){this.delay=12}if(this.left){if(i){this.delay=25}else{this.delay=12}}if(this.right){if(e){this.delay=25}else{this.delay=12}}}stopScroll(t){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=0}if(t==="right"){this.right=false}else if(t==="left"){this.left=false}else if(t==="bottom"){this.bottom=false}else if(t==="top"){this.top=false}}initTouchScroll(){new s({target:this.container})}}t.Ears=c})(this.BX.UI=this.BX.UI||{},BX,BX.Event);
//# sourceMappingURL=ears.bundle.map.js