Skip to content

Commit 9f33d6b

Browse files
committed
Update to 2.0.8
1 parent 899b5b6 commit 9f33d6b

File tree

9 files changed

+131
-96
lines changed

9 files changed

+131
-96
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ion.rangeSlider",
3-
"version": "2.0.7",
3+
"version": "2.0.8",
44
"homepage": "https://github.com/IonDen/ion.rangeSlider",
55
"authors": [
66
{

history.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Ion.RangeSlider Update History
22

3+
### Version 2.0.8. May 30, 2015
4+
* Fixed some bugs. Issues: #219, #228, #230, #245
5+
36
### Version 2.0.7. May 26, 2015
47
* Fixed memory issue: #220
58
* Fixed CPU issue: #186

index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Ion.Range Slider 2.0.7
1+
# Ion.Range Slider 2.0.8
22

33
> English description | <a href="readme.ru.md">Описание на русском</a>
44
55
Easy, flexible and responsive range slider
66
* <a href="http://ionden.com/a/plugins/ion.rangeSlider/en.html">Project page and demos</a>
7-
* <a href="http://ionden.com/a/plugins/ion.rangeSlider/ion.rangeSlider-2.0.7.zip">Download ion.rangeSlider-2.0.7.zip</a>
7+
* <a href="http://ionden.com/a/plugins/ion.rangeSlider/ion.rangeSlider-2.0.8.zip">Download ion.rangeSlider-2.0.8.zip</a>
88

99
***
1010

ion-rangeSlider.jquery.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ion-rangeSlider",
3-
"version": "2.0.7",
3+
"version": "2.0.8",
44
"title": "Ion.RangeSlider",
55
"description": "Cool, comfortable and easily customizable range slider with many options and skin support",
66
"keywords": [
@@ -30,7 +30,7 @@
3030
"homepage": "https://github.com/IonDen/ion.rangeSlider",
3131
"docs": "https://github.com/IonDen/ion.rangeSlider/blob/master/readme.md",
3232
"demo": "http://ionden.com/a/plugins/ion.rangeSlider/en.html",
33-
"download": "http://ionden.com/a/plugins/ion.rangeSlider/ion.rangeSlider-2.0.7.zip",
33+
"download": "http://ionden.com/a/plugins/ion.rangeSlider/ion.rangeSlider-2.0.8.zip",
3434
"dependencies": {
3535
"jquery": ">=1.8"
3636
}

js/ion.rangeSlider.js

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Ion.RangeSlider
2-
// version 2.0.7 Build: 315
2+
// version 2.0.8 Build: 320
33
// © Denis Ineshin, 2015
44
// https://github.com/IonDen
55
//
@@ -18,6 +18,7 @@
1818

1919
var plugin_count = 0;
2020

21+
// IE8 fix
2122
var is_old_ie = (function () {
2223
var n = navigator.userAgent,
2324
r = /msie\s\d+/i,
@@ -32,8 +33,6 @@
3233
}
3334
return false;
3435
} ());
35-
36-
// IE8 fix
3736
if (!Function.prototype.bind) {
3837
Function.prototype.bind = function bind(that) {
3938

@@ -139,7 +138,7 @@
139138
// Core
140139

141140
var IonRangeSlider = function (input, options, plugin_count) {
142-
this.VERSION = "2.0.7";
141+
this.VERSION = "2.0.8";
143142
this.input = input;
144143
this.plugin_count = plugin_count;
145144
this.current_plugin = 0;
@@ -232,7 +231,6 @@
232231
disable: $inp.data("disable")
233232
};
234233
data.values = data.values && data.values.split(",");
235-
options = $.extend(data, options);
236234

237235
// get from and to out of input
238236
var val = $inp.prop("value");
@@ -255,6 +253,9 @@
255253
}
256254
}
257255

256+
// JS config has a priority
257+
options = $.extend(data, options);
258+
258259
// get config from options
259260
this.options = $.extend({
260261
type: "single",
@@ -446,6 +447,8 @@
446447
this.$cache.s_to = this.$cache.cont.find(".to");
447448
this.$cache.shad_from = this.$cache.cont.find(".shadow-from");
448449
this.$cache.shad_to = this.$cache.cont.find(".shadow-to");
450+
451+
this.setTopHandler();
449452
}
450453

451454
if (this.options.hide_from_to) {
@@ -466,6 +469,19 @@
466469
}
467470
},
468471

472+
setTopHandler: function () {
473+
var min = this.options.min,
474+
max = this.options.max,
475+
from = this.options.from,
476+
to = this.options.to;
477+
478+
if (from > min && to === max) {
479+
this.$cache.s_from.addClass("type_last");
480+
} else if (to < max) {
481+
this.$cache.s_to.addClass("type_last");
482+
}
483+
},
484+
469485
appendDisableMask: function () {
470486
this.$cache.cont.append(disable_html);
471487
this.$cache.cont.addClass("irs-disabled");
@@ -681,7 +697,7 @@
681697
return true;
682698
},
683699

684-
// Move by key beta
700+
// Move by key. Beta
685701
// TODO: refactor than have plenty of time
686702
moveByKey: function (right) {
687703
var p = this.coords.p_pointer;
@@ -1137,11 +1153,11 @@
11371153
} else {
11381154

11391155
if (this.options.decorate_both) {
1140-
text_single = this.decorate(this._prettify(this.result.from));
1156+
text_single = this.decorate(this._prettify(this.result.from), this.result.from);
11411157
text_single += this.options.values_separator;
1142-
text_single += this.decorate(this._prettify(this.result.to));
1158+
text_single += this.decorate(this._prettify(this.result.to), this.result.to);
11431159
} else {
1144-
text_single = this.decorate(this._prettify(this.result.from) + this.options.values_separator + this._prettify(this.result.to), this.result.from);
1160+
text_single = this.decorate(this._prettify(this.result.from) + this.options.values_separator + this._prettify(this.result.to), this.result.to);
11451161
}
11461162
text_from = this.decorate(this._prettify(this.result.from), this.result.from);
11471163
text_to = this.decorate(this._prettify(this.result.to), this.result.to);
@@ -1281,7 +1297,8 @@
12811297
}
12821298

12831299
var number = ((max - min) / 100 * percent) + min,
1284-
string = this.options.step.toString().split(".")[1];
1300+
string = this.options.step.toString().split(".")[1],
1301+
result;
12851302

12861303
if (string) {
12871304
number = +number.toFixed(string.length);
@@ -1295,17 +1312,19 @@
12951312
number -= abs;
12961313
}
12971314

1298-
if (number < this.options.min) {
1299-
number = this.options.min;
1300-
} else if (number > this.options.max) {
1301-
number = this.options.max;
1302-
}
1303-
13041315
if (string) {
1305-
return +number.toFixed(string.length);
1316+
result = +number.toFixed(string.length);
13061317
} else {
1307-
return this.toFixed(number);
1318+
result = this.toFixed(number);
1319+
}
1320+
1321+
if (result < this.options.min) {
1322+
result = this.options.min;
1323+
} else if (result > this.options.max) {
1324+
result = this.options.max;
13081325
}
1326+
1327+
return result;
13091328
},
13101329

13111330
calcWithStep: function (percent) {
@@ -1500,16 +1519,28 @@
15001519
o.to = o.max;
15011520
}
15021521

1503-
if (o.from < o.min || o.from > o.max) {
1504-
o.from = o.min;
1505-
}
1522+
if (o.type === "single") {
15061523

1507-
if (o.to > o.max || o.to < o.min) {
1508-
o.to = o.max;
1509-
}
1524+
if (o.from < o.min) {
1525+
o.from = o.min;
1526+
}
1527+
1528+
if (o.from > o.max) {
1529+
o.from = o.max;
1530+
}
1531+
1532+
} else {
1533+
1534+
if (o.from < o.min || o.from > o.max) {
1535+
o.from = o.min;
1536+
}
1537+
if (o.to > o.max || o.to < o.min) {
1538+
o.to = o.max;
1539+
}
1540+
if (o.from > o.to) {
1541+
o.from = o.to;
1542+
}
15101543

1511-
if (o.type === "double" && o.from > o.to) {
1512-
o.from = o.to;
15131544
}
15141545

15151546
if (typeof o.step !== "number" || isNaN(o.step) || !o.step || o.step < 0) {

0 commit comments

Comments
 (0)