diff --git a/distribute/nouislider.js b/distribute/nouislider.js index 24bb34b3..1b944966 100644 --- a/distribute/nouislider.js +++ b/distribute/nouislider.js @@ -1,4 +1,4 @@ -/*! nouislider - 8.4.0 - 2016-04-16 16:30:28 */ +/*! nouislider - 8.4.0 - 2016-04-16 16:46:07 */ (function (factory) { @@ -1690,9 +1690,10 @@ function closure ( target, options, originalOptions ){ // Set the slider value. function valueSet ( input, fireSetEvent ) { - var count, values = asArray( input ), i, - // Event fires by default - fireSetEvent = (fireSetEvent === undefined ? true : !!fireSetEvent); + var count, values = asArray( input ), i; + + // Event fires by default + fireSetEvent = (fireSetEvent === undefined ? true : !!fireSetEvent); // The RTL settings is implemented by reversing the front-end, // internal mechanisms are the same. @@ -1824,7 +1825,7 @@ function closure ( target, options, originalOptions ){ // Spectrum is created using the range, snap, direction and step options. // 'snap' and 'step' can be updated, 'direction' cannot, due to event binding. // If 'snap' and 'step' are not passed, they should remain unchanged. - var v = valueGet(), i, newOptions = testOptions({ + var v = valueGet(), newOptions = testOptions({ start: [0, 0], margin: optionsToUpdate.margin, limit: optionsToUpdate.limit, diff --git a/distribute/nouislider.min.css b/distribute/nouislider.min.css index ea127a18..da9be7c5 100644 --- a/distribute/nouislider.min.css +++ b/distribute/nouislider.min.css @@ -1,4 +1,4 @@ -/*! nouislider - 8.4.0 - 2016-04-16 16:30:28 */ +/*! nouislider - 8.4.0 - 2016-04-16 16:46:08 */ .noUi-target,.noUi-target *{-webkit-touch-callout:none;-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-origin{position:absolute;right:0;top:0;left:0;bottom:0}.noUi-handle{position:relative;z-index:1}.noUi-stacking .noUi-handle{z-index:10}.noUi-state-tap .noUi-origin{-webkit-transition:left .3s,top .3s;transition:left .3s,top .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-background{background:#FAFAFA;box-shadow:inset 0 1px 1px #f0f0f0}.noUi-connect{background:#3FB8AF;box-shadow:inset 0 0 3px rgba(51,51,51,.45);-webkit-transition:background 450ms;transition:background 450ms}.noUi-origin{border-radius:2px}.noUi-target{border-radius:4px;border:1px solid #D3D3D3;box-shadow:inset 0 1px 1px #F0F0F0,0 3px 6px -5px #BBB}.noUi-target.noUi-connect{box-shadow:inset 0 0 3px rgba(51,51,51,.45),0 3px 6px -5px #BBB}.noUi-draggable{cursor:w-resize}.noUi-vertical .noUi-draggable{cursor:n-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,[disabled].noUi-connect{background:#B8B8B8}[disabled] .noUi-handle,[disabled].noUi-origin{cursor:not-allowed}.noUi-pips,.noUi-pips *{-moz-box-sizing:border-box;box-sizing:border-box}.noUi-pips{position:absolute;color:#999}.noUi-value{width:40px;position:absolute;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:50px;top:100%;left:0;width:100%}.noUi-value-horizontal{margin-left:-20px;padding-top:20px}.noUi-value-horizontal.noUi-value-sub{padding-top:15px}.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{width:15px;margin-left:20px;margin-top:-5px}.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;padding:5px;text-align:center}.noUi-horizontal .noUi-handle-lower .noUi-tooltip{top:-32px}.noUi-horizontal .noUi-handle-upper .noUi-tooltip{bottom:-32px}.noUi-vertical .noUi-handle-lower .noUi-tooltip{left:120%}.noUi-vertical .noUi-handle-upper .noUi-tooltip{right:120%} \ No newline at end of file diff --git a/distribute/nouislider.min.js b/distribute/nouislider.min.js index bd3fd40d..27fc2c31 100644 --- a/distribute/nouislider.min.js +++ b/distribute/nouislider.min.js @@ -1,3 +1,3 @@ -/*! nouislider - 8.4.0 - 2016-04-16 16:30:28 */ +/*! nouislider - 8.4.0 - 2016-04-16 16:46:07 */ -!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 a.filter(function(a){return this[a]?!1:this[a]=!0},{})}function b(a,b){return Math.round(a/b)*b}function c(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.documentElement,e=l();return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(e.x=0),{top:b.top+e.y-d.clientTop,left:b.left+e.x-d.clientLeft}}function d(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function e(a,b,c){i(a,b),setTimeout(function(){j(a,b)},c)}function f(a){return Math.max(Math.min(a,100),0)}function g(a){return Array.isArray(a)?a:[a]}function h(a){var b=a.split(".");return b.length>1?b[1].length:0}function i(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function j(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function k(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function l(){var a=void 0!==window.pageXOffset,b="CSS1Compat"===(document.compatMode||""),c=a?window.pageXOffset:b?document.documentElement.scrollLeft:document.body.scrollLeft,d=a?window.pageYOffset:b?document.documentElement.scrollTop:document.body.scrollTop;return{x:c,y:d}}function m(a){a.stopPropagation()}function n(a){return function(b){return a+b}}function o(){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 p(a,b){return 100/(b-a)}function q(a,b){return 100*b/(a[1]-a[0])}function r(a,b){return q(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function s(a,b){return b*(a[1]-a[0])/100+a[0]}function t(a,b){for(var c=1;a>=b[c];)c+=1;return c}function u(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=t(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+r([d,e],c)/p(f,g)}function v(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=t(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],s([d,e],(c-f)*p(f,g))}function w(a,c,d,e){if(100===e)return e;var f,g,h=t(e,a);return d?(f=a[h-1],g=a[h],e-f>(g-f)/2?g:f):c[h-1]?a[h-1]+b(e-a[h-1],c[h-1]):e}function x(a,b,c){var e;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider: 'range' contains invalid value.");if(e="min"===a?0:"max"===a?100:parseFloat(a),!d(e)||!d(b[0]))throw new Error("noUiSlider: 'range' value isn't numeric.");c.xPct.push(e),c.xVal.push(b[0]),e?c.xSteps.push(isNaN(b[1])?!1:b[1]):isNaN(b[1])||(c.xSteps[0]=b[1])}function y(a,b,c){return b?void(c.xSteps[a]=q([c.xVal[a],c.xVal[a+1]],b)/p(c.xPct[a],c.xPct[a+1])):!0}function z(a,b,c,d){this.xPct=[],this.xVal=[],this.xSteps=[d||!1],this.xNumSteps=[!1],this.snap=b,this.direction=c;var e,f=[];for(e in a)a.hasOwnProperty(e)&&f.push([a[e],e]);for(f.length&&"object"==typeof f[0][0]?f.sort(function(a,b){return a[0][0]-b[0][0]}):f.sort(function(a,b){return a[0]-b[0]}),e=0;e2)throw new Error("noUiSlider: 'start' option is incorrect.");a.handles=b.length,a.start=b}function D(a,b){if(a.snap=b,"boolean"!=typeof b)throw new Error("noUiSlider: 'snap' option must be a boolean.")}function E(a,b){if(a.animate=b,"boolean"!=typeof b)throw new Error("noUiSlider: 'animate' option must be a boolean.")}function F(a,b){if(a.animationDuration=b,"number"!=typeof b)throw new Error("noUiSlider: 'animationDuration' option must be a number.")}function G(a,b){if("lower"===b&&1===a.handles)a.connect=1;else if("upper"===b&&1===a.handles)a.connect=2;else if(b===!0&&2===a.handles)a.connect=3;else{if(b!==!1)throw new Error("noUiSlider: 'connect' option doesn't match handle count.");a.connect=0}}function H(a,b){switch(b){case"horizontal":a.ort=0;break;case"vertical":a.ort=1;break;default:throw new Error("noUiSlider: 'orientation' option is invalid.")}}function I(a,b){if(!d(b))throw new Error("noUiSlider: 'margin' option must be numeric.");if(0!==b&&(a.margin=a.spectrum.getMargin(b),!a.margin))throw new Error("noUiSlider: 'margin' option is only supported on linear sliders.")}function J(a,b){if(!d(b))throw new Error("noUiSlider: 'limit' option must be numeric.");if(a.limit=a.spectrum.getMargin(b),!a.limit)throw new Error("noUiSlider: 'limit' option is only supported on linear sliders.")}function K(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1,a.connect=[0,2,1,3][a.connect];break;default:throw new Error("noUiSlider: 'direction' option was not recognized.")}}function L(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(d&&!a.connect)throw new Error("noUiSlider: 'drag' behaviour must be used with 'connect': true.");a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function M(a,b){var c;if(b!==!1)if(b===!0)for(a.tooltips=[],c=0;cd&&(e+=Math.abs(d)),e>100&&(d-=e-100),[f(d),f(e)]):[d,e]}function r(a,b){a.preventDefault();var c,d,e=0===a.type.indexOf("touch"),f=0===a.type.indexOf("mouse"),g=0===a.type.indexOf("pointer"),h=a;return 0===a.type.indexOf("MSPointer")&&(g=!0),e&&(c=a.changedTouches[0].pageX,d=a.changedTouches[0].pageY),b=b||l(),(f||g)&&(c=a.clientX+b.x,d=a.clientY+b.y),h.pageOffset=b,h.points=[c,d],h.cursor=f||g,h}function s(a,b){var c=document.createElement("div"),d=document.createElement("div"),e=["-lower","-upper"];return a&&e.reverse(),i(d,fa[3]),i(d,fa[3]+e[b]),i(c,fa[2]),c.appendChild(d),c}function t(a,b,c){switch(a){case 1:i(b,fa[7]),i(c[0],fa[6]);break;case 3:i(c[1],fa[6]);case 2:i(c[0],fa[7]);case 0:i(b,fa[6])}}function u(a,b,c){var d,e=[];for(d=0;a>d;d+=1)e.push(c.appendChild(s(b,d)));return e}function v(a,b,c){i(c,fa[0]),i(c,fa[8+a]),i(c,fa[4+b]);var d=document.createElement("div");return i(d,fa[1]),c.appendChild(d),d}function w(a,b){if(!d.tooltips[b])return!1;var c=document.createElement("div");return c.className=fa[18],a.firstChild.appendChild(c)}function x(){d.dir&&d.tooltips.reverse();var a=Z.map(w);d.dir&&(a.reverse(),d.tooltips.reverse()),V("update",function(b,c,e){a[c]&&(a[c].innerHTML=d.tooltips[c]===!0?b[c]:d.tooltips[c].to(e[c]))})}function y(a,b,c){if("range"===a||"steps"===a)return ca.xVal;if("count"===a){var d,e=100/(b-1),f=0;for(b=[];(d=f++*e)<=100;)b.push(d);a="positions"}return"positions"===a?b.map(function(a){return ca.fromStepping(c?ca.getStep(a):a)}):"values"===a?c?b.map(function(a){return ca.fromStepping(ca.getStep(ca.toStepping(a)))}):b:void 0}function z(b,c,d){function e(a,b){return(a+b).toFixed(7)/1}var f=ca.direction,g={},h=ca.xVal[0],i=ca.xVal[ca.xVal.length-1],j=!1,k=!1,l=0;return ca.direction=0,d=a(d.slice().sort(function(a,b){return a-b})),d[0]!==h&&(d.unshift(h),j=!0),d[d.length-1]!==i&&(d.push(i),k=!0),d.forEach(function(a,f){var h,i,m,n,o,p,q,r,s,t,u=a,v=d[f+1];if("steps"===c&&(h=ca.xNumSteps[f]),h||(h=v-u),u!==!1&&void 0!==v)for(i=u;v>=i;i=e(i,h)){for(n=ca.toStepping(i),o=n-l,r=o/b,s=Math.round(r),t=o/s,m=1;s>=m;m+=1)p=l+m*t,g[p.toFixed(5)]=["x",0];q=d.indexOf(i)>-1?1:"steps"===c?2:0,!f&&j&&(q=0),i===v&&k||(g[n.toFixed(5)]=[i,q]),l=n}}),ca.direction=f,g}function A(a,b,c){function e(a){return["-normal","-large","-sub"][a]}function f(a,b,c){return'class="'+b+" "+b+"-"+h+" "+b+e(c[1])+'" style="'+d.style+": "+a+'%"'}function g(a,d){ca.direction&&(a=100-a),d[1]=d[1]&&b?b(d[0],d[1]):d[1],k+="
",d[1]&&(k+="
"+c.to(d[0])+"
")}var h=["horizontal","vertical"][d.ort],j=document.createElement("div"),k="";return i(j,fa[20]),i(j,fa[20]+"-"+h),Object.keys(a).forEach(function(b){g(b,a[b])}),j.innerHTML=k,j}function B(a){var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=y(b,e,f),h=z(c,b,g),i=a.format||{to:Math.round};return aa.appendChild(A(h,d,i))}function C(){var a=Y.getBoundingClientRect(),b="offset"+["Width","Height"][d.ort];return 0===d.ort?a.width||Y[b]:a.height||Y[b]}function D(a,b,c){var e;for(e=0;e1?!1:e.hover&&b.buttons?!1:(b.calcPoint=b.points[d.ort],void c(b,e)))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!1),g.push([a,f])}),g}function G(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return H(a,b);var c,d,e=b.handles||Z,f=!1,g=100*(a.calcPoint-b.start)/b.baseSize,h=e[0]===Z[0]?0:1;if(c=q(g,b.positions,e.length>1),f=N(e[0],c[h],1===e.length),e.length>1){if(f=N(e[1],c[h?0:1],!1)||f)for(d=0;d1&&i(aa,fa[12]);var g=function(){return!1};document.body.noUiListener=g,document.body.addEventListener("selectstart",g,!1)}void 0!==b.handleNumber&&D("start",b.handleNumber)}function K(a){var b,f,g=a.calcPoint,h=0;return a.stopPropagation(),Z.forEach(function(a){h+=c(a)[d.style]}),b=h/2>g||1===Z.length?0:1,Z[b].hasAttribute("disabled")&&(b=b?0:1),g-=c(Y)[d.style],f=100*g/C(),d.events.snap||e(aa,fa[14],d.animationDuration),Z[b].hasAttribute("disabled")?!1:(N(Z[b],f),D("slide",b,!0),D("set",b,!0),D("change",b,!0),void(d.events.snap&&J(a,{handles:[Z[b]]})))}function L(a){var b=a.calcPoint-c(Y)[d.style],e=ca.getStep(100*b/C()),f=ca.fromStepping(e);Object.keys(ea).forEach(function(a){"hover"===a.split(".")[0]&&ea[a].forEach(function(a){a.call($,f)})})}function M(a){var b,c;if(!a.fixed)for(b=0;b1&&(b=e?Math.max(b,g):Math.min(b,h)),c!==!1&&d.limit&&Z.length>1&&(b=e?Math.min(b,k):Math.max(b,l)),b=ca.getStep(b),b=f(b),b===ba[e]?!1:(window.requestAnimationFrame?window.requestAnimationFrame(function(){a.style[d.style]=b+"%"}):a.style[d.style]=b+"%",a.previousSibling||(j(a,fa[17]),b>50&&i(a,fa[17])),ba[e]=b,da[e]=ca.fromStepping(b),D("update",e),!0)}function O(a,b){var c,e,f;for(d.limit&&(a+=1),c=0;a>c;c+=1)e=c%2,f=b[e],null!==f&&f!==!1&&("number"==typeof f&&(f=String(f)),f=d.format.from(f),(f===!1||isNaN(f)||N(Z[e],ca.toStepping(f),c===3-d.dir)===!1)&&D("update",e))}function Q(a,b){var c,f,h=g(a),b=void 0===b?!0:!!b;for(d.dir&&d.handles>1&&h.reverse(),d.animate&&-1!==ba[0]&&e(aa,fa[14],d.animationDuration),c=Z.length>1?3:1,1===h.length&&(c=1),O(c,h),f=0;f=c[1]?c[2]:c[0]||!1;return[i,f]});return E(a)}function V(a,b){ea[a]=ea[a]||[],ea[a].push(b),"update"===a.split(".")[0]&&Z.forEach(function(a,b){D("update",b)})}function W(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(ea).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete ea[a]})}function X(a,b){var c=R(),e=P({start:[0,0],margin:a.margin,limit:a.limit,step:void 0===a.step?d.singleStep:a.step,range:a.range,animate:a.animate,snap:void 0===a.snap?d.snap:a.snap});["margin","limit","range","animate"].forEach(function(b){void 0!==a[b]&&(d[b]=a[b])}),e.spectrum.direction=ca.direction,ca=e.spectrum,ba=[-1,-1],Q(a.start||c,b)}var Y,Z,$,_=o(),aa=b,ba=[-1,-1],ca=d.spectrum,da=[],ea={},fa=["target","base","origin","handle","horizontal","vertical","background","connect","ltr","rtl","draggable","","state-drag","","state-tap","active","","stacking","tooltip","","pips","marker","value"].map(n(d.cssPrefix||S));if(aa.noUiSlider)throw new Error("Slider was already initialized.");return Y=v(d.dir,d.ort,aa),Z=u(d.handles,d.dir,Y),t(d.connect,aa,Z),d.pips&&B(d.pips),d.tooltips&&x(),$={destroy:T,steps:U,on:V,off:W,get:R,set:Q,updateOptions:X,options:p,target:aa,pips:B},M(d.events),$}function R(a,b){if(!a.nodeName)throw new Error("noUiSlider.create requires a single element.");var c=P(b,a),d=Q(a,c,b);return d.set(c.start),a.noUiSlider=d,d}var S="noUi-";z.prototype.getMargin=function(a){return 2===this.xPct.length?q(this.xVal,a):!1},z.prototype.toStepping=function(a){return a=u(this.xVal,this.xPct,a),this.direction&&(a=100-a),a},z.prototype.fromStepping=function(a){return this.direction&&(a=100-a),v(this.xVal,this.xPct,a)},z.prototype.getStep=function(a){return this.direction&&(a=100-a),a=w(this.xPct,this.xSteps,this.snap,a),this.direction&&(a=100-a),a},z.prototype.getApplicableStep=function(a){var b=t(a,this.xPct),c=100===a?2:1;return[this.xNumSteps[b-2],this.xVal[b-c],this.xNumSteps[b-c]]},z.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var T={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{create:R}}); \ 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 a.filter(function(a){return this[a]?!1:this[a]=!0},{})}function b(a,b){return Math.round(a/b)*b}function c(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.documentElement,e=l();return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(e.x=0),{top:b.top+e.y-d.clientTop,left:b.left+e.x-d.clientLeft}}function d(a){return"number"==typeof a&&!isNaN(a)&&isFinite(a)}function e(a,b,c){i(a,b),setTimeout(function(){j(a,b)},c)}function f(a){return Math.max(Math.min(a,100),0)}function g(a){return Array.isArray(a)?a:[a]}function h(a){var b=a.split(".");return b.length>1?b[1].length:0}function i(a,b){a.classList?a.classList.add(b):a.className+=" "+b}function j(a,b){a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," ")}function k(a,b){return a.classList?a.classList.contains(b):new RegExp("\\b"+b+"\\b").test(a.className)}function l(){var a=void 0!==window.pageXOffset,b="CSS1Compat"===(document.compatMode||""),c=a?window.pageXOffset:b?document.documentElement.scrollLeft:document.body.scrollLeft,d=a?window.pageYOffset:b?document.documentElement.scrollTop:document.body.scrollTop;return{x:c,y:d}}function m(a){a.stopPropagation()}function n(a){return function(b){return a+b}}function o(){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 p(a,b){return 100/(b-a)}function q(a,b){return 100*b/(a[1]-a[0])}function r(a,b){return q(a,a[0]<0?b+Math.abs(a[0]):b-a[0])}function s(a,b){return b*(a[1]-a[0])/100+a[0]}function t(a,b){for(var c=1;a>=b[c];)c+=1;return c}function u(a,b,c){if(c>=a.slice(-1)[0])return 100;var d,e,f,g,h=t(c,a);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],f+r([d,e],c)/p(f,g)}function v(a,b,c){if(c>=100)return a.slice(-1)[0];var d,e,f,g,h=t(c,b);return d=a[h-1],e=a[h],f=b[h-1],g=b[h],s([d,e],(c-f)*p(f,g))}function w(a,c,d,e){if(100===e)return e;var f,g,h=t(e,a);return d?(f=a[h-1],g=a[h],e-f>(g-f)/2?g:f):c[h-1]?a[h-1]+b(e-a[h-1],c[h-1]):e}function x(a,b,c){var e;if("number"==typeof b&&(b=[b]),"[object Array]"!==Object.prototype.toString.call(b))throw new Error("noUiSlider: 'range' contains invalid value.");if(e="min"===a?0:"max"===a?100:parseFloat(a),!d(e)||!d(b[0]))throw new Error("noUiSlider: 'range' value isn't numeric.");c.xPct.push(e),c.xVal.push(b[0]),e?c.xSteps.push(isNaN(b[1])?!1:b[1]):isNaN(b[1])||(c.xSteps[0]=b[1])}function y(a,b,c){return b?void(c.xSteps[a]=q([c.xVal[a],c.xVal[a+1]],b)/p(c.xPct[a],c.xPct[a+1])):!0}function z(a,b,c,d){this.xPct=[],this.xVal=[],this.xSteps=[d||!1],this.xNumSteps=[!1],this.snap=b,this.direction=c;var e,f=[];for(e in a)a.hasOwnProperty(e)&&f.push([a[e],e]);for(f.length&&"object"==typeof f[0][0]?f.sort(function(a,b){return a[0][0]-b[0][0]}):f.sort(function(a,b){return a[0]-b[0]}),e=0;e2)throw new Error("noUiSlider: 'start' option is incorrect.");a.handles=b.length,a.start=b}function D(a,b){if(a.snap=b,"boolean"!=typeof b)throw new Error("noUiSlider: 'snap' option must be a boolean.")}function E(a,b){if(a.animate=b,"boolean"!=typeof b)throw new Error("noUiSlider: 'animate' option must be a boolean.")}function F(a,b){if(a.animationDuration=b,"number"!=typeof b)throw new Error("noUiSlider: 'animationDuration' option must be a number.")}function G(a,b){if("lower"===b&&1===a.handles)a.connect=1;else if("upper"===b&&1===a.handles)a.connect=2;else if(b===!0&&2===a.handles)a.connect=3;else{if(b!==!1)throw new Error("noUiSlider: 'connect' option doesn't match handle count.");a.connect=0}}function H(a,b){switch(b){case"horizontal":a.ort=0;break;case"vertical":a.ort=1;break;default:throw new Error("noUiSlider: 'orientation' option is invalid.")}}function I(a,b){if(!d(b))throw new Error("noUiSlider: 'margin' option must be numeric.");if(0!==b&&(a.margin=a.spectrum.getMargin(b),!a.margin))throw new Error("noUiSlider: 'margin' option is only supported on linear sliders.")}function J(a,b){if(!d(b))throw new Error("noUiSlider: 'limit' option must be numeric.");if(a.limit=a.spectrum.getMargin(b),!a.limit)throw new Error("noUiSlider: 'limit' option is only supported on linear sliders.")}function K(a,b){switch(b){case"ltr":a.dir=0;break;case"rtl":a.dir=1,a.connect=[0,2,1,3][a.connect];break;default:throw new Error("noUiSlider: 'direction' option was not recognized.")}}function L(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(d&&!a.connect)throw new Error("noUiSlider: 'drag' behaviour must be used with 'connect': true.");a.events={tap:c||f,drag:d,fixed:e,snap:f,hover:g}}function M(a,b){var c;if(b!==!1)if(b===!0)for(a.tooltips=[],c=0;cd&&(e+=Math.abs(d)),e>100&&(d-=e-100),[f(d),f(e)]):[d,e]}function r(a,b){a.preventDefault();var c,d,e=0===a.type.indexOf("touch"),f=0===a.type.indexOf("mouse"),g=0===a.type.indexOf("pointer"),h=a;return 0===a.type.indexOf("MSPointer")&&(g=!0),e&&(c=a.changedTouches[0].pageX,d=a.changedTouches[0].pageY),b=b||l(),(f||g)&&(c=a.clientX+b.x,d=a.clientY+b.y),h.pageOffset=b,h.points=[c,d],h.cursor=f||g,h}function s(a,b){var c=document.createElement("div"),d=document.createElement("div"),e=["-lower","-upper"];return a&&e.reverse(),i(d,fa[3]),i(d,fa[3]+e[b]),i(c,fa[2]),c.appendChild(d),c}function t(a,b,c){switch(a){case 1:i(b,fa[7]),i(c[0],fa[6]);break;case 3:i(c[1],fa[6]);case 2:i(c[0],fa[7]);case 0:i(b,fa[6])}}function u(a,b,c){var d,e=[];for(d=0;a>d;d+=1)e.push(c.appendChild(s(b,d)));return e}function v(a,b,c){i(c,fa[0]),i(c,fa[8+a]),i(c,fa[4+b]);var d=document.createElement("div");return i(d,fa[1]),c.appendChild(d),d}function w(a,b){if(!d.tooltips[b])return!1;var c=document.createElement("div");return c.className=fa[18],a.firstChild.appendChild(c)}function x(){d.dir&&d.tooltips.reverse();var a=Z.map(w);d.dir&&(a.reverse(),d.tooltips.reverse()),V("update",function(b,c,e){a[c]&&(a[c].innerHTML=d.tooltips[c]===!0?b[c]:d.tooltips[c].to(e[c]))})}function y(a,b,c){if("range"===a||"steps"===a)return ca.xVal;if("count"===a){var d,e=100/(b-1),f=0;for(b=[];(d=f++*e)<=100;)b.push(d);a="positions"}return"positions"===a?b.map(function(a){return ca.fromStepping(c?ca.getStep(a):a)}):"values"===a?c?b.map(function(a){return ca.fromStepping(ca.getStep(ca.toStepping(a)))}):b:void 0}function z(b,c,d){function e(a,b){return(a+b).toFixed(7)/1}var f=ca.direction,g={},h=ca.xVal[0],i=ca.xVal[ca.xVal.length-1],j=!1,k=!1,l=0;return ca.direction=0,d=a(d.slice().sort(function(a,b){return a-b})),d[0]!==h&&(d.unshift(h),j=!0),d[d.length-1]!==i&&(d.push(i),k=!0),d.forEach(function(a,f){var h,i,m,n,o,p,q,r,s,t,u=a,v=d[f+1];if("steps"===c&&(h=ca.xNumSteps[f]),h||(h=v-u),u!==!1&&void 0!==v)for(i=u;v>=i;i=e(i,h)){for(n=ca.toStepping(i),o=n-l,r=o/b,s=Math.round(r),t=o/s,m=1;s>=m;m+=1)p=l+m*t,g[p.toFixed(5)]=["x",0];q=d.indexOf(i)>-1?1:"steps"===c?2:0,!f&&j&&(q=0),i===v&&k||(g[n.toFixed(5)]=[i,q]),l=n}}),ca.direction=f,g}function A(a,b,c){function e(a){return["-normal","-large","-sub"][a]}function f(a,b,c){return'class="'+b+" "+b+"-"+h+" "+b+e(c[1])+'" style="'+d.style+": "+a+'%"'}function g(a,d){ca.direction&&(a=100-a),d[1]=d[1]&&b?b(d[0],d[1]):d[1],k+="
",d[1]&&(k+="
"+c.to(d[0])+"
")}var h=["horizontal","vertical"][d.ort],j=document.createElement("div"),k="";return i(j,fa[20]),i(j,fa[20]+"-"+h),Object.keys(a).forEach(function(b){g(b,a[b])}),j.innerHTML=k,j}function B(a){var b=a.mode,c=a.density||1,d=a.filter||!1,e=a.values||!1,f=a.stepped||!1,g=y(b,e,f),h=z(c,b,g),i=a.format||{to:Math.round};return aa.appendChild(A(h,d,i))}function C(){var a=Y.getBoundingClientRect(),b="offset"+["Width","Height"][d.ort];return 0===d.ort?a.width||Y[b]:a.height||Y[b]}function D(a,b,c){var e;for(e=0;e1?!1:e.hover&&b.buttons?!1:(b.calcPoint=b.points[d.ort],void c(b,e)))},g=[];return a.split(" ").forEach(function(a){b.addEventListener(a,f,!1),g.push([a,f])}),g}function G(a,b){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===a.buttons&&0!==b.buttonsProperty)return H(a,b);var c,d,e=b.handles||Z,f=!1,g=100*(a.calcPoint-b.start)/b.baseSize,h=e[0]===Z[0]?0:1;if(c=q(g,b.positions,e.length>1),f=N(e[0],c[h],1===e.length),e.length>1){if(f=N(e[1],c[h?0:1],!1)||f)for(d=0;d1&&i(aa,fa[12]);var g=function(){return!1};document.body.noUiListener=g,document.body.addEventListener("selectstart",g,!1)}void 0!==b.handleNumber&&D("start",b.handleNumber)}function K(a){var b,f,g=a.calcPoint,h=0;return a.stopPropagation(),Z.forEach(function(a){h+=c(a)[d.style]}),b=h/2>g||1===Z.length?0:1,Z[b].hasAttribute("disabled")&&(b=b?0:1),g-=c(Y)[d.style],f=100*g/C(),d.events.snap||e(aa,fa[14],d.animationDuration),Z[b].hasAttribute("disabled")?!1:(N(Z[b],f),D("slide",b,!0),D("set",b,!0),D("change",b,!0),void(d.events.snap&&J(a,{handles:[Z[b]]})))}function L(a){var b=a.calcPoint-c(Y)[d.style],e=ca.getStep(100*b/C()),f=ca.fromStepping(e);Object.keys(ea).forEach(function(a){"hover"===a.split(".")[0]&&ea[a].forEach(function(a){a.call($,f)})})}function M(a){var b,c;if(!a.fixed)for(b=0;b1&&(b=e?Math.max(b,g):Math.min(b,h)),c!==!1&&d.limit&&Z.length>1&&(b=e?Math.min(b,k):Math.max(b,l)),b=ca.getStep(b),b=f(b),b===ba[e]?!1:(window.requestAnimationFrame?window.requestAnimationFrame(function(){a.style[d.style]=b+"%"}):a.style[d.style]=b+"%",a.previousSibling||(j(a,fa[17]),b>50&&i(a,fa[17])),ba[e]=b,da[e]=ca.fromStepping(b),D("update",e),!0)}function O(a,b){var c,e,f;for(d.limit&&(a+=1),c=0;a>c;c+=1)e=c%2,f=b[e],null!==f&&f!==!1&&("number"==typeof f&&(f=String(f)),f=d.format.from(f),(f===!1||isNaN(f)||N(Z[e],ca.toStepping(f),c===3-d.dir)===!1)&&D("update",e))}function Q(a,b){var c,f,h=g(a);for(b=void 0===b?!0:!!b,d.dir&&d.handles>1&&h.reverse(),d.animate&&-1!==ba[0]&&e(aa,fa[14],d.animationDuration),c=Z.length>1?3:1,1===h.length&&(c=1),O(c,h),f=0;f=c[1]?c[2]:c[0]||!1;return[i,f]});return E(a)}function V(a,b){ea[a]=ea[a]||[],ea[a].push(b),"update"===a.split(".")[0]&&Z.forEach(function(a,b){D("update",b)})}function W(a){var b=a&&a.split(".")[0],c=b&&a.substring(b.length);Object.keys(ea).forEach(function(a){var d=a.split(".")[0],e=a.substring(d.length);b&&b!==d||c&&c!==e||delete ea[a]})}function X(a,b){var c=R(),e=P({start:[0,0],margin:a.margin,limit:a.limit,step:void 0===a.step?d.singleStep:a.step,range:a.range,animate:a.animate,snap:void 0===a.snap?d.snap:a.snap});["margin","limit","range","animate"].forEach(function(b){void 0!==a[b]&&(d[b]=a[b])}),e.spectrum.direction=ca.direction,ca=e.spectrum,ba=[-1,-1],Q(a.start||c,b)}var Y,Z,$,_=o(),aa=b,ba=[-1,-1],ca=d.spectrum,da=[],ea={},fa=["target","base","origin","handle","horizontal","vertical","background","connect","ltr","rtl","draggable","","state-drag","","state-tap","active","","stacking","tooltip","","pips","marker","value"].map(n(d.cssPrefix||S));if(aa.noUiSlider)throw new Error("Slider was already initialized.");return Y=v(d.dir,d.ort,aa),Z=u(d.handles,d.dir,Y),t(d.connect,aa,Z),d.pips&&B(d.pips),d.tooltips&&x(),$={destroy:T,steps:U,on:V,off:W,get:R,set:Q,updateOptions:X,options:p,target:aa,pips:B},M(d.events),$}function R(a,b){if(!a.nodeName)throw new Error("noUiSlider.create requires a single element.");var c=P(b,a),d=Q(a,c,b);return d.set(c.start),a.noUiSlider=d,d}var S="noUi-";z.prototype.getMargin=function(a){return 2===this.xPct.length?q(this.xVal,a):!1},z.prototype.toStepping=function(a){return a=u(this.xVal,this.xPct,a),this.direction&&(a=100-a),a},z.prototype.fromStepping=function(a){return this.direction&&(a=100-a),v(this.xVal,this.xPct,a)},z.prototype.getStep=function(a){return this.direction&&(a=100-a),a=w(this.xPct,this.xSteps,this.snap,a),this.direction&&(a=100-a),a},z.prototype.getApplicableStep=function(a){var b=t(a,this.xPct),c=100===a?2:1;return[this.xNumSteps[b-2],this.xVal[b-c],this.xNumSteps[b-c]]},z.prototype.convert=function(a){return this.getStep(this.toStepping(a))};var T={to:function(a){return void 0!==a&&a.toFixed(2)},from:Number};return{create:R}}); \ No newline at end of file diff --git a/src/js/scope.js b/src/js/scope.js index 965b7d71..13c222e6 100644 --- a/src/js/scope.js +++ b/src/js/scope.js @@ -108,9 +108,10 @@ // Set the slider value. function valueSet ( input, fireSetEvent ) { - var count, values = asArray( input ), i, - // Event fires by default - fireSetEvent = (fireSetEvent === undefined ? true : !!fireSetEvent); + var count, values = asArray( input ), i; + + // Event fires by default + fireSetEvent = (fireSetEvent === undefined ? true : !!fireSetEvent); // The RTL settings is implemented by reversing the front-end, // internal mechanisms are the same. @@ -242,7 +243,7 @@ // Spectrum is created using the range, snap, direction and step options. // 'snap' and 'step' can be updated, 'direction' cannot, due to event binding. // If 'snap' and 'step' are not passed, they should remain unchanged. - var v = valueGet(), i, newOptions = testOptions({ + var v = valueGet(), newOptions = testOptions({ start: [0, 0], margin: optionsToUpdate.margin, limit: optionsToUpdate.limit,