1// Ion.RangeSlider | version 2.2.0 | https://github.com/IonDen/ion.rangeSlider 2; 3(function(f) { 4 "function" === typeof define && define.amd ? define(["jquery"], function(n) { 5 return f(n, document, window, navigator) 6 }) : "object" === typeof exports ? f(require("jquery"), document, window, navigator) : f(jQuery, document, window, navigator) 7})(function(f, n, k, r, p) { 8 var t = 0, 9 m = function() { 10 var a = r.userAgent, 11 b = /msie\s\d+/i; 12 return 0 < a.search(b) && (a = b.exec(a).toString(), a = a.split(" ")[1], 9 > a) ? (f("html").addClass("lt-ie9"), !0) : !1 13 }(); 14 Function.prototype.bind || (Function.prototype.bind = function(a) { 15 var b = this, 16 d = [].slice; 17 if ("function" != 18 typeof b) throw new TypeError; 19 var c = d.call(arguments, 1), 20 e = function() { 21 if (this instanceof e) { 22 var g = function() {}; 23 g.prototype = b.prototype; 24 var g = new g, 25 l = b.apply(g, c.concat(d.call(arguments))); 26 return Object(l) === l ? l : g 27 } 28 return b.apply(a, c.concat(d.call(arguments))) 29 }; 30 return e 31 }); 32 Array.prototype.indexOf || (Array.prototype.indexOf = function(a, b) { 33 if (null == this) throw new TypeError('"this" is null or not defined'); 34 var d = Object(this), 35 c = d.length >>> 0; 36 if (0 === c) return -1; 37 var e = +b || 0; 38 Infinity === Math.abs(e) && (e = 0); 39 if (e >= c) return -1; 40 for (e = Math.max(0 <= e ? e : c - Math.abs(e), 0); e < c;) { 41 if (e in d && d[e] === a) return e; 42 e++ 43 } 44 return -1 45 }); 46 var q = function(a, b, d) { 47 this.VERSION = "2.2.0"; 48 this.input = a; 49 this.plugin_count = d; 50 this.old_to = this.old_from = this.update_tm = this.calc_count = this.current_plugin = 0; 51 this.raf_id = this.old_min_interval = null; 52 this.no_diapason = this.force_redraw = this.dragging = !1; 53 this.has_tab_index = !0; 54 this.is_update = this.is_key = !1; 55 this.is_start = !0; 56 this.is_click = this.is_resize = this.is_active = this.is_finish = !1; 57 b = b || {}; 58 this.$cache = { 59 win: f(k), 60 body: f(n.body), 61 input: f(a), 62 cont: null, 63 rs: null, 64 min: null, 65 max: null, 66 from: null, 67 to: null, 68 single: null, 69 bar: null, 70 line: null, 71 s_single: null, 72 s_from: null, 73 s_to: null, 74 shad_single: null, 75 shad_from: null, 76 shad_to: null, 77 edge: null, 78 grid: null, 79 grid_labels: [] 80 }; 81 this.coords = { 82 x_gap: 0, 83 x_pointer: 0, 84 w_rs: 0, 85 w_rs_old: 0, 86 w_handle: 0, 87 p_gap: 0, 88 p_gap_left: 0, 89 p_gap_right: 0, 90 p_step: 0, 91 p_pointer: 0, 92 p_handle: 0, 93 p_single_fake: 0, 94 p_single_real: 0, 95 p_from_fake: 0, 96 p_from_real: 0, 97 p_to_fake: 0, 98 p_to_real: 0, 99 p_bar_x: 0, 100 p_bar_w: 0, 101 grid_gap: 0, 102 big_num: 0, 103 big: [], 104 big_w: [], 105 big_p: [], 106 big_x: [] 107 }; 108 this.labels = { 109 w_min: 0, 110 w_max: 0, 111 w_from: 0, 112 w_to: 0, 113 w_single: 0, 114 p_min: 0, 115 p_max: 0, 116 p_from_fake: 0, 117 p_from_left: 0, 118 p_to_fake: 0, 119 p_to_left: 0, 120 p_single_fake: 0, 121 p_single_left: 0 122 }; 123 var c = this.$cache.input; 124 a = c.prop("value"); 125 var e; 126 d = { 127 type: "single", 128 min: 10, 129 max: 100, 130 from: null, 131 to: null, 132 step: 1, 133 min_interval: 0, 134 max_interval: 0, 135 drag_interval: !1, 136 values: [], 137 p_values: [], 138 from_fixed: !1, 139 from_min: null, 140 from_max: null, 141 from_shadow: !1, 142 to_fixed: !1, 143 to_min: null, 144 to_max: null, 145 to_shadow: !1, 146 prettify_enabled: !0, 147 prettify_separator: " ", 148 prettify: null, 149 force_edges: !1, 150 keyboard: !0, 151 grid: !1, 152 grid_margin: !0, 153 grid_num: 4, 154 grid_snap: !1, 155 hide_min_max: !1, 156 hide_from_to: !1, 157 prefix: "", 158 postfix: "", 159 max_postfix: "", 160 decorate_both: !0, 161 values_separator: " \u2014 ", 162 input_values_separator: ";", 163 disable: !1, 164 block: !1, 165 extra_classes: "", 166 scope: null, 167 onStart: null, 168 onChange: null, 169 onFinish: null, 170 onUpdate: null 171 }; 172 "INPUT" !== c[0].nodeName && console && console.warn && console.warn("Base element should be <input>!", c[0]); 173 c = { 174 type: c.data("type"), 175 min: c.data("min"), 176 max: c.data("max"), 177 from: c.data("from"), 178 to: c.data("to"), 179 step: c.data("step"), 180 min_interval: c.data("minInterval"), 181 max_interval: c.data("maxInterval"), 182 drag_interval: c.data("dragInterval"), 183 values: c.data("values"), 184 from_fixed: c.data("fromFixed"), 185 from_min: c.data("fromMin"), 186 from_max: c.data("fromMax"), 187 from_shadow: c.data("fromShadow"), 188 to_fixed: c.data("toFixed"), 189 to_min: c.data("toMin"), 190 to_max: c.data("toMax"), 191 to_shadow: c.data("toShadow"), 192 prettify_enabled: c.data("prettifyEnabled"), 193 prettify_separator: c.data("prettifySeparator"), 194 force_edges: c.data("forceEdges"), 195 keyboard: c.data("keyboard"), 196 grid: c.data("grid"), 197 grid_margin: c.data("gridMargin"), 198 grid_num: c.data("gridNum"), 199 grid_snap: c.data("gridSnap"), 200 hide_min_max: c.data("hideMinMax"), 201 hide_from_to: c.data("hideFromTo"), 202 prefix: c.data("prefix"), 203 postfix: c.data("postfix"), 204 max_postfix: c.data("maxPostfix"), 205 decorate_both: c.data("decorateBoth"), 206 values_separator: c.data("valuesSeparator"), 207 input_values_separator: c.data("inputValuesSeparator"), 208 disable: c.data("disable"), 209 block: c.data("block"),
210 extra_classes: c.data("extraClasses") 211 }; 212 c.values = c.values && c.values.split(","); 213 for (e in c) c.hasOwnProperty(e) && (c[e] !== p && "" !== c[e] || delete c[e]); 214 a !== p && "" !== a && (a = a.split(c.input_values_separator || b.input_values_separator || ";"), a[0] && a[0] == +a[0] && (a[0] = +a[0]), a[1] && a[1] == +a[1] && (a[1] = +a[1]), b && b.values && b.values.length ? (d.from = a[0] && b.values.indexOf(a[0]), d.to = a[1] && b.values.indexOf(a[1])) : (d.from = a[0] && +a[0], d.to = a[1] && +a[1])); 215 f.extend(d, b); 216 f.extend(d, c); 217 this.options = d; 218 this.update_check = {}; 219 this.validate(); 220 this.result = { 221 input: this.$cache.input, 222 slider: null, 223 min: this.options.min, 224 max: this.options.max, 225 from: this.options.from, 226 from_percent: 0, 227 from_value: null, 228 to: this.options.to, 229 to_percent: 0, 230 to_value: null 231 }; 232 this.init() 233 }; 234 q.prototype = { 235 init: function(a) { 236 this.no_diapason = !1; 237 this.coords.p_step = this.convertToPercent(this.options.step, !0); 238 this.target = "base"; 239 this.toggleInput(); 240 this.append(); 241 this.setMinMax(); 242 a ? (this.force_redraw = !0, this.calc(!0), this.callOnUpdate()) : (this.force_redraw = !0, this.calc(!0), this.callOnStart()); 243 this.updateScene() 244 }, 245 append: function() { 246 this.$cache.input.before('<span class="irs js-irs-' + 247 this.plugin_count + " " + this.options.extra_classes + '"></span>'); 248 this.$cache.input.prop("readonly", !0); 249 this.$cache.cont = this.$cache.input.prev(); 250 this.result.slider = this.$cache.cont; 251 this.$cache.cont.html('<span class="irs"><span class="irs-line" tabindex="0"><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>');
252 this.$cache.rs = this.$cache.cont.find(".irs"); 253 this.$cache.min = this.$cache.cont.find(".irs-min"); 254 this.$cache.max = this.$cache.cont.find(".irs-max"); 255 this.$cache.from = this.$cache.cont.find(".irs-from"); 256 this.$cache.to = this.$cache.cont.find(".irs-to"); 257 this.$cache.single = this.$cache.cont.find(".irs-single"); 258 this.$cache.bar = this.$cache.cont.find(".irs-bar"); 259 this.$cache.line = this.$cache.cont.find(".irs-line"); 260 this.$cache.grid = this.$cache.cont.find(".irs-grid"); 261 "single" === this.options.type ? (this.$cache.cont.append('<span class="irs-bar-edge"></span><span class="irs-shadow shadow-single"></span><span class="irs-slider single"></span>'), 262 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('<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>'), this.$cache.s_from = this.$cache.cont.find(".from"), 263 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()); 264 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"); 265 this.appendGrid(); 266 this.options.disable ? (this.appendDisableMask(), this.$cache.input[0].disabled = !0) : (this.$cache.input[0].disabled = !1, this.removeDisableMask(), this.bindEvents()); 267 this.options.disable || (this.options.block ? this.appendDisableMask() : this.removeDisableMask()); 268 this.options.drag_interval && (this.$cache.bar[0].style.cursor = "ew-resize") 269 }, 270 setTopHandler: function() { 271 var a = this.options.max, 272 b = this.options.to; 273 this.options.from > this.options.min && b === a ? this.$cache.s_from.addClass("type_last") : b < a && this.$cache.s_to.addClass("type_last") 274 }, 275 changeLevel: function(a) { 276 switch (a) { 277 case "single": 278 this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_single_fake); 279 this.$cache.s_single.addClass("state_hover"); 280 break; 281 case "from": 282 this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_from_fake); 283 this.$cache.s_from.addClass("state_hover"); 284 this.$cache.s_from.addClass("type_last"); 285 this.$cache.s_to.removeClass("type_last"); 286 break; 287 case "to": 288 this.coords.p_gap = this.toFixed(this.coords.p_pointer - this.coords.p_to_fake); 289 this.$cache.s_to.addClass("state_hover"); 290 this.$cache.s_to.addClass("type_last"); 291 this.$cache.s_from.removeClass("type_last"); 292 break; 293 case "both": 294 this.coords.p_gap_left = this.toFixed(this.coords.p_pointer - 295 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") 296 } 297 }, 298 appendDisableMask: function() { 299 this.$cache.cont.append('<span class="irs-disable-mask"></span>'); 300 this.$cache.cont.addClass("irs-disabled") 301 }, 302 removeDisableMask: function() { 303 this.$cache.cont.remove(".irs-disable-mask"); 304 this.$cache.cont.removeClass("irs-disabled") 305 }, 306 remove: function() { 307 this.$cache.cont.remove(); 308 this.$cache.cont = 309 null; 310 this.$cache.line.off("keydown.irs_" + this.plugin_count); 311 this.$cache.body.off("touchmove.irs_" + this.plugin_count); 312 this.$cache.body.off("mousemove.irs_" + this.plugin_count); 313 this.$cache.win.off("touchend.irs_" + this.plugin_count); 314 this.$cache.win.off("mouseup.irs_" + this.plugin_count); 315 m && (this.$cache.body.off("mouseup.irs_" + this.plugin_count), this.$cache.body.off("mouseleave.irs_" + this.plugin_count)); 316 this.$cache.grid_labels = []; 317 this.coords.big = []; 318 this.coords.big_w = []; 319 this.coords.big_p = []; 320 this.coords.big_x = []; 321 cancelAnimationFrame(this.raf_id) 322 }, 323 bindEvents: function() { 324 if (!this.no_diapason) { 325 this.$cache.body.on("touchmove.irs_" + this.plugin_count, this.pointerMove.bind(this)); 326 this.$cache.body.on("mousemove.irs_" + this.plugin_count, this.pointerMove.bind(this)); 327 this.$cache.win.on("touchend.irs_" + this.plugin_count, this.pointerUp.bind(this)); 328 this.$cache.win.on("mouseup.irs_" + this.plugin_count, this.pointerUp.bind(this)); 329 this.$cache.line.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); 330 this.$cache.line.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click")); 331 this.$cache.line.on("focus.irs_" + this.plugin_count, this.pointerFocus.bind(this)); 332 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")), 333 this.$cache.bar.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"))); 334 "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, 335 "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_" + 336 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, 337 "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_" + 338 this.plugin_count, this.pointerClick.bind(this, "click"))); 339 if (this.options.keyboard) this.$cache.line.on("key
339down.irs_" + this.plugin_count, this.key.bind(this, "keyboard")); 340 m && (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))) 341 } 342 }, 343 pointerFocus: function(a) { 344 if (!this.target) { 345 var b = "single" === this.options.type ? this.$cache.single : this.$cache.from; 346 a = b.offset().left; 347 a += b.width() / 2 - 1; 348 this.pointerClick("single", { 349 preventDefault: function() {}, 350 pageX: a 351 }) 352 } 353 }, 354 pointerMove: function(a) { 355 this.dragging && (this.coords.x_pointer = (a.pageX || a.originalEvent.touches && a.originalEvent.touches[0].pageX) - this.coords.x_gap, this.calc()) 356 }, 357 pointerUp: function(a) { 358 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, m && f("*").prop("unselectable", !1), this.updateScene(), this.restoreOriginalMinInterval(), (f.contains(this.$cache.cont[0], 359 a.target) || this.dragging) && this.callOnFinish(), this.dragging = !1) 360 }, 361 pointerDown: function(a, b) { 362 b.preventDefault(); 363 var d = b.pageX || b.originalEvent.touches && b.originalEvent.touches[0].pageX; 364 2 !== b.button && ("both" === a && this.setTempMinInterval(), a || (a = this.target || "from"), this.current_plugin = this.plugin_count, this.target = a, this.dragging = this.is_active = !0, this.coords.x_gap = this.$cache.rs.offset().left, this.coords.x_pointer = d - this.coords.x_gap, this.calcPointerPercent(), this.changeLevel(a), m && f("*").prop("unselectable", 365 !0), this.$cache.line.trigger("focus"), this.updateScene()) 366 }, 367 pointerClick: function(a, b) { 368 b.preventDefault(); 369 var d = b.pageX || b.originalEvent.touches && b.originalEvent.touches[0].pageX; 370 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 = +(d - this.coords.x_gap).toFixed(), this.force_redraw = !0, this.calc(), this.$cache.line.trigger("focus")) 371 }, 372 key: function(a, b) { 373 if (!(this.current_plugin !== this.plugin_count || b.altKey || 374 b.ctrlKey || b.shiftKey || b.metaKey)) { 375 switch (b.which) { 376 case 83: 377 case 65: 378 case 40: 379 case 37: 380 b.preventDefault(); 381 this.moveByKey(!1); 382 break; 383 case 87: 384 case 68: 385 case 38: 386 case 39: 387 b.preventDefault(), this.moveByKey(!0) 388 } 389 return !0 390 } 391 }, 392 moveByKey: function(a) { 393 var b = this.coords.p_pointer, 394 d = (this.options.max - this.options.min) / 100, 395 d = this.options.step / d; 396 this.coords.x_pointer = this.toFixed(this.coords.w_rs / 100 * (a ? b + d : b - d)); 397 this.is_key = !0; 398 this.calc() 399 }, 400 setMinMax: function() { 401 if (this.options) 402 if (this.options.hide_min_max) this.$cache.min[0].style.display = 403 "none", this.$cache.max[0].style.display = "none"; 404 else { 405 if (this.options.values.length) this.$cache.min.html(format_money(this.options.p_values[this.options.min])), this.$cache.max.html(format_money(this.options.p_values[this.options.max])); 406 else { 407 var a = this._prettify(this.options.min), 408 b = this._prettify(this.options.max); 409 this.result.min_pretty = a; 410 this.result.max_pretty = b; 411 this.$cache.min.html(format_money(this.options.min)); 412 this.$cache.max.html(format_money(this.options.max)) 413 414 // this.$cache.min.html(this.decorate(a, this.options.min)); 415 // this.$cache.max.html(format_money( this.options.max)) 416 } 417 this.labels.w_min = this.$cache.min.outerWidth(!1); 418 this.labels.w_max = this.$cache.max.outerWidth(!1) 419 } 420 }, 421 setTempMinInterval: function() { 422 var a = this.result.to - this.result.from; 423 null === this.old_min_interval && (this.old_min_interval = this.options.min_interval); 424 this.options.min_interval = a 425 }, 426 restoreOriginalMinInterval: function() { 427 null !== this.old_min_interval && (this.options.min_interval = this.old_min_interval, this.old_min_interval = null) 428 }, 429 calc: function(a) { 430 if (this.options) { 431 this.calc_count++; 432 if (10 === this.calc_count || a) this.calc_count = 0, this.coords.w_rs = this.$cache.rs.outerWidth(!1), 433 this.calcHandlePercent(); 434 if (this.coords.w_rs) { 435 this.calcPointerPercent();
436 a = this.getHandleX(); 437 "both" === this.target && (this.coords.p_gap = 0, a = this.getHandleX()); 438 "click" === this.target && (this.coords.p_gap = this.coords.p_handle / 2, a = this.getHandleX(), this.target = this.options.drag_interval ? "both_one" : this.chooseHandle(a)); 439 switch (this.target) { 440 case "base": 441 var b = (this.options.max - this.options.min) / 100; 442 a = (this.result.from - this.options.min) / b; 443 b = (this.result.to - this.options.min) / b; 444 this.coords.p_single_real = this.toFixed(a); 445 this.coords.p_from_real = this.toFixed(a); 446 this.coords.p_to_real = this.toFixed(b); 447 this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max); 448 this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max); 449 this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max); 450 this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real); 451 this.coords.p_from_fake = 452 this.convertToFakePercent(this.coords.p_from_real); 453 this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real); 454 this.target = null; 455 break; 456 case "single": 457 if (this.options.from_fixed) break; 458 this.coords.p_single_real = this.convertToRealPercent(a); 459 this.coords.p_single_real = this.calcWithStep(this.coords.p_single_real); 460 this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max); 461 this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real); 462 break; 463 case "from": 464 if (this.options.from_fixed) break; 465 this.coords.p_from_real = this.convertToRealPercent(a); 466 this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real); 467 this.coords.p_from_real > this.coords.p_to_real && (this.coords.p_from_real = this.coords.p_to_real); 468 this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max); 469 this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from"); 470 this.coords.p_from_real = 471 this.checkMaxInterval(this.coords.p_from_real, this.coords.p_to_real, "from"); 472 this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real); 473 break; 474 case "to": 475 if (this.options.to_fixed) break; 476 this.coords.p_to_real = this.convertToRealPercent(a); 477 this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real); 478 this.coords.p_to_real < this.coords.p_from_real && (this.coords.p_to_real = this.coords.p_from_real); 479 this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max); 480 this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to"); 481 this.coords.p_to_real = this.checkMaxInterval(this.coords.p_to_real, this.coords.p_from_real, "to"); 482 this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real); 483 break; 484 case "both": 485 if (this.options.from_fixed || this.options.to_fixed) break; 486 a = this.toFixed(a + .001 * this.coords.p_handle); 487 this.coords.p_from_real = this.convertToRealPercent(a) - this.coords.p_gap_left; 488 this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real); 489 this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max); 490 this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from"); 491 this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real); 492 this.coords.p_to_real = this.convertToRealPercent(a) + this.coords.p_gap_right; 493 this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real); 494 this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, 495 this.options.to_max); 496 this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to"); 497 this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real); 498 break; 499 case "both_one": 500 if (!this.options.from_fixed && !this.options.to_fixed) { 501 var d = this.convertToRealPercent(a); 502 a = this.result.to_percent - this.result.from_percent; 503 var c = a / 2, 504 b = d - c, 505 d = d + c; 506 0 > b && (b = 0, d = b + a);
507 100 < d && (d = 100, b = d - a); 508 this.coords.p_from_real = this.calcWithStep(b); 509 this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, 510 this.options.from_min, this.options.from_max); 511 this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real); 512 this.coords.p_to_real = this.calcWithStep(d); 513 this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max); 514 this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real) 515 } 516 } 517 "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, 518 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 = 519 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])); 520 this.calcMinMax(); 521 this.calcLabels() 522 } 523 } 524 }, 525 calcPointerPercent: function() { 526 this.coords.w_rs ? (0 > this.coords.x_pointer || isNaN(this.coords.x_pointer) ? this.coords.x_pointer = 527 0 : this.coords.x_pointer > this.coords.w_rs && (this.coords.x_pointer = this.coords.w_rs), this.coords.p_pointer = this.toFixed(this.coords.x_pointer / this.coords.w_rs * 100)) : this.coords.p_pointer = 0 528 }, 529 convertToRealPercent: function(a) { 530 return a / (100 - this.coords.p_handle) * 100 531 }, 532 convertToFakePercent: function(a) { 533 return a / 100 * (100 - this.coords.p_handle) 534 }, 535 getHandleX: function() { 536 var a = 100 - this.coords.p_handle, 537 b = this.toFixed(this.coords.p_pointer - this.coords.p_gap); 538 0 > b ? b = 0 : b > a && (b = a); 539 return b 540 }, 541 calcHandlePercent: function() { 542 this.coords.w_handle = 543 "single" === this.options.type ? this.$cache.s_single.outerWidth(!1) : this.$cache.s_from.outerWidth(!1); 544 this.coords.p_handle = this.toFixed(this.coords.w_handle / this.coords.w_rs * 100) 545 }, 546 chooseHandle: function(a) { 547 return "single" === this.options.type ? "single" : a >= this.coords.p_from_real + (this.coords.p_to_real - this.coords.p_from_real) / 2 ? this.options.to_fixed ? "from" : "to" : this.options.from_fixed ? "to" : "from" 548 }, 549 calcMinMax: function() { 550 this.coords.w_rs && (this.labels.p_min = this.labels.w_min / this.coords.w_rs * 100, this.labels.p_max = 551 this.labels.w_max / this.coords.w_rs * 100) 552 }, 553 calcLabels: function() { 554 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.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 = 555 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 = 556 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)) 557 }, 558 updateScene: function() { 559 this.raf_id && 560 (cancelAnimationFrame(this.raf_id), this.raf_id = null); 561 clearTimeout(this.update_tm); 562 this.update_tm = null; 563 this.options && (this.drawHandles(), this.is_active ? this.raf_id = requestAnimationFrame(this.updateScene.bind(this)) : this.update_tm = setTimeout(this.updateScene.bind(this), 300)) 564 }, 565 drawHandles: function() { 566 this.coords.w_rs = this.$cache.rs.outerWidth(!1); 567 if (this.coords.w_rs) { 568 this.coords.w_rs !== this.coords.w_rs_old && (this.target = "base", this.is_resize = !0); 569 if (this.coords.w_rs !== this.coords.w_rs_old || this.force_redraw) this.setMinMax(), 570 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(); 571 if (this.coords.w_rs && (this.dragging || this.force_redraw || this.is_key)) { 572 if (this.old_from !== this.result.from || this.old_to !== this.result.to || this.force_redraw || this.is_key) { 573 this.drawLabels(); 574 this.$cache.bar[0].style.left = this.coords.p_bar_x + "%"; 575 this.$cache.bar[0].style.width = this.coords.p_bar_w + "%"; 576 if ("single" === this.options.type) this.$cache.s_single[0].style.left = 577 this.coords.p_single_fake + "%"; 578 else { 579 this.$cache.s_from[0].style.left = this.coords.p_from_fake + "%"; 580 this.$cache.s_to[0].style.left = this.coords.p_to_fake + "%"; 581 if (this.old_from !== this.result.from || this.force_redraw) this.$cache.from[0].style.left = this.labels.p_from_left + "%"; 582 if (this.old_to !== this.result.to || this.force_redraw) this.$cache.to[0].style.left = this.labels.p_to_left + "%" 583 } 584 this.$cache.single[0].style.left = this.labels.p_single_left + "%"; 585 this.writeToInput(); 586 this.old_from === this.result.from && this.old_to === 587 this.result.to || this.is_start || (this.$cache.input.trigger("change"), this.$cache.input.trigger("input")); 588 this.old_from = this.result.from; 589 this.old_to = this.result.to; 590 this.is_resize || this.is_update || this.is_start || this.is_finish || this.callOnChange(); 591 if (this.is_key || this.is_click) this.is_click = this.is_key = !1, this.callOnFinish(); 592 this.is_finish = this.is_resize = this.is_update = !1 593 } 594 this.force_redraw = this.is_click = this.is_key = this.is_start = !1 595 } 596 } 597 }, 598 drawLabels: function() { 599 if (this.options) { 600 var a = this.options.values.length, 601 b = this.options.p_values; 602 if (!this.options.hide_from_to) 603 if ("single" === this.options.type) { 604 if (a) a = format_money(b[this.result.from]); 605 else { 606 var d = this._prettify(this.result.from); 607 a = format_money(this.result.from) 608 } 609 this.$cache.single.html(a); 610 this.calcLabels(); 611 this.$cache.min[0].style.visibility = this.labels.p_single_left < this.labels.p_min + 1 ? "hidden" : "visible"; 612 this.$cache.max[0].style.visibility = this.labels.p_single_left + this.labels.p_single_fake > 100 - this.labels.p_max - 1 ? "hidden" : "visible" 613 } else { 614 a ? (this.options.decorate_both ? 615 (a = format_money(b[this.result.from]), a += this.options.values_separator, a += format_money(b[this.result.to])) : a = format_money(b[this.result.from] + this.options.values_separator + b[this.result.to]), d = format_money(b[this.result.from]), b = format_money(b[this.result.to])) : (d = this._prettify(this.result.from), b = this._prettify(this.result.to), this.options.decorate_both ? (a = format_money( this.result.from), a += this.options.values_separator, a += format_money( this.result.to)) : a = this.decorate(d + this.options.values_separator + 616 b, this.result.to), d = format_money( this.result.from), b = format_money( this.result.to)); 617 this.$cache.single.html(a); 618 this.$cache.from.html(d); 619 this.$cache.to.html(b); 620 this.calcLabels(); 621 a = Math.min(this.labels.p_single_left, this.labels.p_from_left); 622 d = this.labels.p_single_left + this.labels.p_single_fake; 623 var b = this.labels.p_to_left + this.labels.p_to_fake, 624 c = Math.max(d, b); 625 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 = 626 "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", c = b) : (this.$cache.from[0].style.visibility = "hidden", this.$cache.to[0].style.visibility = "hidden", this.$cache.single[0].style.visibility = "visible", c = Math.max(d, b))) : (this.$cache.from[0].style.visibility = 627 "visible", this.$cache.to[0].style.visibility = "visible", this.$cache.single[0].style.visibility = "hidden"); 628 this.$cache.min[0].style.visibility = a < this.labels.p_min + 1 ? "hidden" : "visible"; 629 this.$cache.max[0].style.visibility = c > 100 - this.labels.p_max - 1 ? "hidden" : "visible" 630 } 631 } 632 }, 633 drawShadow: function() { 634 var a = this.options, 635 b = this.$cache, 636 d = "number" === typeof a.from_min && !isNaN(a.from_min), 637 c = "number" === typeof a.from_max && !isNaN(a.from_max), 638 e = "number" === typeof a.to_min && !isNaN(a.to_min), 639 g = "number" === typeof a.to_max && !isNaN(a.to_max); 640 "single" === a.type ? a.from_shadow && (d || c) ? (d = this.convertToPercent(d ? a.from_min : a.min), c = this.convertToPercent(c ? a.from_max : a.max) - d, d = this.toFixed(d - this.coords.p_handle / 100 * d), c = this.toFixed(c - this.coords.p_handle / 100 * c), d += this.coords.p_handle / 2, b.shad_single[0].style.display = "block", b.shad_single[0].style.left = d + "%", b.shad_single[0].style.width = c + "%") : b.shad_single[0].style.display = "none" : (a.from_shadow && (d || c) ? (d = this.convertToPercent(d ? a.from_min : a.min), c = this.convertToPercent(c ? a.from_max : a.max) - 641 d, d = this.toFixed(d - this.coords.p_handle / 100 * d), c = this.toFixed(c - this.coords.p_handle / 100 * c), d += this.coords.p_handle / 2, b.shad_from[0].style.display = "block", b.shad_from[0].style.left = d + "%", b.shad_from[0].style.width = c + "%") : b.shad_from[0].style.display = "none", a.to_shadow && (e || g) ? (e = this.convertToPercent(e ? a.to_min : a.min), a = this.convertToPercent(g ? a.to_max : a.max) - e, e = this.toFixed(e - this.coords.p_handle / 100 * e), a = this.toFixed(a - this.coords.p_handle / 100 * a), e += this.coords.p_handle / 2, b.shad_to[0].style.display = 642 "block", b.shad_to[0].style.left = e + "%", b.shad_to[0].style.width = a + "%") : b.shad_to[0].style.display = "none") 643 },
644 writeToInput: function() { 645 "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", 646 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)) 647 }, 648 callOnStart: function() { 649 this.writeToInput(); 650 if (this.options.onStart && "function" === typeof this.options.onStart) 651 if (this.options.scope) this.options.onStart.call(this.options.scope, this.result); 652 else this.options.onStart(this.result) 653 }, 654 callOnChange: function() { 655 this.writeToInput(); 656 if (this.options.onChange && "function" === typeof this.options.onChange) 657 if (this.options.scope) this.options.onChange.call(this.options.scope, 658 this.result); 659 else this.options.onChange(this.result) 660 }, 661 callOnFinish: function() { 662 this.writeToInput(); 663 if (this.options.onFinish && "function" === typeof this.options.onFinish) 664 if (this.options.scope) this.options.onFinish.call(this.options.scope, this.result); 665 else this.options.onFinish(this.result) 666 }, 667 callOnUpdate: function() { 668 this.writeToInput(); 669 if (this.options.onUpdate && "function" === typeof this.options.onUpdate) 670 if (this.options.scope) this.options.onUpdate.call(this.options.scope, this.result); 671 else this.options.onUpdate(this.result) 672 }, 673 toggleInput: function() { 674 this.$cache.input.toggleClass("irs-hidden-input"); 675 this.has_tab_index ? this.$cache.input.prop("tabindex", -1) : this.$cache.input.removeProp("tabindex"); 676 this.has_tab_index = !this.has_tab_index 677 }, 678 convertToPercent: function(a, b) { 679 var d = this.options.max - this.options.min; 680 return d ? this.toFixed((b ? a : a - this.options.min) / (d / 100)) : (this.no_diapason = !0, 0) 681 }, 682 convertToValue: function(a) { 683 var b = this.options.min, 684 d = this.options.max, 685 c = b.toString().split(".")[1], 686 e = d.toString().split(".")[1], 687 g, l, f = 0, 688 h = 0; 689 if (0 === a) return this.options.min; 690 if (100 === a) return this.options.max; 691 c && (f = g = c.length); 692 e && (f = l = e.length); 693 g && l && (f = g >= l ? g : l); 694 0 > b && (h = Math.abs(b), b = +(b + h).toFixed(f), d = +(d + h).toFixed(f)); 695 a = (d - b) / 100 * a + b; 696 (b = this.options.step.toString().split(".")[1]) ? a = +a.toFixed(b.length): (a /= this.options.step, a *= this.options.step, a = +a.toFixed(0)); 697 h && (a -= h); 698 h = b ? +a.toFixed(b.length) : this.toFixed(a); 699 h < this.options.min ? h = this.options.min : h > this.options.max && (h = this.options.max); 700 return h 701 }, 702 calcWithStep: function(a) { 703 var b = 704 Math.round(a / this.coords.p_step) * this.coords.p_step; 705 100 < b && (b = 100); 706 100 === a && (b = 100); 707 return this.toFixed(b) 708 }, 709 checkMinInterval: function(a, b, d) { 710 var c = this.options; 711 if (!c.min_interval) return a; 712 a = this.convertToValue(a); 713 b = this.convertToValue(b); 714 "from" === d ? b - a < c.min_interval && (a = b - c.min_interval) : a - b < c.min_interval && (a = b + c.min_interval); 715 return this.convertToPercent(a) 716 }, 717 checkMaxInterval: function(a, b, d) { 718 var c = this.options; 719 if (!c.max_interval) return a; 720 a = this.convertToValue(a); 721 b = this.convertToValue(b); 722 "from" === 723 d ? b - a > c.max_interval && (a = b - c.max_interval) : a - b > c.max_interval && (a = b + c.max_interval); 724 return this.convertToPercent(a) 725 }, 726 checkDiapason: function(a, b, d) { 727 a = this.convertToValue(a); 728 var c = this.options; 729 "number" !== typeof b && (b = c.min); 730 "number" !== typeof d && (d = c.max); 731 a < b && (a = b); 732 a > d && (a = d); 733 return this.convertToPercent(a) 734 }, 735 toFixed: function(a) { 736 a = a.toFixed(20); 737 return +a 738 }, 739 _prettify: function(a) { 740 return this.options.prettify_enabled ? this.options.prettify && "function" === typeof this.options.prettify ? this.options.prettify(a) : 741 this.prettify(a) : a 742 }, 743 prettify: function(a) { 744 return a.toString().replace(/(\d{1,3}(?=(?:\d\d\d)+(?!\d)))/g, "$1" + this.options.prettify_separator) 745 }, 746 checkEdges: function(a, b) { 747 if (!this.options.force_edges) return this.toFixed(a); 748 0 > a ? a = 0 : a > 100 - b && (a = 100 - b); 749 return this.toFixed(a) 750 }, 751 validate: function() { 752 var a = this.options, 753 b = this.result, 754 d = a.values, 755 c = d.length, 756 e; 757 "string" === typeof a.min && (a.min = +a.min); 758 "string" === typeof a.max && (a.max = +a.max); 759 "string" === typeof a.from && (a.from = +a.from); 760 "string" === typeof a.to && (a.to = +a.to);
761 "string" === typeof a.step && (a.step = +a.step); 762 "string" === typeof a.from_min && (a.from_min = +a.from_min); 763 "string" === typeof a.from_max && (a.from_max = +a.from_max); 764 "string" === typeof a.to_min && (a.to_min = +a.to_min); 765 "string" === typeof a.to_max && (a.to_max = +a.to_max); 766 "string" === typeof a.grid_num && (a.grid_num = +a.grid_num); 767 a.max < a.min && (a.max = a.min); 768 if (c) 769 for (a.p_values = [], a.min = 0, a.max = c - 1, a.step = 1, a.grid_num = a.max, a.grid_snap = !0, e = 0; e < c; e++) { 770 var g = +d[e]; 771 isNaN(g) ? g = d[e] : (d[e] = g, g = this._prettify(g)); 772 a.p_values.push(g) 773 } 774 if ("number" !== 775 typeof a.from || isNaN(a.from)) a.from = a.min; 776 if ("number" !== typeof a.to || isNaN(a.to)) a.to = a.max; 777 "single" === a.type ? (a.from < a.min && (a.from = a.min), a.from > a.max && (a.from = a.max)) : (a.from < a.min && (a.from = a.min), a.from > a.max && (a.from = a.max), a.to < a.min && (a.to = a.min), a.to > a.max && (a.to = a.max), this.update_check.from && (this.update_check.from !== a.from && a.from > a.to && (a.from = a.to), this.update_check.to !== a.to && a.to < a.from && (a.to = a.from)), a.from > a.to && (a.from = a.to), a.to < a.from && (a.to = a.from)); 778 if ("number" !== typeof a.step || 779 isNaN(a.step) || !a.step || 0 > a.step) a.step = 1; 780 "number" === typeof a.from_min && a.from < a.from_min && (a.from = a.from_min); 781 "number" === typeof a.from_max && a.from > a.from_max && (a.from = a.from_max); 782 "number" === typeof a.to_min && a.to < a.to_min && (a.to = a.to_min); 783 "number" === typeof a.to_max && a.from > a.to_max && (a.to = a.to_max); 784 if (b) { 785 b.min !== a.min && (b.min = a.min); 786 b.max !== a.max && (b.max = a.max); 787 if (b.from < b.min || b.from > b.max) b.from = a.from; 788 if (b.to < b.min || b.to > b.max) b.to = a.to 789 } 790 if ("number" !== typeof a.min_interval || isNaN(a.min_interval) || 791 !a.min_interval || 0 > a.min_interval) a.min_interval = 0; 792 if ("number" !== typeof a.max_interval || isNaN(a.max_interval) || !a.max_interval || 0 > a.max_interval) a.max_interval = 0; 793 a.min_interval && a.min_interval > a.max - a.min && (a.min_interval = a.max - a.min); 794 a.max_interval && a.max_interval > a.max - a.min && (a.max_interval = a.max - a.min) 795 }, 796 decorate: function(a, b) { 797 var d = "", 798 c = this.options; 799 c.prefix && (d += c.prefix); 800 d += a; 801 c.max_postfix && (c.values.length && a === c.p_values[c.max] ? (d += c.max_postfix, c.postfix && (d += " ")) : b === c.max && (d += c.max_postfix, 802 c.postfix && (d += " "))); 803 c.postfix && (d += c.postfix); 804 return d 805 }, 806 updateFrom: function() { 807 this.result.from = this.options.from; 808 this.result.from_percent = this.convertToPercent(this.result.from); 809 this.result.from_pretty = this._prettify(this.result.from); 810 this.options.values && (this.result.from_value = this.options.values[this.result.from]) 811 }, 812 updateTo: function() { 813 this.result.to = this.options.to; 814 this.result.to_percent = this.convertToPercent(this.result.to); 815 this.result.to_pretty = this._prettify(this.result.to); 816 this.options.values && 817 (this.result.to_value = this.options.values[this.result.to]) 818 }, 819 updateResult: function() { 820 this.result.min = this.options.min; 821 this.result.max = this.options.max; 822 this.updateFrom(); 823 this.updateTo() 824 }, 825 appendGrid: function() { 826 if (this.options.grid) { 827 var a = this.options, 828 b; 829 var d = a.max - a.min; 830 var c = a.grid_num, 831 e = 4, 832 g = ""; 833 this.calcGridMargin(); 834 if (a.grid_snap) 835 if (50 < d) { 836 c = 50 / a.step; 837 var f = this.toFixed(a.step / .5) 838 } else c = d / a.step, f = this.toFixed(a.step / (d / 100)); 839 else f = this.toFixed(100 / c); 840 4 < c && (e = 3); 841 7 < c && (e = 2); 842 14 < c && (e = 1); 843 28 < c && (e = 0); 844 for (d = 0; d < c + 1; d++) { 845 var k = e; 846 var h = this.toFixed(f * d); 847 100 < h && (h = 100); 848 this.coords.big[d] = h;
849 var m = (h - f * (d - 1)) / (k + 1); 850 for (b = 1; b <= k && 0 !== h; b++) { 851 var n = this.toFixed(h - m * b); 852 g += '<span class="irs-grid-pol small" style="left: ' + n + '%"></span>' 853 } 854 g += '<span class="irs-grid-pol" style="left: ' + h + '%"></span>'; 855 b = this.convertToValue(h); 856 b = a.values.length ? a.p_values[b] : this._prettify(b); 857 g += '<span class="irs-grid-text js-grid-text-' + d + '" style="left: ' + h + '%">' + b + "</span>" 858 } 859 this.coords.big_num = Math.ceil(c + 1); 860 this.$cache.cont.addClass("irs-with-grid"); 861 this.$cache.grid.html(g); 862 this.cacheGridLabels() 863 } 864 }, 865 cacheGridLabels: function() { 866 var a, b = this.coords.big_num; 867 for (a = 0; a < b; a++) { 868 var d = this.$cache.grid.find(".js-grid-text-" + a); 869 this.$cache.grid_labels.push(d) 870 } 871 this.calcGridLabels() 872 }, 873 calcGridLabels: function() { 874 var a; 875 var b = []; 876 var d = [], 877 c = this.coords.big_num; 878 for (a = 0; a < c; 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] / 879 2), b[a] = this.toFixed(this.coords.big[a] - this.coords.big_x[a]), d[a] = this.toFixed(b[a] + this.coords.big_p[a]); 880 this.options.force_edges && (b[0] < -this.coords.grid_gap && (b[0] =
880-this.coords.grid_gap, d[0] = this.toFixed(b[0] + this.coords.big_p[0]), this.coords.big_x[0] = this.coords.grid_gap), d[c - 1] > 100 + this.coords.grid_gap && (d[c - 1] = 100 + this.coords.grid_gap, b[c - 1] = this.toFixed(d[c - 1] - this.coords.big_p[c - 1]), this.coords.big_x[c - 1] = this.toFixed(this.coords.big_p[c - 1] - this.coords.grid_gap))); 881 this.calcGridCollision(2, 882 b, d); 883 this.calcGridCollision(4, b, d); 884 for (a = 0; a < c; a++) b = this.$cache.grid_labels[a][0], this.coords.big_x[a] !== Number.POSITIVE_INFINITY && (b.style.marginLeft = -this.coords.big_x[a] + "%") 885 }, 886 calcGridCollision: function(a, b, d) { 887 var c, e = this.coords.big_num; 888 for (c = 0; c < e; c += a) { 889 var g = c + a / 2; 890 if (g >= e) break; 891 var f = this.$cache.grid_labels[g][0]; 892 f.style.visibility = d[c] <= b[g] ? "visible" : "hidden" 893 } 894 }, 895 calcGridMargin: function() { 896 this.options.grid_margin && (this.coords.w_rs = this.$cache.rs.outerWidth(!1), this.coords.w_rs && (this.coords.w_handle = 897 "single" === this.options.type ? this.$cache.s_single.outerWidth(!1) : 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[
8970].style.width = this.toFixed(100 - this.coords.p_handle) + "%", this.$cache.grid[0].style.left = this.coords.grid_gap + "%")) 898 }, 899 update: function(a) { 900 this.input && (this.is_update = !0, this.options.from = this.result.from, this.options.to = this.result.to, this.update_check.from = 901 this.result.from, this.update_check.to = this.result.to, this.options = f.extend(this.options, a), this.validate(), this.updateResult(a), this.toggleInput(), this.remove(), this.init(!0)) 902 }, 903 reset: function() { 904 this.input && (this.updateResult(), this.update()) 905 }, 906 destroy: function() { 907 this.input && (this.toggleInput(), this.$cache.input.prop("readonly", !1), f.data(this.input, "ionRangeSlider", null), this.remove(), this.options = this.input = null) 908 } 909 }; 910 f.fn.ionRangeSlider = function(a) { 911 return this.each(function() { 912 f.data(this, "ionRangeSlider") || 913 f.data(this, "ionRangeSlider", new q(this, a, t++)) 914 }) 915 }; 916 (function() { 917 for (var a = 0, b = ["ms", "moz", "webkit", "o"], d = 0; d < b.length && !k.requestAnimationFrame; ++d) k.requestAnimationFrame = k[b[d] + "RequestAnimationFrame"], k.cancelAnimationFrame = k[b[d] + "CancelAnimationFrame"] || k[b[d] + "CancelRequestAnimationFrame"]; 918 k.requestAnimationFrame || (k.requestAnimationFrame = function(b, d) { 919 var c = (new Date).getTime(), 920 e = Math.max(0, 16 - (c - a)), 921 f = k.setTimeout(function() { 922 b(c + e) 923 }, e); 924 a = c + e; 925 return f 926 }); 927 k.cancelAnimationFrame || (k.cancelAnimationFrame = 928 function(a) { 929 clearTimeout(a) 930 }) 931 })() 932}); 933function format_money($money) { 934 // if (!$money) { 935 // return st_params.free_text; 936 // } 937 938 $money = st_number_format($money, st_params.booking_currency_precision, st_params.decimal_separator, st_params.thousand_separator); 939 var $symbol = st_params.currency_symbol; 940 var $money_string = ''; 941 942 switch (st_params.currency_position) { 943 case "right": 944 $money_string = $money + $symbol; 945 break; 946 case "left_space": 947 $money_string = $symbol + " " + $money; 948 break; 949 950 case "right_space": 951 $money_string = $money + " " + $symbol; 952 break; 953 case "left": 954 default: 955 $money_string = $symbol + $money; 956 break; 957 } 958 959 return $money_string; 960 } 961 function st_number_format(number, decimals, dec_point, thousands_sep) { 962 963 964 number = (number + '') 965 .replace(/[^0-9+\-Ee.]/g, ''); 966 var n = !isFinite(+number) ? 0 : +number, 967 prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), 968 sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, 969 dec = (typeof dec_point === 'undefined') ? '.' : dec_point, 970 s = '', 971 toFixedFix = function(n, prec) { 972 var k = Math.pow(10, prec); 973 return '' + (Math.round(n * k) / k) 974 .toFixed(prec); 975 }; 976 // Fix for IE parseFloat(0.55).toFixed(0) = 0; 977 s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)) 978 .split('.'); 979 if (s[0].length > 3) { 980 s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); 981 } 982 if ((s[1] || '') 983 .length < prec) { 984 s[1] = s[1] || ''; 985 s[1] += new Array(prec - s[1].length + 1) 986 .join('0'); 987 } 988 return s.join(dec); 989 }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.