From 0f5e199c90828204de8aa22d71e3f88953ca165a Mon Sep 17 00:00:00 2001 From: Reece Sheppard Date: Tue, 27 Jun 2017 15:39:10 +0800 Subject: [PATCH 01/40] Fixed issue with pip values on LTR vertical sliders --- distribute/nouislider.css | 8 ++++++-- distribute/nouislider.js | 2 +- distribute/nouislider.min.css | 2 +- distribute/nouislider.min.js | 4 ++-- src/nouislider.pips.less | 9 +++++++-- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/distribute/nouislider.css b/distribute/nouislider.css index 97a96f0b..dfee0f12 100644 --- a/distribute/nouislider.css +++ b/distribute/nouislider.css @@ -1,4 +1,4 @@ -/*! nouislider - 10.0.0 - 2017-05-28 14:52:48 */ +/*! nouislider - 10.0.0 - 2017-06-27 15:36:52 */ /* Functional styling; * These styles are required for noUiSlider to function. * You don't need to change these rules to apply your design. @@ -220,9 +220,13 @@ left: 100%; } .noUi-value-vertical { + -webkit-transform: translate3d(0, -50%, 0); + transform: translate3d(0, -50%, 0); + padding-left: 25px; +} +.noUi-rtl .noUi-value-vertical { -webkit-transform: translate3d(0, 50%, 0); transform: translate3d(0, 50%, 0); - padding-left: 25px; } .noUi-marker-vertical.noUi-marker { width: 5px; diff --git a/distribute/nouislider.js b/distribute/nouislider.js index f282facd..6c1f60d2 100644 --- a/distribute/nouislider.js +++ b/distribute/nouislider.js @@ -1,4 +1,4 @@ -/*! nouislider - 10.0.0 - 2017-05-28 14:52:48 */ +/*! nouislider - 10.0.0 - 2017-06-27 15:36:52 */ (function (factory) { diff --git a/distribute/nouislider.min.css b/distribute/nouislider.min.css index fc1a3b39..1a65b33e 100644 --- a/distribute/nouislider.min.css +++ b/distribute/nouislider.min.css @@ -1 +1 @@ -/*! nouislider - 10.0.0 - 2017-05-28 14:52:48 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);padding-left:25px}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file +/*! nouislider - 10.0.0 - 2017-06-27 15:36:52 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0);padding-left:25px}.noUi-rtl .noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file diff --git a/distribute/nouislider.min.js b/distribute/nouislider.min.js index b6f3032b..51bfee05 100644 --- a/distribute/nouislider.min.js +++ b/distribute/nouislider.min.js @@ -1,3 +1,3 @@ -/*! nouislider - 10.0.0 - 2017-05-28 14:52:49 */ +/*! nouislider - 10.0.0 - 2017-06-27 15:36:52 */ -!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return this[a]?!1:this[a]=!0},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||""),d=b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,e=b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop;return{x:d,y:e}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(c){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+$+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+$+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(isNaN(b[1])?!1:b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.sort(e.length&&"object"==typeof e[0][0]?function(a,b){return a[0][0]-b[0][0]}:function(a,b){return a[0]-b[0]}),d=0;d=50)throw new Error("noUiSlider ("+$+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+$+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+$+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+$+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(b!==!1)if(b===!0){a.tooltips=[];for(var c=0;c=l;l=e(l,h)){for(n=ta.toStepping(l),o=n-k,r=o/a,s=Math.round(r),t=o/s,m=1;s>=m;m+=1)p=k+m*t,f[p.toFixed(5)]=["x",0];q=c.indexOf(l)>-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=xa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(b){return pa.hasAttribute("disabled")?!1:n(pa,e.cssClasses.tap)?!1:(b=G(b,d.pageOffset))?a===ma.start&&void 0!==b.buttons&&b.buttons>1?!1:d.hover&&b.buttons?!1:(oa||b.preventDefault(),b.calcPoint=b.points[e.ort],void c(b,d)):!1},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,oa?{passive:!0}:!1),g.push([a,f])}),g}function G(a,b){var c,d,e=0===a.type.indexOf("touch"),f=0===a.type.indexOf("mouse"),g=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(g=!0),e){if(a.touches.length>1)return!1;c=a.changedTouches[0].pageX,d=a.changedTouches[0].pageY}return b=b||o(xa),(f||g)&&(c=a.clientX+b.x,d=a.clientY+b.y),a.pageOffset=b,a.points=[c,d],a.cursor=f||g,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);b>f&&(c=e,b=f)}}),c}function J(a,b,c,d){var e=c.slice(),f=[!a,a],g=[a,!a];d=d.slice(),a&&d.reverse(),d.length>1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);d===!1?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint),d=100*c/b.baseSize;J(c>0,d,b.locations,b.handleNumbers)}function N(a,b){sa&&(m(sa,e.cssClasses.active),sa=!1),a.cursor&&(za.style.cursor="",za.removeEventListener("selectstart",c)),wa.forEach(function(a){ya.removeEventListener(a[0],a[1])}),m(pa,e.cssClasses.drag),V(),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){if(1===b.handleNumbers.length){var d=ia[b.handleNumbers[0]];if(d.hasAttribute("disabled"))return!1;sa=d.children[0],l(sa,e.cssClasses.active)}a.stopPropagation();var f=F(ma.move,ya,M,{startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),g=F(ma.end,ya,N,{handleNumbers:b.handleNumbers}),h=F("mouseout",ya,L,{handleNumbers:b.handleNumbers});wa=f.concat(g,h),a.cursor&&(za.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),za.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);return c===!1?!1:(e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),void(e.events.snap&&O(a,{handleNumbers:[c]})))}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(b!==!1&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return b=S(qa,a,b,c,d,!1),b===!1?!1:(U(a,b),!0)}function Y(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&a!==!1&&("number"==typeof a&&(a=String(a)),a=e.format.from(a),a===!1||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function _(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b?!0:!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){_(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;e!==!1&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:c.stepBefore.step===!1?!1:d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&e!==!1&&(e=Number(e.toFixed(g))),null!==f&&f!==!1&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=X(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],_(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=!1,ta=e.spectrum,ua=[],va={},wa=null,xa=a.ownerDocument,ya=xa.documentElement,za=xa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+$+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:_,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),_(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function Z(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+$+"): create requires a single element, got: "+a);var c=X(b,a),d=Y(a,c,b);return a.noUiSlider=d,d}var $="10.0.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!==0)throw new Error("noUiSlider ("+$+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length?t(this.xVal,a):!1},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var _={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:$,create:Z}}); \ No newline at end of file +!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return!this[a]&&(this[a]=!0)},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||"");return{x:b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,y:b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(a){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+$+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+$+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(!isNaN(b[1])&&b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.length&&"object"==typeof e[0][0]?e.sort(function(a,b){return a[0][0]-b[0][0]}):e.sort(function(a,b){return a[0]-b[0]}),d=0;d=50)throw new Error("noUiSlider ("+$+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+$+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+$+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+$+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(!1!==b)if(!0===b){a.tooltips=[];for(var c=0;c-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=xa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(b){return!pa.hasAttribute("disabled")&&(!n(pa,e.cssClasses.tap)&&(!!(b=G(b,d.pageOffset))&&(!(a===ma.start&&void 0!==b.buttons&&b.buttons>1)&&((!d.hover||!b.buttons)&&(oa||b.preventDefault(),b.calcPoint=b.points[e.ort],void c(b,d))))))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!!oa&&{passive:!0}),g.push([a,f])}),g}function G(a,b){var c,d,e=0===a.type.indexOf("touch"),f=0===a.type.indexOf("mouse"),g=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(g=!0),e){if(a.touches.length>1)return!1;c=a.changedTouches[0].pageX,d=a.changedTouches[0].pageY}return b=b||o(xa),(f||g)&&(c=a.clientX+b.x,d=a.clientY+b.y),a.pageOffset=b,a.points=[c,d],a.cursor=f||g,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);f1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);!1===d?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint);J(c>0,100*c/b.baseSize,b.locations,b.handleNumbers)}function N(a,b){sa&&(m(sa,e.cssClasses.active),sa=!1),a.cursor&&(za.style.cursor="",za.removeEventListener("selectstart",c)),wa.forEach(function(a){ya.removeEventListener(a[0],a[1])}),m(pa,e.cssClasses.drag),V(),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){if(1===b.handleNumbers.length){var d=ia[b.handleNumbers[0]];if(d.hasAttribute("disabled"))return!1;sa=d.children[0],l(sa,e.cssClasses.active)}a.stopPropagation();var f=F(ma.move,ya,M,{startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),g=F(ma.end,ya,N,{handleNumbers:b.handleNumbers}),h=F("mouseout",ya,L,{handleNumbers:b.handleNumbers});wa=f.concat(g,h),a.cursor&&(za.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),za.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);if(!1===c)return!1;e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),e.events.snap&&O(a,{handleNumbers:[c]})}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(!1!==b&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return!1!==(b=S(qa,a,b,c,d,!1))&&(U(a,b),!0)}function Y(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&!1!==a&&("number"==typeof a&&(a=String(a)),!1===(a=e.format.from(a))||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function _(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b||!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){_(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;!1!==e&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:!1!==c.stepBefore.step&&d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&!1!==e&&(e=Number(e.toFixed(g))),null!==f&&!1!==f&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=X(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],_(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=!1,ta=e.spectrum,ua=[],va={},wa=null,xa=a.ownerDocument,ya=xa.documentElement,za=xa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+$+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:_,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),_(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function Z(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+$+"): create requires a single element, got: "+a);var c=X(b,a),d=Y(a,c,b);return a.noUiSlider=d,d}var $="10.0.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!=0)throw new Error("noUiSlider ("+$+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&t(this.xVal,a)},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var _={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:$,create:Z}}); \ No newline at end of file diff --git a/src/nouislider.pips.less b/src/nouislider.pips.less index 5f23f24b..df33b099 100644 --- a/src/nouislider.pips.less +++ b/src/nouislider.pips.less @@ -76,9 +76,14 @@ left: 100%; } .@{noUi-css-prefix}-value-vertical { - -webkit-transform: translate3d(0,50%,0); - transform: translate3d(0,50%,0); + -webkit-transform: translate3d(0,-50%,0); + transform: translate3d(0,-50%,0); padding-left: 25px; + + .@{noUi-css-prefix}-rtl & { + -webkit-transform: translate3d(0,50%,0); + transform: translate3d(0,50%,0); + } } .@{noUi-css-prefix}-marker-vertical.@{noUi-css-prefix}-marker { From e1d9cf0dd992b1ab26c8e8ca44db049aa520e3de Mon Sep 17 00:00:00 2001 From: Reece Sheppard Date: Tue, 27 Jun 2017 15:52:18 +0800 Subject: [PATCH 02/40] Fixed pip value alignment on RTL horizontal sliders --- distribute/nouislider.css | 6 +++++- distribute/nouislider.js | 2 +- distribute/nouislider.min.css | 2 +- distribute/nouislider.min.js | 2 +- src/nouislider.pips.less | 5 +++++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/distribute/nouislider.css b/distribute/nouislider.css index dfee0f12..e6dd332c 100644 --- a/distribute/nouislider.css +++ b/distribute/nouislider.css @@ -1,4 +1,4 @@ -/*! nouislider - 10.0.0 - 2017-06-27 15:36:52 */ +/*! nouislider - 10.0.0 - 2017-06-27 15:51:09 */ /* Functional styling; * These styles are required for noUiSlider to function. * You don't need to change these rules to apply your design. @@ -199,6 +199,10 @@ -webkit-transform: translate3d(-50%, 50%, 0); transform: translate3d(-50%, 50%, 0); } +.noUi-rtl .noUi-value-horizontal { + -webkit-transform: translate3d(50%, 50%, 0); + transform: translate3d(50%, 50%, 0); +} .noUi-marker-horizontal.noUi-marker { margin-left: -1px; width: 2px; diff --git a/distribute/nouislider.js b/distribute/nouislider.js index 6c1f60d2..b979517d 100644 --- a/distribute/nouislider.js +++ b/distribute/nouislider.js @@ -1,4 +1,4 @@ -/*! nouislider - 10.0.0 - 2017-06-27 15:36:52 */ +/*! nouislider - 10.0.0 - 2017-06-27 15:51:09 */ (function (factory) { diff --git a/distribute/nouislider.min.css b/distribute/nouislider.min.css index 1a65b33e..f1380692 100644 --- a/distribute/nouislider.min.css +++ b/distribute/nouislider.min.css @@ -1 +1 @@ -/*! nouislider - 10.0.0 - 2017-06-27 15:36:52 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0);padding-left:25px}.noUi-rtl .noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file +/*! nouislider - 10.0.0 - 2017-06-27 15:51:09 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-rtl .noUi-value-horizontal{-webkit-transform:translate3d(50%,50%,0);transform:translate3d(50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0);padding-left:25px}.noUi-rtl .noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file diff --git a/distribute/nouislider.min.js b/distribute/nouislider.min.js index 51bfee05..39d0f12d 100644 --- a/distribute/nouislider.min.js +++ b/distribute/nouislider.min.js @@ -1,3 +1,3 @@ -/*! nouislider - 10.0.0 - 2017-06-27 15:36:52 */ +/*! nouislider - 10.0.0 - 2017-06-27 15:51:09 */ !function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return!this[a]&&(this[a]=!0)},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||"");return{x:b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,y:b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(a){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+$+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+$+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(!isNaN(b[1])&&b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.length&&"object"==typeof e[0][0]?e.sort(function(a,b){return a[0][0]-b[0][0]}):e.sort(function(a,b){return a[0]-b[0]}),d=0;d=50)throw new Error("noUiSlider ("+$+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+$+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+$+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+$+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(!1!==b)if(!0===b){a.tooltips=[];for(var c=0;c-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=xa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(b){return!pa.hasAttribute("disabled")&&(!n(pa,e.cssClasses.tap)&&(!!(b=G(b,d.pageOffset))&&(!(a===ma.start&&void 0!==b.buttons&&b.buttons>1)&&((!d.hover||!b.buttons)&&(oa||b.preventDefault(),b.calcPoint=b.points[e.ort],void c(b,d))))))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!!oa&&{passive:!0}),g.push([a,f])}),g}function G(a,b){var c,d,e=0===a.type.indexOf("touch"),f=0===a.type.indexOf("mouse"),g=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(g=!0),e){if(a.touches.length>1)return!1;c=a.changedTouches[0].pageX,d=a.changedTouches[0].pageY}return b=b||o(xa),(f||g)&&(c=a.clientX+b.x,d=a.clientY+b.y),a.pageOffset=b,a.points=[c,d],a.cursor=f||g,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);f1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);!1===d?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint);J(c>0,100*c/b.baseSize,b.locations,b.handleNumbers)}function N(a,b){sa&&(m(sa,e.cssClasses.active),sa=!1),a.cursor&&(za.style.cursor="",za.removeEventListener("selectstart",c)),wa.forEach(function(a){ya.removeEventListener(a[0],a[1])}),m(pa,e.cssClasses.drag),V(),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){if(1===b.handleNumbers.length){var d=ia[b.handleNumbers[0]];if(d.hasAttribute("disabled"))return!1;sa=d.children[0],l(sa,e.cssClasses.active)}a.stopPropagation();var f=F(ma.move,ya,M,{startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),g=F(ma.end,ya,N,{handleNumbers:b.handleNumbers}),h=F("mouseout",ya,L,{handleNumbers:b.handleNumbers});wa=f.concat(g,h),a.cursor&&(za.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),za.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);if(!1===c)return!1;e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),e.events.snap&&O(a,{handleNumbers:[c]})}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(!1!==b&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return!1!==(b=S(qa,a,b,c,d,!1))&&(U(a,b),!0)}function Y(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&!1!==a&&("number"==typeof a&&(a=String(a)),!1===(a=e.format.from(a))||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function _(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b||!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){_(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;!1!==e&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:!1!==c.stepBefore.step&&d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&!1!==e&&(e=Number(e.toFixed(g))),null!==f&&!1!==f&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=X(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],_(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=!1,ta=e.spectrum,ua=[],va={},wa=null,xa=a.ownerDocument,ya=xa.documentElement,za=xa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+$+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:_,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),_(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function Z(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+$+"): create requires a single element, got: "+a);var c=X(b,a),d=Y(a,c,b);return a.noUiSlider=d,d}var $="10.0.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!=0)throw new Error("noUiSlider ("+$+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&t(this.xVal,a)},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var _={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:$,create:Z}}); \ No newline at end of file diff --git a/src/nouislider.pips.less b/src/nouislider.pips.less index df33b099..2f417cfd 100644 --- a/src/nouislider.pips.less +++ b/src/nouislider.pips.less @@ -52,6 +52,11 @@ .@{noUi-css-prefix}-value-horizontal { -webkit-transform: translate3d(-50%,50%,0); transform: translate3d(-50%,50%,0); + + .@{noUi-css-prefix}-rtl & { + -webkit-transform: translate3d(50%,50%,0); + transform: translate3d(50%,50%,0); + } } .@{noUi-css-prefix}-marker-horizontal.@{noUi-css-prefix}-marker { From 2846c4a8c502045a8929ce0e216832a68a7613d2 Mon Sep 17 00:00:00 2001 From: Reece Sheppard Date: Tue, 27 Jun 2017 16:08:03 +0800 Subject: [PATCH 03/40] Reverted distribute files for pull --- distribute/nouislider.css | 12 ++---------- distribute/nouislider.js | 2 +- distribute/nouislider.min.css | 2 +- distribute/nouislider.min.js | 4 ++-- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/distribute/nouislider.css b/distribute/nouislider.css index e6dd332c..97a96f0b 100644 --- a/distribute/nouislider.css +++ b/distribute/nouislider.css @@ -1,4 +1,4 @@ -/*! nouislider - 10.0.0 - 2017-06-27 15:51:09 */ +/*! nouislider - 10.0.0 - 2017-05-28 14:52:48 */ /* Functional styling; * These styles are required for noUiSlider to function. * You don't need to change these rules to apply your design. @@ -199,10 +199,6 @@ -webkit-transform: translate3d(-50%, 50%, 0); transform: translate3d(-50%, 50%, 0); } -.noUi-rtl .noUi-value-horizontal { - -webkit-transform: translate3d(50%, 50%, 0); - transform: translate3d(50%, 50%, 0); -} .noUi-marker-horizontal.noUi-marker { margin-left: -1px; width: 2px; @@ -224,13 +220,9 @@ left: 100%; } .noUi-value-vertical { - -webkit-transform: translate3d(0, -50%, 0); - transform: translate3d(0, -50%, 0); - padding-left: 25px; -} -.noUi-rtl .noUi-value-vertical { -webkit-transform: translate3d(0, 50%, 0); transform: translate3d(0, 50%, 0); + padding-left: 25px; } .noUi-marker-vertical.noUi-marker { width: 5px; diff --git a/distribute/nouislider.js b/distribute/nouislider.js index b979517d..f282facd 100644 --- a/distribute/nouislider.js +++ b/distribute/nouislider.js @@ -1,4 +1,4 @@ -/*! nouislider - 10.0.0 - 2017-06-27 15:51:09 */ +/*! nouislider - 10.0.0 - 2017-05-28 14:52:48 */ (function (factory) { diff --git a/distribute/nouislider.min.css b/distribute/nouislider.min.css index f1380692..fc1a3b39 100644 --- a/distribute/nouislider.min.css +++ b/distribute/nouislider.min.css @@ -1 +1 @@ -/*! nouislider - 10.0.0 - 2017-06-27 15:51:09 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-rtl .noUi-value-horizontal{-webkit-transform:translate3d(50%,50%,0);transform:translate3d(50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0);padding-left:25px}.noUi-rtl .noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file +/*! nouislider - 10.0.0 - 2017-05-28 14:52:48 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);padding-left:25px}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file diff --git a/distribute/nouislider.min.js b/distribute/nouislider.min.js index 39d0f12d..b6f3032b 100644 --- a/distribute/nouislider.min.js +++ b/distribute/nouislider.min.js @@ -1,3 +1,3 @@ -/*! nouislider - 10.0.0 - 2017-06-27 15:51:09 */ +/*! nouislider - 10.0.0 - 2017-05-28 14:52:49 */ -!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return!this[a]&&(this[a]=!0)},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||"");return{x:b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,y:b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(a){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+$+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+$+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(!isNaN(b[1])&&b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.length&&"object"==typeof e[0][0]?e.sort(function(a,b){return a[0][0]-b[0][0]}):e.sort(function(a,b){return a[0]-b[0]}),d=0;d=50)throw new Error("noUiSlider ("+$+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+$+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+$+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+$+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(!1!==b)if(!0===b){a.tooltips=[];for(var c=0;c-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=xa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(b){return!pa.hasAttribute("disabled")&&(!n(pa,e.cssClasses.tap)&&(!!(b=G(b,d.pageOffset))&&(!(a===ma.start&&void 0!==b.buttons&&b.buttons>1)&&((!d.hover||!b.buttons)&&(oa||b.preventDefault(),b.calcPoint=b.points[e.ort],void c(b,d))))))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!!oa&&{passive:!0}),g.push([a,f])}),g}function G(a,b){var c,d,e=0===a.type.indexOf("touch"),f=0===a.type.indexOf("mouse"),g=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(g=!0),e){if(a.touches.length>1)return!1;c=a.changedTouches[0].pageX,d=a.changedTouches[0].pageY}return b=b||o(xa),(f||g)&&(c=a.clientX+b.x,d=a.clientY+b.y),a.pageOffset=b,a.points=[c,d],a.cursor=f||g,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);f1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);!1===d?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint);J(c>0,100*c/b.baseSize,b.locations,b.handleNumbers)}function N(a,b){sa&&(m(sa,e.cssClasses.active),sa=!1),a.cursor&&(za.style.cursor="",za.removeEventListener("selectstart",c)),wa.forEach(function(a){ya.removeEventListener(a[0],a[1])}),m(pa,e.cssClasses.drag),V(),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){if(1===b.handleNumbers.length){var d=ia[b.handleNumbers[0]];if(d.hasAttribute("disabled"))return!1;sa=d.children[0],l(sa,e.cssClasses.active)}a.stopPropagation();var f=F(ma.move,ya,M,{startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),g=F(ma.end,ya,N,{handleNumbers:b.handleNumbers}),h=F("mouseout",ya,L,{handleNumbers:b.handleNumbers});wa=f.concat(g,h),a.cursor&&(za.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),za.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);if(!1===c)return!1;e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),e.events.snap&&O(a,{handleNumbers:[c]})}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(!1!==b&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return!1!==(b=S(qa,a,b,c,d,!1))&&(U(a,b),!0)}function Y(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&!1!==a&&("number"==typeof a&&(a=String(a)),!1===(a=e.format.from(a))||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function _(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b||!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){_(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;!1!==e&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:!1!==c.stepBefore.step&&d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&!1!==e&&(e=Number(e.toFixed(g))),null!==f&&!1!==f&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=X(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],_(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=!1,ta=e.spectrum,ua=[],va={},wa=null,xa=a.ownerDocument,ya=xa.documentElement,za=xa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+$+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:_,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),_(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function Z(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+$+"): create requires a single element, got: "+a);var c=X(b,a),d=Y(a,c,b);return a.noUiSlider=d,d}var $="10.0.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!=0)throw new Error("noUiSlider ("+$+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&t(this.xVal,a)},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var _={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:$,create:Z}}); \ No newline at end of file +!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return this[a]?!1:this[a]=!0},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||""),d=b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,e=b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop;return{x:d,y:e}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(c){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+$+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+$+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(isNaN(b[1])?!1:b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.sort(e.length&&"object"==typeof e[0][0]?function(a,b){return a[0][0]-b[0][0]}:function(a,b){return a[0]-b[0]}),d=0;d=50)throw new Error("noUiSlider ("+$+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+$+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+$+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+$+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(b!==!1)if(b===!0){a.tooltips=[];for(var c=0;c=l;l=e(l,h)){for(n=ta.toStepping(l),o=n-k,r=o/a,s=Math.round(r),t=o/s,m=1;s>=m;m+=1)p=k+m*t,f[p.toFixed(5)]=["x",0];q=c.indexOf(l)>-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=xa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(b){return pa.hasAttribute("disabled")?!1:n(pa,e.cssClasses.tap)?!1:(b=G(b,d.pageOffset))?a===ma.start&&void 0!==b.buttons&&b.buttons>1?!1:d.hover&&b.buttons?!1:(oa||b.preventDefault(),b.calcPoint=b.points[e.ort],void c(b,d)):!1},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,oa?{passive:!0}:!1),g.push([a,f])}),g}function G(a,b){var c,d,e=0===a.type.indexOf("touch"),f=0===a.type.indexOf("mouse"),g=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(g=!0),e){if(a.touches.length>1)return!1;c=a.changedTouches[0].pageX,d=a.changedTouches[0].pageY}return b=b||o(xa),(f||g)&&(c=a.clientX+b.x,d=a.clientY+b.y),a.pageOffset=b,a.points=[c,d],a.cursor=f||g,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);b>f&&(c=e,b=f)}}),c}function J(a,b,c,d){var e=c.slice(),f=[!a,a],g=[a,!a];d=d.slice(),a&&d.reverse(),d.length>1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);d===!1?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint),d=100*c/b.baseSize;J(c>0,d,b.locations,b.handleNumbers)}function N(a,b){sa&&(m(sa,e.cssClasses.active),sa=!1),a.cursor&&(za.style.cursor="",za.removeEventListener("selectstart",c)),wa.forEach(function(a){ya.removeEventListener(a[0],a[1])}),m(pa,e.cssClasses.drag),V(),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){if(1===b.handleNumbers.length){var d=ia[b.handleNumbers[0]];if(d.hasAttribute("disabled"))return!1;sa=d.children[0],l(sa,e.cssClasses.active)}a.stopPropagation();var f=F(ma.move,ya,M,{startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),g=F(ma.end,ya,N,{handleNumbers:b.handleNumbers}),h=F("mouseout",ya,L,{handleNumbers:b.handleNumbers});wa=f.concat(g,h),a.cursor&&(za.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),za.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);return c===!1?!1:(e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),void(e.events.snap&&O(a,{handleNumbers:[c]})))}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(b!==!1&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return b=S(qa,a,b,c,d,!1),b===!1?!1:(U(a,b),!0)}function Y(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&a!==!1&&("number"==typeof a&&(a=String(a)),a=e.format.from(a),a===!1||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function _(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b?!0:!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){_(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;e!==!1&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:c.stepBefore.step===!1?!1:d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&e!==!1&&(e=Number(e.toFixed(g))),null!==f&&f!==!1&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=X(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],_(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=!1,ta=e.spectrum,ua=[],va={},wa=null,xa=a.ownerDocument,ya=xa.documentElement,za=xa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+$+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:_,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),_(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function Z(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+$+"): create requires a single element, got: "+a);var c=X(b,a),d=Y(a,c,b);return a.noUiSlider=d,d}var $="10.0.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!==0)throw new Error("noUiSlider ("+$+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length?t(this.xVal,a):!1},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var _={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:$,create:Z}}); \ No newline at end of file From ef7f79791d7acc5066b4af8bf7dde5fc2f2a629e Mon Sep 17 00:00:00 2001 From: Stephan Gambke Date: Mon, 7 Aug 2017 02:07:30 +0200 Subject: [PATCH 04/40] Pips: Avoid calculating with and comparing floats; Check error condition --- src/js/pips.js | 17 ++++++++++------- tests/addon_pips.js | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/js/pips.js b/src/js/pips.js index fa2a0eda..6b059568 100644 --- a/src/js/pips.js +++ b/src/js/pips.js @@ -8,22 +8,25 @@ if ( mode === 'count' ) { - if ( !values ) { - throw new Error("noUiSlider (" + VERSION + "): 'values' required for mode 'count'."); + var intervals = values - 1; + + if ( intervals < 1 ) { + throw new Error("noUiSlider (" + VERSION + "): 'values' (>= 2) required for mode 'count'."); } // Divide 0 - 100 in 'count' parts. - var spread = ( 100 / (values - 1) ); - var v; - var i = 0; + var spread = ( 100 / intervals ); + var i = 0; values = []; // List these parts and have them handled as 'positions'. - while ( (v = i++ * spread) <= 100 ) { - values.push(v); + while ( i < intervals ) { + values.push(i++ * spread); } + values.push(100); + mode = 'positions'; } diff --git a/tests/addon_pips.js b/tests/addon_pips.js index 5a8c0f0f..7f7f388a 100644 --- a/tests/addon_pips.js +++ b/tests/addon_pips.js @@ -98,19 +98,28 @@ var slider = test_slider({ mode: 'count', - values: 8 + values: 12 }); // COUNT - assert.equal( Q.querySelectorAll('.noUi-value').length, 8, 'Placed requested number of values' ); + assert.equal( Q.querySelectorAll('.noUi-value').length, 12, 'Placed requested number of values' ); var pos2 = []; Array.prototype.forEach.call(Q.querySelectorAll('.noUi-value'), function( el ){ pos2.push(parseInt(el.style.left)); }); - assert.deepEqual(pos2, [0, Math.floor((100/7)*1), Math.floor((100/7)*2), Math.floor((100/7)*3), Math.floor((100/7)*4), Math.floor((100/7)*5), Math.floor((100/7)*6), 100], 'Values spread evenly'); + assert.deepEqual( pos2, [0, Math.floor( (100 / 11) * 1 ), Math.floor( (100 / 11) * 2 ), Math.floor( (100 / 11) * 3 ), Math.floor( (100 / 11) * 4 ), Math.floor( (100 / 11) * 5 ), Math.floor( (100 / 11) * 6 ), Math.floor( (100 / 11) * 7 ), Math.floor( (100 / 11) * 8 ), Math.floor( (100 / 11) * 9 ), Math.floor( (100 / 11) * 10 ), 100], 'Values spread evenly' ); + + } ); + + QUnit.test( "Count, values >= 2", function (assert) { + + assert.throws( function() { test_slider( { + mode: 'count', + values: 1 + } ) }, 'Checks minimum number of values' ); }); From 6586f96f37d98d260bf46b18b45a8f8a0a3da685 Mon Sep 17 00:00:00 2001 From: Stephan Gambke Date: Mon, 7 Aug 2017 02:41:21 +0200 Subject: [PATCH 05/40] Use one variable less --- src/js/pips.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/js/pips.js b/src/js/pips.js index 6b059568..2313409e 100644 --- a/src/js/pips.js +++ b/src/js/pips.js @@ -8,21 +8,19 @@ if ( mode === 'count' ) { - var intervals = values - 1; - - if ( intervals < 1 ) { + if ( values < 2 ) { throw new Error("noUiSlider (" + VERSION + "): 'values' (>= 2) required for mode 'count'."); } // Divide 0 - 100 in 'count' parts. - var spread = ( 100 / intervals ); + var interval = values - 1; + var spread = ( 100 / interval ); - var i = 0; values = []; // List these parts and have them handled as 'positions'. - while ( i < intervals ) { - values.push(i++ * spread); + while ( interval-- ) { + values[ interval ] = ( interval * spread ); } values.push(100); From dd01d13938b4ee6c457ef8be322ca2e487e44dd2 Mon Sep 17 00:00:00 2001 From: Nils Lundquist Date: Fri, 15 Sep 2017 15:20:48 -0600 Subject: [PATCH 06/40] allow independent padding amount for either end of slider --- distribute/nouislider.css | 2 +- distribute/nouislider.js | 29 ++++++++++++++++++----------- distribute/nouislider.min.css | 2 +- distribute/nouislider.min.js | 4 ++-- src/js/options.js | 22 +++++++++++++++------- src/js/scope.js | 4 ++-- 6 files changed, 39 insertions(+), 24 deletions(-) diff --git a/distribute/nouislider.css b/distribute/nouislider.css index 19789ade..f2d19b0d 100644 --- a/distribute/nouislider.css +++ b/distribute/nouislider.css @@ -1,4 +1,4 @@ -/*! nouislider - 10.1.0 - 2017-07-28 13:09:54 */ +/*! nouislider - 10.1.0 - 2017-09-15 15:04:28 */ /* Functional styling; * These styles are required for noUiSlider to function. * You don't need to change these rules to apply your design. diff --git a/distribute/nouislider.js b/distribute/nouislider.js index e5d92816..03a89ea8 100644 --- a/distribute/nouislider.js +++ b/distribute/nouislider.js @@ -1,4 +1,4 @@ -/*! nouislider - 10.1.0 - 2017-07-28 13:09:54 */ +/*! nouislider - 10.1.0 - 2017-09-15 15:04:28 */ (function (factory) { @@ -649,25 +649,33 @@ function testPadding ( parsed, entry ) { - if ( !isNumeric(entry) ){ - throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric."); + if ( !isNumeric(entry) && !Array.isArray(entry) ){ + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric or array of exactly 2 numbers."); + } + + if ( Array.isArray(entry) && !(entry.length == 2 || isNumeric(entry[0]) || isNumeric(entry[1])) ) { + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric or array of exactly 2 numbers."); } if ( entry === 0 ) { return; } - parsed.padding = parsed.spectrum.getMargin(entry); + if ( !Array.isArray(entry) ) { + entry = [entry, entry]; + } + + parsed.padding = [parsed.spectrum.getMargin(entry[0]), parsed.spectrum.getMargin(entry[1])]; - if ( !parsed.padding ) { + if ( !parsed.padding[0] || !parsed.padding[1] ) { throw new Error("noUiSlider (" + VERSION + "): 'padding' option is only supported on linear sliders."); } - if ( parsed.padding < 0 ) { - throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number."); + if ( parsed.padding[0] < 0 || parsed.padding[1] < 0 ) { + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number(s)."); } - if ( parsed.padding >= 50 ) { + if ( parsed.padding[0] >= 50 || parsed.padding[1] >= 50 ) { throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be less than half the range."); } } @@ -1911,13 +1919,12 @@ function closure ( target, options, originalOptions ){ // The padding option keeps the handles a certain distance from the // edges of the slider. Padding must be > 0. if ( options.padding ) { - if ( handleNumber === 0 ) { - to = Math.max(to, options.padding); + to = Math.max(to, options.padding[0]); } if ( handleNumber === scope_Handles.length - 1 ) { - to = Math.min(to, 100 - options.padding); + to = Math.min(to, 100 - options.padding[1]); } } diff --git a/distribute/nouislider.min.css b/distribute/nouislider.min.css index 5e26604f..3d190bcb 100644 --- a/distribute/nouislider.min.css +++ b/distribute/nouislider.min.css @@ -1 +1 @@ -/*! nouislider - 10.1.0 - 2017-07-28 13:09:54 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);padding-left:25px}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file +/*! nouislider - 10.1.0 - 2017-09-15 15:04:28 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);padding-left:25px}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file diff --git a/distribute/nouislider.min.js b/distribute/nouislider.min.js index d4c28259..9115380e 100644 --- a/distribute/nouislider.min.js +++ b/distribute/nouislider.min.js @@ -1,3 +1,3 @@ -/*! nouislider - 10.1.0 - 2017-07-28 13:09:54 */ +/*! nouislider - 10.1.0 - 2017-09-15 15:04:28 */ -!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return!this[a]&&(this[a]=!0)},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||"");return{x:b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,y:b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(a){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+_+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+_+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(!isNaN(b[1])&&b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.length&&"object"==typeof e[0][0]?e.sort(function(a,b){return a[0][0]-b[0][0]}):e.sort(function(a,b){return a[0]-b[0]}),d=0;d=50)throw new Error("noUiSlider ("+_+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+_+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+_+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+_+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(a.multitouch=b,"boolean"!=typeof b)throw new Error("noUiSlider ("+_+"): 'multitouch' option must be a boolean.")}function S(a,b){if(!1!==b)if(!0===b){a.tooltips=[];for(var c=0;c-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=wa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(f){return!pa.hasAttribute("disabled")&&(!n(pa,e.cssClasses.tap)&&(!!(f=G(f,d.pageOffset,d.target||b))&&(!(a===ma.start&&void 0!==f.buttons&&f.buttons>1)&&((!d.hover||!f.buttons)&&(oa||f.preventDefault(),f.calcPoint=f.points[e.ort],void c(f,d))))))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!!oa&&{passive:!0}),g.push([a,f])}),g}function G(a,b,c){var d,f,g=0===a.type.indexOf("touch"),h=0===a.type.indexOf("mouse"),i=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(i=!0),g&&e.multitouch){var j=function(a){return a.target===c||c.contains(a.target)};if("touchstart"===a.type){var k=Array.prototype.filter.call(a.touches,j);if(k.length>1)return!1;d=k[0].pageX,f=k[0].pageY}else{var l=Array.prototype.find.call(a.changedTouches,j);if(!l)return!1;d=l.pageX,f=l.pageY}}else if(g){if(a.touches.length>1)return!1;d=a.changedTouches[0].pageX,f=a.changedTouches[0].pageY}return b=b||o(wa),(h||i)&&(d=a.clientX+b.x,f=a.clientY+b.y),a.pageOffset=b,a.points=[d,f],a.cursor=h||i,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);f1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);!1===d?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint);J(c>0,100*c/b.baseSize,b.locations,b.handleNumbers)}function N(a,b){b.handle&&(m(b.handle,e.cssClasses.active),sa-=1),b.listeners.forEach(function(a){xa.removeEventListener(a[0],a[1])}),0===sa&&(m(pa,e.cssClasses.drag),V(),a.cursor&&(ya.style.cursor="",ya.removeEventListener("selectstart",c))),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){var d;if(1===b.handleNumbers.length){var f=ia[b.handleNumbers[0]];if(f.hasAttribute("disabled"))return!1;d=f.children[0],sa+=1,l(d,e.cssClasses.active)}a.stopPropagation();var g=[],h=F(ma.move,xa,M,{target:a.target,handle:d,listeners:g,startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),i=F(ma.end,xa,N,{target:a.target,handle:d,listeners:g,handleNumbers:b.handleNumbers}),j=F("mouseout",xa,L,{target:a.target,handle:d,listeners:g,handleNumbers:b.handleNumbers});g.push.apply(g,h.concat(i,j)),a.cursor&&(ya.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),ya.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);if(!1===c)return!1;e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),e.events.snap&&O(a,{handleNumbers:[c]})}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(!1!==b&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return!1!==(b=S(qa,a,b,c,d,!1))&&(U(a,b),!0)}function X(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&!1!==a&&("number"==typeof a&&(a=String(a)),!1===(a=e.format.from(a))||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function $(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b||!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){$(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;!1!==e&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:!1!==c.stepBefore.step&&d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&!1!==e&&(e=Number(e.toFixed(g))),null!==f&&!1!==f&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=Y(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],$(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=0,ta=e.spectrum,ua=[],va={},wa=a.ownerDocument,xa=wa.documentElement,ya=wa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+_+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:$,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),$(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function $(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+_+"): create requires a single element, got: "+a);var c=Y(b,a),d=Z(a,c,b);return a.noUiSlider=d,d}var _="10.1.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!=0)throw new Error("noUiSlider ("+_+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&t(this.xVal,a)},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var aa={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:_,create:$}}); \ No newline at end of file +!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return!this[a]&&(this[a]=!0)},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||"");return{x:b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,y:b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(a){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+_+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+_+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(!isNaN(b[1])&&b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.length&&"object"==typeof e[0][0]?e.sort(function(a,b){return a[0][0]-b[0][0]}):e.sort(function(a,b){return a[0]-b[0]}),d=0;d=50||a.padding[1]>=50)throw new Error("noUiSlider ("+_+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+_+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+_+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+_+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(a.multitouch=b,"boolean"!=typeof b)throw new Error("noUiSlider ("+_+"): 'multitouch' option must be a boolean.")}function S(a,b){if(!1!==b)if(!0===b){a.tooltips=[];for(var c=0;c-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=wa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(f){return!pa.hasAttribute("disabled")&&(!n(pa,e.cssClasses.tap)&&(!!(f=G(f,d.pageOffset,d.target||b))&&(!(a===ma.start&&void 0!==f.buttons&&f.buttons>1)&&((!d.hover||!f.buttons)&&(oa||f.preventDefault(),f.calcPoint=f.points[e.ort],void c(f,d))))))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!!oa&&{passive:!0}),g.push([a,f])}),g}function G(a,b,c){var d,f,g=0===a.type.indexOf("touch"),h=0===a.type.indexOf("mouse"),i=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(i=!0),g&&e.multitouch){var j=function(a){return a.target===c||c.contains(a.target)};if("touchstart"===a.type){var k=Array.prototype.filter.call(a.touches,j);if(k.length>1)return!1;d=k[0].pageX,f=k[0].pageY}else{var l=Array.prototype.find.call(a.changedTouches,j);if(!l)return!1;d=l.pageX,f=l.pageY}}else if(g){if(a.touches.length>1)return!1;d=a.changedTouches[0].pageX,f=a.changedTouches[0].pageY}return b=b||o(wa),(h||i)&&(d=a.clientX+b.x,f=a.clientY+b.y),a.pageOffset=b,a.points=[d,f],a.cursor=h||i,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);f1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);!1===d?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint);J(c>0,100*c/b.baseSize,b.locations,b.handleNumbers)}function N(a,b){b.handle&&(m(b.handle,e.cssClasses.active),sa-=1),b.listeners.forEach(function(a){xa.removeEventListener(a[0],a[1])}),0===sa&&(m(pa,e.cssClasses.drag),V(),a.cursor&&(ya.style.cursor="",ya.removeEventListener("selectstart",c))),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){var d;if(1===b.handleNumbers.length){var f=ia[b.handleNumbers[0]];if(f.hasAttribute("disabled"))return!1;d=f.children[0],sa+=1,l(d,e.cssClasses.active)}a.stopPropagation();var g=[],h=F(ma.move,xa,M,{target:a.target,handle:d,listeners:g,startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),i=F(ma.end,xa,N,{target:a.target,handle:d,listeners:g,handleNumbers:b.handleNumbers}),j=F("mouseout",xa,L,{target:a.target,handle:d,listeners:g,handleNumbers:b.handleNumbers});g.push.apply(g,h.concat(i,j)),a.cursor&&(ya.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),ya.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);if(!1===c)return!1;e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),e.events.snap&&O(a,{handleNumbers:[c]})}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(!1!==b&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return!1!==(b=S(qa,a,b,c,d,!1))&&(U(a,b),!0)}function X(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&!1!==a&&("number"==typeof a&&(a=String(a)),!1===(a=e.format.from(a))||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function $(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b||!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){$(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;!1!==e&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:!1!==c.stepBefore.step&&d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&!1!==e&&(e=Number(e.toFixed(g))),null!==f&&!1!==f&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=Y(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],$(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=0,ta=e.spectrum,ua=[],va={},wa=a.ownerDocument,xa=wa.documentElement,ya=wa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+_+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:$,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),$(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function $(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+_+"): create requires a single element, got: "+a);var c=Y(b,a),d=Z(a,c,b);return a.noUiSlider=d,d}var _="10.1.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!=0)throw new Error("noUiSlider ("+_+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&t(this.xVal,a)},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var aa={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:_,create:$}}); \ No newline at end of file diff --git a/src/js/options.js b/src/js/options.js index bd15fc45..86139eca 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -188,25 +188,33 @@ function testPadding ( parsed, entry ) { - if ( !isNumeric(entry) ){ - throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric."); + if ( !isNumeric(entry) && !Array.isArray(entry) ){ + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric or array of exactly 2 numbers."); + } + + if ( Array.isArray(entry) && !(entry.length == 2 || isNumeric(entry[0]) || isNumeric(entry[1])) ) { + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric or array of exactly 2 numbers."); } if ( entry === 0 ) { return; } - parsed.padding = parsed.spectrum.getMargin(entry); + if ( !Array.isArray(entry) ) { + entry = [entry, entry]; + } + + parsed.padding = [parsed.spectrum.getMargin(entry[0]), parsed.spectrum.getMargin(entry[1])]; - if ( !parsed.padding ) { + if ( !parsed.padding[0] || !parsed.padding[1] ) { throw new Error("noUiSlider (" + VERSION + "): 'padding' option is only supported on linear sliders."); } - if ( parsed.padding < 0 ) { - throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number."); + if ( parsed.padding[0] < 0 || parsed.padding[1] < 0 ) { + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number(s)."); } - if ( parsed.padding >= 50 ) { + if ( parsed.padding[0] >= 50 || parsed.padding[1] >= 50 ) { throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be less than half the range."); } } diff --git a/src/js/scope.js b/src/js/scope.js index 97ee2828..bd87f54e 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -34,11 +34,11 @@ if ( options.padding ) { if ( handleNumber === 0 ) { - to = Math.max(to, options.padding); + to = Math.max(to, options.padding[0]); } if ( handleNumber === scope_Handles.length - 1 ) { - to = Math.min(to, 100 - options.padding); + to = Math.min(to, 100 - options.padding[1]); } } From a931297eb831a8e13390db1be859d416792e8732 Mon Sep 17 00:00:00 2001 From: Nils Lundquist Date: Fri, 15 Sep 2017 19:59:59 -0600 Subject: [PATCH 07/40] look ahead when applying values --- distribute/nouislider.js | 2 +- src/js/scope.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/distribute/nouislider.js b/distribute/nouislider.js index e5d92816..fef36b19 100644 --- a/distribute/nouislider.js +++ b/distribute/nouislider.js @@ -2056,7 +2056,7 @@ function closure ( target, options, originalOptions ){ // Now that all base values are set, apply constraints scope_HandleNumbers.forEach(function(handleNumber){ - setHandle(handleNumber, scope_Locations[handleNumber], true, false); + setHandle(handleNumber, scope_Locations[handleNumber], true, true); }); setZindex(); diff --git a/src/js/scope.js b/src/js/scope.js index 97ee2828..c9b41f22 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -1,4 +1,3 @@ - // Split out the handle positioning logic so the Move event can use it, too function checkHandlePosition ( reference, handleNumber, to, lookBackward, lookForward, getValue ) { @@ -177,7 +176,7 @@ // Now that all base values are set, apply constraints scope_HandleNumbers.forEach(function(handleNumber){ - setHandle(handleNumber, scope_Locations[handleNumber], true, false); + setHandle(handleNumber, scope_Locations[handleNumber], true, true); }); setZindex(); From 4fe1f09b1ac9d9e06413e9abc67c8138f95695af Mon Sep 17 00:00:00 2001 From: Andrei Surdu Date: Thu, 5 Oct 2017 11:38:02 +0300 Subject: [PATCH 08/40] npm: include only distribution files When installed with npm, it will add all files that you see in this repository. I've added "files" option, so only the necessary production files are installed. Please commit this asap on npm as it's really something that most developers will welcome. Who don't like to keep their projects clean? Thank you. --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index d887024c..74eb6588 100644 --- a/package.json +++ b/package.json @@ -31,4 +31,7 @@ "type": "git", "url": "git://github.com/leongersen/noUiSlider.git" } + "files": [ + "distribute" + ] } From 67d070ef3e67cf7357092952da51c1e3410be788 Mon Sep 17 00:00:00 2001 From: Andrei Surdu Date: Thu, 5 Oct 2017 11:44:23 +0300 Subject: [PATCH 09/40] Comma! --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 74eb6588..ec5150da 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "repository": { "type": "git", "url": "git://github.com/leongersen/noUiSlider.git" - } + }, "files": [ "distribute" ] From 5974e9c41c51bd8494fd4f436793d5d7768281f1 Mon Sep 17 00:00:00 2001 From: EC2 Default User Date: Mon, 1 Jan 2018 00:10:39 +0000 Subject: [PATCH 10/40] account for case sensitive --- documentation/_run/router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/_run/router.php b/documentation/_run/router.php index 616fc383..867ae068 100644 --- a/documentation/_run/router.php +++ b/documentation/_run/router.php @@ -30,5 +30,5 @@ ob_end_clean(); - $distribute = '/noUiSlider/distribute'; + $distribute = '/nouislider/distribute'; include '_run/index.php'; From c28bfa7b9bb12698fab16dd2383bcaeb67c06754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Mon, 1 Jan 2018 00:14:57 +0000 Subject: [PATCH 11/40] add rough implementation of transform --- src/js/constants.js | 4 ++++ src/js/scope.js | 24 +++++++++++++++++++++--- src/js/scope_start.js | 1 + src/nouislider.core.less | 14 ++++++++++++-- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/js/constants.js b/src/js/constants.js index 3b72286c..83760224 100644 --- a/src/js/constants.js +++ b/src/js/constants.js @@ -44,3 +44,7 @@ function getSupportsTouchActionNone ( ) { return window.CSS && CSS.supports && CSS.supports('touch-action', 'none'); } + + function getSupportsCSSTransform ( ) { + return window.CSS && CSS.supports && CSS.supports('transform','translate(0,0) scale(0,0)'); + } diff --git a/src/js/scope.js b/src/js/scope.js index 97ee2828..ce5a8d8d 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -55,6 +55,11 @@ return to; } + function inRuleOrder ( v, a ) { + var o = options.ort; + return (o?a:v) + ', ' + (o?v:a); + } + function toPct ( pct ) { return pct + '%'; } @@ -70,7 +75,12 @@ // Called synchronously or on the next animationFrame var stateUpdate = function() { - scope_Handles[handleNumber].style[options.style] = toPct(to); + // scope_Handles[handleNumber].style[options.style] = toPct(to); + + if ( supportsCSSTransform ) { + scope_Handles[handleNumber].style.transform = 'translate(' + inRuleOrder(toPct(100 * to), '0') + ')'; + } + updateConnect(handleNumber); updateConnect(handleNumber + 1); }; @@ -131,8 +141,16 @@ h = scope_Locations[index]; } - scope_Connects[index].style[options.style] = toPct(l); - scope_Connects[index].style[options.styleOposite] = toPct(100 - h); + //scope_Connects[index].style[options.style] = toPct(l); + //scope_Connects[index].style[options.styleOposite] = toPct(100 - h); + + if ( supportsCSSTransform ) { + + var translateRule = 'translate(' + inRuleOrder(toPct(100 * l), '0') + ')'; + var scaleRule = 'scale(' + inRuleOrder(h - l, '1') + ')'; + + scope_Connects[index].style.transform = translateRule + ' ' + scaleRule; + } } // ... diff --git a/src/js/scope_start.js b/src/js/scope_start.js index f7c9d27e..f3e73cc5 100644 --- a/src/js/scope_start.js +++ b/src/js/scope_start.js @@ -4,6 +4,7 @@ function closure ( target, options, originalOptions ){ var actions = getActions(); var supportsTouchActionNone = getSupportsTouchActionNone(); var supportsPassive = supportsTouchActionNone && getSupportsPassive(); + var supportsCSSTransform = getSupportsCSSTransform(); // All variables local to 'closure' are prefixed with 'scope_' var scope_Target = target; diff --git a/src/nouislider.core.less b/src/nouislider.core.less index 6939c29a..6957775e 100644 --- a/src/nouislider.core.less +++ b/src/nouislider.core.less @@ -32,11 +32,21 @@ top: 0; left: 0; bottom: 0; + -webkit-transform-origin: 0 0; + transform-origin: 0 0; + z-index: -1; } +.@{noUi-css-prefix}-vertical .@{noUi-css-prefix}-connect { + height: 1%; +} +.@{noUi-css-prefix}-horizontal .@{noUi-css-prefix}-connect { + width: 1%; +} + .@{noUi-css-prefix}-origin { position: absolute; - height: 0; - width: 0; + height: 1%; + width: 1%; } .@{noUi-css-prefix}-handle { position: relative; From 3670ecaf3204c6c8c9945b9166f7852604c52e5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Mon, 1 Jan 2018 00:32:42 +0000 Subject: [PATCH 12/40] clean up transform --- src/js/options.js | 1 + src/js/scope.js | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/js/options.js b/src/js/options.js index bd15fc45..f09a6a57 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -463,6 +463,7 @@ // Pre-define the styles. parsed.style = styles[parsed.dir][parsed.ort]; parsed.styleOposite = styles[parsed.dir?0:1][parsed.ort]; + parsed.transformRule = 'transform'; // todo add -webkit- if needed return parsed; } diff --git a/src/js/scope.js b/src/js/scope.js index ce5a8d8d..c30f9d49 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -55,6 +55,7 @@ return to; } + // Uses slider orientation to create CSS rules. a = base value; function inRuleOrder ( v, a ) { var o = options.ort; return (o?a:v) + ', ' + (o?v:a); @@ -75,10 +76,11 @@ // Called synchronously or on the next animationFrame var stateUpdate = function() { - // scope_Handles[handleNumber].style[options.style] = toPct(to); if ( supportsCSSTransform ) { - scope_Handles[handleNumber].style.transform = 'translate(' + inRuleOrder(toPct(100 * to), '0') + ')'; + scope_Handles[handleNumber].style[options.transformRule] = 'translate(' + inRuleOrder(toPct(100 * to), '0') + ')'; + } else { + scope_Handles[handleNumber].style[options.style] = toPct(to); } updateConnect(handleNumber); @@ -141,15 +143,22 @@ h = scope_Locations[index]; } - //scope_Connects[index].style[options.style] = toPct(l); - //scope_Connects[index].style[options.styleOposite] = toPct(100 - h); - + // If we've determined the browser can use CSS transforms, we use two rules: + // 'translate' to change the left/top offset; + // 'scale' to change the width of the element; + // As the element has a width of 1%, a translation of 100% is equal to 1% of the parent (.noUi-base) if ( supportsCSSTransform ) { var translateRule = 'translate(' + inRuleOrder(toPct(100 * l), '0') + ')'; var scaleRule = 'scale(' + inRuleOrder(h - l, '1') + ')'; - scope_Connects[index].style.transform = translateRule + ' ' + scaleRule; + scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule; + + } else { + + // Fall back to absolute positioning + scope_Connects[index].style[options.style] = toPct(l); + scope_Connects[index].style[options.styleOposite] = toPct(100 - h); } } From 9b7d55c91be25584bc02b61769aa45cad0d0f9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Mon, 1 Jan 2018 16:25:03 +0000 Subject: [PATCH 13/40] remove RAF and multitouch options --- src/js/options.js | 24 ++---------------------- src/js/scope.js | 30 ++++++++---------------------- src/js/scope_helpers.js | 26 +++++++++++--------------- 3 files changed, 21 insertions(+), 59 deletions(-) diff --git a/src/js/options.js b/src/js/options.js index f09a6a57..57cc3bf3 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -262,14 +262,6 @@ }; } - function testMultitouch ( parsed, entry ) { - parsed.multitouch = entry; - - if ( typeof entry !== 'boolean' ){ - throw new Error("noUiSlider (" + VERSION + "): 'multitouch' option must be a boolean."); - } - } - function testTooltips ( parsed, entry ) { if ( entry === false ) { @@ -339,14 +331,6 @@ } } - function testUseRaf ( parsed, entry ) { - if ( entry === true || entry === false ) { - parsed.useRequestAnimationFrame = entry; - } else { - throw new Error("noUiSlider (" + VERSION + "): 'useRequestAnimationFrame' option should be true (default) or false."); - } - } - // Test all developer settings and parse to assumption-safe values. function testOptions ( options ) { @@ -379,20 +363,17 @@ 'limit': { r: false, t: testLimit }, 'padding': { r: false, t: testPadding }, 'behaviour': { r: true, t: testBehaviour }, - 'multitouch': { r: true, t: testMultitouch }, 'ariaFormat': { r: false, t: testAriaFormat }, 'format': { r: false, t: testFormat }, 'tooltips': { r: false, t: testTooltips }, 'cssPrefix': { r: false, t: testCssPrefix }, - 'cssClasses': { r: false, t: testCssClasses }, - 'useRequestAnimationFrame': { r: false, t: testUseRaf } + 'cssClasses': { r: false, t: testCssClasses } }; var defaults = { 'connect': false, 'direction': 'ltr', 'behaviour': 'tap', - 'multitouch': false, 'orientation': 'horizontal', 'cssPrefix' : 'noUi-', 'cssClasses': { @@ -428,8 +409,7 @@ valueNormal: 'value-normal', valueLarge: 'value-large', valueSub: 'value-sub' - }, - 'useRequestAnimationFrame': true + } }; // AriaFormat defaults to regular format, if any. diff --git a/src/js/scope.js b/src/js/scope.js index c30f9d49..8ce93f68 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -74,28 +74,14 @@ // Convert the value to the slider stepping/range. scope_Values[handleNumber] = scope_Spectrum.fromStepping(to); - // Called synchronously or on the next animationFrame - var stateUpdate = function() { - - if ( supportsCSSTransform ) { - scope_Handles[handleNumber].style[options.transformRule] = 'translate(' + inRuleOrder(toPct(100 * to), '0') + ')'; - } else { - scope_Handles[handleNumber].style[options.style] = toPct(to); - } - - updateConnect(handleNumber); - updateConnect(handleNumber + 1); - }; - - // Set the handle to the new position. - // Use requestAnimationFrame for efficient painting. - // No significant effect in Chrome, Edge sees dramatic performace improvements. - // Option to disable is useful for unit tests, and single-step debugging. - if ( window.requestAnimationFrame && options.useRequestAnimationFrame ) { - window.requestAnimationFrame(stateUpdate); + if ( supportsCSSTransform ) { + scope_Handles[handleNumber].style[options.transformRule] = 'translate(' + inRuleOrder(toPct(100 * to), '0') + ')'; } else { - stateUpdate(); + scope_Handles[handleNumber].style[options.style] = toPct(to); } + + updateConnect(handleNumber); + updateConnect(handleNumber + 1); } function setZindex ( ) { @@ -148,12 +134,12 @@ // 'scale' to change the width of the element; // As the element has a width of 1%, a translation of 100% is equal to 1% of the parent (.noUi-base) if ( supportsCSSTransform ) { - + var translateRule = 'translate(' + inRuleOrder(toPct(100 * l), '0') + ')'; var scaleRule = 'scale(' + inRuleOrder(h - l, '1') + ')'; scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule; - + } else { // Fall back to absolute positioning diff --git a/src/js/scope_helpers.js b/src/js/scope_helpers.js index 4e96f0ef..ad288ddd 100644 --- a/src/js/scope_helpers.js +++ b/src/js/scope_helpers.js @@ -86,44 +86,40 @@ // In the event that multitouch is activated, the only thing one handle should be concerned // about is the touches that originated on top of it. - if ( touch && options.multitouch ) { + if ( touch ) { + // Returns true if a touch originated on the target. var isTouchOnTarget = function (touch) { return touch.target === target || target.contains(touch.target); }; + // In the case of touchstart events, we need to make sure there is still no more than one // touch on the target so we look amongst all touches. if (e.type === 'touchstart') { + var targetTouches = Array.prototype.filter.call(e.touches, isTouchOnTarget); + // Do not support more than one touch per handle. if ( targetTouches.length > 1 ) { return false; } + x = targetTouches[0].pageX; y = targetTouches[0].pageY; + } else { - // In the other cases, find on changedTouches is enough. + + // In the other cases, find on changedTouches is enough. var targetTouch = Array.prototype.find.call(e.changedTouches, isTouchOnTarget); + // Cancel if the target touch has not moved. if ( !targetTouch ) { return false; } + x = targetTouch.pageX; y = targetTouch.pageY; } - } else if ( touch ) { - // Fix bug when user touches with two or more fingers on mobile devices. - // It's useful when you have two or more sliders on one page, - // that can be touched simultaneously. - // #649, #663, #668 - if ( e.touches.length > 1 ) { - return false; - } - - // noUiSlider supports one movement at a time, - // so we can select the first 'changedTouch'. - x = e.changedTouches[0].pageX; - y = e.changedTouches[0].pageY; } pageOffset = pageOffset || getPageOffset(scope_Document); From 00f4ab0201594bd29f41aef00060e2fdbc65611d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Mon, 1 Jan 2018 16:31:14 +0000 Subject: [PATCH 14/40] remove multitouch docs --- documentation/slider-options.php | 31 ---------------------- documentation/slider-options/multitouch.js | 11 -------- 2 files changed, 42 deletions(-) delete mode 100644 documentation/slider-options/multitouch.js diff --git a/documentation/slider-options.php b/documentation/slider-options.php index ae75b368..686a85b8 100644 --- a/documentation/slider-options.php +++ b/documentation/slider-options.php @@ -387,34 +387,3 @@ - - - - -

Multitouch

- -
-
-

Set the multitouch option to true to allow simultaneous interaction with a slider and other content on the page (e.g. another slider). It is even possible to simultaneously control several handles of the same slider.

- -
-
-
-
- -
- -
- Default -
false
- - Accepted values -
true, false
-
- -
- -
- -
-
diff --git a/documentation/slider-options/multitouch.js b/documentation/slider-options/multitouch.js deleted file mode 100644 index aed840ba..00000000 --- a/documentation/slider-options/multitouch.js +++ /dev/null @@ -1,11 +0,0 @@ -[1, 2, 3].forEach(function (i) { - slider = document.getElementById('slider-multitouch-' + i); - noUiSlider.create(slider, { - start: [20, 80], - multitouch: true, - range: { - min: 0, - max: 100 - } - }); -}); From 3b733b7145dbf5ca8f134780b4f27b6ccabf9a76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Mon, 1 Jan 2018 17:12:00 +0000 Subject: [PATCH 15/40] Fix visual/layering glitches --- src/js/scope_events.js | 2 ++ src/js/scope_helpers.js | 17 ++++++++++------- src/nouislider.core.less | 18 +++++------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/js/scope_events.js b/src/js/scope_events.js index 2bc2bd6c..307bb248 100644 --- a/src/js/scope_events.js +++ b/src/js/scope_events.js @@ -105,6 +105,7 @@ target: event.target, handle: handle, listeners: listeners, + doNotReject: true, handleNumbers: data.handleNumbers }); @@ -112,6 +113,7 @@ target: event.target, handle: handle, listeners: listeners, + doNotReject: true, handleNumbers: data.handleNumbers }); diff --git a/src/js/scope_helpers.js b/src/js/scope_helpers.js index ad288ddd..1ae13f7f 100644 --- a/src/js/scope_helpers.js +++ b/src/js/scope_helpers.js @@ -13,19 +13,22 @@ var method = function ( e ){ - if ( scope_Target.hasAttribute('disabled') ) { + e = fixEvent(e, data.pageOffset, data.target || element); + + // fixEvent returns false if this event has a different target + // when handling (multi-) touch events; + if ( !e ) { return false; } - // Stop if an active 'tap' transition is taking place. - if ( hasClass(scope_Target, options.cssClasses.tap) ) { + // doNotReject is passed by all end events to make sure released touches + // are not rejected, leaving the slider "stuck" to the cursor; + if ( scope_Target.hasAttribute('disabled') && !data.doNotReject ) { return false; } - e = fixEvent(e, data.pageOffset, data.target || element); - - // Handle reject of multitouch - if ( !e ) { + // Stop if an active 'tap' transition is taking place. + if ( hasClass(scope_Target, options.cssClasses.tap) && !data.doNotReject ) { return false; } diff --git a/src/nouislider.core.less b/src/nouislider.core.less index 6957775e..3a84b513 100644 --- a/src/nouislider.core.less +++ b/src/nouislider.core.less @@ -44,7 +44,8 @@ } .@{noUi-css-prefix}-origin { - position: absolute; + will-change: transform; + position: relative; height: 1%; width: 1%; } @@ -54,22 +55,13 @@ } .@{noUi-css-prefix}-state-tap .@{noUi-css-prefix}-connect, .@{noUi-css-prefix}-state-tap .@{noUi-css-prefix}-origin { --webkit-transition: top 0.3s, right 0.3s, bottom 0.3s, left 0.3s; - transition: top 0.3s, right 0.3s, bottom 0.3s, left 0.3s; +-webkit-transition: transform 0.3s; + transition: transform 0.3s; } .@{noUi-css-prefix}-state-drag * { cursor: inherit !important; } -/* Painting and performance; - * Browsers can paint handles in their own layer. - */ -.@{noUi-css-prefix}-base, -.@{noUi-css-prefix}-handle { - -webkit-transform: translate3d(0,0,0); - transform: translate3d(0,0,0); -} - /* Slider size and handle placement; */ .@{noUi-css-prefix}-horizontal { @@ -92,6 +84,7 @@ } /* Styling; + * Giving the connect element a border radius causes issues with using transform: scale */ .@{noUi-css-prefix}-target { background: #FAFAFA; @@ -101,7 +94,6 @@ } .@{noUi-css-prefix}-connect { background: #3FB8AF; - border-radius: 4px; box-shadow: inset 0 0 3px rgba(51,51,51,0.45); -webkit-transition: background 450ms; transition: background 450ms; From a717ab6ab450d4ece8872f29d603e78c00ccdabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Mon, 1 Jan 2018 17:51:14 +0000 Subject: [PATCH 16/40] Support transform for direction --- src/js/scope.js | 13 ++++++++++--- src/nouislider.core.less | 4 +++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/js/scope.js b/src/js/scope.js index 8ce93f68..8a994d2b 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -65,6 +65,11 @@ return pct + '%'; } + // Takes a base value and an offset. This offset is used for the connect bar size. + function transformDirection ( a, b ) { + return 100 * (options.dir ? 100 - a - b : a); + } + // Updates scope_Locations and scope_Values, updates visual state function updateHandlePosition ( handleNumber, to ) { @@ -75,7 +80,8 @@ scope_Values[handleNumber] = scope_Spectrum.fromStepping(to); if ( supportsCSSTransform ) { - scope_Handles[handleNumber].style[options.transformRule] = 'translate(' + inRuleOrder(toPct(100 * to), '0') + ')'; + var rule = 'translate(' + inRuleOrder(toPct(transformDirection(to, 0)), '0') + ')'; + scope_Handles[handleNumber].style[options.transformRule] = rule; } else { scope_Handles[handleNumber].style[options.style] = toPct(to); } @@ -135,8 +141,9 @@ // As the element has a width of 1%, a translation of 100% is equal to 1% of the parent (.noUi-base) if ( supportsCSSTransform ) { - var translateRule = 'translate(' + inRuleOrder(toPct(100 * l), '0') + ')'; - var scaleRule = 'scale(' + inRuleOrder(h - l, '1') + ')'; + var connectWidth = h - l; + var translateRule = 'translate(' + inRuleOrder(toPct(transformDirection(l, connectWidth)), '0') + ')'; + var scaleRule = 'scale(' + inRuleOrder(connectWidth, '1') + ')'; scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule; diff --git a/src/nouislider.core.less b/src/nouislider.core.less index 3a84b513..8d86a36d 100644 --- a/src/nouislider.core.less +++ b/src/nouislider.core.less @@ -45,7 +45,9 @@ .@{noUi-css-prefix}-origin { will-change: transform; - position: relative; + position: absolute; + top: 0; + left: 0; height: 1%; width: 1%; } From 0914139405a287cb6d8dc990fe05042bbc935bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Mon, 1 Jan 2018 17:58:37 +0000 Subject: [PATCH 17/40] Array.isArray --- src/js/range.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/range.js b/src/js/range.js index 39922cbb..1b4dc9c8 100644 --- a/src/js/range.js +++ b/src/js/range.js @@ -118,7 +118,7 @@ } // Reject any invalid input, by testing whether value is an array. - if ( Object.prototype.toString.call( value ) !== '[object Array]' ){ + if ( !Array.isArray(value) ){ throw new Error("noUiSlider (" + VERSION + "): 'range' contains invalid value."); } From 19a4e8bfe2699f6eee824822e69b35785e09b293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Mon, 1 Jan 2018 18:47:33 +0000 Subject: [PATCH 18/40] work on transform --- src/js/options.js | 1 + src/js/scope.js | 6 ++++-- src/js/structure.js | 6 ++++-- src/nouislider.core.less | 20 +++++++++++++------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/js/options.js b/src/js/options.js index 57cc3bf3..bcd4d968 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -387,6 +387,7 @@ vertical: 'vertical', background: 'background', connect: 'connect', + connects: 'connects', ltr: 'ltr', rtl: 'rtl', draggable: 'draggable', diff --git a/src/js/scope.js b/src/js/scope.js index 8a994d2b..74ab2f33 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -81,7 +81,8 @@ if ( supportsCSSTransform ) { var rule = 'translate(' + inRuleOrder(toPct(transformDirection(to, 0)), '0') + ')'; - scope_Handles[handleNumber].style[options.transformRule] = rule; + var layerRule = 'translate3d(0,0,0)'; + scope_Handles[handleNumber].style[options.transformRule] = rule + ' ' + layerRule; } else { scope_Handles[handleNumber].style[options.style] = toPct(to); } @@ -144,8 +145,9 @@ var connectWidth = h - l; var translateRule = 'translate(' + inRuleOrder(toPct(transformDirection(l, connectWidth)), '0') + ')'; var scaleRule = 'scale(' + inRuleOrder(connectWidth, '1') + ')'; + var layerRule = 'translate3d(0,0,0)'; - scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule; + scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule + ' ' + layerRule; } else { diff --git a/src/js/structure.js b/src/js/structure.js index e39d57ed..1a311e10 100644 --- a/src/js/structure.js +++ b/src/js/structure.js @@ -51,10 +51,12 @@ // Add handles to the slider base. function addElements ( connectOptions, base ) { + var connectBase = addNodeTo(base, options.cssClasses.connects); + scope_Handles = []; scope_Connects = []; - scope_Connects.push(addConnect(base, connectOptions[0])); + scope_Connects.push(addConnect(connectBase, connectOptions[0])); // [::::O====O====O====] // connectOptions = [0, 1, 1, 1] @@ -63,7 +65,7 @@ // Keep a list of all added handles. scope_Handles.push(addOrigin(base, i)); scope_HandleNumbers[i] = i; - scope_Connects.push(addConnect(base, connectOptions[i + 1])); + scope_Connects.push(addConnect(connectBase, connectOptions[i + 1])); } } diff --git a/src/nouislider.core.less b/src/nouislider.core.less index 8d86a36d..b2005a51 100644 --- a/src/nouislider.core.less +++ b/src/nouislider.core.less @@ -20,12 +20,17 @@ position: relative; direction: ltr; } -.@{noUi-css-prefix}-base { +.@{noUi-css-prefix}-base, +.@{noUi-css-prefix}-connects { width: 100%; height: 100%; position: relative; z-index: 1; /* Fix 401 */ } +.@{noUi-css-prefix}-connects { + overflow: hidden; + z-index: -1; +} .@{noUi-css-prefix}-connect { position: absolute; right: 0; @@ -34,7 +39,6 @@ bottom: 0; -webkit-transform-origin: 0 0; transform-origin: 0 0; - z-index: -1; } .@{noUi-css-prefix}-vertical .@{noUi-css-prefix}-connect { height: 1%; @@ -44,19 +48,21 @@ } .@{noUi-css-prefix}-origin { - will-change: transform; + /*will-change: transform; Causes a bunch of bugs */ position: absolute; top: 0; left: 0; height: 1%; width: 1%; + + background: red; } .@{noUi-css-prefix}-handle { position: relative; z-index: 1; } -.@{noUi-css-prefix}-state-tap .@{noUi-css-prefix}-connect, -.@{noUi-css-prefix}-state-tap .@{noUi-css-prefix}-origin { +.@{noUi-css-prefix}-connect, +.@{noUi-css-prefix}-origin { -webkit-transition: transform 0.3s; transition: transform 0.3s; } @@ -97,8 +103,6 @@ .@{noUi-css-prefix}-connect { background: #3FB8AF; box-shadow: inset 0 0 3px rgba(51,51,51,0.45); --webkit-transition: background 450ms; - transition: background 450ms; } /* Handles and cursors; @@ -110,6 +114,8 @@ cursor: ns-resize; } .@{noUi-css-prefix}-handle { + opacity: 0.3; + border: 1px solid #D9D9D9; border-radius: 3px; background: #FFF; From 32040e3cb90eb87fd0245ce9adce052f5e6a6c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Mon, 1 Jan 2018 19:14:32 +0000 Subject: [PATCH 19/40] profile layering --- src/js/constants.js | 2 +- src/js/scope.js | 10 ++++------ src/nouislider.core.less | 18 +++++++++--------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/js/constants.js b/src/js/constants.js index 83760224..982b437e 100644 --- a/src/js/constants.js +++ b/src/js/constants.js @@ -46,5 +46,5 @@ } function getSupportsCSSTransform ( ) { - return window.CSS && CSS.supports && CSS.supports('transform','translate(0,0) scale(0,0)'); + return window.CSS && CSS.supports && CSS.supports('transform','translate3d(0,0,0) scale(0,0)'); } diff --git a/src/js/scope.js b/src/js/scope.js index 74ab2f33..e8b9e2a3 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -80,9 +80,8 @@ scope_Values[handleNumber] = scope_Spectrum.fromStepping(to); if ( supportsCSSTransform ) { - var rule = 'translate(' + inRuleOrder(toPct(transformDirection(to, 0)), '0') + ')'; - var layerRule = 'translate3d(0,0,0)'; - scope_Handles[handleNumber].style[options.transformRule] = rule + ' ' + layerRule; + var rule = 'translate3d(' + inRuleOrder(toPct(transformDirection(to, 0)), '0') + ', 0)'; + scope_Handles[handleNumber].style[options.transformRule] = rule; } else { scope_Handles[handleNumber].style[options.style] = toPct(to); } @@ -143,11 +142,10 @@ if ( supportsCSSTransform ) { var connectWidth = h - l; - var translateRule = 'translate(' + inRuleOrder(toPct(transformDirection(l, connectWidth)), '0') + ')'; + var translateRule = 'translate3d(' + inRuleOrder(toPct(transformDirection(l, connectWidth)), '0') + ', 0)'; var scaleRule = 'scale(' + inRuleOrder(connectWidth, '1') + ')'; - var layerRule = 'translate3d(0,0,0)'; - scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule + ' ' + layerRule; + scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule; } else { diff --git a/src/nouislider.core.less b/src/nouislider.core.less index b2005a51..3c4f166d 100644 --- a/src/nouislider.core.less +++ b/src/nouislider.core.less @@ -33,18 +33,18 @@ } .@{noUi-css-prefix}-connect { position: absolute; - right: 0; top: 0; left: 0; - bottom: 0; -webkit-transform-origin: 0 0; transform-origin: 0 0; } .@{noUi-css-prefix}-vertical .@{noUi-css-prefix}-connect { height: 1%; + width: 100%; } .@{noUi-css-prefix}-horizontal .@{noUi-css-prefix}-connect { width: 1%; + height: 100%; } .@{noUi-css-prefix}-origin { @@ -52,17 +52,20 @@ position: absolute; top: 0; left: 0; +} +.@{noUi-css-prefix}-vertical .@{noUi-css-prefix}-origin { height: 1%; +} +.@{noUi-css-prefix}-horizontal .@{noUi-css-prefix}-origin { width: 1%; - - background: red; } + .@{noUi-css-prefix}-handle { position: relative; z-index: 1; } -.@{noUi-css-prefix}-connect, -.@{noUi-css-prefix}-origin { +.@{noUi-css-prefix}-state-tap .@{noUi-css-prefix}-connect, +.@{noUi-css-prefix}-state-tap .@{noUi-css-prefix}-origin { -webkit-transition: transform 0.3s; transition: transform 0.3s; } @@ -102,7 +105,6 @@ } .@{noUi-css-prefix}-connect { background: #3FB8AF; - box-shadow: inset 0 0 3px rgba(51,51,51,0.45); } /* Handles and cursors; @@ -114,8 +116,6 @@ cursor: ns-resize; } .@{noUi-css-prefix}-handle { - opacity: 0.3; - border: 1px solid #D9D9D9; border-radius: 3px; background: #FFF; From 287c85736092d3cdf1eb9e4faf36aaffa3a6bd99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Tue, 2 Jan 2018 18:46:09 +0000 Subject: [PATCH 20/40] change transform context to 100% --- src/js/scope.js | 9 ++++++--- src/nouislider.core.less | 38 ++++++++++++++++++-------------------- tests/slider_errors.js | 11 ----------- 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/src/js/scope.js b/src/js/scope.js index e8b9e2a3..13fe4431 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -66,8 +66,11 @@ } // Takes a base value and an offset. This offset is used for the connect bar size. + // In the initial design for this feature, the origin element was 1% wide. + // Unfortunately, a rounding bug in Chrome makes it impossible to implement this feature + // in this manner: https://bugs.chromium.org/p/chromium/issues/detail?id=798223 function transformDirection ( a, b ) { - return 100 * (options.dir ? 100 - a - b : a); + return options.dir ? 100 - a - b : a; } // Updates scope_Locations and scope_Values, updates visual state @@ -98,7 +101,7 @@ // [[7] [8] .......... | .......... [5] [4] var dir = (scope_Locations[handleNumber] > 50 ? -1 : 1); var zIndex = 3 + (scope_Handles.length + (dir * handleNumber)); - scope_Handles[handleNumber].childNodes[0].style.zIndex = zIndex; + scope_Handles[handleNumber].style.zIndex = zIndex; }); } @@ -143,7 +146,7 @@ var connectWidth = h - l; var translateRule = 'translate3d(' + inRuleOrder(toPct(transformDirection(l, connectWidth)), '0') + ', 0)'; - var scaleRule = 'scale(' + inRuleOrder(connectWidth, '1') + ')'; + var scaleRule = 'scale(' + inRuleOrder(connectWidth / 100, '1') + ')'; scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule; diff --git a/src/nouislider.core.less b/src/nouislider.core.less index 3c4f166d..eba142cc 100644 --- a/src/nouislider.core.less +++ b/src/nouislider.core.less @@ -25,43 +25,41 @@ width: 100%; height: 100%; position: relative; - z-index: 1; /* Fix 401 */ + z-index: 1; } +/* Wrapper for all connect elements. + */ .@{noUi-css-prefix}-connects { overflow: hidden; - z-index: -1; + z-index: 0; + border-radius: 3px; } -.@{noUi-css-prefix}-connect { +.@{noUi-css-prefix}-connect, +.@{noUi-css-prefix}-origin { + will-change: transform; position: absolute; + z-index: 1; top: 0; left: 0; + height: 100%; + width: 100%; -webkit-transform-origin: 0 0; transform-origin: 0 0; } -.@{noUi-css-prefix}-vertical .@{noUi-css-prefix}-connect { - height: 1%; - width: 100%; -} -.@{noUi-css-prefix}-horizontal .@{noUi-css-prefix}-connect { - width: 1%; - height: 100%; -} -.@{noUi-css-prefix}-origin { - /*will-change: transform; Causes a bunch of bugs */ - position: absolute; - top: 0; - left: 0; -} +/* Give origins 0 height/width so they don't interfere with clicking the + * connect elements. + */ .@{noUi-css-prefix}-vertical .@{noUi-css-prefix}-origin { - height: 1%; + width: 0; } .@{noUi-css-prefix}-horizontal .@{noUi-css-prefix}-origin { - width: 1%; + height: 0; } + .@{noUi-css-prefix}-handle { - position: relative; + position: absolute; z-index: 1; } .@{noUi-css-prefix}-state-tap .@{noUi-css-prefix}-connect, diff --git a/tests/slider_errors.js b/tests/slider_errors.js index 2df5b3f7..9a00238d 100644 --- a/tests/slider_errors.js +++ b/tests/slider_errors.js @@ -74,17 +74,6 @@ }); }); - assert.throws(function(){ - noUiSlider.create(slider, { - start: [ 1 ], - range: { - 'min': 0, - 'max': 10 - }, - useRequestAnimationFrame: 'Hello' - }); - }, "Should error if useRequestAnimationFrame not a boolean."); - assert.throws(function(){ noUiSlider.create(slider, { start: 10, From bd7bb93878a335d668fa027518105db1f2387e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Wed, 3 Jan 2018 16:29:05 +0000 Subject: [PATCH 21/40] 2d transform --- src/js/constants.js | 2 +- src/js/scope.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/constants.js b/src/js/constants.js index 982b437e..83760224 100644 --- a/src/js/constants.js +++ b/src/js/constants.js @@ -46,5 +46,5 @@ } function getSupportsCSSTransform ( ) { - return window.CSS && CSS.supports && CSS.supports('transform','translate3d(0,0,0) scale(0,0)'); + return window.CSS && CSS.supports && CSS.supports('transform','translate(0,0) scale(0,0)'); } diff --git a/src/js/scope.js b/src/js/scope.js index 13fe4431..46cbace8 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -83,7 +83,7 @@ scope_Values[handleNumber] = scope_Spectrum.fromStepping(to); if ( supportsCSSTransform ) { - var rule = 'translate3d(' + inRuleOrder(toPct(transformDirection(to, 0)), '0') + ', 0)'; + var rule = 'translate(' + inRuleOrder(toPct(transformDirection(to, 0)), '0') + ')'; scope_Handles[handleNumber].style[options.transformRule] = rule; } else { scope_Handles[handleNumber].style[options.style] = toPct(to); @@ -145,7 +145,7 @@ if ( supportsCSSTransform ) { var connectWidth = h - l; - var translateRule = 'translate3d(' + inRuleOrder(toPct(transformDirection(l, connectWidth)), '0') + ', 0)'; + var translateRule = 'translate(' + inRuleOrder(toPct(transformDirection(l, connectWidth)), '0') + ')'; var scaleRule = 'scale(' + inRuleOrder(connectWidth / 100, '1') + ')'; scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule; From dee800bb739164b466dd956cf4551b9addf8b407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Wed, 3 Jan 2018 18:00:51 +0000 Subject: [PATCH 22/40] add test showing lookAhead flaw --- tests/slider.html | 1 + tests/slider_lookaround.js | 143 +++++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 tests/slider_lookaround.js diff --git a/tests/slider.html b/tests/slider.html index 864f172d..ab4155b3 100644 --- a/tests/slider.html +++ b/tests/slider.html @@ -68,6 +68,7 @@ + diff --git a/tests/slider_lookaround.js b/tests/slider_lookaround.js new file mode 100644 index 00000000..2f5d74ca --- /dev/null +++ b/tests/slider_lookaround.js @@ -0,0 +1,143 @@ + + QUnit.test( "Padding and margin (lookaround)", function( assert ){ + + Q.innerHTML = '
'; + + var slider = Q.querySelector('#slider1'); + var slider2 = Q.querySelector('#slider2'); + var slider3 = Q.querySelector('#slider3'); + + noUiSlider.create(slider, { + start: [ 20, 23 ], + step: 1, + padding: 5, + margin: 3, + range: { + 'min': 10, + 'max': 30 + } + }); + + function m ( a ) { + var values = slider.noUiSlider.get(); + values[0] = parseInt(values[0]) + a; + values[1] = parseInt(values[1]) + a; + slider.noUiSlider.set(values); + } + + function up ( ) { m(1); } + function down ( ) { m(-1); } + + assert.deepEqual( slider.noUiSlider.get(), ['20.00', '23.00']); + + up(); + + assert.deepEqual( slider.noUiSlider.get(), ['21.00', '24.00']); + + up(); + + assert.deepEqual( slider.noUiSlider.get(), ['22.00', '25.00'], 'Highest possible values'); + + up(); + + assert.deepEqual( slider.noUiSlider.get(), ['22.00', '25.00'], 'Nothing should have happened'); + + down(); + + assert.deepEqual( slider.noUiSlider.get(), ['21.00', '24.00']); + + down(); + + assert.deepEqual( slider.noUiSlider.get(), ['20.00', '23.00']); + + slider.noUiSlider.set([10, 12]); + + assert.deepEqual( slider.noUiSlider.get(), ['15.00', '18.00'], 'lower bound by padding, upper by margin'); + + slider.noUiSlider.set([15, 17]); + + assert.deepEqual( slider.noUiSlider.get(), ['15.00', '18.00'], 'lower bound ok, but apply margin'); + + + + noUiSlider.create(slider2, { + start: [ 20, 23, 27 ], + step: 1, + padding: 3, + limit: 4, + margin: 3, + range: { + 'min': 10, + 'max': 40 + } + }); + + slider2.noUiSlider.set([20, 24, 27]); + assert.deepEqual(slider2.noUiSlider.get(), ['20.00', '24.00', '27.00']); + + slider2.noUiSlider.set([19, 24, 27]); + assert.deepEqual(slider2.noUiSlider.get(), ['19.00', '23.00', '27.00'], 'Cannot do 24, exceeds limit'); + + slider2.noUiSlider.set([18, 19, 23]); + assert.deepEqual(slider2.noUiSlider.get(), ['18.00', '21.00', '24.00'], 'Cannot do 19, exceeds margin. Same for 23 after 19 becomes 21.'); + + slider2.noUiSlider.set([18, 19, 29]); + assert.deepEqual(slider2.noUiSlider.get(), ['18.00', '21.00', '25.00'], 'Cannot do 25, exceeds limit.'); + + slider2.noUiSlider.set([12, 15, 40]); + assert.deepEqual(slider2.noUiSlider.get(), ['13.00', '16.00', '20.00'], 'Padding, margin and limit'); + + + + + noUiSlider.create(slider3, { + start: [ 20, 23, 27 ], + step: 3, + padding: 6, + limit: 9, + behaviour: 'drag', + margin: 6, + range: { + 'min': 0, + 'max': 100 + } + }); + + slider3.noUiSlider.set([20, 24, 27]); + assert.deepEqual(slider3.noUiSlider.get(), ['21.00', '27.00', '33.00'], 'Margin and step'); + + slider3.noUiSlider.set([21, 27, 36]); + assert.deepEqual(slider3.noUiSlider.get(), ['21.00', '27.00', '36.00'], 'Limit'); + + slider3.noUiSlider.__moveHandles(true, 10, [0, 1]); // Drag the first two handles up by 10 pct + assert.deepEqual(slider3.noUiSlider.get(), ['24.00', '30.00', '36.00'], 'Margin and limit for two handles'); + + slider3.noUiSlider.__moveHandles(true, 20, [0, 1]); // Try to push up further + assert.deepEqual(slider3.noUiSlider.get(), ['24.00', '30.00', '36.00'], 'Nothing should change'); + + slider3.noUiSlider.__moveHandles(true, 10, [1, 2]); // Move the last two handles + assert.deepEqual(slider3.noUiSlider.get(), ['24.00', '33.00', '39.00'], 'Can slide once'); + + slider3.noUiSlider.__moveHandles(true, 10, [1, 2]); // Move the last two handles + assert.deepEqual(slider3.noUiSlider.get(), ['24.00', '33.00', '39.00'], 'Not again, blocked by limit on the 2nd handle.'); + + slider3.noUiSlider.set([76, 85, 91]); + assert.deepEqual(slider3.noUiSlider.get(), ['75.00', '84.00', '90.00']); + + slider3.noUiSlider.set([78, 85, 91]); + assert.deepEqual(slider3.noUiSlider.get(), ['78.00', '84.00', '90.00']); + + slider3.noUiSlider.__moveHandles(true, 10, [1, 2]); // Move the last two handles + assert.deepEqual(slider3.noUiSlider.get(), ['78.00', '87.00', '93.00']); + + slider3.noUiSlider.__moveHandles(false, -10, [1, 2]); // Back down + assert.deepEqual(slider3.noUiSlider.get(), ['78.00', '84.00', '90.00']); + + slider3.noUiSlider.__moveHandles(false, -10, [0, 1]); // Back down + assert.deepEqual(slider3.noUiSlider.get(), ['75.00', '81.00', '90.00']); + + slider3.noUiSlider.__moveHandles(false, -10, [0, 1]); // Back down + assert.deepEqual(slider3.noUiSlider.get(), ['75.00', '81.00', '90.00'], 'Cannot, limited by limit between last handles'); + + + }); From 7deca0283c9323d1aec4cb1d2e61a6a63429f3c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Wed, 3 Jan 2018 18:06:08 +0000 Subject: [PATCH 23/40] cleanup --- distribute/nouislider.js | 2 +- src/js/scope.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/distribute/nouislider.js b/distribute/nouislider.js index fef36b19..e5d92816 100644 --- a/distribute/nouislider.js +++ b/distribute/nouislider.js @@ -2056,7 +2056,7 @@ function closure ( target, options, originalOptions ){ // Now that all base values are set, apply constraints scope_HandleNumbers.forEach(function(handleNumber){ - setHandle(handleNumber, scope_Locations[handleNumber], true, true); + setHandle(handleNumber, scope_Locations[handleNumber], true, false); }); setZindex(); diff --git a/src/js/scope.js b/src/js/scope.js index c9b41f22..725b0e29 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -1,3 +1,4 @@ + // Split out the handle positioning logic so the Move event can use it, too function checkHandlePosition ( reference, handleNumber, to, lookBackward, lookForward, getValue ) { From 7544913596460811b5f2dc2d9b8a313506e2acf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Wed, 3 Jan 2018 18:48:43 +0000 Subject: [PATCH 24/40] Fix lookAhead/back based on unit tests --- src/js/scope.js | 26 +++++++++++++++----------- tests/slider_lookaround.js | 8 +------- tests/slider_setting-getting.js | 1 - tests/slider_update.js | 6 +++--- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/js/scope.js b/src/js/scope.js index 06ac05de..dc7d0129 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -158,27 +158,28 @@ } } - // ... - function setValue ( to, handleNumber ) { + function resolveToValue ( to, handleNumber ) { // Setting with null indicates an 'ignore'. // Inputting 'false' is invalid. - if ( to === null || to === false ) { - return; + if ( to === null || to === false || to === undefined ) { + return scope_Locations[handleNumber]; } - // If a formatted number was passed, attemt to decode it. + // If a formatted number was passed, attempt to decode it. if ( typeof to === 'number' ) { to = String(to); } to = options.format.from(to); + to = scope_Spectrum.toStepping(to); - // Request an update for all links if the value was invalid. - // Do so too if setting the handle fails. - if ( to !== false && !isNaN(to) ) { - setHandle(handleNumber, scope_Spectrum.toStepping(to), false, false); + // If parsing the number failed, use the current value. + if ( to === false || isNaN(to) ) { + return scope_Locations[handleNumber]; } + + return to; } // Set the slider value. @@ -190,14 +191,17 @@ // Event fires by default fireSetEvent = (fireSetEvent === undefined ? true : !!fireSetEvent); - values.forEach(setValue); - // Animation is optional. // Make sure the initial values were set before using animated placement. if ( options.animate && !isInit ) { addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration); } + // First pass, without lookAhead. Values are set from left to right. + scope_HandleNumbers.forEach(function(handleNumber){ + setHandle(handleNumber, resolveToValue(values[handleNumber], handleNumber), true, false); + }); + // Now that all base values are set, apply constraints scope_HandleNumbers.forEach(function(handleNumber){ setHandle(handleNumber, scope_Locations[handleNumber], true, true); diff --git a/tests/slider_lookaround.js b/tests/slider_lookaround.js index 2f5d74ca..ec64fdf4 100644 --- a/tests/slider_lookaround.js +++ b/tests/slider_lookaround.js @@ -31,35 +31,29 @@ assert.deepEqual( slider.noUiSlider.get(), ['20.00', '23.00']); up(); - assert.deepEqual( slider.noUiSlider.get(), ['21.00', '24.00']); up(); - assert.deepEqual( slider.noUiSlider.get(), ['22.00', '25.00'], 'Highest possible values'); up(); - assert.deepEqual( slider.noUiSlider.get(), ['22.00', '25.00'], 'Nothing should have happened'); down(); - assert.deepEqual( slider.noUiSlider.get(), ['21.00', '24.00']); down(); - assert.deepEqual( slider.noUiSlider.get(), ['20.00', '23.00']); slider.noUiSlider.set([10, 12]); - assert.deepEqual( slider.noUiSlider.get(), ['15.00', '18.00'], 'lower bound by padding, upper by margin'); slider.noUiSlider.set([15, 17]); - assert.deepEqual( slider.noUiSlider.get(), ['15.00', '18.00'], 'lower bound ok, but apply margin'); + noUiSlider.create(slider2, { start: [ 20, 23, 27 ], step: 1, diff --git a/tests/slider_setting-getting.js b/tests/slider_setting-getting.js index 5838bc76..6aafc029 100644 --- a/tests/slider_setting-getting.js +++ b/tests/slider_setting-getting.js @@ -10,7 +10,6 @@ start: [ 0, 10 ], behaviour: 'drag', connect: true, - useRequestAnimationFrame: false, format: { to: function(x){ return x.toFixed(1); diff --git a/tests/slider_update.js b/tests/slider_update.js index ad0ac0de..c11c9448 100644 --- a/tests/slider_update.js +++ b/tests/slider_update.js @@ -17,7 +17,7 @@ slider.noUiSlider.destroy(); - equal(slider.innerHTML, '', 'Slider was cleared'); + assert.equal(slider.innerHTML, '', 'Slider was cleared'); var settings = { range: { min: 30, max: 70 }, @@ -35,14 +35,14 @@ slider.noUiSlider.set(40); assert.deepEqual(slider.noUiSlider.get(), ['40', '70']); - equal ( slider.querySelectorAll('.noUi-connect').length, 0, 'Slider uses no connection' ); + assert.equal ( slider.querySelectorAll('.noUi-connect').length, 0, 'Slider uses no connection' ); settings.connect = true; slider.noUiSlider.destroy(); noUiSlider.create(slider, settings); - equal ( slider.querySelectorAll('.noUi-connect').length, 1, 'Slider now connects' ); + assert.equal ( slider.querySelectorAll('.noUi-connect').length, 1, 'Slider now connects' ); assert.deepEqual(slider.noUiSlider.get(), ['30', '60'], 'Value was unchanged'); From e1420cb1501bbf81be448bdf5a28dfdc9956aac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Wed, 3 Jan 2018 19:09:37 +0000 Subject: [PATCH 25/40] update docs/comments --- README.md | 29 ++++++++++++++--------------- documentation/slider-read-write.php | 4 ++-- src/js/scope.js | 7 ++++--- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 9120e3a7..62e81139 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,19 @@ npm [(package)](https://www.npmjs.com/package/nouislider) Changelog --------- +### 11.0.0 (t.b.a) +noUiSlider 11 doesn't include any breaking API changes. +Unless major changes were made to the stylesheet or you specifically dependend +on the handle/connect order in the DOM, there should be no issues upgrading. +- Change: Use CSS transforms for handle movement, resulting in a massive performance improvement (#718); +- Change: Support multitouch by default. +- Added: `.noUi-connects` element holding all `.noUi-connect` elements; +- Removed: `useRequestAnimationFrame` option. No longer needed with CSS transforms; +- Removed: `multitouch` option. Now enabled by default; +- Fixed: Slider could ignore end events it should handle (#704, #805, #834); +- Fixed: Stop depending on array type (#801); +- Fixed: `set` method might bypass margin option (#823); + ### 10.1.0 (*2017-07-26*) - Added: `multitouch` option (#793); @@ -40,7 +53,7 @@ Changelog - Fixed: Content Security Policy issue with pips; - Added: `removePips` method; - Added: aria support (#685); -- Added: `ariaFormat` option (controls `aria-valuetext`); +- Added: `ariaFormat` option (controls `aria-valuetext`); - Fixed: throw a better error when mistakenly trying to initialize noUiSlider with `null` (#658); - Fixed: Made order of events consistent and documented it (#775); - Fixed: Border radius of connect bar, white space wrapping of tooltips (#773, #774); @@ -122,17 +135,3 @@ noUiSlider.create(slider, { } }); ``` - -Browser support ---------------- - -All major browsers are supported. **To support IE8** you'll need to shim several ES5 features. - -You can use [polyfill.io](https://cdn.polyfill.io/v2/docs/) to easily do so: - -```html - - -``` diff --git a/documentation/slider-read-write.php b/documentation/slider-read-write.php index 00d23ceb..efb5ccf8 100644 --- a/documentation/slider-read-write.php +++ b/documentation/slider-read-write.php @@ -20,7 +20,7 @@ -

For one-handle sliders, calling .get() will return the value. For two-handle sliders, an array[value, value] will be returned.

+

For one-handle sliders, calling .get() will return the value as a 'string'. For multi-handle sliders, an array['string', 'string', ...] will be returned.

@@ -38,7 +38,7 @@

Within an array, you can set one position to null if you want to leave a handle unchanged.

-

To return to the initial slider values, you can use the .reset() method. This will only reset the slider values.

+

To return to the initial slider values, you can use the .reset() method. This will only reset the slider values.

diff --git a/src/js/scope.js b/src/js/scope.js index dc7d0129..c56bd18f 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -141,7 +141,7 @@ // If we've determined the browser can use CSS transforms, we use two rules: // 'translate' to change the left/top offset; // 'scale' to change the width of the element; - // As the element has a width of 1%, a translation of 100% is equal to 1% of the parent (.noUi-base) + // As the element has a width of 100%, a translation of 100% is equal to 100% of the parent (.noUi-base) if ( supportsCSSTransform ) { var connectWidth = h - l; @@ -158,6 +158,7 @@ } } + // Parses value passed to .set method. Returns current value if not parseable. function resolveToValue ( to, handleNumber ) { // Setting with null indicates an 'ignore'. @@ -197,12 +198,12 @@ addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration); } - // First pass, without lookAhead. Values are set from left to right. + // First pass, without lookAhead but with lookBackward. Values are set from left to right. scope_HandleNumbers.forEach(function(handleNumber){ setHandle(handleNumber, resolveToValue(values[handleNumber], handleNumber), true, false); }); - // Now that all base values are set, apply constraints + // Second pass. Now that all base values are set, apply constraints scope_HandleNumbers.forEach(function(handleNumber){ setHandle(handleNumber, scope_Locations[handleNumber], true, true); }); From a1e76521463113b1bffac4a4978171a2a19f1371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Wed, 3 Jan 2018 19:29:47 +0000 Subject: [PATCH 26/40] add example --- documentation/examples.php | 24 ++++++++++++++++++++++ documentation/examples/hiding-tooltips.css | 6 ++++++ documentation/examples/hiding-tooltips.js | 10 +++++++++ 3 files changed, 40 insertions(+) create mode 100644 documentation/examples/hiding-tooltips.css create mode 100644 documentation/examples/hiding-tooltips.js diff --git a/documentation/examples.php b/documentation/examples.php index f858c815..bbaaafd1 100644 --- a/documentation/examples.php +++ b/documentation/examples.php @@ -9,6 +9,7 @@
  • Working with HTML5 input types
  • Using non linear ranges
  • Locking two sliders together
  • +
  • Only showing tooltips when sliding handles
  • Colored connect elements
  • Changing the slider value by keypress
  • Skipping values on a slider
  • @@ -218,6 +219,29 @@ + +

    Only showing tooltips when sliding handles

    + +
    + +
    + +

    Issue #836 requested a way to toggle tooltips after slider creation. This effect can be achieved by using the .noUi-active class to show and hide the tooltips. No additional JavaScript is involved.

    + +
    +
    + + +
    +
    + +
    + + +
    +
    + +

    Colored Connect Elements

    diff --git a/documentation/examples/hiding-tooltips.css b/documentation/examples/hiding-tooltips.css new file mode 100644 index 00000000..24f72333 --- /dev/null +++ b/documentation/examples/hiding-tooltips.css @@ -0,0 +1,6 @@ +.noUi-tooltip { + display: none; +} +.noUi-active .noUi-tooltip { + display: block; +} diff --git a/documentation/examples/hiding-tooltips.js b/documentation/examples/hiding-tooltips.js new file mode 100644 index 00000000..69a7a2f4 --- /dev/null +++ b/documentation/examples/hiding-tooltips.js @@ -0,0 +1,10 @@ +var hidingTooltipSlider = document.getElementById('slider-hide'); + +noUiSlider.create(hidingTooltipSlider, { + range: { + min: 0, + max: 100 + }, + start: [ 20, 80 ], + tooltips: true +}); From dd5515a36570dcdb743decb7a94ab1dd2a5e371a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Wed, 3 Jan 2018 19:36:49 +0000 Subject: [PATCH 27/40] change to 2d --- README.md | 1 + src/nouislider.pips.less | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 62e81139..95a30182 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ on the handle/connect order in the DOM, there should be no issues upgrading. - Fixed: Slider could ignore end events it should handle (#704, #805, #834); - Fixed: Stop depending on array type (#801); - Fixed: `set` method might bypass margin option (#823); +- Fixed: Alignment of pips for RTL sliders (#795); ### 10.1.0 (*2017-07-26*) - Added: `multitouch` option (#793); diff --git a/src/nouislider.pips.less b/src/nouislider.pips.less index 2f417cfd..4f737b9d 100644 --- a/src/nouislider.pips.less +++ b/src/nouislider.pips.less @@ -50,12 +50,12 @@ width: 100%; } .@{noUi-css-prefix}-value-horizontal { - -webkit-transform: translate3d(-50%,50%,0); - transform: translate3d(-50%,50%,0); - + -webkit-transform: translate(-50%, 50%); + transform: translate(-50%, 50%); + .@{noUi-css-prefix}-rtl & { - -webkit-transform: translate3d(50%,50%,0); - transform: translate3d(50%,50%,0); + -webkit-transform: translate(50%, 50%); + transform: translate(50%, 50%); } } @@ -81,13 +81,13 @@ left: 100%; } .@{noUi-css-prefix}-value-vertical { - -webkit-transform: translate3d(0,-50%,0); - transform: translate3d(0,-50%,0); + -webkit-transform: translate(0, -50%); + transform: translate(0,-50%,0); padding-left: 25px; - + .@{noUi-css-prefix}-rtl & { - -webkit-transform: translate3d(0,50%,0); - transform: translate3d(0,50%,0); + -webkit-transform: translate(0, 50%); + transform: translate(0, 50%); } } From 29ce629bba9f157b3a610f548f04c7ea548138a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Thu, 4 Jan 2018 15:40:44 +0000 Subject: [PATCH 28/40] Pips improvements, examples --- documentation/examples.php | 31 ++++++++++++++++++++++ documentation/examples/click-pips-setup.js | 10 +++++++ documentation/examples/click-pips.js | 13 +++++++++ src/js/pips.js | 1 + tests/addon_pips.js | 20 +++++++------- 5 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 documentation/examples/click-pips-setup.js create mode 100644 documentation/examples/click-pips.js diff --git a/documentation/examples.php b/documentation/examples.php index bbaaafd1..16375825 100644 --- a/documentation/examples.php +++ b/documentation/examples.php @@ -9,6 +9,7 @@
  • Working with HTML5 input types
  • Using non linear ranges
  • Locking two sliders together
  • +
  • Moving the slider by clicking pips
  • Only showing tooltips when sliding handles
  • Colored connect elements
  • Changing the slider value by keypress
  • @@ -219,6 +220,36 @@ + +

    Moving the slider by clicking pips

    + +
    + +
    + +

    Issue #733 asks about clicking pips to move the slider to their value. noUiSlider 11 adds a data-value attribute to all .noUi-value elements that makes this easy.

    + +
    +
    + + + +
    +
    + +
    + +
    Setup
    + +
    + +
    + + +
    +
    + +

    Only showing tooltips when sliding handles

    diff --git a/documentation/examples/click-pips-setup.js b/documentation/examples/click-pips-setup.js new file mode 100644 index 00000000..0ab60b35 --- /dev/null +++ b/documentation/examples/click-pips-setup.js @@ -0,0 +1,10 @@ +var pipsSlider = document.getElementById('slider-pips'); + +noUiSlider.create(pipsSlider, { + range: { + min: 0, + max: 100 + }, + start: [ 50 ], + pips: { mode: 'count', values: 5 } +}); diff --git a/documentation/examples/click-pips.js b/documentation/examples/click-pips.js new file mode 100644 index 00000000..bf5d5add --- /dev/null +++ b/documentation/examples/click-pips.js @@ -0,0 +1,13 @@ +var pips = pipsSlider.querySelectorAll('.noUi-value'); + +function clickOnPip ( ) { + var value = Number(this.getAttribute('data-value')); + pipsSlider.noUiSlider.set(value); +} + +for ( var i = 0; i < pips.length; i++ ) { + + // For the this example. Do this in CSS! + pips[i].style.cursor = 'pointer'; + pips[i].addEventListener('click', clickOnPip); +} diff --git a/src/js/pips.js b/src/js/pips.js index 323f4b68..b24b3065 100644 --- a/src/js/pips.js +++ b/src/js/pips.js @@ -217,6 +217,7 @@ if ( values[1] ) { node = addNodeTo(element, false); node.className = getClasses(values[1], options.cssClasses.value); + node.setAttribute('data-value', values[0]); node.style[options.style] = offset + '%'; node.innerText = formatter.to(values[0]); } diff --git a/tests/addon_pips.js b/tests/addon_pips.js index 7f7f388a..ae8de751 100644 --- a/tests/addon_pips.js +++ b/tests/addon_pips.js @@ -24,7 +24,7 @@ // RANGE - QUnit.test( "Range", function( assert ){ + QUnit.test( "Pips: Range", function( assert ){ var slider = test_slider({ mode: 'range', @@ -45,7 +45,7 @@ assert.equal( Q.querySelector('.noUi-value').innerHTML, '0.00' ); }); - QUnit.test( "Steps", function( assert ){ + QUnit.test( "Pips: Steps", function( assert ){ var slider = test_slider({ mode: 'steps', @@ -60,7 +60,7 @@ }); - QUnit.test( "Positions", function( assert ){ + QUnit.test( "Pips: Positions", function( assert ){ var slider = test_slider({ mode: 'positions', @@ -81,7 +81,7 @@ }); - QUnit.test( "Positions, stepped", function( assert ){ + QUnit.test( "Pips: Positions, stepped", function( assert ){ expect(0); // TODO @@ -94,7 +94,7 @@ // POSITIONS (STEPPED) }); - QUnit.test( "Count", function( assert ){ + QUnit.test( "Pips: Count", function( assert ){ var slider = test_slider({ mode: 'count', @@ -114,7 +114,7 @@ } ); - QUnit.test( "Count, values >= 2", function (assert) { + QUnit.test( "Pips: Count, values >= 2", function (assert) { assert.throws( function() { test_slider( { mode: 'count', @@ -123,7 +123,7 @@ }); - QUnit.test( "Count, stepped", function( assert ){ + QUnit.test( "Pips: Count, stepped", function( assert ){ expect(0); // TODO @@ -136,7 +136,7 @@ // VALUES - QUnit.test( "Values", function( assert ){ + QUnit.test( "Pips: Values", function( assert ){ // #357 var slider = test_slider({ @@ -149,7 +149,7 @@ // VALUES (STEPPED) - QUnit.test( "Values, stepped", function( assert ){ + QUnit.test( "Pips: Values, stepped", function( assert ){ var slider = test_slider({ mode: 'values', @@ -162,7 +162,7 @@ // #528, #532 - QUnit.test( "Values, stepped", function( assert ){ + QUnit.test( "Pips: Values, stepped", function( assert ){ Q.innerHTML = '
    '; var slider = Q.querySelector('.slider'); From 951219dd704e7c871f5f58dff446198f622c173f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Thu, 4 Jan 2018 16:10:37 +0000 Subject: [PATCH 29/40] replace css transform property --- README.md | 9 ++++++--- src/js/constants.js | 4 ---- src/js/options.js | 15 +++++++++------ src/js/scope.js | 27 +++++++-------------------- src/js/scope_start.js | 1 - 5 files changed, 22 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 95a30182..d598c6c3 100644 --- a/README.md +++ b/README.md @@ -33,17 +33,20 @@ Changelog ### 11.0.0 (t.b.a) noUiSlider 11 doesn't include any breaking API changes. -Unless major changes were made to the stylesheet or you specifically dependend +Unless major changes were made to the stylesheet or you specifically depend on the handle/connect order in the DOM, there should be no issues upgrading. - Change: Use CSS transforms for handle movement, resulting in a massive performance improvement (#718); -- Change: Support multitouch by default. -- Added: `.noUi-connects` element holding all `.noUi-connect` elements; +- Change: Support multitouch by default; +- Change: Handle stacking is now on `.noUi-origin` instead of `.noUi-handle`; +- Added: A `.noUi-connects` element holding all `.noUi-connect` elements; +- Added: `[data-value]` property for `.noUi-value` in pips (#733); - Removed: `useRequestAnimationFrame` option. No longer needed with CSS transforms; - Removed: `multitouch` option. Now enabled by default; - Fixed: Slider could ignore end events it should handle (#704, #805, #834); - Fixed: Stop depending on array type (#801); - Fixed: `set` method might bypass margin option (#823); - Fixed: Alignment of pips for RTL sliders (#795); +- Fixed: Several issues regarding pips (#812, #826, #832); ### 10.1.0 (*2017-07-26*) - Added: `multitouch` option (#793); diff --git a/src/js/constants.js b/src/js/constants.js index 83760224..3b72286c 100644 --- a/src/js/constants.js +++ b/src/js/constants.js @@ -44,7 +44,3 @@ function getSupportsTouchActionNone ( ) { return window.CSS && CSS.supports && CSS.supports('touch-action', 'none'); } - - function getSupportsCSSTransform ( ) { - return window.CSS && CSS.supports && CSS.supports('transform','translate(0,0) scale(0,0)'); - } diff --git a/src/js/options.js b/src/js/options.js index bcd4d968..1116ef6c 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -439,12 +439,15 @@ // Forward pips options parsed.pips = options.pips; - var styles = [['left', 'top'], ['right', 'bottom']]; - - // Pre-define the styles. - parsed.style = styles[parsed.dir][parsed.ort]; - parsed.styleOposite = styles[parsed.dir?0:1][parsed.ort]; - parsed.transformRule = 'transform'; // todo add -webkit- if needed + // All recent browsers accept unprefixed transform. + // We need -ms- for IE9 and -webkit- for older Android; + // Assume use of -webkit- if unprefixed and -ms- are not supported. + // https://caniuse.com/#feat=transforms2d + var d = document.createElement("div"); + var msPrefix = d.style.msTransform !== undefined; + var noPrefix = d.style.transform !== undefined; + + parsed.transformRule = noPrefix ? 'transform' : (msPrefix ? 'msTransform' : 'webkitTransform'); return parsed; } diff --git a/src/js/scope.js b/src/js/scope.js index c56bd18f..19b88f6e 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -82,12 +82,8 @@ // Convert the value to the slider stepping/range. scope_Values[handleNumber] = scope_Spectrum.fromStepping(to); - if ( supportsCSSTransform ) { - var rule = 'translate(' + inRuleOrder(toPct(transformDirection(to, 0)), '0') + ')'; - scope_Handles[handleNumber].style[options.transformRule] = rule; - } else { - scope_Handles[handleNumber].style[options.style] = toPct(to); - } + var rule = 'translate(' + inRuleOrder(toPct(transformDirection(to, 0)), '0') + ')'; + scope_Handles[handleNumber].style[options.transformRule] = rule; updateConnect(handleNumber); updateConnect(handleNumber + 1); @@ -138,24 +134,15 @@ h = scope_Locations[index]; } - // If we've determined the browser can use CSS transforms, we use two rules: + // We use two rules: // 'translate' to change the left/top offset; // 'scale' to change the width of the element; // As the element has a width of 100%, a translation of 100% is equal to 100% of the parent (.noUi-base) - if ( supportsCSSTransform ) { - - var connectWidth = h - l; - var translateRule = 'translate(' + inRuleOrder(toPct(transformDirection(l, connectWidth)), '0') + ')'; - var scaleRule = 'scale(' + inRuleOrder(connectWidth / 100, '1') + ')'; - - scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule; + var connectWidth = h - l; + var translateRule = 'translate(' + inRuleOrder(toPct(transformDirection(l, connectWidth)), '0') + ')'; + var scaleRule = 'scale(' + inRuleOrder(connectWidth / 100, '1') + ')'; - } else { - - // Fall back to absolute positioning - scope_Connects[index].style[options.style] = toPct(l); - scope_Connects[index].style[options.styleOposite] = toPct(100 - h); - } + scope_Connects[index].style[options.transformRule] = translateRule + ' ' + scaleRule; } // Parses value passed to .set method. Returns current value if not parseable. diff --git a/src/js/scope_start.js b/src/js/scope_start.js index f3e73cc5..f7c9d27e 100644 --- a/src/js/scope_start.js +++ b/src/js/scope_start.js @@ -4,7 +4,6 @@ function closure ( target, options, originalOptions ){ var actions = getActions(); var supportsTouchActionNone = getSupportsTouchActionNone(); var supportsPassive = supportsTouchActionNone && getSupportsPassive(); - var supportsCSSTransform = getSupportsCSSTransform(); // All variables local to 'closure' are prefixed with 'scope_' var scope_Target = target; From 944b7ebfadd83dd0af800ffaf432ed810230d9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Thu, 4 Jan 2018 16:17:26 +0000 Subject: [PATCH 30/40] return style for pips, handle relative --- src/js/options.js | 5 +++++ src/nouislider.core.less | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/js/options.js b/src/js/options.js index 1116ef6c..d06b9c9f 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -449,5 +449,10 @@ parsed.transformRule = noPrefix ? 'transform' : (msPrefix ? 'msTransform' : 'webkitTransform'); + // Pips don't move, so we can place them using left/top. + var styles = [['left', 'top'], ['right', 'bottom']]; + + parsed.style = styles[parsed.dir][parsed.ort]; + return parsed; } diff --git a/src/nouislider.core.less b/src/nouislider.core.less index eba142cc..5196889c 100644 --- a/src/nouislider.core.less +++ b/src/nouislider.core.less @@ -32,7 +32,6 @@ .@{noUi-css-prefix}-connects { overflow: hidden; z-index: 0; - border-radius: 3px; } .@{noUi-css-prefix}-connect, .@{noUi-css-prefix}-origin { @@ -56,11 +55,8 @@ .@{noUi-css-prefix}-horizontal .@{noUi-css-prefix}-origin { height: 0; } - - .@{noUi-css-prefix}-handle { - position: absolute; - z-index: 1; + position: relative; } .@{noUi-css-prefix}-state-tap .@{noUi-css-prefix}-connect, .@{noUi-css-prefix}-state-tap .@{noUi-css-prefix}-origin { @@ -101,6 +97,9 @@ border: 1px solid #D3D3D3; box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB; } +.@{noUi-css-prefix}-connects { + border-radius: 3px; +} .@{noUi-css-prefix}-connect { background: #3FB8AF; } From 3a68d9f3ccc80012012761c2638e6789fc119a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Thu, 4 Jan 2018 17:14:28 +0000 Subject: [PATCH 31/40] Update docs --- documentation/_run/menu.php | 10 ++-- documentation/download.php | 2 +- documentation/more.php | 56 +++++++++++------------ documentation/more/classes.js | 3 +- documentation/more/horizontal-contain.css | 9 ---- documentation/more/update-setup.js | 4 +- documentation/more/vertical-contain.css | 9 ---- documentation/slider-options.php | 24 ++++++---- tests/slider_three_or_more_handles.js | 5 +- 9 files changed, 52 insertions(+), 70 deletions(-) delete mode 100644 documentation/more/horizontal-contain.css delete mode 100644 documentation/more/vertical-contain.css diff --git a/documentation/_run/menu.php b/documentation/_run/menu.php index ca83072a..ac6b7a85 100644 --- a/documentation/_run/menu.php +++ b/documentation/_run/menu.php @@ -1,12 +1,12 @@ diff --git a/documentation/download.php b/documentation/download.php index d5a8aa7f..2231d9be 100644 --- a/documentation/download.php +++ b/documentation/download.php @@ -49,7 +49,7 @@
    -

    You can also visit the repository: noUiSlider on gitHub. If you need help implementing noUiSlider in your website, or if you'd like to see a new feature, feel free to ask me on twitter: @LeonGersen.

    +

    You can visit the repository: noUiSlider on gitHub. If you need help implementing noUiSlider in your website, or if you'd like to see a new feature, feel free to ask me on twitter: @LeonGersen.

    diff --git a/documentation/more.php b/documentation/more.php index f6dc090f..1aca2ddc 100644 --- a/documentation/more.php +++ b/documentation/more.php @@ -1,9 +1,16 @@ -

    More...

    +
    + +
    +

    Disabling a slider

    @@ -12,13 +19,15 @@
    -

    Disabling a slider is identical to disabling a checkbox or textarea; simply set the disabled attribute.

    +

    Disabling a slider is identical to disabling a checkbox or textarea; add the disabled attribute.

    + +

    A disabled slider can't be changed by user interaction (sliding, clicking or touching), but you can still change its value using the .set() method.

    -

    A disabled slider can't be changed by sliding, click or touching, but you can still change its value using the .set() method. You can use CSS to show the disabled state. The default theme also sets a not-allowed cursor.

    +

    CSS can be used to show the disabled state. The default stylesheet also sets a not-allowed cursor.

    -

    The slider below is disabled when the checkbox gets checked, and re-enabled when it is unchecked.

    +

    The slider below is disabled when the checkbox is checked, and re-enabled when it is unchecked.

    -

    Individual handles can also be disabled by setting the disabled attribute on a .noUi-origin element.

    +

    Individual handles can be disabled by adding a disabled attribute to a .noUi-origin element.

    @@ -63,18 +72,22 @@
    -

    noUiSlider has an updateOptions(newOptions, fireSetEvent) method that can change the 'margin', 'limit', 'step', 'range', 'animate' and 'snap' options. All other options require changes to the slider's HTML or event bindings.

    +

    noUiSlider has an update method that can change the 'margin', 'limit', 'step', 'range', 'animate' and 'snap' options. All other options require changes to the slider's HTML or event bindings.

    To update any other option, destroy the slider using slider.noUiSlider.destroy() and create a new one. Note that events are not unbound when destroying a slider.

    +

    The update method can be called as slider.noUiSlider.updateOptions(newOptions, [fireSetEvent]).

    +

    The 'update' event fires after updating the slider.

    By default, the sliders values remain unchanged. To update the slider values, newOptions may also contain a start property that matches the signature of the set method.

    The 'set' event fires when the slider values are restored. If this is unwanted, you can pass false as the second parameter, fireSetEvent.

    -

    Options can be read from the slider using the slider.noUiSlider.options property. This property contains a reference to the options object passed when creating the slider. This object is modified when calling updateOptions. Note that if you initiate multiple sliders using the same options object and update a subset of them later, this will move the options property out of sync with the actual slider options.

    - +

    Options can be read from the slider using the slider.noUiSlider.options property. This property contains a reference to the options object passed when creating the slider. This object is modified when calling updateOptions.

    + +

    Note that if you initiate multiple sliders using the same options object and update a subset of them later, this will move the options property out of sync with the actual slider options.

    +
    @@ -89,7 +102,7 @@
    -
    The HTML for this example
    +
    HTML for this example
    @@ -128,17 +141,11 @@
    -

    Styling noUiSlider is easy. The default stylesheet contains helpful comments to get a head start. I strongly recommend using the default stylesheet as a starting point when re-styling noUiSlider.

    +

    Styling noUiSlider is easy. The default stylesheet contains helpful comments to get a head start.

    + +

    It is strongly recommended to use the default stylesheet, overriding where necessary, as a starting point when re-styling noUiSlider.

    If your styling system doesn't match the convention in noUiSlider, you can use the cssPrefix and cssClasses options to reconfigure the markup.

    - -

    Things to watch out for

    - -
      -
    • If you want the handles to stay within the slider bar (instead of the default overlap), have a look at the CSS detailed to the right. Add the styles to your stylesheet and give your element the noUi-extended class for this effect.
    • -
    • The .noUi-connect and .noUi-background classes are applied to various elements. -
    • To position your handles on the center of its relative position, it should have a negative offset of half the handle width. See the default theme for reference.
    • -
    @@ -193,17 +200,6 @@
    -
    Containing handles within the slider bar (horizontal)
    - -
    -
    -
    - -
    Containing handles within the slider bar (vertical)
    - -
    -
    -
    diff --git a/documentation/more/classes.js b/documentation/more/classes.js index b565a802..fdb8340e 100644 --- a/documentation/more/classes.js +++ b/documentation/more/classes.js @@ -6,7 +6,8 @@ noUiSlider.create(slider, { }, cssPrefix: 'noUi-', // defaults to 'noUi-', cssClasses: { - // Full list of classnames to override. Does NOT extend the default classes. + // Full list of classnames to override. + // Does NOT extend the default classes. // Have a look at the source for the full, current list: // https://github.com/leongersen/noUiSlider/blob/master/src/js/options.js#L398 } diff --git a/documentation/more/horizontal-contain.css b/documentation/more/horizontal-contain.css deleted file mode 100644 index 28448746..00000000 --- a/documentation/more/horizontal-contain.css +++ /dev/null @@ -1,9 +0,0 @@ -.noUi-horizontal.noUi-extended { - padding-right: 32px; -} -.noUi-horizontal.noUi-extended .noUi-handle { - left: -1px; -} -.noUi-horizontal.noUi-extended .noUi-origin { - right: -32px; -} diff --git a/documentation/more/update-setup.js b/documentation/more/update-setup.js index 8d628278..62010d0a 100644 --- a/documentation/more/update-setup.js +++ b/documentation/more/update-setup.js @@ -1,5 +1,5 @@ -var updateSlider = document.getElementById('slider-update'), - updateSliderValue = document.getElementById('slider-update-value'); +var updateSlider = document.getElementById('slider-update'); +var updateSliderValue = document.getElementById('slider-update-value'); noUiSlider.create(updateSlider, { range: { diff --git a/documentation/more/vertical-contain.css b/documentation/more/vertical-contain.css deleted file mode 100644 index 4200e13c..00000000 --- a/documentation/more/vertical-contain.css +++ /dev/null @@ -1,9 +0,0 @@ -.noUi-vertical.noUi-extended { - padding-bottom: 32px; -} -.noUi-vertical.noUi-extended .noUi-handle { - top: -1px; -} -.noUi-vertical.noUi-extended .noUi-origin { - bottom: -32px; -} diff --git a/documentation/slider-options.php b/documentation/slider-options.php index 686a85b8..52cb39bb 100644 --- a/documentation/slider-options.php +++ b/documentation/slider-options.php @@ -9,7 +9,9 @@
    -

    noUiSlider can be configured with a wide variety of options, which can be use to customize the slider in to doing exactly what you want. For options regarding the slider range, see slider values.

    +

    noUiSlider can be configured with a wide variety of options, which can be use to customize a slider's behaviour.

    + +

    For options regarding the slider range, see slider values.

    @@ -21,7 +23,9 @@
    -

    The start option sets the number of handles and corresponding start positions, relative to range.

    +

    The start option sets the number of handles and corresponding start positions.

    + +

    The start option uses the slider's 'format' option to decode the input. Number input will be cast to string and decoded.

    @@ -33,9 +37,9 @@
    none
    Accepted values -
    number,
    - array[number],
    - array[number, number, ...] +
    'string',
    + array['string'],
    + array['string', 'string', ...]
    @@ -54,7 +58,7 @@
    -

    The connect setting can be used to control the (green) bar between the handles, or the edges of the slider.

    +

    The connect option can be used to control the bar between the handles or the edges of the slider.

    Pass an array with a boolean for every connecting element, including the edges of the slider. The length of this array must match the handle count + 1.

    @@ -216,7 +220,7 @@
    -

    By default, the slider slides fluently. In order to make the handles jump between intervals, you can use this option. The step option is relative to the values provided to range.

    +

    By default, the slider slides fluently. In order to make the handles jump between intervals, you can use the step option.

    @@ -318,7 +322,7 @@
    -

    noUiSlider can provide a basic tooltip without using its events system. Set the tooltips option to true to enable. This option can also accept formatting options to format the tooltips content. In that case, pass an array with a formatter for each handle, true to use the default or false to display no tooltip.

    +

    noUiSlider can provide a basic tooltip using the tooltips option. This option can also accept formatting options to format the tooltips content. In that case, pass an array with a formatter for each handle, true to use the default or false to display no tooltip.

    @@ -330,7 +334,7 @@
    false
    Accepted values -
    false, true, formatter, array[formatter or false]
    +
    false, true, formatter, array[formatter or true or false, ...]
    @@ -371,7 +375,7 @@
    -

    The animationDuration option can be used to set the animation speed assumed by the slider library. In addition to this, you must manually set the CSS (-webkit-)transition property for the .noUi-state-tap .noUi-origin selector.

    +

    The animationDuration option can be used to set the animation speed assumed by the slider library. In addition to this, you must manually alter the CSS (-webkit-)transition property for the .noUi-state-tap .noUi-origin selector.

    Default diff --git a/tests/slider_three_or_more_handles.js b/tests/slider_three_or_more_handles.js index 424b9ac7..22e6fffa 100644 --- a/tests/slider_three_or_more_handles.js +++ b/tests/slider_three_or_more_handles.js @@ -49,8 +49,7 @@ 'max': [20] }, animate: false, - animationDuration: 0, - useRequestAnimationFrame: false + animationDuration: 0 }); var handles2 = slider2.querySelectorAll('.noUi-handle'), @@ -79,7 +78,7 @@ clickY = middleHandleY, click1x = leftmostHandlePos.right*0.75+middleHandlePos.left*0.25, click2x = leftmostHandlePos.right*0.25+middleHandlePos.left*0.75; - + assert.deepEqual(slider2.noUiSlider.get(), [ "10.00", "20.00", "20.00" ], "Checking initial state"); simulateMousedown(clickTarget, click1x, clickY); From dff0b1bd307e174a94bda41a5e0c9686da8e4d4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Fri, 5 Jan 2018 01:52:04 +0000 Subject: [PATCH 32/40] doc updates --- documentation/events-callbacks.php | 4 +--- documentation/examples.php | 19 ++++++++++++------- documentation/examples/click-pips.js | 2 +- documentation/examples/colored-setup.js | 10 ++++++++++ documentation/examples/colored.js | 11 ----------- 5 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 documentation/examples/colored-setup.js diff --git a/documentation/events-callbacks.php b/documentation/events-callbacks.php index 8b5740f8..5a12b051 100644 --- a/documentation/events-callbacks.php +++ b/documentation/events-callbacks.php @@ -147,11 +147,9 @@

    Nested namespaces ('slide.something.else') are not supported, and are threated as a single namespace (so '.a.b' isn't related to '.a').

    -

    Event callbacks receive three arguments. values is always an array, for both one-handle and two-handle sliders. It contains the current slider values, with formatting applied. handle is 0 or 1 and indicates the handle that caused the event. values[handle] gives the value for the current handle. Should you need it, unencodedValues contains the slider values without any formatting.

    +

    Event callbacks receive three arguments. values is always an array, for both one-handle and two-handle sliders. It contains the current slider values, with formatting applied. handle is the index of the handle that caused the event, starting at zero. values[handle] gives the value for the handle that triggered the event. unencodedValues contains the slider values without any formatting.

    For all events, this is set to the current slider's public API, containing (among others) the 'get' and 'set' methods.

    - -

    Quick note: When any of the events fire, the slider state has updated. However, it's visual might not have been updated yet. This happens asynchronically to increase paint performance.

    diff --git a/documentation/examples.php b/documentation/examples.php index 16375825..d3e70b20 100644 --- a/documentation/examples.php +++ b/documentation/examples.php @@ -5,7 +5,7 @@
      -
    • Colorpicker
    • +
    • Color Picker
    • Working with HTML5 input types
    • Using non linear ranges
    • Locking two sliders together
    • @@ -87,10 +87,7 @@
      -

      noUiSlider is perfectly fine serializing values to any element with a .val() method, so lets try using type="number" and <select>.

      -

      Note that if your browser doesn't support an input type, it will just assume "text". If you'd like to know more, consider reading this article.

      - -

      We'll append <option> elements to the <select> dynamically.

      +

      noUiSlider's 'update' method is useful for synchronizing with other elements, such as <input> (type="number") and <select>.

      @@ -116,7 +113,7 @@
      -
      Linking the <select> and <input>
      +
      Updating the <select> and <input>
      @@ -138,7 +135,7 @@
      -

      One of noUiSlider's core features is the ability to divide the range in a non-linear fashion. Stepping can be applied, too! The example on the right shows where the handles are on the slider range in values and percentages.

      +

      One of noUiSlider's core features is the ability to divide the range in a non-linear fashion. Stepping can be applied. The example on the right shows where the handles are on the slider range in values and percentages.

      @@ -284,11 +281,19 @@
      +
      + +
      Slider setup
      + +
      + +
      +
      diff --git a/documentation/examples/click-pips.js b/documentation/examples/click-pips.js index bf5d5add..50116baa 100644 --- a/documentation/examples/click-pips.js +++ b/documentation/examples/click-pips.js @@ -7,7 +7,7 @@ function clickOnPip ( ) { for ( var i = 0; i < pips.length; i++ ) { - // For the this example. Do this in CSS! + // For this example. Do this in CSS! pips[i].style.cursor = 'pointer'; pips[i].addEventListener('click', clickOnPip); } diff --git a/documentation/examples/colored-setup.js b/documentation/examples/colored-setup.js new file mode 100644 index 00000000..0e079736 --- /dev/null +++ b/documentation/examples/colored-setup.js @@ -0,0 +1,10 @@ +var slider = document.getElementById('slider-color'); + +noUiSlider.create(slider, { + start: [ 4000, 8000, 12000, 16000 ], + connect: [false, true, true, true, true], + range: { + 'min': [ 2000 ], + 'max': [ 20000 ] + } +}); diff --git a/documentation/examples/colored.js b/documentation/examples/colored.js index 443b5337..d11a7260 100644 --- a/documentation/examples/colored.js +++ b/documentation/examples/colored.js @@ -1,14 +1,3 @@ -var slider = document.getElementById('slider-color'); - -noUiSlider.create(slider, { - start: [ 4000, 8000, 12000, 16000 ], - connect: [false, true, true, true, true], - range: { - 'min': [ 2000 ], - 'max': [ 20000 ] - } -}); - var connect = slider.querySelectorAll('.noUi-connect'); var classes = ['c-1-color', 'c-2-color', 'c-3-color', 'c-4-color', 'c-5-color']; From dff8c6479ed8dedc36212d5494c9a581cc638beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Fri, 12 Jan 2018 01:33:16 +0000 Subject: [PATCH 33/40] reset distribute --- distribute/nouislider.css | 2 +- distribute/nouislider.js | 29 +++++++++++------------------ distribute/nouislider.min.css | 2 +- distribute/nouislider.min.js | 4 ++-- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/distribute/nouislider.css b/distribute/nouislider.css index f2d19b0d..19789ade 100644 --- a/distribute/nouislider.css +++ b/distribute/nouislider.css @@ -1,4 +1,4 @@ -/*! nouislider - 10.1.0 - 2017-09-15 15:04:28 */ +/*! nouislider - 10.1.0 - 2017-07-28 13:09:54 */ /* Functional styling; * These styles are required for noUiSlider to function. * You don't need to change these rules to apply your design. diff --git a/distribute/nouislider.js b/distribute/nouislider.js index 03a89ea8..e5d92816 100644 --- a/distribute/nouislider.js +++ b/distribute/nouislider.js @@ -1,4 +1,4 @@ -/*! nouislider - 10.1.0 - 2017-09-15 15:04:28 */ +/*! nouislider - 10.1.0 - 2017-07-28 13:09:54 */ (function (factory) { @@ -649,33 +649,25 @@ function testPadding ( parsed, entry ) { - if ( !isNumeric(entry) && !Array.isArray(entry) ){ - throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric or array of exactly 2 numbers."); - } - - if ( Array.isArray(entry) && !(entry.length == 2 || isNumeric(entry[0]) || isNumeric(entry[1])) ) { - throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric or array of exactly 2 numbers."); + if ( !isNumeric(entry) ){ + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be numeric."); } if ( entry === 0 ) { return; } - if ( !Array.isArray(entry) ) { - entry = [entry, entry]; - } - - parsed.padding = [parsed.spectrum.getMargin(entry[0]), parsed.spectrum.getMargin(entry[1])]; + parsed.padding = parsed.spectrum.getMargin(entry); - if ( !parsed.padding[0] || !parsed.padding[1] ) { + if ( !parsed.padding ) { throw new Error("noUiSlider (" + VERSION + "): 'padding' option is only supported on linear sliders."); } - if ( parsed.padding[0] < 0 || parsed.padding[1] < 0 ) { - throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number(s)."); + if ( parsed.padding < 0 ) { + throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number."); } - if ( parsed.padding[0] >= 50 || parsed.padding[1] >= 50 ) { + if ( parsed.padding >= 50 ) { throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be less than half the range."); } } @@ -1919,12 +1911,13 @@ function closure ( target, options, originalOptions ){ // The padding option keeps the handles a certain distance from the // edges of the slider. Padding must be > 0. if ( options.padding ) { + if ( handleNumber === 0 ) { - to = Math.max(to, options.padding[0]); + to = Math.max(to, options.padding); } if ( handleNumber === scope_Handles.length - 1 ) { - to = Math.min(to, 100 - options.padding[1]); + to = Math.min(to, 100 - options.padding); } } diff --git a/distribute/nouislider.min.css b/distribute/nouislider.min.css index 3d190bcb..5e26604f 100644 --- a/distribute/nouislider.min.css +++ b/distribute/nouislider.min.css @@ -1 +1 @@ -/*! nouislider - 10.1.0 - 2017-09-15 15:04:28 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);padding-left:25px}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file +/*! nouislider - 10.1.0 - 2017-07-28 13:09:54 */.noUi-target,.noUi-target *{-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-ms-touch-action:none;touch-action:none;-ms-user-select:none;-moz-user-select:none;user-select:none;-moz-box-sizing:border-box;box-sizing:border-box}.noUi-target{position:relative;direction:ltr}.noUi-base{width:100%;height:100%;position:relative;z-index:1}.noUi-connect{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-origin{position:absolute;height:0;width:0}.noUi-handle{position:relative;z-index:1}.noUi-state-tap .noUi-connect,.noUi-state-tap .noUi-origin{-webkit-transition:top .3s,right .3s,bottom .3s,left .3s;transition:top .3s,right .3s,bottom .3s,left .3s}.noUi-state-drag *{cursor:inherit!important}.noUi-base,.noUi-handle{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.noUi-horizontal{height:18px}.noUi-horizontal .noUi-handle{width:34px;height:28px;left:-17px;top:-6px}.noUi-vertical{width:18px}.noUi-vertical .noUi-handle{width:28px;height:34px;left:-6px;top:-17px}.noUi-target{background:#FAFAFA;border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-connect{background:#3FB8AF;border-radius:4px;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-draggable{cursor:ew-resize}.noUi-vertical .noUi-draggable{cursor:ns-resize}.noUi-handle{border:1px solid #D9D9D9;border-radius:3px;background:#FFF;cursor:default;box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #EBEBEB,0 3px 6px -3px #BBB}.noUi-active{box-shadow:inset 0 0 1px #FFF,inset 0 1px 7px #DDD,0 3px 6px -3px #BBB}.noUi-handle:after,.noUi-handle:before{content:"";display:block;position:absolute;height:14px;width:1px;background:#E8E7E6;left:14px;top:6px}.noUi-handle:after{left:17px}.noUi-vertical .noUi-handle:after,.noUi-vertical .noUi-handle:before{width:14px;height:1px;left:6px;top:14px}.noUi-vertical .noUi-handle:after{top:17px}[disabled] .noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-handle,[disabled].noUi-target{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{position:absolute;white-space:nowrap;text-align:center}.noUi-value-sub{color:#ccc;font-size:10px}.noUi-marker{position:absolute;background:#CCC}.noUi-marker-large,.noUi-marker-sub{background:#AAA}.noUi-pips-horizontal{padding:10px 0;height:80px;top:100%;left:0;width:100%}.noUi-value-horizontal{-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0)}.noUi-marker-horizontal.noUi-marker{margin-left:-1px;width:2px;height:5px}.noUi-marker-horizontal.noUi-marker-sub{height:10px}.noUi-marker-horizontal.noUi-marker-large{height:15px}.noUi-pips-vertical{padding:0 10px;height:100%;top:0;left:100%}.noUi-value-vertical{-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);padding-left:25px}.noUi-marker-vertical.noUi-marker{width:5px;height:2px;margin-top:-1px}.noUi-marker-vertical.noUi-marker-sub{width:10px}.noUi-marker-vertical.noUi-marker-large{width:15px}.noUi-tooltip{display:block;position:absolute;border:1px solid #D9D9D9;border-radius:3px;background:#fff;color:#000;padding:5px;text-align:center;white-space:nowrap}.noUi-horizontal .noUi-tooltip{-webkit-transform:translate(-50%,0);transform:translate(-50%,0);left:50%;bottom:120%}.noUi-vertical .noUi-tooltip{-webkit-transform:translate(0,-50%);transform:translate(0,-50%);top:50%;right:120%} \ No newline at end of file diff --git a/distribute/nouislider.min.js b/distribute/nouislider.min.js index 9115380e..d4c28259 100644 --- a/distribute/nouislider.min.js +++ b/distribute/nouislider.min.js @@ -1,3 +1,3 @@ -/*! nouislider - 10.1.0 - 2017-09-15 15:04:28 */ +/*! nouislider - 10.1.0 - 2017-07-28 13:09:54 */ -!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return!this[a]&&(this[a]=!0)},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||"");return{x:b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,y:b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(a){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+_+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+_+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(!isNaN(b[1])&&b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.length&&"object"==typeof e[0][0]?e.sort(function(a,b){return a[0][0]-b[0][0]}):e.sort(function(a,b){return a[0]-b[0]}),d=0;d=50||a.padding[1]>=50)throw new Error("noUiSlider ("+_+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+_+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+_+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+_+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(a.multitouch=b,"boolean"!=typeof b)throw new Error("noUiSlider ("+_+"): 'multitouch' option must be a boolean.")}function S(a,b){if(!1!==b)if(!0===b){a.tooltips=[];for(var c=0;c-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=wa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(f){return!pa.hasAttribute("disabled")&&(!n(pa,e.cssClasses.tap)&&(!!(f=G(f,d.pageOffset,d.target||b))&&(!(a===ma.start&&void 0!==f.buttons&&f.buttons>1)&&((!d.hover||!f.buttons)&&(oa||f.preventDefault(),f.calcPoint=f.points[e.ort],void c(f,d))))))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!!oa&&{passive:!0}),g.push([a,f])}),g}function G(a,b,c){var d,f,g=0===a.type.indexOf("touch"),h=0===a.type.indexOf("mouse"),i=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(i=!0),g&&e.multitouch){var j=function(a){return a.target===c||c.contains(a.target)};if("touchstart"===a.type){var k=Array.prototype.filter.call(a.touches,j);if(k.length>1)return!1;d=k[0].pageX,f=k[0].pageY}else{var l=Array.prototype.find.call(a.changedTouches,j);if(!l)return!1;d=l.pageX,f=l.pageY}}else if(g){if(a.touches.length>1)return!1;d=a.changedTouches[0].pageX,f=a.changedTouches[0].pageY}return b=b||o(wa),(h||i)&&(d=a.clientX+b.x,f=a.clientY+b.y),a.pageOffset=b,a.points=[d,f],a.cursor=h||i,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);f1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);!1===d?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint);J(c>0,100*c/b.baseSize,b.locations,b.handleNumbers)}function N(a,b){b.handle&&(m(b.handle,e.cssClasses.active),sa-=1),b.listeners.forEach(function(a){xa.removeEventListener(a[0],a[1])}),0===sa&&(m(pa,e.cssClasses.drag),V(),a.cursor&&(ya.style.cursor="",ya.removeEventListener("selectstart",c))),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){var d;if(1===b.handleNumbers.length){var f=ia[b.handleNumbers[0]];if(f.hasAttribute("disabled"))return!1;d=f.children[0],sa+=1,l(d,e.cssClasses.active)}a.stopPropagation();var g=[],h=F(ma.move,xa,M,{target:a.target,handle:d,listeners:g,startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),i=F(ma.end,xa,N,{target:a.target,handle:d,listeners:g,handleNumbers:b.handleNumbers}),j=F("mouseout",xa,L,{target:a.target,handle:d,listeners:g,handleNumbers:b.handleNumbers});g.push.apply(g,h.concat(i,j)),a.cursor&&(ya.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),ya.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);if(!1===c)return!1;e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),e.events.snap&&O(a,{handleNumbers:[c]})}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(!1!==b&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return!1!==(b=S(qa,a,b,c,d,!1))&&(U(a,b),!0)}function X(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&!1!==a&&("number"==typeof a&&(a=String(a)),!1===(a=e.format.from(a))||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function $(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b||!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){$(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;!1!==e&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:!1!==c.stepBefore.step&&d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&!1!==e&&(e=Number(e.toFixed(g))),null!==f&&!1!==f&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=Y(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],$(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=0,ta=e.spectrum,ua=[],va={},wa=a.ownerDocument,xa=wa.documentElement,ya=wa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+_+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:$,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),$(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function $(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+_+"): create requires a single element, got: "+a);var c=Y(b,a),d=Z(a,c,b);return a.noUiSlider=d,d}var _="10.1.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!=0)throw new Error("noUiSlider ("+_+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&t(this.xVal,a)},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var aa={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:_,create:$}}); \ No newline at end of file +!function(a){"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?module.exports=a():window.noUiSlider=a()}(function(){"use strict";function a(a){return"object"==typeof a&&"function"==typeof a.to&&"function"==typeof a.from}function b(a){a.parentElement.removeChild(a)}function c(a){a.preventDefault()}function d(a){return a.filter(function(a){return!this[a]&&(this[a]=!0)},{})}function e(a,b){return Math.round(a/b)*b}function f(a,b){var c=a.getBoundingClientRect(),d=a.ownerDocument,e=d.documentElement,f=o(d);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(f.x=0),b?c.top+f.y-e.clientTop:c.left+f.x-e.clientLeft}function g(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function h(a,b,c){c>0&&(l(a,b),setTimeout(function(){m(a,b)},c))}function i(a){return Math.max(Math.min(a,100),0)}function j(a){return Array.isArray(a)?a:[a]}function k(a){a=String(a);var b=a.split(".");return b.length>1?b[1].length:0}function l(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function m(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function n(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function o(a){var b=void 0!==window.pageXOffset,c="CSS1Compat"===(a.compatMode||"");return{x:b?window.pageXOffset:c?a.documentElement.scrollLeft:a.body.scrollLeft,y:b?window.pageYOffset:c?a.documentElement.scrollTop:a.body.scrollTop}}function p(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function q(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("test",null,b)}catch(a){}return a}function r(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function s(a,b){return 100/(b-a)}function t(a,b){return 100*b/(a[1]-a[0])}function u(a,b){return t(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function v(a,b){return b*(a[1]-a[0])/100+a[0]}function w(a,b){for(var c=1;a>=b[c];)c+=1;return c}function x(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=w(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+u([d,e],c)/s(f,g)}function y(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=w(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],v([d,e],(c-f)*s(f,g))}function z(a,b,c,d){if(100===d)return d;var f,g,h=w(d,a);return c?(f=a[h-1],g=a[h],d-f>(g-f)/2?g:f):b[h-1]?a[h-1]+e(d-a[h-1],b[h-1]):d}function A(a,b,c){var d;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider ("+_+"): 'range' contains invalid value.");if(d="min"===a?0:"max"===a?100:parseFloat(a),!g(d)||!g(b[0]))throw new Error("noUiSlider ("+_+"): 'range' value isn't numeric.");c.xPct.push(d),c.xVal.push(b[0]),d?c.xSteps.push(!isNaN(b[1])&&b[1]):isNaN(b[1])||(c.xSteps[0]=b[1]),c.xHighestCompleteStep.push(0)}function B(a,b,c){if(!b)return!0;c.xSteps[a]=t([c.xVal[a],c.xVal[a+1]],b)/s(c.xPct[a],c.xPct[a+1]);var d=(c.xVal[a+1]-c.xVal[a])/c.xNumSteps[a],e=Math.ceil(Number(d.toFixed(3))-1),f=c.xVal[a]+c.xNumSteps[a]*e;c.xHighestCompleteStep[a]=f}function C(a,b,c){this.xPct=[],this.xVal=[],this.xSteps=[c||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=b;var d,e=[];for(d in a)a.hasOwnProperty(d)&&e.push([a[d],d]);for(e.length&&"object"==typeof e[0][0]?e.sort(function(a,b){return a[0][0]-b[0][0]}):e.sort(function(a,b){return a[0]-b[0]}),d=0;d=50)throw new Error("noUiSlider ("+_+"): 'padding' option must be less than half the range.")}}function P(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1;break;default:throw new Error("noUiSlider ("+_+"): 'direction' option was not recognized.")}}function Q(a,b){if("string"!=typeof b)throw new Error("noUiSlider ("+_+"): 'behaviour' must be a string containing options.");var c=b.indexOf("tap")>=0,d=b.indexOf("drag")>=0,e=b.indexOf("fixed")>=0,f=b.indexOf("snap")>=0,g=b.indexOf("hover")>=0;if(e){if(2!==a.handles)throw new Error("noUiSlider ("+_+"): 'fixed' behaviour must be used with 2 handles");M(a,a.start[1]-a.start[0])}a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function R(a,b){if(a.multitouch=b,"boolean"!=typeof b)throw new Error("noUiSlider ("+_+"): 'multitouch' option must be a boolean.")}function S(a,b){if(!1!==b)if(!0===b){a.tooltips=[];for(var c=0;c-1?1:"steps"===b?2:0,!g&&i&&(q=0),l===v&&j||(f[n.toFixed(5)]=[l,q]),k=n}}),f}function B(a,b,c){function d(a,b){var c=b===e.cssClasses.value,d=c?j:m,f=c?h:i;return b+" "+d[e.ort]+" "+f[a]}function f(a,f){f[1]=f[1]&&b?b(f[0],f[1]):f[1];var h=k(g,!1);h.className=d(f[1],e.cssClasses.marker),h.style[e.style]=a+"%",f[1]&&(h=k(g,!1),h.className=d(f[1],e.cssClasses.value),h.style[e.style]=a+"%",h.innerText=c.to(f[0]))}var g=wa.createElement("div"),h=[e.cssClasses.valueNormal,e.cssClasses.valueLarge,e.cssClasses.valueSub],i=[e.cssClasses.markerNormal,e.cssClasses.markerLarge,e.cssClasses.markerSub],j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],m=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];return l(g,e.cssClasses.pips),l(g,0===e.ort?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical),Object.keys(a).forEach(function(b){f(b,a[b])}),g}function C(){la&&(b(la),la=null)}function D(a){C();var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=z(b,e,f),h=A(c,b,g),i=a.format||{to:Math.round};return la=pa.appendChild(B(h,d,i))}function E(){var a=ha.getBoundingClientRect(),b="offset"+["Width","Height"][e.ort];return 0===e.ort?a.width||ha[b]:a.height||ha[b]}function F(a,b,c,d){var f=function(f){return!pa.hasAttribute("disabled")&&(!n(pa,e.cssClasses.tap)&&(!!(f=G(f,d.pageOffset,d.target||b))&&(!(a===ma.start&&void 0!==f.buttons&&f.buttons>1)&&((!d.hover||!f.buttons)&&(oa||f.preventDefault(),f.calcPoint=f.points[e.ort],void c(f,d))))))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!!oa&&{passive:!0}),g.push([a,f])}),g}function G(a,b,c){var d,f,g=0===a.type.indexOf("touch"),h=0===a.type.indexOf("mouse"),i=0===a.type.indexOf("pointer");if(0===a.type.indexOf("MSPointer")&&(i=!0),g&&e.multitouch){var j=function(a){return a.target===c||c.contains(a.target)};if("touchstart"===a.type){var k=Array.prototype.filter.call(a.touches,j);if(k.length>1)return!1;d=k[0].pageX,f=k[0].pageY}else{var l=Array.prototype.find.call(a.changedTouches,j);if(!l)return!1;d=l.pageX,f=l.pageY}}else if(g){if(a.touches.length>1)return!1;d=a.changedTouches[0].pageX,f=a.changedTouches[0].pageY}return b=b||o(wa),(h||i)&&(d=a.clientX+b.x,f=a.clientY+b.y),a.pageOffset=b,a.points=[d,f],a.cursor=h||i,a}function H(a){var b=a-f(ha,e.ort),c=100*b/E();return e.dir?100-c:c}function I(a){var b=100,c=!1;return ia.forEach(function(d,e){if(!d.hasAttribute("disabled")){var f=Math.abs(qa[e]-a);f1?d.forEach(function(a,c){var d=S(e,a,e[a]+b,f[c],g[c],!1);!1===d?b=0:(b=d-e[a],e[a]=d)}):f=g=[!0];var h=!1;d.forEach(function(a,d){h=W(a,c[a]+b,f[d],g[d])||h}),h&&d.forEach(function(a){K("update",a),K("slide",a)})}function K(a,b,c){Object.keys(va).forEach(function(d){var f=d.split(".")[0];a===f&&va[d].forEach(function(a){a.call(ka,ua.map(e.format.to),b,ua.slice(),c||!1,qa.slice())})})}function L(a,b){"mouseout"===a.type&&"HTML"===a.target.nodeName&&null===a.relatedTarget&&N(a,b)}function M(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return N(a,b);var c=(e.dir?-1:1)*(a.calcPoint-b.startCalcPoint);J(c>0,100*c/b.baseSize,b.locations,b.handleNumbers)}function N(a,b){b.handle&&(m(b.handle,e.cssClasses.active),sa-=1),b.listeners.forEach(function(a){xa.removeEventListener(a[0],a[1])}),0===sa&&(m(pa,e.cssClasses.drag),V(),a.cursor&&(ya.style.cursor="",ya.removeEventListener("selectstart",c))),b.handleNumbers.forEach(function(a){K("change",a),K("set",a),K("end",a)})}function O(a,b){var d;if(1===b.handleNumbers.length){var f=ia[b.handleNumbers[0]];if(f.hasAttribute("disabled"))return!1;d=f.children[0],sa+=1,l(d,e.cssClasses.active)}a.stopPropagation();var g=[],h=F(ma.move,xa,M,{target:a.target,handle:d,listeners:g,startCalcPoint:a.calcPoint,baseSize:E(),pageOffset:a.pageOffset,handleNumbers:b.handleNumbers,buttonsProperty:a.buttons,locations:qa.slice()}),i=F(ma.end,xa,N,{target:a.target,handle:d,listeners:g,handleNumbers:b.handleNumbers}),j=F("mouseout",xa,L,{target:a.target,handle:d,listeners:g,handleNumbers:b.handleNumbers});g.push.apply(g,h.concat(i,j)),a.cursor&&(ya.style.cursor=getComputedStyle(a.target).cursor,ia.length>1&&l(pa,e.cssClasses.drag),ya.addEventListener("selectstart",c,!1)),b.handleNumbers.forEach(function(a){K("start",a)})}function P(a){a.stopPropagation();var b=H(a.calcPoint),c=I(b);if(!1===c)return!1;e.events.snap||h(pa,e.cssClasses.tap,e.animationDuration),W(c,b,!0,!0),V(),K("slide",c,!0),K("update",c,!0),K("change",c,!0),K("set",c,!0),e.events.snap&&O(a,{handleNumbers:[c]})}function Q(a){var b=H(a.calcPoint),c=ta.getStep(b),d=ta.fromStepping(c);Object.keys(va).forEach(function(a){"hover"===a.split(".")[0]&&va[a].forEach(function(a){a.call(ka,d)})})}function R(a){a.fixed||ia.forEach(function(a,b){F(ma.start,a.children[0],O,{handleNumbers:[b]})}),a.tap&&F(ma.start,ha,P,{}),a.hover&&F(ma.move,ha,Q,{hover:!0}),a.drag&&ja.forEach(function(b,c){if(!1!==b&&0!==c&&c!==ja.length-1){var d=ia[c-1],f=ia[c],g=[b];l(b,e.cssClasses.draggable),a.fixed&&(g.push(d.children[0]),g.push(f.children[0])),g.forEach(function(a){F(ma.start,a,O,{handles:[d,f],handleNumbers:[c-1,c]})})}})}function S(a,b,c,d,f,g){return ia.length>1&&(d&&b>0&&(c=Math.max(c,a[b-1]+e.margin)),f&&b1&&e.limit&&(d&&b>0&&(c=Math.min(c,a[b-1]+e.limit)),f&&b50?-1:1,c=3+(ia.length+b*a);ia[a].childNodes[0].style.zIndex=c})}function W(a,b,c,d){return!1!==(b=S(qa,a,b,c,d,!1))&&(U(a,b),!0)}function X(a){if(ja[a]){var b=0,c=100;0!==a&&(b=qa[a-1]),a!==ja.length-1&&(c=qa[a]),ja[a].style[e.style]=T(b),ja[a].style[e.styleOposite]=T(100-c)}}function Z(a,b){null!==a&&!1!==a&&("number"==typeof a&&(a=String(a)),!1===(a=e.format.from(a))||isNaN(a)||W(b,ta.toStepping(a),!1,!1))}function $(a,b){var c=j(a),d=void 0===qa[0];b=void 0===b||!!b,c.forEach(Z),e.animate&&!d&&h(pa,e.cssClasses.tap,e.animationDuration),ra.forEach(function(a){W(a,qa[a],!0,!1)}),V(),ra.forEach(function(a){K("update",a),null!==c[a]&&b&&K("set",a)})}function aa(a){$(e.start,a)}function ba(){var a=ua.map(e.format.to);return 1===a.length?a[0]:a}function ca(){for(var a in e.cssClasses)e.cssClasses.hasOwnProperty(a)&&m(pa,e.cssClasses[a]);for(;pa.firstChild;)pa.removeChild(pa.firstChild);delete pa.noUiSlider}function da(){return qa.map(function(a,b){var c=ta.getNearbySteps(a),d=ua[b],e=c.thisStep.step,f=null;!1!==e&&d+e>c.stepAfter.startValue&&(e=c.stepAfter.startValue-d),f=d>c.thisStep.startValue?c.thisStep.step:!1!==c.stepBefore.step&&d-c.stepBefore.highestStep,100===a?e=null:0===a&&(f=null);var g=ta.countStepDecimals();return null!==e&&!1!==e&&(e=Number(e.toFixed(g))),null!==f&&!1!==f&&(f=Number(f.toFixed(g))),[f,e]})}function ea(a,b){va[a]=va[a]||[],va[a].push(b),"update"===a.split(".")[0]&&ia.forEach(function(a,b){K("update",b)})}function fa(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(va).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete va[a]})}function ga(a,b){var c=ba(),d=["margin","limit","padding","range","animate","snap","step","format"];d.forEach(function(b){void 0!==a[b]&&(g[b]=a[b])});var f=Y(g);d.forEach(function(b){void 0!==a[b]&&(e[b]=f[b])}),ta=f.spectrum,e.margin=f.margin,e.limit=f.limit,e.padding=f.padding,e.pips&&D(e.pips),qa=[],$(a.start||c,b)}var ha,ia,ja,ka,la,ma=p(),na=r(),oa=na&&q(),pa=a,qa=[],ra=[],sa=0,ta=e.spectrum,ua=[],va={},wa=a.ownerDocument,xa=wa.documentElement,ya=wa.body;if(pa.noUiSlider)throw new Error("noUiSlider ("+_+"): Slider was already initialized.");return v(pa),u(e.connect,ha),ka={destroy:ca,steps:da,on:ea,off:fa,get:ba,set:$,reset:aa,__moveHandles:function(a,b,c){J(a,b,qa,c)},options:g,updateOptions:ga,target:pa,removePips:C,pips:D},R(e.events),$(e.start),e.pips&&D(e.pips),e.tooltips&&x(),y(),ka}function $(a,b){if(!a||!a.nodeName)throw new Error("noUiSlider ("+_+"): create requires a single element, got: "+a);var c=Y(b,a),d=Z(a,c,b);return a.noUiSlider=d,d}var _="10.1.0";C.prototype.getMargin=function(a){var b=this.xNumSteps[0];if(b&&a/b%1!=0)throw new Error("noUiSlider ("+_+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&t(this.xVal,a)},C.prototype.toStepping=function(a){return a=x(this.xVal,this.xPct,a)},C.prototype.fromStepping=function(a){return y(this.xVal,this.xPct,a)},C.prototype.getStep=function(a){return a=z(this.xPct,this.xSteps,this.snap,a)},C.prototype.getNearbySteps=function(a){var b=w(a,this.xPct);return{stepBefore:{startValue:this.xVal[b-2],step:this.xNumSteps[b-2],highestStep:this.xHighestCompleteStep[b-2]},thisStep:{startValue:this.xVal[b-1],step:this.xNumSteps[b-1],highestStep:this.xHighestCompleteStep[b-1]},stepAfter:{startValue:this.xVal[b-0],step:this.xNumSteps[b-0],highestStep:this.xHighestCompleteStep[b-0]}}},C.prototype.countStepDecimals=function(){var a=this.xNumSteps.map(k);return Math.max.apply(null,a)},C.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var aa={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{version:_,create:$}}); \ No newline at end of file From b9c71b0b12e68fad4b5badf2a51d701930876c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Fri, 12 Jan 2018 02:44:06 +0000 Subject: [PATCH 34/40] Use build (not create) css --- tests/slider.html | 2 +- tests/slider_three_or_more_handles.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/slider.html b/tests/slider.html index ab4155b3..111e9fc7 100644 --- a/tests/slider.html +++ b/tests/slider.html @@ -20,7 +20,7 @@ - + diff --git a/tests/slider_three_or_more_handles.js b/tests/slider_three_or_more_handles.js index 22e6fffa..e750d505 100644 --- a/tests/slider_three_or_more_handles.js +++ b/tests/slider_three_or_more_handles.js @@ -61,7 +61,7 @@ rightmostHandlePos = rightmostHandle.getBoundingClientRect(); assert.deepEqual(middleHandlePos, rightmostHandlePos, "Two handles in the same location should have the same on-screen position"); - assert.notDeepEqual(middleHandlePos, leftmostHandlePos, "Handles at different ends of the slider should have different positions. This might mean requestAnimationFrame is waiting for a repaint before moving the handles, or the box you're drawing into is off screen."); + assert.notDeepEqual(middleHandlePos, leftmostHandlePos, "Handles at different ends of the slider should have different positions."); var middleHandleX = (middleHandlePos.right+middleHandlePos.left)/2, middleHandleY = (middleHandlePos.top+middleHandlePos.bottom)/2, From 2b852cd3ac8e3ce5fe3e46ccd9fce2015c0ee82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Fri, 12 Jan 2018 02:44:48 +0000 Subject: [PATCH 35/40] fix padding can now be zero --- src/js/options.js | 3 ++- tests/slider_padding.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/js/options.js b/src/js/options.js index 11961c91..1e05c21f 100644 --- a/src/js/options.js +++ b/src/js/options.js @@ -204,9 +204,10 @@ entry = [entry, entry]; } + // 'getMargin' returns false for invalid values. parsed.padding = [parsed.spectrum.getMargin(entry[0]), parsed.spectrum.getMargin(entry[1])]; - if ( !parsed.padding[0] || !parsed.padding[1] ) { + if ( parsed.padding[0] === false || parsed.padding[1] === false ) { throw new Error("noUiSlider (" + VERSION + "): 'padding' option is only supported on linear sliders."); } diff --git a/tests/slider_padding.js b/tests/slider_padding.js index 147596af..29a19871 100644 --- a/tests/slider_padding.js +++ b/tests/slider_padding.js @@ -35,3 +35,33 @@ slider.noUiSlider.set( [ 3, 10 ] ); assert.deepEqual( slider.noUiSlider.get(), ['3.00', '9.00'], 'RTL set.' ); }); + + QUnit.test( "Padding option", function( assert ){ + + Q.innerHTML = '
      '; + + var settings = { + start: [ 0, 100 ], + padding: [ 10, 5 ], + range: { + 'min': 0, + 'max': 100 + } + }; + + var slider = Q.querySelector('.slider'); + + noUiSlider.create(slider, settings); + + assert.deepEqual( slider.noUiSlider.get(), ['10.00', '95.00'], 'Different paddings applied' ); + + // ============= + + slider.noUiSlider.destroy(); + + settings.padding = [0, 10]; + + noUiSlider.create(slider, settings); + assert.deepEqual( slider.noUiSlider.get(), ['0.00', '90.00'], 'One of the padding values is 0' ); + + }); From 678f49bc7854690c4b909a3fc819a0995ff67fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Fri, 12 Jan 2018 02:46:52 +0000 Subject: [PATCH 36/40] readme --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d598c6c3..2e511677 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,11 @@ noUiSlider is lightweight JavaScript range slider. - **No dependencies** -- All modern browsers and [IE9+](#browser-support) are supported +- All modern browsers and IE > 9 are supported - Fully **responsive** - **Touch support** on Android, iOS and Windows devices - Tons of [examples](https://refreshless.com/nouislider/examples) and answered [Stack Overflow questions](https://stackoverflow.com/questions/tagged/nouislider) --------- -**Quick note:** I'm out of town for a while, so support will be slower than usual. Apologies in advance. --------- - License ------- noUiSlider is licensed [WTFPL](http://www.wtfpl.net/about/). You can use it **for free** and **without any attribution**, in any personal or commercial project. You may also fork the project and re-release it under another license you prefer. @@ -40,6 +36,7 @@ on the handle/connect order in the DOM, there should be no issues upgrading. - Change: Handle stacking is now on `.noUi-origin` instead of `.noUi-handle`; - Added: A `.noUi-connects` element holding all `.noUi-connect` elements; - Added: `[data-value]` property for `.noUi-value` in pips (#733); +- Added: `padding` option can now take an array for different padding values at both sides of a slider (#822); - Removed: `useRequestAnimationFrame` option. No longer needed with CSS transforms; - Removed: `multitouch` option. Now enabled by default; - Fixed: Slider could ignore end events it should handle (#704, #805, #834); From 7cbd47addf0357478b7abe65a28a2f174cbecaa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Fri, 12 Jan 2018 02:56:33 +0000 Subject: [PATCH 37/40] padding docs --- documentation/slider-options.php | 22 ++++++++++++++++++++-- documentation/slider-options/padding.js | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/documentation/slider-options.php b/documentation/slider-options.php index 52cb39bb..02398190 100644 --- a/documentation/slider-options.php +++ b/documentation/slider-options.php @@ -16,6 +16,22 @@
      +
      + +
      + +

      Start

      @@ -196,7 +212,10 @@
      0
      Accepted values -
      number
      +
      number,
      + array[number],
      + array[number, number] +
    @@ -213,7 +232,6 @@
    -

    Step

    diff --git a/documentation/slider-options/padding.js b/documentation/slider-options/padding.js index 978be75f..39605f0a 100644 --- a/documentation/slider-options/padding.js +++ b/documentation/slider-options/padding.js @@ -2,7 +2,7 @@ var paddingSlider = document.getElementById('slider-padding'); noUiSlider.create(paddingSlider, { start: [ 20, 80 ], - padding: 10, + padding: [ 10, 15 ], // Or just 10 range: { 'min': 0, 'max': 100 From c8e2d637173c003ba55a6c3710ea34456f9d351f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Fri, 12 Jan 2018 03:26:00 +0000 Subject: [PATCH 38/40] pips docs --- documentation/pips.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/documentation/pips.php b/documentation/pips.php index 69f84b3c..1f17bf10 100644 --- a/documentation/pips.php +++ b/documentation/pips.php @@ -12,6 +12,8 @@

    This feature allows you to generate points along the slider.

    Five options can be set: mode to determine where to place pips, values as additional options for mode, stepped to round pip values to the slider stepping, density to pre-scale the number of pips, and filter to manually modify pip size.

    +

    The density value controls how many pips are placed on one percent of the slider range. With the default value of 1, there is one pip per percent. For a value of 2, a pip is placed for every 2 percent. A value below one will place more than one pip per percentage.

    +

    All sliders on the page use the same range, as displayed to the right.

    From b0dfd07a872d56120db2277cffe747cd5ec4e420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Fri, 12 Jan 2018 19:21:59 +0000 Subject: [PATCH 39/40] Update documentation on containing slider --- documentation/_run/helpers.php | 7 +++++++ documentation/more.php | 12 ++++++++++-- documentation/more/padding.css | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 documentation/more/padding.css diff --git a/documentation/_run/helpers.php b/documentation/_run/helpers.php index b840122e..a30cac2b 100644 --- a/documentation/_run/helpers.php +++ b/documentation/_run/helpers.php @@ -27,6 +27,13 @@ function loadShowCSS ( $name ) { '
    ' . $content . '
    '; } + function showCSS ( $name ) { + + $content = fgc($name . '.css'); + + echo "\r\n".'
    ' . $content . '
    '; + } + function sect ( $title ) { echo '§'; } diff --git a/documentation/more.php b/documentation/more.php index 1aca2ddc..c585c3f8 100644 --- a/documentation/more.php +++ b/documentation/more.php @@ -143,9 +143,11 @@

    Styling noUiSlider is easy. The default stylesheet contains helpful comments to get a head start.

    -

    It is strongly recommended to use the default stylesheet, overriding where necessary, as a starting point when re-styling noUiSlider.

    +

    It is recommended to use the default stylesheet, overriding where necessary, as a starting point when re-styling noUiSlider.

    If your styling system doesn't match the convention in noUiSlider, you can use the cssPrefix and cssClasses options to reconfigure the markup.

    + +

    noUiSlider listens to events on the .noUi-base element. To add padding on the .noUi-target element and contain handles within the slider width, .noUi-base needs to be extended. This can be done using CSS :before and :after pseudo-elements. An example is included to the right.

    @@ -194,10 +196,16 @@
    +
    Add padding to slider base
    + +
    + +
    +
    Overriding classes
    -
    +
    diff --git a/documentation/more/padding.css b/documentation/more/padding.css new file mode 100644 index 00000000..8d9c8fbb --- /dev/null +++ b/documentation/more/padding.css @@ -0,0 +1,18 @@ +.noUi-target { + padding: 0 17px; +} +.noUi-base:before, +.noUi-base:after { + width: 17px; + content: ""; + position: absolute; + top: 0; + height: 100%; + display: block; +} +.noUi-base:before { + left: -17px; +} +.noUi-base:after { + left: 100%; +} From 3000248f604cc21e4f04f6bdfec9f980124d6d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Gersen?= Date: Fri, 12 Jan 2018 19:42:35 +0000 Subject: [PATCH 40/40] Documentation on update --- documentation/more.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/documentation/more.php b/documentation/more.php index c585c3f8..06028caf 100644 --- a/documentation/more.php +++ b/documentation/more.php @@ -72,12 +72,16 @@
    -

    noUiSlider has an update method that can change the 'margin', 'limit', 'step', 'range', 'animate' and 'snap' options. All other options require changes to the slider's HTML or event bindings.

    +

    noUiSlider has an update method that can change the 'margin', 'limit', 'step', 'range', 'animate' and 'snap' options.

    -

    To update any other option, destroy the slider using slider.noUiSlider.destroy() and create a new one. Note that events are not unbound when destroying a slider.

    +

    All other options require changes to the slider's HTML or event bindings.

    + +

    To update any other option, destroy the slider using slider.noUiSlider.destroy() and create a new one. Events are unbound when destroying a slider.

    The update method can be called as slider.noUiSlider.updateOptions(newOptions, [fireSetEvent]).

    +

    Options that can not be updated will be ignored without errors.

    +

    The 'update' event fires after updating the slider.

    By default, the sliders values remain unchanged. To update the slider values, newOptions may also contain a start property that matches the signature of the set method.