You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ion.rangeSlider.min.js 39KB

12
  1. !function(a,b,c,d,e){"use strict";var f=0,g=function(){var b,c=d.userAgent,e=/msie\s\d+/i;return c.search(e)>0&&(b=e.exec(c).toString(),b=b.split(" ")[1],9>b)?(a("html").addClass("lt-ie9"),!0):!1}();Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=[].slice;if("function"!=typeof b)throw new TypeError;var d=c.call(arguments,1),e=function(){if(this instanceof e){var f=function(){};f.prototype=b.prototype;var g=new f,h=b.apply(g,d.concat(c.call(arguments)));return Object(h)===h?h:g}return b.apply(a,d.concat(c.call(arguments)))};return e}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var c;if(null==this)throw new TypeError('"this" is null or not defined');var d=Object(this),e=d.length>>>0;if(0===e)return-1;var f=+b||0;if(Math.abs(f)===1/0&&(f=0),f>=e)return-1;for(c=Math.max(f>=0?f:e-Math.abs(f),0);e>c;){if(c in d&&d[c]===a)return c;c++}return-1});var h='<span class="irs"><span class="irs-line" tabindex="-1"><span class="irs-line-left"></span><span class="irs-line-mid"></span><span class="irs-line-right"></span></span><span class="irs-min">0</span><span class="irs-max">1</span><span class="irs-from">0</span><span class="irs-to">0</span><span class="irs-single">0</span></span><span class="irs-grid"></span><span class="irs-bar"></span>',i='<span class="irs-bar-edge"></span><span class="irs-shadow shadow-single"></span><span class="irs-slider single"></span>',j='<span class="irs-shadow shadow-from"></span><span class="irs-shadow shadow-to"></span><span class="irs-slider from"></span><span class="irs-slider to"></span>',k='<span class="irs-disable-mask"></span>',l=function(d,e,f){this.VERSION="2.1.2",this.input=d,this.plugin_count=f,this.current_plugin=0,this.calc_count=0,this.update_tm=0,this.old_from=0,this.old_to=0,this.old_min_interval=null,this.raf_id=null,this.dragging=!1,this.force_redraw=!1,this.no_diapason=!1,this.is_key=!1,this.is_update=!1,this.is_start=!0,this.is_finish=!1,this.is_active=!1,this.is_resize=!1,this.is_click=!1,this.$cache={"win":a(c),"body":a(b.body),"input":a(d),"cont":null,"rs":null,"min":null,"max":null,"from":null,"to":null,"single":null,"bar":null,"line":null,"s_single":null,"s_from":null,"s_to":null,"shad_single":null,"shad_from":null,"shad_to":null,"edge":null,"grid":null,"grid_labels":[]},this.coords={"x_gap":0,"x_pointer":0,"w_rs":0,"w_rs_old":0,"w_handle":0,"p_gap":0,"p_gap_left":0,"p_gap_right":0,"p_step":0,"p_pointer":0,"p_handle":0,"p_single_fake":0,"p_single_real":0,"p_from_fake":0,"p_from_real":0,"p_to_fake":0,"p_to_real":0,"p_bar_x":0,"p_bar_w":0,"grid_gap":0,"big_num":0,"big":[],"big_w":[],"big_p":[],"big_x":[]},this.labels={"w_min":0,"w_max":0,"w_from":0,"w_to":0,"w_single":0,"p_min":0,"p_max":0,"p_from_fake":0,"p_from_left":0,"p_to_fake":0,"p_to_left":0,"p_single_fake":0,"p_single_left":0};var g,h,i,j=this.$cache.input,k=j.prop("value");g={"type":"single","min":10,"max":100,"from":null,"to":null,"step":1,"min_interval":0,"max_interval":0,"drag_interval":!1,"values":[],"p_values":[],"from_fixed":!1,"from_min":null,"from_max":null,"from_shadow":!1,"to_fixed":!1,"to_min":null,"to_max":null,"to_shadow":!1,"prettify_enabled":!0,"prettify_separator":" ","prettify":null,"force_edges":!1,"keyboard":!1,"keyboard_step":5,"grid":!1,"grid_margin":!0,"grid_num":4,"grid_snap":!1,"hide_min_max":!1,"hide_from_to":!1,"prefix":"","postfix":"","max_postfix":"","decorate_both":!0,"values_separator":" \u2014 ","input_values_separator":";","disable":!1,"onStart":null,"onChange":null,"onFinish":null,"onUpdate":null},h={"type":j.data("type"),"min":j.data("min"),"max":j.data("max"),"from":j.data("from"),"to":j.data("to"),"step":j.data("step"),"min_interval":j.data("minInterval"),"max_interval":j.data("maxInterval"),"drag_interval":j.data("dragInterval"),"values":j.data("values"),"from_fixed":j.data("fromFixed"),"from_min":j.data("fromMin"),"from_max":j.data("fromMax"),"from_shadow":j.data("fromShadow"),"to_fixed":j.data("toFixed"),"to_min":j.data("toMin"),"to_max":j.data("toMax"),"to_shadow":j.data("toShadow"),"prettify_enabled":j.data("prettifyEnabled"),"prettify_separator":j.data("prettifySeparator"),"force_edges":j.data("forceEdges"),"keyboard":j.data("keyboard"),"keyboard_step":j.data("keyboardStep"),"grid":j.data("grid"),"grid_margin":j.data("gridMargin"),"grid_num":j.data("gridNum"),"grid_snap":j.data("gridSnap"),"hide_min_max":j.data("hideMinMax"),"hide_from_to":j.data("hideFromTo"),"prefix":j.data("prefix"),"postfix":j.data("postfix"),"max_postfix":j.data("maxPostfix"),"decorate_both":j.data("decorateBoth"),"values_separator":j.data("valuesSeparator"),"input_values_separator":j.data("inputValuesSeparator"),"disable":j.data("disable")},h.values=h.values&&h.values.split(",");for(i in h)h.hasOwnProperty(i)&&(h[i]||0===h[i]||delete h[i]);k&&(k=k.split(h.input_values_separator||e.input_values_separator||";"),k[0]&&k[0]==+k[0]&&(k[0]=+k[0]),k[1]&&k[1]==+k[1]&&(k[1]=+k[1]),e&&e.values&&e.values.length?(g.from=k[0]&&e.values.indexOf(k[0]),g.to=k[1]&&e.values.indexOf(k[1])):(g.from=k[0]&&+k[0],g.to=k[1]&&+k[1])),a.extend(g,e),a.extend(g,h),this.options=g,this.validate(),this.result={"input":this.$cache.input,"slider":null,"min":this.options.min,"max":this.options.max,"from":this.options.from,"from_percent":0,"from_value":null,"to":this.options.to,"to_percent":0,"to_value":null},this.init()};l.prototype={"init":function(a){this.no_diapason=!1,this.coords.p_step=this.convertToPercent(this.options.step,!0),this.target="base",this.toggleInput(),this.append(),this.setMinMax(),a?(this.force_redraw=!0,this.calc(!0),this.callOnUpdate()):(this.force_redraw=!0,this.calc(!0),this.callOnStart()),this.updateScene()},"append":function(){var a='<span class="irs js-irs-'+this.plugin_count+'"></span>';this.$cache.input.before(a),this.$cache.input.prop("readonly",!0),this.$cache.cont=this.$cache.input.prev(),this.result.slider=this.$cache.cont,this.$cache.cont.html(h),this.$cache.rs=this.$cache.cont.find(".irs"),this.$cache.min=this.$cache.cont.find(".irs-min"),this.$cache.max=this.$cache.cont.find(".irs-max"),this.$cache.from=this.$cache.cont.find(".irs-from"),this.$cache.to=this.$cache.cont.find(".irs-to"),this.$cache.single=this.$cache.cont.find(".irs-single"),this.$cache.bar=this.$cache.cont.find(".irs-bar"),this.$cache.line=this.$cache.cont.find(".irs-line"),this.$cache.grid=this.$cache.cont.find(".irs-grid"),"single"===this.options.type?(this.$cache.cont.append(i),this.$cache.edge=this.$cache.cont.find(".irs-bar-edge"),this.$cache.s_single=this.$cache.cont.find(".single"),this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.shad_single=this.$cache.cont.find(".shadow-single")):(this.$cache.cont.append(j),this.$cache.s_from=this.$cache.cont.find(".from"),this.$cache.s_to=this.$cache.cont.find(".to"),this.$cache.shad_from=this.$cache.cont.find(".shadow-from"),this.$cache.shad_to=this.$cache.cont.find(".shadow-to"),this.setTopHandler()),this.options.hide_from_to&&(this.$cache.from[0].style.display="none",this.$cache.to[0].style.display="none",this.$cache.single[0].style.display="none"),this.appendGrid(),this.options.disable?(this.appendDisableMask(),this.$cache.input[0].disabled=!0):(this.$cache.cont.removeClass("irs-disabled"),this.$cache.input[0].disabled=!1,this.bindEvents()),this.options.drag_interval&&(this.$cache.bar[0].style.cursor="ew-resize")},"setTopHandler":function(){var a=this.options.min,b=this.options.max,c=this.options.from,d=this.options.to;c>a&&d===b?this.$cache.s_from.addClass("type_last"):b>d&&this.$cache.s_to.addClass("type_last")},"changeLevel":function(a){switch(a){case"single":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_single_fake);break;case"from":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake),this.$cache.s_from.addClass("state_hover"),this.$cache.s_from.addClass("type_last"),this.$cache.s_to.removeClass("type_last");break;case"to":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_to_fake),this.$cache.s_to.addClass("state_hover"),this.$cache.s_to.addClass("type_last"),this.$cache.s_from.removeClass("type_last");break;case"both":this.coords.p_gap_left=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake),this.coords.p_gap_right=this.toFixed(this.coords.p_to_fake-this.coords.p_pointer),this.$cache.s_to.removeClass("type_last"),this.$cache.s_from.removeClass("type_last")}},"appendDisableMask":function(){this.$cache.cont.append(k),this.$cache.cont.addClass("irs-disabled")},"remove":function(){this.$cache.cont.remove(),this.$cache.cont=null,this.$cache.line.off("keydown.irs_"+this.plugin_count),this.$cache.body.off("touchmove.irs_"+this.plugin_count),this.$cache.body.off("mousemove.irs_"+this.plugin_count),this.$cache.win.off("touchend.irs_"+this.plugin_count),this.$cache.win.off("mouseup.irs_"+this.plugin_count),g&&(this.$cache.body.off("mouseup.irs_"+this.plugin_count),this.$cache.body.off("mouseleave.irs_"+this.plugin_count)),this.$cache.grid_labels=[],this.coords.big=[],this.coords.big_w=[],this.coords.big_p=[],this.coords.big_x=[],cancelAnimationFrame(this.raf_id)},"bindEvents":function(){this.no_diapason||(this.$cache.body.on("touchmove.irs_"+this.plugin_count,this.pointerMove.bind(this)),this.$cache.body.on("mousemove.irs_"+this.plugin_count,this.pointerMove.bind(this)),this.$cache.win.on("touchend.irs_"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.win.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.line.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.line.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.options.drag_interval&&"double"===this.options.type?(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"both")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"both"))):(this.$cache.bar.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.bar.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"))),"single"===this.options.type?(this.$cache.single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.shad_single.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.s_single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"single")),this.$cache.edge.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_single.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"))):(this.$cache.single.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.single.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("touchstart.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.shad_from.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("touchstart.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.s_from.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"from")),this.$cache.to.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.s_to.on("mousedown.irs_"+this.plugin_count,this.pointerDown.bind(this,"to")),this.$cache.shad_from.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click")),this.$cache.shad_to.on("mousedown.irs_"+this.plugin_count,this.pointerClick.bind(this,"click"))),this.options.keyboard&&this.$cache.line.on("keydown.irs_"+this.plugin_count,this.key.bind(this,"keyboard")),g&&(this.$cache.body.on("mouseup.irs_"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.body.on("mouseleave.irs_"+this.plugin_count,this.pointerUp.bind(this))))},"pointerMove":function(a){if(this.dragging){var b=a.pageX||a.originalEvent.touches&&a.originalEvent.touches[0].pageX;this.coords.x_pointer=b-this.coords.x_gap,this.calc()}},"pointerUp":function(b){this.current_plugin===this.plugin_count&&this.is_active&&(this.is_active=!1,this.$cache.cont.find(".state_hover").removeClass("state_hover"),this.force_redraw=!0,g&&a("*").prop("unselectable",!1),this.updateScene(),this.restoreOriginalMinInterval(),(a.contains(this.$cache.cont[0],b.target)||this.dragging)&&(this.is_finish=!0,this.callOnFinish()),this.dragging=!1)},"pointerDown":function(b,c){c.preventDefault();var d=c.pageX||c.originalEvent.touches&&c.originalEvent.touches[0].pageX;2!==c.button&&("both"===b&&this.setTempMinInterval(),b||(b=this.target),this.current_plugin=this.plugin_count,this.target=b,this.is_active=!0,this.dragging=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=d-this.coords.x_gap,this.calcPointerPercent(),this.changeLevel(b),g&&a("*").prop("unselectable",!0),this.$cache.line.trigger("focus"),this.updateScene())},"pointerClick":function(a,b){b.preventDefault();var c=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&(this.current_plugin=this.plugin_count,this.target=a,this.is_click=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=+(c-this.coords.x_gap).toFixed(),this.force_redraw=!0,this.calc(),this.$cache.line.trigger("focus"))},"key":function(a,b){if(!(this.current_plugin!==this.plugin_count||b.altKey||b.ctrlKey||b.shiftKey||b.metaKey)){switch(b.which){case 83:case 65:case 40:case 37:b.preventDefault(),this.moveByKey(!1);break;case 87:case 68:case 38:case 39:b.preventDefault(),this.moveByKey(!0)}return!0}},"moveByKey":function(a){var b=this.coords.p_pointer;a?b+=this.options.keyboard_step:b-=this.options.keyboard_step,this.coords.x_pointer=this.toFixed(this.coords.w_rs/100*b),this.is_key=!0,this.calc()},"setMinMax":function(){if(this.options){if(this.options.hide_min_max)return this.$cache.min[0].style.display="none",void(this.$cache.max[0].style.display="none");this.options.values.length?(this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])),this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]))):(this.$cache.min.html(this.decorate(this._prettify(this.options.min),this.options.min)),this.$cache.max.html(this.decorate(this._prettify(this.options.max),this.options.max))),this.labels.w_min=this.$cache.min.outerWidth(!1),this.labels.w_max=this.$cache.max.outerWidth(!1)}},"setTempMinInterval":function(){var a=this.result.to-this.result.from;null===this.old_min_interval&&(this.old_min_interval=this.options.min_interval),this.options.min_interval=a},"restoreOriginalMinInterval":function(){null!==this.old_min_interval&&(this.options.min_interval=this.old_min_interval,this.old_min_interval=null)},"calc":function(a){if(this.options&&(this.calc_count++,(10===this.calc_count||a)&&(this.calc_count=0,this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.calcHandlePercent()),this.coords.w_rs)){this.calcPointerPercent();var b=this.getHandleX();switch("click"===this.target&&(this.coords.p_gap=this.coords.p_handle/2,b=this.getHandleX(),this.options.drag_interval?this.target="both_one":this.target=this.chooseHandle(b)),this.target){case"base":var c=(this.options.max-this.options.min)/100,d=(this.result.from-this.options.min)/c,e=(this.result.to-this.options.min)/c;this.coords.p_single_real=this.toFixed(d),this.coords.p_from_real=this.toFixed(d),this.coords.p_to_real=this.toFixed(e),this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max),this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max),this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max),this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real),this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real),this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real),this.target=null;break;case"single":if(this.options.from_fixed)break;this.coords.p_single_real=this.convertToRealPercent(b),this.coords.p_single_real=this.calcWithStep(this.coords.p_single_real),this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max),this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);break;case"from":if(this.options.from_fixed)break;this.coords.p_from_real=this.convertToRealPercent(b),this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real),this.coords.p_from_real>this.coords.p_to_real&&(this.coords.p_from_real=this.coords.p_to_real),this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max),this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from"),this.coords.p_from_real=this.checkMaxInterval(this.coords.p_from_real,this.coords.p_to_real,"from"),this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);break;case"to":if(this.options.to_fixed)break;this.coords.p_to_real=this.convertToRealPercent(b),this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real),this.coords.p_to_real<this.coords.p_from_real&&(this.coords.p_to_real=this.coords.p_from_real),this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max),this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to"),this.coords.p_to_real=this.checkMaxInterval(this.coords.p_to_real,this.coords.p_from_real,"to"),this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);break;case"both":if(this.options.from_fixed||this.options.to_fixed)break;b=this.toFixed(b+.1*this.coords.p_handle),this.coords.p_from_real=this.convertToRealPercent(b)-this.coords.p_gap_left,this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real),this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max),this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,"from"),this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real),this.coords.p_to_real=this.convertToRealPercent(b)+this.coords.p_gap_right,this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real),this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max),this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,"to"),this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);break;case"both_one":if(this.options.from_fixed||this.options.to_fixed)break;var f=this.convertToRealPercent(b),g=this.result.from_percent,h=this.result.to_percent,i=h-g,j=i/2,k=f-j,l=f+j;0>k&&(k=0,l=k+i),l>100&&(l=100,k=l-i),this.coords.p_from_real=this.calcWithStep(k),this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max),this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real),this.coords.p_to_real=this.calcWithStep(l),this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max),this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real)}"single"===this.options.type?(this.coords.p_bar_x=this.coords.p_handle/2,this.coords.p_bar_w=this.coords.p_single_fake,this.result.from_percent=this.coords.p_single_real,this.result.from=this.convertToValue(this.coords.p_single_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from])):(this.coords.p_bar_x=this.toFixed(this.coords.p_from_fake+this.coords.p_handle/2),this.coords.p_bar_w=this.toFixed(this.coords.p_to_fake-this.coords.p_from_fake),this.result.from_percent=this.coords.p_from_real,this.result.from=this.convertToValue(this.coords.p_from_real),this.result.to_percent=this.coords.p_to_real,this.result.to=this.convertToValue(this.coords.p_to_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from],this.result.to_value=this.options.values[this.result.to])),this.calcMinMax(),this.calcLabels()}},"calcPointerPercent":function(){return this.coords.w_rs?(this.coords.x_pointer<0||isNaN(this.coords.x_pointer)?this.coords.x_pointer=0:this.coords.x_pointer>this.coords.w_rs&&(this.coords.x_pointer=this.coords.w_rs),void(this.coords.p_pointer=this.toFixed(this.coords.x_pointer/this.coords.w_rs*100))):void(this.coords.p_pointer=0)},"convertToRealPercent":function(a){var b=100-this.coords.p_handle;return a/b*100},"convertToFakePercent":function(a){var b=100-this.coords.p_handle;return a/100*b},"getHandleX":function(){var a=100-this.coords.p_handle,b=this.toFixed(this.coords.p_pointer-this.coords.p_gap);return 0>b?b=0:b>a&&(b=a),b},"calcHandlePercent":function(){"single"===this.options.type?this.coords.w_handle=this.$cache.s_single.outerWidth(!1):this.coords.w_handle=this.$cache.s_from.outerWidth(!1),this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100)},"chooseHandle":function(a){if("single"===this.options.type)return"single";var b=this.coords.p_from_real+(this.coords.p_to_real-this.coords.p_from_real)/2;return a>=b?this.options.to_fixed?"from":"to":this.options.from_fixed?"to":"from"},"calcMinMax":function(){this.coords.w_rs&&(this.labels.p_min=this.labels.w_min/this.coords.w_rs*100,this.labels.p_max=this.labels.w_max/this.coords.w_rs*100)},"calcLabels":function(){this.coords.w_rs&&!this.options.hide_from_to&&("single"===this.options.type?(this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=this.coords.p_single_fake+this.coords.p_handle/2-this.labels.p_single_fake/2,this.labels.p_single_left=this.checkEdges(this.labels.p_single_left,this.labels.p_single_fake)):(this.labels.w_from=this.$cache.from.outerWidth(!1),this.labels.p_from_fake=this.labels.w_from/this.coords.w_rs*100,this.labels.p_from_left=this.coords.p_from_fake+this.coords.p_handle/2-this.labels.p_from_fake/2,this.labels.p_from_left=this.toFixed(this.labels.p_from_left),this.labels.p_from_left=this.checkEdges(this.labels.p_from_left,this.labels.p_from_fake),this.labels.w_to=this.$cache.to.outerWidth(!1),this.labels.p_to_fake=this.labels.w_to/this.coords.w_rs*100,this.labels.p_to_left=this.coords.p_to_fake+this.coords.p_handle/2-this.labels.p_to_fake/2,this.labels.p_to_left=this.toFixed(this.labels.p_to_left),this.labels.p_to_left=this.checkEdges(this.labels.p_to_left,this.labels.p_to_fake),this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=(this.labels.p_from_left+this.labels.p_to_left+this.labels.p_to_fake)/2-this.labels.p_single_fake/2,this.labels.p_single_left=this.toFixed(this.labels.p_single_left),this.labels.p_single_left=this.checkEdges(this.labels.p_single_left,this.labels.p_single_fake)))},"updateScene":function(){this.raf_id&&(cancelAnimationFrame(this.raf_id),this.raf_id=null),clearTimeout(this.update_tm),this.update_tm=null,this.options&&(this.drawHandles(),this.is_active?this.raf_id=requestAnimationFrame(this.updateScene.bind(this)):this.update_tm=setTimeout(this.updateScene.bind(this),300))},"drawHandles":function(){this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.coords.w_rs&&(this.coords.w_rs!==this.coords.w_rs_old&&(this.target="base",this.is_resize=!0),(this.coords.w_rs!==this.coords.w_rs_old||this.force_redraw)&&(this.setMinMax(),this.calc(!0),this.drawLabels(),this.options.grid&&(this.calcGridMargin(),this.calcGridLabels()),this.force_redraw=!0,this.coords.w_rs_old=this.coords.w_rs,this.drawShadow()),this.coords.w_rs&&(this.dragging||this.force_redraw||this.is_key)&&((this.old_from!==this.result.from||this.old_to!==this.result.to||this.force_redraw||this.is_key)&&(this.drawLabels(),this.$cache.bar[0].style.left=this.coords.p_bar_x+"%",this.$cache.bar[0].style.width=this.coords.p_bar_w+"%","single"===this.options.type?(this.$cache.s_single[0].style.left=this.coords.p_single_fake+"%",this.$cache.single[0].style.left=this.labels.p_single_left+"%",this.options.values.length?this.$cache.input.prop("value",this.result.from_value):this.$cache.input.prop("value",this.result.from),this.$cache.input.data("from",this.result.from)):(this.$cache.s_from[0].style.left=this.coords.p_from_fake+"%",this.$cache.s_to[0].style.left=this.coords.p_to_fake+"%",(this.old_from!==this.result.from||this.force_redraw)&&(this.$cache.from[0].style.left=this.labels.p_from_left+"%"),(this.old_to!==this.result.to||this.force_redraw)&&(this.$cache.to[0].style.left=this.labels.p_to_left+"%"),this.$cache.single[0].style.left=this.labels.p_single_left+"%",this.options.values.length?this.$cache.input.prop("value",this.result.from_value+this.options.input_values_separator+this.result.to_value):this.$cache.input.prop("value",this.result.from+this.options.input_values_separator+this.result.to),this.$cache.input.data("from",this.result.from),this.$cache.input.data("to",this.result.to)),this.old_from===this.result.from&&this.old_to===this.result.to||this.is_start||this.$cache.input.trigger("change"),this.old_from=this.result.from,this.old_to=this.result.to,this.is_resize||this.is_update||this.is_start||this.is_finish||this.callOnChange(),(this.is_key||this.is_click)&&(this.is_key=!1,this.is_click=!1,this.callOnFinish()),this.is_update=!1,this.is_resize=!1,this.is_finish=!1),this.is_start=!1,this.is_key=!1,this.is_click=!1,this.force_redraw=!1))},"drawLabels":function(){if(this.options){var a,b,c,d=this.options.values.length,e=this.options.p_values;if(!this.options.hide_from_to)if("single"===this.options.type)d?(a=this.decorate(e[this.result.from]),this.$cache.single.html(a)):(a=this.decorate(this._prettify(this.result.from),this.result.from),this.$cache.single.html(a)),this.calcLabels(),this.labels.p_single_left<this.labels.p_min+1?this.$cache.min[0].style.visibility="hidden":this.$cache.min[0].style.visibility="visible",this.labels.p_single_left+this.labels.p_single_fake>100-this.labels.p_max-1?this.$cache.max[0].style.visibility="hidden":this.$cache.max[0].style.visibility="visible";else{d?(this.options.decorate_both?(a=this.decorate(e[this.result.from]),a+=this.options.values_separator,a+=this.decorate(e[this.result.to])):a=this.decorate(e[this.result.from]+this.options.values_separator+e[this.result.to]),b=this.decorate(e[this.result.from]),c=this.decorate(e[this.result.to]),this.$cache.single.html(a),this.$cache.from.html(b),this.$cache.to.html(c)):(this.options.decorate_both?(a=this.decorate(this._prettify(this.result.from),this.result.from),a+=this.options.values_separator,a+=this.decorate(this._prettify(this.result.to),this.result.to)):a=this.decorate(this._prettify(this.result.from)+this.options.values_separator+this._prettify(this.result.to),this.result.to),b=this.decorate(this._prettify(this.result.from),this.result.from),c=this.decorate(this._prettify(this.result.to),this.result.to),this.$cache.single.html(a),this.$cache.from.html(b),this.$cache.to.html(c)),this.calcLabels();var f=Math.min(this.labels.p_single_left,this.labels.p_from_left),g=this.labels.p_single_left+this.labels.p_single_fake,h=this.labels.p_to_left+this.labels.p_to_fake,i=Math.max(g,h);this.labels.p_from_left+this.labels.p_from_fake>=this.labels.p_to_left?(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",this.result.from===this.result.to?("from"===this.target?this.$cache.from[0].style.visibility="visible":"to"===this.target&&(this.$cache.to[0].style.visibility="visible"),this.$cache.single[0].style.visibility="hidden",i=h):(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",i=Math.max(g,h))):(this.$cache.from[0].style.visibility="visible",this.$cache.to[0].style.visibility="visible",this.$cache.single[0].style.visibility="hidden"),f<this.labels.p_min+1?this.$cache.min[0].style.visibility="hidden":this.$cache.min[0].style.visibility="visible",i>100-this.labels.p_max-1?this.$cache.max[0].style.visibility="hidden":this.$cache.max[0].style.visibility="visible"}}},"drawShadow":function(){var a,b,c,d,e=this.options,f=this.$cache,g="number"==typeof e.from_min&&!isNaN(e.from_min),h="number"==typeof e.from_max&&!isNaN(e.from_max),i="number"==typeof e.to_min&&!isNaN(e.to_min),j="number"==typeof e.to_max&&!isNaN(e.to_max);"single"===e.type?e.from_shadow&&(g||h)?(a=this.convertToPercent(g?e.from_min:e.min),b=this.convertToPercent(h?e.from_max:e.max)-a,a=this.toFixed(a-this.coords.p_handle/100*a),b=this.toFixed(b-this.coords.p_handle/100*b),a+=this.coords.p_handle/2,f.shad_single[0].style.display="block",f.shad_single[0].style.left=a+"%",f.shad_single[0].style.width=b+"%"):f.shad_single[0].style.display="none":(e.from_shadow&&(g||h)?(a=this.convertToPercent(g?e.from_min:e.min),b=this.convertToPercent(h?e.from_max:e.max)-a,a=this.toFixed(a-this.coords.p_handle/100*a),b=this.toFixed(b-this.coords.p_handle/100*b),a+=this.coords.p_handle/2,f.shad_from[0].style.display="block",f.shad_from[0].style.left=a+"%",f.shad_from[0].style.width=b+"%"):f.shad_from[0].style.display="none",e.to_shadow&&(i||j)?(c=this.convertToPercent(i?e.to_min:e.min),d=this.convertToPercent(j?e.to_max:e.max)-c,c=this.toFixed(c-this.coords.p_handle/100*c),d=this.toFixed(d-this.coords.p_handle/100*d),c+=this.coords.p_handle/2,f.shad_to[0].style.display="block",f.shad_to[0].style.left=c+"%",f.shad_to[0].style.width=d+"%"):f.shad_to[0].style.display="none")},"callOnStart":function(){this.options.onStart&&"function"==typeof this.options.onStart&&this.options.onStart(this.result)},"callOnChange":function(){this.options.onChange&&"function"==typeof this.options.onChange&&this.options.onChange(this.result)},"callOnFinish":function(){this.options.onFinish&&"function"==typeof this.options.onFinish&&this.options.onFinish(this.result)},"callOnUpdate":function(){this.options.onUpdate&&"function"==typeof this.options.onUpdate&&this.options.onUpdate(this.result)},"toggleInput":function(){this.$cache.input.toggleClass("irs-hidden-input")},"convertToPercent":function(a,b){var c,d,e=this.options.max-this.options.min,f=e/100;return e?(c=b?a:a-this.options.min,d=c/f,this.toFixed(d)):(this.no_diapason=!0,0)},"convertToValue":function(a){var b,c,d=this.options.min,e=this.options.max,f=d.toString().split(".")[1],g=e.toString().split(".")[1],h=0,i=0;if(0===a)return this.options.min;if(100===a)return this.options.max;f&&(b=f.length,h=b),g&&(c=g.length,h=c),b&&c&&(h=b>=c?b:c),0>d&&(i=Math.abs(d),d=+(d+i).toFixed(h),e=+(e+i).toFixed(h));var j,k=(e-d)/100*a+d,l=this.options.step.toString().split(".")[1];return l?k=+k.toFixed(l.length):(k/=this.options.step,k*=this.options.step,k=+k.toFixed(0)),i&&(k-=i),j=l?+k.toFixed(l.length):this.toFixed(k),j<this.options.min?j=this.options.min:j>this.options.max&&(j=this.options.max),j},"calcWithStep":function(a){var b=Math.round(a/this.coords.p_step)*this.coords.p_step;return b>100&&(b=100),100===a&&(b=100),this.toFixed(b)},"checkMinInterval":function(a,b,c){var d,e,f=this.options;return f.min_interval?(d=this.convertToValue(a),e=this.convertToValue(b),"from"===c?e-d<f.min_interval&&(d=e-f.min_interval):d-e<f.min_interval&&(d=e+f.min_interval),this.convertToPercent(d)):a},"checkMaxInterval":function(a,b,c){var d,e,f=this.options;
  2. return f.max_interval?(d=this.convertToValue(a),e=this.convertToValue(b),"from"===c?e-d>f.max_interval&&(d=e-f.max_interval):d-e>f.max_interval&&(d=e+f.max_interval),this.convertToPercent(d)):a},"checkDiapason":function(a,b,c){var d=this.convertToValue(a),e=this.options;return"number"!=typeof b&&(b=e.min),"number"!=typeof c&&(c=e.max),b>d&&(d=b),d>c&&(d=c),this.convertToPercent(d)},"toFixed":function(a){return a=a.toFixed(9),+a},"_prettify":function(a){return this.options.prettify_enabled?this.options.prettify&&"function"==typeof this.options.prettify?this.options.prettify(a):this.prettify(a):a},"prettify":function(a){var b=a.toString();return b.replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g,"$1"+this.options.prettify_separator)},"checkEdges":function(a,b){return this.options.force_edges?(0>a?a=0:a>100-b&&(a=100-b),this.toFixed(a)):this.toFixed(a)},"validate":function(){var a,b,c=this.options,d=this.result,e=c.values,f=e.length;if("string"==typeof c.min&&(c.min=+c.min),"string"==typeof c.max&&(c.max=+c.max),"string"==typeof c.from&&(c.from=+c.from),"string"==typeof c.to&&(c.to=+c.to),"string"==typeof c.step&&(c.step=+c.step),"string"==typeof c.from_min&&(c.from_min=+c.from_min),"string"==typeof c.from_max&&(c.from_max=+c.from_max),"string"==typeof c.to_min&&(c.to_min=+c.to_min),"string"==typeof c.to_max&&(c.to_max=+c.to_max),"string"==typeof c.keyboard_step&&(c.keyboard_step=+c.keyboard_step),"string"==typeof c.grid_num&&(c.grid_num=+c.grid_num),c.max<c.min&&(c.max=c.min),f)for(c.p_values=[],c.min=0,c.max=f-1,c.step=1,c.grid_num=c.max,c.grid_snap=!0,b=0;f>b;b++)a=+e[b],isNaN(a)?a=e[b]:(e[b]=a,a=this._prettify(a)),c.p_values.push(a);("number"!=typeof c.from||isNaN(c.from))&&(c.from=c.min),("number"!=typeof c.to||isNaN(c.from))&&(c.to=c.max),"single"===c.type?(c.from<c.min&&(c.from=c.min),c.from>c.max&&(c.from=c.max)):((c.from<c.min||c.from>c.max)&&(c.from=c.min),(c.to>c.max||c.to<c.min)&&(c.to=c.max),c.from>c.to&&(c.from=c.to)),("number"!=typeof c.step||isNaN(c.step)||!c.step||c.step<0)&&(c.step=1),("number"!=typeof c.keyboard_step||isNaN(c.keyboard_step)||!c.keyboard_step||c.keyboard_step<0)&&(c.keyboard_step=5),"number"==typeof c.from_min&&c.from<c.from_min&&(c.from=c.from_min),"number"==typeof c.from_max&&c.from>c.from_max&&(c.from=c.from_max),"number"==typeof c.to_min&&c.to<c.to_min&&(c.to=c.to_min),"number"==typeof c.to_max&&c.from>c.to_max&&(c.to=c.to_max),d&&(d.min!==c.min&&(d.min=c.min),d.max!==c.max&&(d.max=c.max),(d.from<d.min||d.from>d.max)&&(d.from=c.from),(d.to<d.min||d.to>d.max)&&(d.to=c.to)),("number"!=typeof c.min_interval||isNaN(c.min_interval)||!c.min_interval||c.min_interval<0)&&(c.min_interval=0),("number"!=typeof c.max_interval||isNaN(c.max_interval)||!c.max_interval||c.max_interval<0)&&(c.max_interval=0),c.min_interval&&c.min_interval>c.max-c.min&&(c.min_interval=c.max-c.min),c.max_interval&&c.max_interval>c.max-c.min&&(c.max_interval=c.max-c.min)},"decorate":function(a,b){var c="",d=this.options;return d.prefix&&(c+=d.prefix),c+=a,d.max_postfix&&(d.values.length&&a===d.p_values[d.max]?(c+=d.max_postfix,d.postfix&&(c+=" ")):b===d.max&&(c+=d.max_postfix,d.postfix&&(c+=" "))),d.postfix&&(c+=d.postfix),c},"updateFrom":function(){this.result.from=this.options.from,this.result.from_percent=this.convertToPercent(this.result.from),this.options.values&&(this.result.from_value=this.options.values[this.result.from])},"updateTo":function(){this.result.to=this.options.to,this.result.to_percent=this.convertToPercent(this.result.to),this.options.values&&(this.result.to_value=this.options.values[this.result.to])},"updateResult":function(){this.result.min=this.options.min,this.result.max=this.options.max,this.updateFrom(),this.updateTo()},"appendGrid":function(){if(this.options.grid){var a,b,c,d,e,f=this.options,g=f.max-f.min,h=f.grid_num,i=0,j=0,k=4,l=0,m="";for(this.calcGridMargin(),f.grid_snap?(h=g/f.step,i=this.toFixed(f.step/(g/100))):i=this.toFixed(100/h),h>4&&(k=3),h>7&&(k=2),h>14&&(k=1),h>28&&(k=0),a=0;h+1>a;a++){for(c=k,j=this.toFixed(i*a),j>100&&(j=100,c-=2,0>c&&(c=0)),this.coords.big[a]=j,d=(j-i*(a-1))/(c+1),b=1;c>=b&&0!==j;b++)l=this.toFixed(j-d*b),m+='<span class="irs-grid-pol small" style="left: '+l+'%"></span>';m+='<span class="irs-grid-pol" style="left: '+j+'%"></span>',e=this.convertToValue(j),e=f.values.length?f.p_values[e]:this._prettify(e),m+='<span class="irs-grid-text js-grid-text-'+a+'" style="left: '+j+'%">'+e+"</span>"}this.coords.big_num=Math.ceil(h+1),this.$cache.cont.addClass("irs-with-grid"),this.$cache.grid.html(m),this.cacheGridLabels()}},"cacheGridLabels":function(){var a,b,c=this.coords.big_num;for(b=0;c>b;b++)a=this.$cache.grid.find(".js-grid-text-"+b),this.$cache.grid_labels.push(a);this.calcGridLabels()},"calcGridLabels":function(){var a,b,c=[],d=[],e=this.coords.big_num;for(a=0;e>a;a++)this.coords.big_w[a]=this.$cache.grid_labels[a].outerWidth(!1),this.coords.big_p[a]=this.toFixed(this.coords.big_w[a]/this.coords.w_rs*100),this.coords.big_x[a]=this.toFixed(this.coords.big_p[a]/2),c[a]=this.toFixed(this.coords.big[a]-this.coords.big_x[a]),d[a]=this.toFixed(c[a]+this.coords.big_p[a]);for(this.options.force_edges&&(c[0]<-this.coords.grid_gap&&(c[0]=-this.coords.grid_gap,d[0]=this.toFixed(c[0]+this.coords.big_p[0]),this.coords.big_x[0]=this.coords.grid_gap),d[e-1]>100+this.coords.grid_gap&&(d[e-1]=100+this.coords.grid_gap,c[e-1]=this.toFixed(d[e-1]-this.coords.big_p[e-1]),this.coords.big_x[e-1]=this.toFixed(this.coords.big_p[e-1]-this.coords.grid_gap))),this.calcGridCollision(2,c,d),this.calcGridCollision(4,c,d),a=0;e>a;a++)b=this.$cache.grid_labels[a][0],b.style.marginLeft=-this.coords.big_x[a]+"%"},"calcGridCollision":function(a,b,c){var d,e,f,g=this.coords.big_num;for(d=0;g>d&&(e=d+a/2,!(e>=g));d+=a)f=this.$cache.grid_labels[e][0],c[d]<=b[e]?f.style.visibility="visible":f.style.visibility="hidden"},"calcGridMargin":function(){this.options.grid_margin&&(this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.coords.w_rs&&("single"===this.options.type?this.coords.w_handle=this.$cache.s_single.outerWidth(!1):this.coords.w_handle=this.$cache.s_from.outerWidth(!1),this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100),this.coords.grid_gap=this.toFixed(this.coords.p_handle/2-.1),this.$cache.grid[0].style.width=this.toFixed(100-this.coords.p_handle)+"%",this.$cache.grid[0].style.left=this.coords.grid_gap+"%"))},"update":function(b){this.input&&(this.is_update=!0,this.options.from=this.result.from,this.options.to=this.result.to,this.options=a.extend(this.options,b),this.validate(),this.updateResult(b),this.toggleInput(),this.remove(),this.init(!0))},"reset":function(){this.input&&(this.updateResult(),this.update())},"destroy":function(){this.input&&(this.toggleInput(),this.$cache.input.prop("readonly",!1),a.data(this.input,"ionRangeSlider",null),this.remove(),this.input=null,this.options=null)}},a.fn.ionRangeSlider=function(b){return this.each(function(){a.data(this,"ionRangeSlider")||a.data(this,"ionRangeSlider",new l(this,b,f++))})},function(){for(var a=0,b=["ms","moz","webkit","o"],d=0;d<b.length&&!c.requestAnimationFrame;++d)c.requestAnimationFrame=c[b[d]+"RequestAnimationFrame"],c.cancelAnimationFrame=c[b[d]+"CancelAnimationFrame"]||c[b[d]+"CancelRequestAnimationFrame"];c.requestAnimationFrame||(c.requestAnimationFrame=function(b,d){var e=(new Date).getTime(),f=Math.max(0,16-(e-a)),g=c.setTimeout(function(){b(e+f)},f);return a=e+f,g}),c.cancelAnimationFrame||(c.cancelAnimationFrame=function(a){clearTimeout(a)})}()}(jQuery,document,window,navigator);