Skip to content

Commit

Permalink
Supporting documents
Browse files Browse the repository at this point in the history
  • Loading branch information
leongersen committed Dec 2, 2015
1 parent ad8f402 commit a92a6b3
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ An extensive documentation, including **examples**, **options** and **configurat

Changelog
---------
### 8.2.0 (latest)
### 8.2.1 (latest)
- Fixed #568 and #569

### 8.2.0
- Added 'start', 'end' and 'hover' events
- Added better tooltip formatting options
- Bugfixes, including an issues where a mouseup would be missed
Expand Down
33 changes: 22 additions & 11 deletions distribute/nouislider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nouislider - 8.2.0 - 2015-11-29 15:32:31 */
/*! nouislider - 8.2.1 - 2015-12-02 21:43:14 */

(function (factory) {

Expand Down Expand Up @@ -631,28 +631,26 @@

var i;

if ( entry === true ) {
if ( entry === false ) {
return;
} else if ( entry === true ) {

parsed.tooltips = [];

for ( i = 0; i < parsed.handles; i++ ) {
parsed.tooltips.push(false);
parsed.tooltips.push(true);
}

} else {

parsed.tooltips = asArray(entry);

if ( parsed.dir ) {
parsed.tooltips.reverse();
}

if ( parsed.tooltips.length !== parsed.handles ) {
throw new Error("noUiSlider: must pass a formatter for all handles.");
}

parsed.tooltips.forEach(function(formatter){
if ( formatter !== false && (typeof formatter !== 'object' || typeof formatter.to !== 'function') ) {
if ( typeof formatter !== 'boolean' && (typeof formatter !== 'object' || typeof formatter.to !== 'function') ) {
throw new Error("noUiSlider: 'tooltips' must be passed a formatter or 'false'.");
}
});
Expand Down Expand Up @@ -920,7 +918,12 @@ function closure ( target, options ){
}


function addTooltip ( handle ) {
function addTooltip ( handle, index ) {

if ( !options.tooltips[index] ) {
return false;
}

var element = document.createElement('div');
element.className = cssClasses[18];
return handle.firstChild.appendChild(element);
Expand All @@ -929,14 +932,22 @@ function closure ( target, options ){
// The tooltips option is a shorthand for using the 'update' event.
function tooltips ( ) {

if ( options.dir ) {
options.tooltips.reverse();
}

// Tooltips are added with options.tooltips in original order.
var tips = scope_Handles.map(addTooltip);

if ( options.dir ) {
tips.reverse();
options.tooltips.reverse();
}

bindEvent('update', function(f, o, r) {
tips[o].innerHTML = options.tooltips[o] ? options.tooltips[o].to(r[o]) : f[o];
if ( tips[o] ) {
tips[o].innerHTML = options.tooltips[o] === true ? f[o] : options.tooltips[o].to(r[o]);
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion distribute/nouislider.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a92a6b3

Please sign in to comment.