Skip to content

Commit

Permalink
Update to 2.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
IonDen committed May 30, 2015
1 parent 899b5b6 commit 9f33d6b
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 96 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ion.rangeSlider",
"version": "2.0.7",
"version": "2.0.8",
"homepage": "https://github.com/IonDen/ion.rangeSlider",
"authors": [
{
Expand Down
3 changes: 3 additions & 0 deletions history.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Ion.RangeSlider Update History

### Version 2.0.8. May 30, 2015
* Fixed some bugs. Issues: #219, #228, #230, #245

### Version 2.0.7. May 26, 2015
* Fixed memory issue: #220
* Fixed CPU issue: #186
Expand Down
4 changes: 2 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Ion.Range Slider 2.0.7
# Ion.Range Slider 2.0.8

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

***

Expand Down
4 changes: 2 additions & 2 deletions ion-rangeSlider.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ion-rangeSlider",
"version": "2.0.7",
"version": "2.0.8",
"title": "Ion.RangeSlider",
"description": "Cool, comfortable and easily customizable range slider with many options and skin support",
"keywords": [
Expand Down Expand Up @@ -30,7 +30,7 @@
"homepage": "https://github.com/IonDen/ion.rangeSlider",
"docs": "https://github.com/IonDen/ion.rangeSlider/blob/master/readme.md",
"demo": "http://ionden.com/a/plugins/ion.rangeSlider/en.html",
"download": "http://ionden.com/a/plugins/ion.rangeSlider/ion.rangeSlider-2.0.7.zip",
"download": "http://ionden.com/a/plugins/ion.rangeSlider/ion.rangeSlider-2.0.8.zip",
"dependencies": {
"jquery": ">=1.8"
}
Expand Down
83 changes: 57 additions & 26 deletions js/ion.rangeSlider.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Ion.RangeSlider
// version 2.0.7 Build: 315
// version 2.0.8 Build: 320
// © Denis Ineshin, 2015
// https://github.com/IonDen
//
Expand All @@ -18,6 +18,7 @@

var plugin_count = 0;

// IE8 fix
var is_old_ie = (function () {
var n = navigator.userAgent,
r = /msie\s\d+/i,
Expand All @@ -32,8 +33,6 @@
}
return false;
} ());

// IE8 fix
if (!Function.prototype.bind) {
Function.prototype.bind = function bind(that) {

Expand Down Expand Up @@ -139,7 +138,7 @@
// Core

var IonRangeSlider = function (input, options, plugin_count) {
this.VERSION = "2.0.7";
this.VERSION = "2.0.8";
this.input = input;
this.plugin_count = plugin_count;
this.current_plugin = 0;
Expand Down Expand Up @@ -232,7 +231,6 @@
disable: $inp.data("disable")
};
data.values = data.values && data.values.split(",");
options = $.extend(data, options);

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

// JS config has a priority
options = $.extend(data, options);

// get config from options
this.options = $.extend({
type: "single",
Expand Down Expand Up @@ -446,6 +447,8 @@
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();
}

if (this.options.hide_from_to) {
Expand All @@ -466,6 +469,19 @@
}
},

setTopHandler: function () {
var min = this.options.min,
max = this.options.max,
from = this.options.from,
to = this.options.to;

if (from > min && to === max) {
this.$cache.s_from.addClass("type_last");
} else if (to < max) {
this.$cache.s_to.addClass("type_last");
}
},

appendDisableMask: function () {
this.$cache.cont.append(disable_html);
this.$cache.cont.addClass("irs-disabled");
Expand Down Expand Up @@ -681,7 +697,7 @@
return true;
},

// Move by key beta
// Move by key. Beta
// TODO: refactor than have plenty of time
moveByKey: function (right) {
var p = this.coords.p_pointer;
Expand Down Expand Up @@ -1137,11 +1153,11 @@
} else {

if (this.options.decorate_both) {
text_single = this.decorate(this._prettify(this.result.from));
text_single = this.decorate(this._prettify(this.result.from), this.result.from);
text_single += this.options.values_separator;
text_single += this.decorate(this._prettify(this.result.to));
text_single += this.decorate(this._prettify(this.result.to), this.result.to);
} else {
text_single = this.decorate(this._prettify(this.result.from) + this.options.values_separator + this._prettify(this.result.to), this.result.from);
text_single = this.decorate(this._prettify(this.result.from) + this.options.values_separator + this._prettify(this.result.to), 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);
Expand Down Expand Up @@ -1281,7 +1297,8 @@
}

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

if (string) {
number = +number.toFixed(string.length);
Expand All @@ -1295,17 +1312,19 @@
number -= abs;
}

if (number < this.options.min) {
number = this.options.min;
} else if (number > this.options.max) {
number = this.options.max;
}

if (string) {
return +number.toFixed(string.length);
result = +number.toFixed(string.length);
} else {
return this.toFixed(number);
result = this.toFixed(number);
}

if (result < this.options.min) {
result = this.options.min;
} else if (result > this.options.max) {
result = this.options.max;
}

return result;
},

calcWithStep: function (percent) {
Expand Down Expand Up @@ -1500,16 +1519,28 @@
o.to = o.max;
}

if (o.from < o.min || o.from > o.max) {
o.from = o.min;
}
if (o.type === "single") {

if (o.to > o.max || o.to < o.min) {
o.to = o.max;
}
if (o.from < o.min) {
o.from = o.min;
}

if (o.from > o.max) {
o.from = o.max;
}

} else {

if (o.from < o.min || o.from > o.max) {
o.from = o.min;
}
if (o.to > o.max || o.to < o.min) {
o.to = o.max;
}
if (o.from > o.to) {
o.from = o.to;
}

if (o.type === "double" && o.from > o.to) {
o.from = o.to;
}

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

0 comments on commit 9f33d6b

Please sign in to comment.