From f28dcd85fbbc09ca5a701cab462cdb1365562bfd Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Mon, 26 Feb 2018 14:24:08 -0600 Subject: [PATCH] Update to ion.rangeSlider 2.2.0 --- NEWS.md | 1 + .../css/ion.rangeSlider.skinRound.css | 108 +++++++++++ .../css/ion.rangeSlider.skinSquare.css | 87 +++++++++ .../ionrangeslider/js/ion.rangeSlider.js | 182 +++++++++++++----- .../ionrangeslider/js/ion.rangeSlider.min.js | 4 +- 5 files changed, 332 insertions(+), 50 deletions(-) create mode 100644 inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinRound.css create mode 100644 inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinSquare.css diff --git a/NEWS.md b/NEWS.md index d8778be27..e0a40d4d0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -27,6 +27,7 @@ shiny 1.0.5.9000 ### Library updates +* Updated to ion.rangeSlider 2.2.0. ([#1955](https://github.com/rstudio/shiny/pull/1955)) shiny 1.0.5 =========== diff --git a/inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinRound.css b/inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinRound.css new file mode 100644 index 000000000..be5ab7041 --- /dev/null +++ b/inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinRound.css @@ -0,0 +1,108 @@ +/* Ion.RangeSlider, Round Skin +// css version 2.2.0 +// © Denis Ineshin, 2014 https://github.com/IonDen +// © Veaceslav Grimalschi, 2018 https://github.com/grimalschi +// ===================================================================================================================*/ + +/* ===================================================================================================================== +// Skin details */ + +.irs { + height: 50px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +.irs-with-grid { + height: 67px; +} + +.irs-line { + top: 36px; + height: 4px; + background: #DEE4EC; + border-radius: 16px; +} + +.irs-bar, .irs-bar-edge { + top: 36px; + height: 4px; + background: #006CFA; +} +.irs-bar-edge { + width: 12px; +} + +.irs-shadow { + height: 4px; + top: 40px; + background: #DEE4EC; + opacity: 0.5; +} + +.lt-ie9 .irs-shadow { + filter: alpha(opacity=25); +} + +.irs-slider { + top: 35px; + width: 16px; + height: 16px; + margin-top: -10px; + border: 4px solid #006CFA; + background: white; + border-radius: 27px; + box-shadow: 0 1px 3px rgba(0,0,255,0.3); + cursor: pointer; + box-sizing: content-box; +} + +.irs-slider.state_hover, .irs-slider:hover { + background: #f0f6ff; +} + +.irs-min, .irs-max { + color: #333; + font-size: 14px; + top: 0; + padding: 3px 5px; + background: rgba(0,0,0,0.1); + border-radius: 3px; + line-height: 1; +} + +.irs-from, .irs-to, .irs-single { + color: #fff; + font-size: 14px; + text-shadow: none; + padding: 3px 5px; + background: #006CFA; + border-radius: 3px; + line-height: 1; +} +.irs-from:after, .irs-to:after, .irs-single:after { + position: absolute; + display: block; + content: ""; + bottom: -6px; + left: 50%; + width: 0; + height: 0; + margin-left: -3px; + overflow: hidden; + border: 3px solid transparent; + border-top-color: #006CFA; +} + +.irs-grid { + height: 27px; +} +.irs-grid-pol { + background: #DEE4EC; +} + +.irs-grid-text { + bottom: 4px; + color: silver; + font-size: 12px; +} + diff --git a/inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinSquare.css b/inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinSquare.css new file mode 100644 index 000000000..323921ced --- /dev/null +++ b/inst/www/shared/ionrangeslider/css/ion.rangeSlider.skinSquare.css @@ -0,0 +1,87 @@ +/* Ion.RangeSlider, Square Skin +// css version 2.2.0 +// © Denis Ineshin, 2014 https://github.com/IonDen +// © Veaceslav Grimalschi, 2018 https://github.com/grimalschi +// ===================================================================================================================*/ + +/* ===================================================================================================================== +// Skin details */ + +.irs { + height: 45px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +.irs-with-grid { + height: 62px; +} + +.irs-line { + top: 31px; + height: 4px; + background: #DEDEDE; +} + +.irs-bar, .irs-bar-edge { + top: 31px; + height: 4px; + background: black; +} +.irs-bar-edge { + width: 8px; +} + +.irs-shadow { + height: 2px; + top: 37px; + background: #DEDEDE; +} + +.irs-slider { + top: 30px; + width: 10px; + height: 10px; + margin-top: -5px; + border: 3px solid black; + background: white; + cursor: pointer; + box-sizing: content-box; + -webkit-transform: rotate(45deg); + -ms-transform: rotate(45deg); + transform: rotate(45deg); +} + +.irs-slider.state_hover, .irs-slider:hover { + background: #f0f0f0; +} + +.irs-min, .irs-max { + color: #333; + font-size: 13px; + top: 0; + padding: 3px 4px; + background: rgba(0,0,0,0.1); + line-height: 1; +} + +.irs-from, .irs-to, .irs-single { + color: #fff; + font-size: 13px; + text-shadow: none; + padding: 3px 4px; + background: black; + line-height: 1; +} + +.irs-grid { + height: 27px; +} +.irs-grid-pol { + background: #DEDEDE; +} + +.irs-grid-text { + bottom: 4px; + color: silver; + font-size: 11px; +} diff --git a/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js b/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js index e99886675..89d204ed0 100644 --- a/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js +++ b/inst/www/shared/ionrangeslider/js/ion.rangeSlider.js @@ -1,6 +1,6 @@ // Ion.RangeSlider -// version 2.1.6 Build: 369 -// © Denis Ineshin, 2016 +// version 2.2.0 Build: 380 +// © Denis Ineshin, 2017 // https://github.com/IonDen // // Project page: http://ionden.com/a/plugins/ion.rangeSlider/en.html @@ -121,7 +121,7 @@ var base_html = '' + - '' + + '' + '01' + '000' + '' + @@ -156,7 +156,7 @@ * @constructor */ var IonRangeSlider = function (input, options, plugin_count) { - this.VERSION = "2.1.6"; + this.VERSION = "2.2.0"; this.input = input; this.plugin_count = plugin_count; this.current_plugin = 0; @@ -169,9 +169,9 @@ this.dragging = false; this.force_redraw = false; this.no_diapason = false; + this.has_tab_index = true; this.is_key = false; this.is_update = false; - this.is_first_update = true; this.is_start = true; this.is_finish = false; this.is_active = false; @@ -303,8 +303,7 @@ force_edges: false, - keyboard: false, - keyboard_step: 5, + keyboard: true, grid: false, grid_margin: true, @@ -323,7 +322,11 @@ input_values_separator: ";", disable: false, + block: false, + extra_classes: "", + + scope: null, onStart: null, onChange: null, onFinish: null, @@ -369,7 +372,6 @@ force_edges: $inp.data("forceEdges"), keyboard: $inp.data("keyboard"), - keyboard_step: $inp.data("keyboardStep"), grid: $inp.data("grid"), grid_margin: $inp.data("gridMargin"), @@ -387,7 +389,10 @@ input_values_separator: $inp.data("inputValuesSeparator"), - disable: $inp.data("disable") + disable: $inp.data("disable"), + block: $inp.data("block"), + + extra_classes: $inp.data("extraClasses"), }; config_from_data.values = config_from_data.values && config_from_data.values.split(","); @@ -498,7 +503,7 @@ * Appends slider template to a DOM */ append: function () { - var container_html = ''; + var container_html = ''; this.$cache.input.before(container_html); this.$cache.input.prop("readonly", true); this.$cache.cont = this.$cache.input.prev(); @@ -544,11 +549,20 @@ this.appendDisableMask(); this.$cache.input[0].disabled = true; } else { - this.$cache.cont.removeClass("irs-disabled"); this.$cache.input[0].disabled = false; + this.removeDisableMask(); this.bindEvents(); } + // block only if not disabled + if (!this.options.disable) { + if (this.options.block) { + this.appendDisableMask(); + } else { + this.removeDisableMask(); + } + } + if (this.options.drag_interval) { this.$cache.bar[0].style.cursor = "ew-resize"; } @@ -581,6 +595,7 @@ switch (target) { case "single": this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_single_fake); + this.$cache.s_single.addClass("state_hover"); break; case "from": this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_from_fake); @@ -612,9 +627,18 @@ this.$cache.cont.addClass("irs-disabled"); }, + /** + * Then slider is not disabled + * remove disable mask + */ + removeDisableMask: function () { + this.$cache.cont.remove(".irs-disable-mask"); + this.$cache.cont.removeClass("irs-disabled"); + }, + /** * Remove slider instance - * and ubind all events + * and unbind all events */ remove: function () { this.$cache.cont.remove(); @@ -659,6 +683,8 @@ 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.$cache.line.on("focus.irs_" + this.plugin_count, this.pointerFocus.bind(this)); + if (this.options.drag_interval && this.options.type === "double") { 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")); @@ -705,6 +731,29 @@ } }, + /** + * Focus with tabIndex + * + * @param e {Object} event object + */ + pointerFocus: function (e) { + if (!this.target) { + var x; + var $handle; + + if (this.options.type === "single") { + $handle = this.$cache.single; + } else { + $handle = this.$cache.from; + } + + x = $handle.offset().left; + x += ($handle.width() / 2) - 1; + + this.pointerClick("single", {preventDefault: function () {}, pageX: x}); + } + }, + /** * Mousemove or touchmove * only for handlers @@ -864,18 +913,19 @@ }, /** - * Move by key. Beta - * @todo refactor than have plenty of time + * Move by key * * @param right {boolean} direction to move */ moveByKey: function (right) { var p = this.coords.p_pointer; + var p_step = (this.options.max - this.options.min) / 100; + p_step = this.options.step / p_step; if (right) { - p += this.options.keyboard_step; + p += p_step; } else { - p -= this.options.keyboard_step; + p -= p_step; } this.coords.x_pointer = this.toFixed(this.coords.w_rs / 100 * p); @@ -902,8 +952,14 @@ 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])); } else { - 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)); + var min_pretty = this._prettify(this.options.min); + var max_pretty = this._prettify(this.options.max); + + this.result.min_pretty = min_pretty; + this.result.max_pretty = max_pretty; + + this.$cache.min.html(this.decorate(min_pretty, this.options.min)); + this.$cache.max.html(this.decorate(max_pretty, this.options.max)); } this.labels.w_min = this.$cache.min.outerWidth(false); @@ -1114,6 +1170,7 @@ this.result.from_percent = this.coords.p_single_real; this.result.from = this.convertToValue(this.coords.p_single_real); + this.result.from_pretty = this._prettify(this.result.from); if (this.options.values.length) { this.result.from_value = this.options.values[this.result.from]; @@ -1124,8 +1181,10 @@ this.result.from_percent = this.coords.p_from_real; this.result.from = this.convertToValue(this.coords.p_from_real); + this.result.from_pretty = this._prettify(this.result.from); this.result.to_percent = this.coords.p_to_real; this.result.to = this.convertToValue(this.coords.p_to_real); + this.result.to_pretty = this._prettify(this.result.to); if (this.options.values.length) { this.result.from_value = this.options.values[this.result.from]; @@ -1364,10 +1423,9 @@ if (!this.is_resize && !this.is_update && !this.is_start && !this.is_finish) { this.callOnChange(); } - if (this.is_key || this.is_click || this.is_first_update) { + if (this.is_key || this.is_click) { this.is_key = false; this.is_click = false; - this.is_first_update = false; this.callOnFinish(); } @@ -1392,11 +1450,13 @@ return; } - var values_num = this.options.values.length, - p_values = this.options.p_values, - text_single, - text_from, - text_to; + var values_num = this.options.values.length; + var p_values = this.options.p_values; + var text_single; + var text_from; + var text_to; + var from_pretty; + var to_pretty; if (this.options.hide_from_to) { return; @@ -1408,7 +1468,9 @@ text_single = this.decorate(p_values[this.result.from]); this.$cache.single.html(text_single); } else { - text_single = this.decorate(this._prettify(this.result.from), this.result.from); + from_pretty = this._prettify(this.result.from); + + text_single = this.decorate(from_pretty, this.result.from); this.$cache.single.html(text_single); } @@ -1445,16 +1507,18 @@ this.$cache.to.html(text_to); } else { + from_pretty = this._prettify(this.result.from); + to_pretty = this._prettify(this.result.to); if (this.options.decorate_both) { - text_single = this.decorate(this._prettify(this.result.from), this.result.from); + text_single = this.decorate(from_pretty, this.result.from); text_single += this.options.values_separator; - text_single += this.decorate(this._prettify(this.result.to), this.result.to); + text_single += this.decorate(to_pretty, this.result.to); } else { - text_single = this.decorate(this._prettify(this.result.from) + this.options.values_separator + this._prettify(this.result.to), this.result.to); + text_single = this.decorate(from_pretty + this.options.values_separator + to_pretty, this.result.to); } - text_from = this.decorate(this._prettify(this.result.from), this.result.from); - text_to = this.decorate(this._prettify(this.result.to), this.result.to); + text_from = this.decorate(from_pretty, this.result.from); + text_to = this.decorate(to_pretty, this.result.to); this.$cache.single.html(text_single); this.$cache.from.html(text_from); @@ -1606,28 +1670,44 @@ this.writeToInput(); if (this.options.onStart && typeof this.options.onStart === "function") { - this.options.onStart(this.result); + if (this.options.scope) { + this.options.onStart.call(this.options.scope, this.result); + } else { + this.options.onStart(this.result); + } } }, callOnChange: function () { this.writeToInput(); if (this.options.onChange && typeof this.options.onChange === "function") { - this.options.onChange(this.result); + if (this.options.scope) { + this.options.onChange.call(this.options.scope, this.result); + } else { + this.options.onChange(this.result); + } } }, callOnFinish: function () { this.writeToInput(); if (this.options.onFinish && typeof this.options.onFinish === "function") { - this.options.onFinish(this.result); + if (this.options.scope) { + this.options.onFinish.call(this.options.scope, this.result); + } else { + this.options.onFinish(this.result); + } } }, callOnUpdate: function () { this.writeToInput(); if (this.options.onUpdate && typeof this.options.onUpdate === "function") { - this.options.onUpdate(this.result); + if (this.options.scope) { + this.options.onUpdate.call(this.options.scope, this.result); + } else { + this.options.onUpdate(this.result); + } } }, @@ -1639,6 +1719,14 @@ toggleInput: function () { this.$cache.input.toggleClass("irs-hidden-input"); + + if (this.has_tab_index) { + this.$cache.input.prop("tabindex", -1); + } else { + this.$cache.input.removeProp("tabindex"); + } + + this.has_tab_index = !this.has_tab_index; }, /** @@ -1897,7 +1985,6 @@ if (typeof o.to_min === "string") o.to_min = +o.to_min; if (typeof o.to_max === "string") o.to_max = +o.to_max; - if (typeof o.keyboard_step === "string") o.keyboard_step = +o.keyboard_step; if (typeof o.grid_num === "string") o.grid_num = +o.grid_num; if (o.max < o.min) { @@ -1912,7 +1999,6 @@ o.grid_num = o.max; o.grid_snap = true; - for (i = 0; i < vl; i++) { value = +v[i]; @@ -1968,10 +2054,6 @@ o.step = 1; } - if (typeof o.keyboard_step !== "number" || isNaN(o.keyboard_step) || !o.keyboard_step || o.keyboard_step < 0) { - o.keyboard_step = 5; - } - if (typeof o.from_min === "number" && o.from < o.from_min) { o.from = o.from_min; } @@ -2057,6 +2139,7 @@ updateFrom: function () { this.result.from = this.options.from; this.result.from_percent = this.convertToPercent(this.result.from); + this.result.from_pretty = this._prettify(this.result.from); if (this.options.values) { this.result.from_value = this.options.values[this.result.from]; } @@ -2065,6 +2148,7 @@ updateTo: function () { this.result.to = this.options.to; this.result.to_percent = this.convertToPercent(this.result.to); + this.result.to_pretty = this._prettify(this.result.to); if (this.options.values) { this.result.to_value = this.options.values[this.result.to]; } @@ -2107,8 +2191,15 @@ this.calcGridMargin(); if (o.grid_snap) { - big_num = total / o.step; - big_p = this.toFixed(o.step / (total / 100)); + + if (total > 50) { + big_num = 50 / o.step; + big_p = this.toFixed(o.step / 0.5); + } else { + big_num = total / o.step; + big_p = this.toFixed(o.step / (total / 100)); + } + } else { big_p = this.toFixed(100 / big_num); } @@ -2133,11 +2224,6 @@ if (big_w > 100) { big_w = 100; - - local_small_max -= 2; - if (local_small_max < 0) { - local_small_max = 0; - } } this.coords.big[i] = big_w; diff --git a/inst/www/shared/ionrangeslider/js/ion.rangeSlider.min.js b/inst/www/shared/ionrangeslider/js/ion.rangeSlider.min.js index f86fdc5c8..337ef2633 100644 --- a/inst/www/shared/ionrangeslider/js/ion.rangeSlider.min.js +++ b/inst/www/shared/ionrangeslider/js/ion.rangeSlider.min.js @@ -1,2 +1,2 @@ -!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){return a(b,document,window,navigator)}):"object"==typeof exports?a(require("jquery"),document,window,navigator):a(jQuery,document,window,navigator)}(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],b<9)&&(a("html").addClass("lt-ie9"),!0)}();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);c!",k[0]),i={type:k.data("type"),min:k.data("min"),max:k.data("max"),from:k.data("from"),to:k.data("to"),step:k.data("step"),min_interval:k.data("minInterval"),max_interval:k.data("maxInterval"),drag_interval:k.data("dragInterval"),values:k.data("values"),from_fixed:k.data("fromFixed"),from_min:k.data("fromMin"),from_max:k.data("fromMax"),from_shadow:k.data("fromShadow"),to_fixed:k.data("toFixed"),to_min:k.data("toMin"),to_max:k.data("toMax"),to_shadow:k.data("toShadow"),prettify_enabled:k.data("prettifyEnabled"),prettify_separator:k.data("prettifySeparator"),force_edges:k.data("forceEdges"),keyboard:k.data("keyboard"),keyboard_step:k.data("keyboardStep"),grid:k.data("grid"),grid_margin:k.data("gridMargin"),grid_num:k.data("gridNum"),grid_snap:k.data("gridSnap"),hide_min_max:k.data("hideMinMax"),hide_from_to:k.data("hideFromTo"),prefix:k.data("prefix"),postfix:k.data("postfix"),max_postfix:k.data("maxPostfix"),decorate_both:k.data("decorateBoth"),values_separator:k.data("valuesSeparator"),input_values_separator:k.data("inputValuesSeparator"),disable:k.data("disable")},i.values=i.values&&i.values.split(",");for(j in i)i.hasOwnProperty(j)&&(i[j]!==e&&""!==i[j]||delete i[j]);l!==e&&""!==l&&(l=l.split(i.input_values_separator||f.input_values_separator||";"),l[0]&&l[0]==+l[0]&&(l[0]=+l[0]),l[1]&&l[1]==+l[1]&&(l[1]=+l[1]),f&&f.values&&f.values.length?(h.from=l[0]&&f.values.indexOf(l[0]),h.to=l[1]&&f.values.indexOf(l[1])):(h.from=l[0]&&+l[0],h.to=l[1]&&+l[1])),a.extend(h,f),a.extend(h,i),this.options=h,this.update_check={},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='';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"):dthis.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_real100&&(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 b<0?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.$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.writeToInput(),this.old_from===this.result.from&&this.old_to===this.result.to||this.is_start||(this.$cache.input.trigger("change"),this.$cache.input.trigger("input")),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_first_update)&&(this.is_key=!1,this.is_click=!1,this.is_first_update=!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_left100-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.target||(this.$cache.from[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"),f100-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")},writeToInput:function(){"single"===this.options.type?(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.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))},callOnStart:function(){this.writeToInput(),this.options.onStart&&"function"==typeof this.options.onStart&&this.options.onStart(this.result)},callOnChange:function(){this.writeToInput(),this.options.onChange&&"function"==typeof this.options.onChange&&this.options.onChange(this.result)},callOnFinish:function(){this.writeToInput(),this.options.onFinish&&"function"==typeof this.options.onFinish&&this.options.onFinish(this.result)},callOnUpdate:function(){this.writeToInput(),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),d<0&&(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),jthis.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-df.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),dc&&(d=c),this.convertToPercent(d)},toFixed:function(a){return a=a.toFixed(20),+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?(a<0?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.maxc.max&&(c.from=c.max)):(c.fromc.max&&(c.from=c.max),c.toc.max&&(c.to=c.max),this.update_check.from&&(this.update_check.from!==c.from&&c.from>c.to&&(c.from=c.to),this.update_check.to!==c.to&&c.toc.to&&(c.from=c.to),c.toc.from_max&&(c.from=c.from_max),"number"==typeof c.to_min&&c.toc.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.fromd.max)&&(d.from=c.from),(d.tod.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;a100&&(j=100,c-=2,c<0&&(c=0)),this.coords.big[a]=j,d=(j-i*(a-1))/(c+1),b=1;b<=c&&0!==j;b++)l=this.toFixed(j-d*b),m+='';m+='',e=this.convertToValue(j),e=f.values.length?f.p_values[e]:this._prettify(e),m+=''+e+""}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;b100+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;a=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.update_check.from=this.result.from,this.update_check.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;d0&&(b=e.exec(c).toString(),b=b.split(" ")[1],b<9)&&(a("html").addClass("lt-ie9"),!0)}();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);c!",k[0]),i={type:k.data("type"),min:k.data("min"),max:k.data("max"),from:k.data("from"),to:k.data("to"),step:k.data("step"),min_interval:k.data("minInterval"),max_interval:k.data("maxInterval"),drag_interval:k.data("dragInterval"),values:k.data("values"),from_fixed:k.data("fromFixed"),from_min:k.data("fromMin"),from_max:k.data("fromMax"),from_shadow:k.data("fromShadow"),to_fixed:k.data("toFixed"),to_min:k.data("toMin"),to_max:k.data("toMax"),to_shadow:k.data("toShadow"),prettify_enabled:k.data("prettifyEnabled"),prettify_separator:k.data("prettifySeparator"),force_edges:k.data("forceEdges"),keyboard:k.data("keyboard"),grid:k.data("grid"),grid_margin:k.data("gridMargin"),grid_num:k.data("gridNum"),grid_snap:k.data("gridSnap"),hide_min_max:k.data("hideMinMax"),hide_from_to:k.data("hideFromTo"),prefix:k.data("prefix"),postfix:k.data("postfix"),max_postfix:k.data("maxPostfix"),decorate_both:k.data("decorateBoth"),values_separator:k.data("valuesSeparator"),input_values_separator:k.data("inputValuesSeparator"),disable:k.data("disable"),block:k.data("block"),extra_classes:k.data("extraClasses")},i.values=i.values&&i.values.split(",");for(j in i)i.hasOwnProperty(j)&&(i[j]!==e&&""!==i[j]||delete i[j]);l!==e&&""!==l&&(l=l.split(i.input_values_separator||f.input_values_separator||";"),l[0]&&l[0]==+l[0]&&(l[0]=+l[0]),l[1]&&l[1]==+l[1]&&(l[1]=+l[1]),f&&f.values&&f.values.length?(h.from=l[0]&&f.values.indexOf(l[0]),h.to=l[1]&&f.values.indexOf(l[1])):(h.from=l[0]&&+l[0],h.to=l[1]&&+l[1])),a.extend(h,f),a.extend(h,i),this.options=h,this.update_check={},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='';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.input[0].disabled=!1,this.removeDisableMask(),this.bindEvents()),this.options.disable||(this.options.block?this.appendDisableMask():this.removeDisableMask()),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"):dthis.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_real100&&(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.result.from_pretty=this._prettify(this.result.from),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.from_pretty=this._prettify(this.result.from),this.result.to_percent=this.coords.p_to_real,this.result.to=this.convertToValue(this.coords.p_to_real),this.result.to_pretty=this._prettify(this.result.to),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 b<0?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.$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.writeToInput(),this.old_from===this.result.from&&this.old_to===this.result.to||this.is_start||(this.$cache.input.trigger("change"),this.$cache.input.trigger("input")),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,e,f=this.options.values.length,g=this.options.p_values;if(!this.options.hide_from_to)if("single"===this.options.type)f?(a=this.decorate(g[this.result.from]),this.$cache.single.html(a)):(d=this._prettify(this.result.from),a=this.decorate(d,this.result.from),this.$cache.single.html(a)),this.calcLabels(),this.labels.p_single_left100-this.labels.p_max-1?this.$cache.max[0].style.visibility="hidden":this.$cache.max[0].style.visibility="visible";else{f?(this.options.decorate_both?(a=this.decorate(g[this.result.from]),a+=this.options.values_separator,a+=this.decorate(g[this.result.to])):a=this.decorate(g[this.result.from]+this.options.values_separator+g[this.result.to]),b=this.decorate(g[this.result.from]),c=this.decorate(g[this.result.to]),this.$cache.single.html(a),this.$cache.from.html(b),this.$cache.to.html(c)):(d=this._prettify(this.result.from),e=this._prettify(this.result.to),this.options.decorate_both?(a=this.decorate(d,this.result.from),a+=this.options.values_separator,a+=this.decorate(e,this.result.to)):a=this.decorate(d+this.options.values_separator+e,this.result.to),b=this.decorate(d,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.calcLabels();var h=Math.min(this.labels.p_single_left,this.labels.p_from_left),i=this.labels.p_single_left+this.labels.p_single_fake,j=this.labels.p_to_left+this.labels.p_to_fake,k=Math.max(i,j);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.target||(this.$cache.from[0].style.visibility="visible"),this.$cache.single[0].style.visibility="hidden",k=j):(this.$cache.from[0].style.visibility="hidden",this.$cache.to[0].style.visibility="hidden",this.$cache.single[0].style.visibility="visible",k=Math.max(i,j))):(this.$cache.from[0].style.visibility="visible",this.$cache.to[0].style.visibility="visible",this.$cache.single[0].style.visibility="hidden"),h100-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")},writeToInput:function(){"single"===this.options.type?(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.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))},callOnStart:function(){this.writeToInput(),this.options.onStart&&"function"==typeof this.options.onStart&&(this.options.scope?this.options.onStart.call(this.options.scope,this.result):this.options.onStart(this.result))},callOnChange:function(){this.writeToInput(),this.options.onChange&&"function"==typeof this.options.onChange&&(this.options.scope?this.options.onChange.call(this.options.scope,this.result):this.options.onChange(this.result))},callOnFinish:function(){this.writeToInput(),this.options.onFinish&&"function"==typeof this.options.onFinish&&(this.options.scope?this.options.onFinish.call(this.options.scope,this.result):this.options.onFinish(this.result))},callOnUpdate:function(){this.writeToInput(),this.options.onUpdate&&"function"==typeof this.options.onUpdate&&(this.options.scope?this.options.onUpdate.call(this.options.scope,this.result):this.options.onUpdate(this.result)); +},toggleInput:function(){this.$cache.input.toggleClass("irs-hidden-input"),this.has_tab_index?this.$cache.input.prop("tabindex",-1):this.$cache.input.removeProp("tabindex"),this.has_tab_index=!this.has_tab_index},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),d<0&&(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),jthis.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-df.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),dc&&(d=c),this.convertToPercent(d)},toFixed:function(a){return a=a.toFixed(20),+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?(a<0?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.grid_num&&(c.grid_num=+c.grid_num),c.maxc.max&&(c.from=c.max)):(c.fromc.max&&(c.from=c.max),c.toc.max&&(c.to=c.max),this.update_check.from&&(this.update_check.from!==c.from&&c.from>c.to&&(c.from=c.to),this.update_check.to!==c.to&&c.toc.to&&(c.from=c.to),c.toc.from_max&&(c.from=c.from_max),"number"==typeof c.to_min&&c.toc.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.fromd.max)&&(d.from=c.from),(d.tod.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.result.from_pretty=this._prettify(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.result.to_pretty=this._prettify(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?g>50?(h=50/f.step,i=this.toFixed(f.step/.5)):(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;a100&&(j=100),this.coords.big[a]=j,d=(j-i*(a-1))/(c+1),b=1;b<=c&&0!==j;b++)l=this.toFixed(j-d*b),m+='';m+='',e=this.convertToValue(j),e=f.values.length?f.p_values[e]:this._prettify(e),m+=''+e+""}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;b100+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;a=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.update_check.from=this.result.from,this.update_check.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