jquery.nouislider.min.js 12.8 KB
/*

$.classVal - WTFPL - refreshless.com/classval/ */
(function(b){function h(a,e){var d=!1;b.each(a?q:g,function(a){if(b(e).hasClass(a))return d=a,!1});return d}var n=b.fn.val,g={},q={},u={};b.classVal=function(a,b,d,l){"string"===typeof a&&"boolean"===typeof l&&(b&&(g[a]=b),d&&(q[a]=d),u[a]=l)};b.fn.val=function(){var a=Array.prototype.slice.call(arguments,0),e,d;return a.length?this.each(function(){(e=h(!0,this))?(d=u[e]?b(this):this,d[q[e]].apply(this,a)):n.apply(b(this),a)}):(e=h(!1,this))?(d=u[e]?this:this[0],d[g[e]].apply(d)):n.apply(this)}})(window.jQuery||
window.Zepto);/*

$.Link (part of noUiSlider) - WTFPL */
(function(b){function h(a,b,d){if((a[b]||a[d])&&a[b]===a[d])throw Error("(Link) '"+b+"' can't match '"+d+"'.'");}function n(a){void 0===a&&(a={});if("object"!==typeof a)throw Error("(Format) 'format' option must be an object.");var e={};b(q).each(function(b,l){if(void 0===a[l])e[l]=u[b];else if(typeof a[l]===typeof u[b]){if("decimals"===l&&(0>a[l]||7<a[l]))throw Error("(Format) 'format.decimals' option must be between 0 and 7.");e[l]=a[l]}else throw Error("(Format) 'format."+l+"' must be a "+typeof u[b]+
".");});h(e,"mark","thousand");h(e,"prefix","negative");h(e,"prefix","negativeBefore");this.r=e}function g(a,e){"object"!==typeof a&&b.error("(Link) Initialize with an object.");return new g.prototype.p(a.target||function(){},a.method,a.format||{},e)}var q="decimals mark thousand prefix postfix encoder decoder negative negativeBefore to from".split(" "),u=[2,".","","","",function(a){return a},function(a){return a},"-","",function(a){return a},function(a){return a}];n.prototype.a=function(a){return this.r[a]};
n.prototype.L=function(a){function b(a){return a.split("").reverse().join("")}a=this.a("encoder")(a);var d=this.a("decimals"),l="",g="",h="",n="";0===parseFloat(a.toFixed(d))&&(a="0");0>a&&(l=this.a("negative"),g=this.a("negativeBefore"));a=Math.abs(a).toFixed(d).toString();a=a.split(".");this.a("thousand")?(h=b(a[0]).match(/.{1,3}/g),h=b(h.join(b(this.a("thousand"))))):h=a[0];this.a("mark")&&1<a.length&&(n=this.a("mark")+a[1]);return this.a("to")(g+this.a("prefix")+l+h+n+this.a("postfix"))};n.prototype.w=
function(a){function b(a){return a.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g,"\\$&")}var d;if(null===a||void 0===a)return!1;a=this.a("from")(a);a=a.toString();d=a.replace(RegExp("^"+b(this.a("negativeBefore"))),"");a!==d?(a=d,d="-"):d="";a=a.replace(RegExp("^"+b(this.a("prefix"))),"");this.a("negative")&&(d="",a=a.replace(RegExp("^"+b(this.a("negative"))),"-"));a=a.replace(RegExp(b(this.a("postfix"))+"$"),"").replace(RegExp(b(this.a("thousand")),"g"),"").replace(this.a("mark"),".");a=this.a("decoder")(parseFloat(d+
a));return isNaN(a)?!1:a};g.prototype.K=function(a,e){this.method=e||"html";this.j=b(a.replace("-tooltip-","")||"<div/>")[0]};g.prototype.H=function(a){this.method="val";this.j=document.createElement("input");this.j.name=a;this.j.type="hidden"};g.prototype.G=function(a){function e(a,b){return[b?null:a,b?a:null]}var d=this;this.method="val";this.target=a.on("change",function(a){d.B.val(e(b(a.target).val(),d.t),{link:d,set:!0})})};g.prototype.p=function(a,e,d,g){this.g=d;this.update=!g;if("string"===
typeof a&&0===a.indexOf("-tooltip-"))this.K(a,e);else if("string"===typeof a&&0!==a.indexOf("-"))this.H(a);else if("function"===typeof a)this.target=!1,this.method=a;else{if(a instanceof b||b.zepto&&b.zepto.isZ(a)){if(!e){if(a.is("input, select, textarea")){this.G(a);return}e="html"}if("function"===typeof e||"string"===typeof e&&a[e]){this.method=e;this.target=a;return}}throw new RangeError("(Link) Invalid Link.");}};g.prototype.write=function(a,b,d,g){if(!this.update||!1!==g)if(this.u=a,this.F=a=
this.format(a),"function"===typeof this.method)this.method.call(this.target[0]||d[0],a,b,d);else this.target[this.method](a,b,d)};g.prototype.q=function(a){this.g=new n(b.extend({},a,this.g instanceof n?this.g.r:this.g))};g.prototype.J=function(a){this.B=a};g.prototype.I=function(a){this.t=a};g.prototype.format=function(a){return this.g.L(a)};g.prototype.A=function(a){return this.g.w(a)};g.prototype.p.prototype=g.prototype;b.Link=g})(window.jQuery||window.Zepto);/*

$.fn.noUiSlider - WTFPL - refreshless.com/nouislider/ */
(function(b){function h(a){return"number"===typeof a&&!isNaN(a)&&isFinite(a)}function n(a){return b.isArray(a)?a:[a]}function g(a,c){a.addClass(c);setTimeout(function(){a.removeClass(c)},300)}function q(a,c){return 100*c/(a[1]-a[0])}function u(a,c){if(c>=a.d.slice(-1)[0])return 100;for(var b=1,f,d,e;c>=a.d[b];)b++;f=a.d[b-1];d=a.d[b];e=a.c[b-1];f=[f,d];return e+q(f,0>f[0]?c+Math.abs(f[0]):c-f[0])/(100/(a.c[b]-e))}function a(a,c){if(100<=c)return a.d.slice(-1)[0];for(var b=1,f,d,e;c>=a.c[b];)b++;f=
a.d[b-1];d=a.d[b];e=a.c[b-1];f=[f,d];return 100/(a.c[b]-e)*(c-e)*(f[1]-f[0])/100+f[0]}function e(a,c){for(var b=1,f;c>=a.c[b];)b++;if(a.m)return f=a.c[b-1],b=a.c[b],c-f>(b-f)/2?b:f;a.h[b-1]?(f=a.h[b-1],b=a.c[b-1]+Math.round((c-a.c[b-1])/f)*f):b=c;return b}function d(a,c){if(!h(c))throw Error("noUiSlider: 'step' is not numeric.");a.h[0]=c}function l(a,c){if("object"!==typeof c||b.isArray(c))throw Error("noUiSlider: 'range' is not an object.");b.each(c,function(c,f){var d;"number"===typeof f&&(f=[f]);
if(!b.isArray(f))throw Error("noUiSlider: 'range' contains invalid value.");d="min"===c?0:"max"===c?100:parseFloat(c);if(!h(d)||!h(f[0]))throw Error("noUiSlider: 'range' value isn't numeric.");a.c.push(d);a.d.push(f[0]);d?a.h.push(isNaN(f[1])?!1:f[1]):isNaN(f[1])||(a.h[0]=f[1])});b.each(a.h,function(c,b){if(!b)return!0;a.h[c]=q([a.d[c],a.d[c+1]],b)/(100/(a.c[c+1]-a.c[c]))})}function z(a,c){"number"===typeof c&&(c=[c]);if(!b.isArray(c)||!c.length||2<c.length)throw Error("noUiSlider: 'start' option is incorrect.");
a.b=c.length;a.start=c}function A(a,c){a.m=c;if("boolean"!==typeof c)throw Error("noUiSlider: 'snap' option must be a boolean.");}function B(a,c){if("lower"===c&&1===a.b)a.i=1;else if("upper"===c&&1===a.b)a.i=2;else if(!0===c&&2===a.b)a.i=3;else if(!1===c)a.i=0;else throw Error("noUiSlider: 'connect' option doesn't match handle count.");}function y(a,c){switch(c){case "horizontal":a.k=0;break;case "vertical":a.k=1;break;default:throw Error("noUiSlider: 'orientation' option is invalid.");}}function I(a,
c){if(2<a.c.length)throw Error("noUiSlider: 'margin' option is only supported on linear sliders.");a.margin=q(a.d,c);if(!h(c))throw Error("noUiSlider: 'margin' option must be numeric.");}function J(a,c){switch(c){case "ltr":a.dir=0;break;case "rtl":a.dir=1;a.i=[0,2,1,3][a.i];break;default:throw Error("noUiSlider: 'direction' option was not recognized.");}}function K(a,c){if("string"!==typeof c)throw Error("noUiSlider: 'behaviour' must be a string containing options.");var b=0<=c.indexOf("snap");a.n=
{s:0<=c.indexOf("tap")||b,extend:0<=c.indexOf("extend"),v:0<=c.indexOf("drag"),fixed:0<=c.indexOf("fixed"),m:b}}function L(a,c,d){a.o=[c.lower,c.upper];a.g=c.format;b.each(a.o,function(a,e){if(!b.isArray(e))throw Error("noUiSlider: 'serialization."+(a?"upper":"lower")+"' must be an array.");b.each(e,function(){if(!(this instanceof b.Link))throw Error("noUiSlider: 'serialization."+(a?"upper":"lower")+"' can only contain Link instances.");this.I(a);this.J(d);this.q(c.format)})});a.dir&&1<a.b&&a.o.reverse()}
function M(a,c){var e={c:[],d:[],h:[!1],margin:0},f;f={step:{e:!1,f:d},range:{e:!0,f:l},start:{e:!0,f:z},snap:{e:!1,f:A},connect:{e:!0,f:B},orientation:{e:!1,f:y},margin:{e:!1,f:I},direction:{e:!0,f:J},behaviour:{e:!0,f:K},serialization:{e:!0,f:L}};a=b.extend({connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal"},a);a.serialization=b.extend({lower:[],upper:[],format:{}},a.serialization);b.each(f,function(b,d){if(void 0===a[b]){if(d.e)throw Error("noUiSlider: '"+b+"' is required.");
return!0}d.f(e,a[b],c)});e.style=e.k?"top":"left";return e}function N(a,c){var d=b("<div><div/></div>").addClass(k[2]),f=["-lower","-upper"];a.dir&&f.reverse();d.children().addClass(k[3]+" "+k[3]+f[c]);return d}function O(a,c){c.j&&(c=new b.Link({target:b(c.j).clone().appendTo(a),method:c.method,format:c.g},!0));return c}function P(a,c){var d,f=[];for(d=0;d<a.b;d++){var e=f,g=d,k=a.o[d],h=c[d].children(),l=a.g,n=void 0,q=[],n=new b.Link({},!0);n.q(l);q.push(n);for(n=0;n<k.length;n++)q.push(O(h,k[n]));
e[g]=q}return f}function Q(a,c,b){switch(a){case 1:c.addClass(k[7]);b[0].addClass(k[6]);break;case 3:b[1].addClass(k[6]);case 2:b[0].addClass(k[7]);case 0:c.addClass(k[6])}}function R(a,b){var d,f=[];for(d=0;d<a.b;d++)f.push(N(a,d).appendTo(b));return f}function S(a,c){c.addClass([k[0],k[8+a.dir],k[4+a.k]].join(" "));return b("<div/>").appendTo(c).addClass(k[1])}function T(d,c,h){function f(){return r[["width","height"][c.k]]()}function l(a){var b,c=[s.val()];for(b=0;b<a.length;b++)s.trigger(a[b],
c)}function q(d,p,f){var g=d[0]!==m[0][0]?1:0,H=v[0]+c.margin,l=v[1]-c.margin;f&&1<m.length&&(p=g?Math.max(p,H):Math.min(p,l));100>p&&(p=e(c,p));p=Math.max(Math.min(parseFloat(p.toFixed(7)),100),0);if(p===v[g])return 1===m.length?!1:p===H||p===l?0:!1;d.css(c.style,p+"%");d.is(":first-child")&&d.toggleClass(k[17],50<p);v[g]=p;c.dir&&(p=100-p);b(w[g]).each(function(){this.write(a(c,p),d.children(),s)});return!0}function G(a,b,c){c||g(s,k[14]);q(a,b,!1);l(["slide","set","change"])}function t(a,b,d,f){a=
a.replace(/\s/g,".nui ")+".nui";b.on(a,function(a){var b=s.attr("disabled");if(s.hasClass(k[14])||void 0!==b&&null!==b)return!1;a.preventDefault();var b=0===a.type.indexOf("touch"),p=0===a.type.indexOf("mouse"),e=0===a.type.indexOf("pointer"),D,g,l=a;0===a.type.indexOf("MSPointer")&&(e=!0);a.originalEvent&&(a=a.originalEvent);b&&(D=a.changedTouches[0].pageX,g=a.changedTouches[0].pageY);if(p||e)e||void 0!==window.pageXOffset||(window.pageXOffset=document.documentElement.scrollLeft,window.pageYOffset=
document.documentElement.scrollTop),D=a.clientX+window.pageXOffset,g=a.clientY+window.pageYOffset;l.C=[D,g];l.cursor=p;a=l;a.l=a.C[c.k];d(a,f)})}function y(a,b){var c=b.b||m,d,e=!1,e=100*(a.l-b.start)/f(),g=c[0][0]!==m[0][0]?1:0;var k=b.D;d=e+k[0];e+=k[1];1<c.length?(0>d&&(e+=Math.abs(d)),100<e&&(d-=e-100),d=[Math.max(Math.min(d,100),0),Math.max(Math.min(e,100),0)]):d=[d,e];e=q(c[0],d[g],1===c.length);1<c.length&&(e=q(c[1],d[g?0:1],!1)||e);e&&l(["slide"])}function z(a){b("."+k[15]).removeClass(k[15]);
a.cursor&&b("body").css("cursor","").off(".nui");E.off(".nui");s.removeClass(k[12]);l(["set","change"])}function C(a,c){1===c.b.length&&c.b[0].children().addClass(k[15]);a.stopPropagation();t(x.move,E,y,{start:a.l,b:c.b,D:[v[0],v[m.length-1]]});t(x.end,E,z,null);a.cursor&&(b("body").css("cursor",b(a.target).css("cursor")),1<m.length&&s.addClass(k[12]),b("body").on("selectstart.nui",!1))}function A(a){var d=a.l,e=0;a.stopPropagation();b.each(m,function(){e+=this.offset()[c.style]});e=d<e/2||1===m.length?
0:1;d-=r.offset()[c.style];d=100*d/f();G(m[e],d,c.n.m);c.n.m&&C(a,{b:[m[e]]})}function B(a){var b=(a=a.l<r.offset()[c.style])?0:100;a=a?0:m.length-1;G(m[a],b,!1)}var s=b(d),v=[-1,-1],r,w,m;if(s.hasClass(k[0]))throw Error("Slider was already initialized.");r=S(c,s);m=R(c,r);w=P(c,m);Q(c.i,s,m);(function(a){var b;if(!a.fixed)for(b=0;b<m.length;b++)t(x.start,m[b].children(),C,{b:[m[b]]});a.s&&t(x.start,r,A,{b:m});a.extend&&(s.addClass(k[16]),a.s&&t(x.start,s,B,{b:m}));a.v&&(b=r.find("."+k[7]).addClass(k[10]),
a.fixed&&(b=b.add(r.children().not(b).children())),t(x.start,b,C,{b:m}))})(c.n);d.vSet=function(){var a=Array.prototype.slice.call(arguments,0),d,e,f,h,r,F,t=n(a[0]);"object"===typeof a[1]?(d=a[1].set,e=a[1].link,f=a[1].update,h=a[1].animate):!0===a[1]&&(d=!0);c.dir&&1<c.b&&t.reverse();h&&g(s,k[14]);a=1<m.length?3:1;1===t.length&&(a=1);for(r=0;r<a;r++)h=e||w[r%2][0],h=h.A(t[r%2]),!1!==h&&(h=u(c,h),c.dir&&(h=100-h),!0!==q(m[r%2],h,!0)&&b(w[r%2]).each(function(a){if(!a)return F=this.u,!0;this.write(F,
m[r%2].children(),s,f)}));!0===d&&l(["set"]);return this};d.vGet=function(){var a,b=[];for(a=0;a<c.b;a++)b[a]=w[a][0].F;return 1===b.length?b[0]:c.dir?b.reverse():b};d.destroy=function(){b.each(w,function(){b.each(this,function(){this.target&&this.target.off(".nui")})});b(this).off(".nui").removeClass(k.join(" ")).empty();return h};s.val(c.start)}function U(a){if(!this.length)throw Error("noUiSlider: Can't initialize slider on empty selection.");var b=M(a,this);return this.each(function(){T(this,
b,a)})}function V(a){return this.each(function(){var c=b(this).val(),d=this.destroy(),e=b.extend({},d,a);b(this).noUiSlider(e);d.start===e.start&&b(this).val(c)})}var E=b(document),x=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"},k="noUi-target noUi-base noUi-origin noUi-handle noUi-horizontal noUi-vertical noUi-background noUi-connect noUi-ltr noUi-rtl noUi-dragable  noUi-state-drag  noUi-state-tap noUi-active noUi-extended noUi-stacking".split(" ");
b.noUiSlider={Link:b.Link};b.fn.noUiSlider=function(a,b){return(b?V:U).call(this,a)};b.classVal(k[0],"vGet","vSet",!1)})(window.jQuery||window.Zepto);