Skip to content

Commit

Permalink
Update to 2.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
IonDen committed Jul 25, 2015
1 parent 6e931e2 commit f36255c
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 66 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.12",
"version": "2.0.13",
"homepage": "https://github.com/IonDen/ion.rangeSlider",
"authors": [
{
Expand Down
4 changes: 4 additions & 0 deletions history.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Ion.RangeSlider Update History

### Version 2.0.13. July 25, 2015
* Fixed bugs. Issues: #208, #270, #273
* New features. Requests: #233

### Version 2.0.12. July 10, 2015
* Fixed more bugs. Issues: #247, #263, #265, #269

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.12
# Ion.Range Slider 2.0.13

> 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.12.zip">Download ion.rangeSlider-2.0.12.zip</a>
* <a href="http://ionden.com/a/plugins/ion.rangeSlider/ion.rangeSlider-2.0.13.zip">Download ion.rangeSlider-2.0.13.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.12",
"version": "2.0.13",
"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.12.zip",
"download": "http://ionden.com/a/plugins/ion.rangeSlider/ion.rangeSlider-2.0.13.zip",
"dependencies": {
"jquery": ">=1.8"
}
Expand Down
76 changes: 56 additions & 20 deletions js/ion.rangeSlider.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Ion.RangeSlider
// version 2.0.12 Build: 331
// version 2.0.13 Build: 335
// © Denis Ineshin, 2015
// https://github.com/IonDen
//
Expand Down Expand Up @@ -137,8 +137,16 @@
// =================================================================================================================
// Core

/**
* Main plugin constructor
*
* @param input {object}
* @param options {object}
* @param plugin_count {number}
* @constructor
*/
var IonRangeSlider = function (input, options, plugin_count) {
this.VERSION = "2.0.12";
this.VERSION = "2.0.13";
this.input = input;
this.plugin_count = plugin_count;
this.current_plugin = 0;
Expand All @@ -152,6 +160,7 @@
this.is_key = false;
this.is_update = false;
this.is_start = true;
this.is_finish = false;
this.is_active = false;
this.is_resize = false;
this.is_click = false;
Expand Down Expand Up @@ -403,16 +412,14 @@
this.force_redraw = true;
this.calc(true);

if (this.options.onUpdate && typeof this.options.onUpdate === "function") {
this.options.onUpdate(this.result);
}
// callbacks called
this.callOnUpdate();
} else {
this.force_redraw = true;
this.calc(true);

if (this.options.onStart && typeof this.options.onStart === "function") {
this.options.onStart(this.result);
}
// callbacks called
this.callOnStart();
}

this.updateScene();
Expand Down Expand Up @@ -534,19 +541,28 @@
}

if (this.options.type === "single") {
this.$cache.single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "single"));
this.$cache.s_single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "single"));
this.$cache.shad_single.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));

this.$cache.single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "single"));
this.$cache.s_single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "single"));
this.$cache.edge.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
this.$cache.shad_single.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
} else {
this.$cache.single.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "from"));
this.$cache.single.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "from"));

this.$cache.from.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "from"));
this.$cache.s_from.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "from"));
this.$cache.to.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "to"));
this.$cache.s_to.on("touchstart.irs_" + this.plugin_count, this.pointerDown.bind(this, "to"));
this.$cache.shad_from.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
this.$cache.shad_to.on("touchstart.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));

this.$cache.from.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "from"));
this.$cache.s_from.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "from"));
this.$cache.to.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "to"));
this.$cache.s_to.on("mousedown.irs_" + this.plugin_count, this.pointerDown.bind(this, "to"));
this.$cache.shad_from.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
this.$cache.shad_to.on("mousedown.irs_" + this.plugin_count, this.pointerClick.bind(this, "click"));
Expand Down Expand Up @@ -584,11 +600,10 @@
return;
}

var is_function = this.options.onFinish && typeof this.options.onFinish === "function",
is_original = $.contains(this.$cache.cont[0], e.target) || this.dragging;

if (is_function && is_original) {
this.options.onFinish(this.result);
// callbacks call
if ($.contains(this.$cache.cont[0], e.target) || this.dragging) {
this.is_finish = true;
this.callOnFinish();
}

this.$cache.cont.find(".state_hover").removeClass("state_hover");
Expand Down Expand Up @@ -1080,18 +1095,17 @@
this.old_from = this.result.from;
this.old_to = this.result.to;

var is_function = this.options.onChange && typeof this.options.onChange === "function" && !this.is_resize;
if (is_function && !this.is_update && !this.is_start) {
this.options.onChange(this.result);
// callbacks call
if (!this.is_resize && !this.is_update && !this.is_start && !this.is_finish) {
this.callOnChange();
}

var is_finish = this.options.onFinish && typeof this.options.onFinish === "function";
if (is_finish && (this.is_key || this.is_click)) {
this.options.onFinish(this.result);
if (this.is_key || this.is_click) {
this.callOnFinish();
}

this.is_update = false;
this.is_resize = false;
this.is_finish = false;
}

this.is_start = false;
Expand All @@ -1100,6 +1114,28 @@
this.force_redraw = false;
},

// callbacks
callOnStart: function () {
if (this.options.onStart && typeof this.options.onStart === "function") {
this.options.onStart(this.result);
}
},
callOnChange: function () {
if (this.options.onChange && typeof this.options.onChange === "function") {
this.options.onChange(this.result);
}
},
callOnFinish: function () {
if (this.options.onFinish && typeof this.options.onFinish === "function") {
this.options.onFinish(this.result);
}
},
callOnUpdate: function () {
if (this.options.onUpdate && typeof this.options.onUpdate === "function") {
this.options.onUpdate(this.result);
}
},

drawLabels: function () {
if (!this.options) {
return;
Expand Down
Loading

0 comments on commit f36255c

Please sign in to comment.