; /* Start:"a:4:{s:4:"full";s:103:"/bitrix/templates/aspro_mshop/components/bitrix/catalog.smart.filter/main/script.min.js?167213515616790";s:6:"source";s:83:"/bitrix/templates/aspro_mshop/components/bitrix/catalog.smart.filter/main/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ function JCSmartFilter(a,b,c){this.ajaxURL=a,this.form=null,this.timer=null,this.cacheKey="",this.cache=[],this.viewMode=b,c&&c.SEF_SET_FILTER_URL&&(this.bindUrlToButton("set_filter",c.SEF_SET_FILTER_URL),this.sef=!0),c&&c.SEF_DEL_FILTER_URL&&this.bindUrlToButton("del_filter",c.SEF_DEL_FILTER_URL)}JCSmartFilter.prototype.keyup=function(a){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(BX.delegate(function(){this.reload(a)},this),500)},JCSmartFilter.prototype.click=function(a){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(BX.delegate(function(){this.reload(a)},this),500)},JCSmartFilter.prototype.reload=function(a){if(""!==this.cacheKey)return this.timer&&clearTimeout(this.timer),void(this.timer=setTimeout(BX.delegate(function(){this.reload(a)},this),1e3));this.cacheKey="|";var b=!1;if(b=$(a).closest(".bx_filter_select_container").length,this.position_input=0,this.label_input=$("label[data-role=label_"+$(a).attr("id").replace("all_","")+"]"),b&&(this.label_input=$(a).closest(".bx_filter_select_container")),this.label_input.length&&(this.position_input=this.label_input.offset().top-this.label_input.height()/2,this.label_input.hasClass("nab")&&(this.position_input+=7),b&&(this.position_input+=10)),this.position=BX.pos(a,!0),this.form=BX.findParent(a,{tag:"form"}),this.form){var c=[];c[0]={name:"ajax",value:"y"},this.gatherInputsValues(c,BX.findChildren(this.form,{tag:new RegExp("^(input|select)$","i")},!0));for(var d=0;dthis.minPrice&&(a=this.curMinPrice-this.minPrice,this.leftPercent=100*a/this.priceDiff,this.leftSlider.style.left=this.leftPercent+"%",this.colorUnavailableActive.style.left=this.leftPercent+"%"),this.setMinFilteredValue(this.fltMinPrice),this.curMaxPrice=this.minPrice){var b=this.fltMinPrice-this.minPrice;this.fltMinPercent=100*b/this.priceDiff,this.leftPercent>this.fltMinPercent?this.colorAvailableActive.style.left=this.leftPercent+"%":this.colorAvailableActive.style.left=this.fltMinPercent+"%",this.colorAvailableInactive.style.left=this.fltMinPercent+"%"}else this.colorAvailableActive.style.left="0%",this.colorAvailableInactive.style.left="0%"},a.prototype.setMaxFilteredValue=function(a){if(this.fltMaxPrice=parseFloat(a),this.fltMaxPrice<=this.maxPrice){var b=this.maxPrice-this.fltMaxPrice;this.fltMaxPercent=100*b/this.priceDiff,this.rightPercent>this.fltMaxPercent?this.colorAvailableActive.style.right=this.rightPercent+"%":this.colorAvailableActive.style.right=this.fltMaxPercent+"%",this.colorAvailableInactive.style.right=this.fltMaxPercent+"%"}else this.colorAvailableActive.style.right="0%",this.colorAvailableInactive.style.right="0%"},a.prototype.getXCoord=function(a){var b=a.getBoundingClientRect(),c=document.body,d=document.documentElement,e=window.pageXOffset||d.scrollLeft||c.scrollLeft,f=d.clientLeft||c.clientLeft||0,g=b.left+e-f;return Math.round(g)},a.prototype.getPageX=function(a){a=a||window.event;var b=null;if(this.isTouch&&null!=a.targetTouches[0])b=a.targetTouches[0].pageX;else if(null!=a.pageX)b=a.pageX;else if(null!=a.clientX){var c=document.documentElement,d=document.body;b=a.clientX+(c.scrollLeft||d&&d.scrollLeft||0),b-=c.clientLeft||0}return b},a.prototype.recountMinPrice=function(){var a=this.priceDiff*this.leftPercent/100;a=(this.minPrice+a).toFixed(this.precision),a!=this.minPrice?this.minInput.value=a:this.minInput.value="",smartFilter.keyup(this.minInput)},a.prototype.recountMaxPrice=function(){var a=this.priceDiff*this.rightPercent/100;a=(this.maxPrice-a).toFixed(this.precision),a!=this.maxPrice?this.maxInput.value=a:this.maxInput.value="",smartFilter.keyup(this.maxInput)},a.prototype.onInputChange=function(){var a;if(this.minInput.value){var b=this.minInput.value;bthis.maxPrice&&(b=this.maxPrice),a=b-this.minPrice,this.leftPercent=100*a/this.priceDiff,this.makeLeftSliderMove(!1)}if(this.maxInput.value){var c=this.maxInput.value;cthis.maxPrice&&(c=this.maxPrice),a=this.maxPrice-c,this.rightPercent=100*a/this.priceDiff,this.makeRightSliderMove(!1)}},a.prototype.makeLeftSliderMove=function(a){a=a!==!1,this.leftSlider.style.left=this.leftPercent+"%",this.colorUnavailableActive.style.left=this.leftPercent+"%";var b=!1;this.leftPercent+this.rightPercent>=100&&(b=!0,this.rightPercent=100-this.leftPercent,this.rightSlider.style.right=this.rightPercent+"%",this.colorUnavailableActive.style.right=this.rightPercent+"%"),this.leftPercent>=this.fltMinPercent&&this.leftPercent<=100-this.fltMaxPercent?(this.colorAvailableActive.style.left=this.leftPercent+"%",b&&(this.colorAvailableActive.style.right=100-this.leftPercent+"%")):this.leftPercent<=this.fltMinPercent?(this.colorAvailableActive.style.left=this.fltMinPercent+"%",b&&(this.colorAvailableActive.style.right=100-this.fltMinPercent+"%")):this.leftPercent>=this.fltMaxPercent&&(this.colorAvailableActive.style.left=100-this.fltMaxPercent+"%",b&&(this.colorAvailableActive.style.right=this.fltMaxPercent+"%")),a&&(this.recountMinPrice(),b&&this.recountMaxPrice())},a.prototype.countNewLeft=function(a){var b=this.getPageX(a),c=this.getXCoord(this.trackerWrap),d=this.trackerWrap.offsetWidth,e=b-c;return e<0?e=0:e>d&&(e=d),e},a.prototype.onMoveLeftSlider=function(a){if(this.isTouch||(this.leftSlider.ondragstart=function(){return!1}),this.isTouch){var b=BX.proxy(function(a){this.leftPercent=100*this.countNewLeft(a)/this.trackerWrap.offsetWidth,this.makeLeftSliderMove()},this),c=BX.proxy(function(a){window.removeEventListener("touchmove",b,!1),window.removeEventListener("touchend",c,!1),b=c=null},this);window.addEventListener("touchmove",b,!1),window.addEventListener("touchend",c,!1)}else document.onmousemove=BX.proxy(function(a){this.leftPercent=100*this.countNewLeft(a)/this.trackerWrap.offsetWidth,this.makeLeftSliderMove()},this),document.onmouseup=function(){document.onmousemove=document.onmouseup=null};return!1},a.prototype.makeRightSliderMove=function(a){a=a!==!1,this.rightSlider.style.right=this.rightPercent+"%",this.colorUnavailableActive.style.right=this.rightPercent+"%";var b=!1;this.leftPercent+this.rightPercent>=100&&(b=!0,this.leftPercent=100-this.rightPercent,this.leftSlider.style.left=this.leftPercent+"%",this.colorUnavailableActive.style.left=this.leftPercent+"%"),100-this.rightPercent>=this.fltMinPercent&&this.rightPercent>=this.fltMaxPercent?(this.colorAvailableActive.style.right=this.rightPercent+"%",b&&(this.colorAvailableActive.style.left=100-this.rightPercent+"%")):this.rightPercent<=this.fltMaxPercent?(this.colorAvailableActive.style.right=this.fltMaxPercent+"%",b&&(this.colorAvailableActive.style.left=100-this.fltMaxPercent+"%")):100-this.rightPercent<=this.fltMinPercent&&(this.colorAvailableActive.style.right=100-this.fltMinPercent+"%",b&&(this.colorAvailableActive.style.left=this.fltMinPercent+"%")),a&&(this.recountMaxPrice(),b&&this.recountMinPrice())},a.prototype.onMoveRightSlider=function(a){if(this.isTouch||(this.rightSlider.ondragstart=function(){return!1}),this.isTouch){var b=BX.proxy(function(a){this.rightPercent=100-100*this.countNewLeft(a)/this.trackerWrap.offsetWidth,this.makeRightSliderMove()},this),c=BX.proxy(function(a){window.removeEventListener("touchmove",b,!1),window.removeEventListener("touchend",c,!1),b=c=null},this);window.addEventListener("touchmove",b,!1),window.addEventListener("touchend",c,!1)}else document.onmousemove=BX.proxy(function(a){this.rightPercent=100-100*this.countNewLeft(a)/this.trackerWrap.offsetWidth,this.makeRightSliderMove()},this),document.onmouseup=function(){document.onmousemove=document.onmouseup=null};return!1},a.prototype.onChangeLeftSlider=function(a){if(this.isTouch||(this.leftSlider.ondragstart=function(){}),this.isTouch){var b=100*this.countNewLeft(a)/this.trackerWrap.offsetWidth;if($(a.target).is(".bx_ui_slider_handle"))return;b<50?(this.leftPercent=b,this.makeLeftSliderMove()):(this.rightPercent=100-b,this.makeRightSliderMove())}else document.onmousedown=BX.proxy(function(a){var b=100*this.countNewLeft(a)/this.trackerWrap.offsetWidth;!$(a.target).is(".bx_ui_slider_handle")&&$(a.target).is("[class^=bx_ui_slider]")&&(b<50?(this.leftPercent=b+1,this.makeLeftSliderMove()):(this.rightPercent=100-b,this.makeRightSliderMove()))},this),document.onmouseup=function(){document.onmousemove=document.onmouseup=null};return!1},a}(); /* End */ ;; /* /bitrix/templates/aspro_mshop/components/bitrix/catalog.smart.filter/main/script.min.js?167213515616790*/