phcthemes_web_theme_pack 3.1.0 → 4.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/Rakefile +5 -29
- data/app/assets/javascripts/phcthemes_web_theme_pack_antlr.js +0 -1
- data/app/assets/javascripts/themes/antlr/theme/bootstrap.min.js +7 -0
- data/app/assets/javascripts/themes/antlr/theme/covervid.min.js +1 -0
- data/app/assets/javascripts/themes/antlr/theme/custom.js +1 -0
- data/app/assets/javascripts/themes/antlr/theme/filter.js +64 -0
- data/app/assets/javascripts/themes/antlr/theme/gdpr-cookie.js +43 -0
- data/app/assets/javascripts/themes/antlr/theme/isotope.min.js +5 -5
- data/app/assets/javascripts/themes/antlr/theme/jquery.circliful.min.js +92 -0
- data/app/assets/javascripts/themes/antlr/theme/jquery.countdown.js +17 -0
- data/app/assets/javascripts/themes/antlr/theme/jquery.min.js +2 -0
- data/app/assets/javascripts/themes/antlr/theme/jquery.viewportchecker.min.js +1 -0
- data/app/assets/javascripts/themes/antlr/theme/lazysizes.min.js +3 -2
- data/app/assets/javascripts/themes/antlr/theme/lib/i18next.min.js +3 -0
- data/app/assets/javascripts/themes/antlr/theme/lib/i18nextXHRBackend.min.js +1 -0
- data/app/assets/javascripts/themes/antlr/theme/lib/jquery-i18next.min.js +1 -0
- data/app/assets/javascripts/themes/antlr/theme/mixevents.js +104 -0
- data/app/assets/javascripts/themes/antlr/theme/mixitup.min.js +18 -0
- data/app/assets/javascripts/themes/antlr/theme/mixitup.multifilter.min.js +18 -0
- data/app/assets/javascripts/themes/antlr/theme/modernizr.js +3 -0
- data/app/assets/javascripts/themes/antlr/theme/nouislider.js +2514 -0
- data/app/assets/javascripts/themes/antlr/theme/popper.min.js +5 -0
- data/app/assets/javascripts/themes/antlr/theme/scripts.js +32 -108
- data/app/assets/javascripts/themes/antlr/theme/scripts.min.js +1 -0
- data/app/assets/javascripts/themes/antlr/theme/swiper.min.js +4 -4
- data/app/assets/javascripts/themes/antlr/theme/variables.js +25 -0
- data/app/assets/stylesheets/phcthemes_web_theme_pack_antlr.scss +5 -5
- data/app/assets/stylesheets/themes/antlr/css/style.css +13 -2
- data/app/assets/stylesheets/themes/antlr/img/logo-light.svg +11 -11
- data/app/assets/stylesheets/themes/antlr/img/topbanner17.jpg +0 -0
- data/app/assets/stylesheets/themes/antlr/locales/de-DE/translations.json +6 -0
- data/app/assets/stylesheets/themes/antlr/locales/de/translations.json +0 -0
- data/app/assets/stylesheets/themes/antlr/locales/dev/translations.json +0 -0
- data/app/assets/stylesheets/themes/antlr/locales/en-US/translations.json +63 -0
- data/app/assets/stylesheets/themes/antlr/locales/en/translations.json +0 -0
- data/app/assets/stylesheets/themes/antlr/locales/pt-PT/translations.json +63 -0
- data/app/assets/stylesheets/themes/antlr/locales/pt/translations.json +0 -0
- data/app/assets/stylesheets/themes/antlr/patterns/blackfriday25.svg +1479 -0
- data/app/assets/stylesheets/themes/antlr/patterns/cybermonday.svg +1411 -0
- data/app/assets/stylesheets/themes/antlr/patterns/ssd.svg +140 -73
- data/lib/phcthemes_web_theme_pack.rb +1 -0
- data/lib/phcthemes_web_theme_pack/version.rb +1 -1
- metadata +42 -9
@@ -0,0 +1,18 @@
|
|
1
|
+
/**!
|
2
|
+
* MixItUp v3.3.1
|
3
|
+
* A high-performance, dependency-free library for animated filtering, sorting and more
|
4
|
+
* Build 94e0fbf6-cd0b-4987-b3c0-14b59b67b8a0
|
5
|
+
*
|
6
|
+
* @copyright Copyright 2014-2018 KunkaLabs Limited.
|
7
|
+
* @author KunkaLabs Limited.
|
8
|
+
* @link https://www.kunkalabs.com/mixitup/
|
9
|
+
*
|
10
|
+
* @license Commercial use requires a commercial license.
|
11
|
+
* https://www.kunkalabs.com/mixitup/licenses/
|
12
|
+
*
|
13
|
+
* Non-commercial use permitted under same terms as CC BY-NC 3.0 license.
|
14
|
+
* http://creativecommons.org/licenses/by-nc/3.0/
|
15
|
+
*/
|
16
|
+
!function(t){"use strict";var e=null,n=null;!function(){var e=["webkit","moz","o","ms"],n=t.document.createElement("div"),a=-1;for(a=0;a<e.length&&!t.requestAnimationFrame;a++)t.requestAnimationFrame=t[e[a]+"RequestAnimationFrame"];"undefined"==typeof n.nextElementSibling&&Object.defineProperty(t.Element.prototype,"nextElementSibling",{get:function(){for(var t=this.nextSibling;t;){if(1===t.nodeType)return t;t=t.nextSibling}return null}}),function(t){t.matches=t.matches||t.machesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector||function(t){return Array.prototype.indexOf.call(this.parentElement.querySelectorAll(t),this)>-1}}(t.Element.prototype),Object.keys||(Object.keys=function(){var t=Object.prototype.hasOwnProperty,e=!1,n=[],a=-1;return e=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=n.length,function(i){var o=[],r="",s=-1;if("object"!=typeof i&&("function"!=typeof i||null===i))throw new TypeError("Object.keys called on non-object");for(r in i)t.call(i,r)&&o.push(r);if(e)for(s=0;s<a;s++)t.call(i,n[s])&&o.push(n[s]);return o}}()),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),"function"!=typeof Object.create&&(Object.create=function(t){var e=function(){};return function(n,a){if(n!==Object(n)&&null!==n)throw TypeError("Argument must be an object, or null");e.prototype=n||{};var i=new e;return e.prototype=null,a!==t&&Object.defineProperties(i,a),null===n&&(i.__proto__=null),i}}()),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e,n,a,i;if(null===this)throw new TypeError;if(a=Object(this),i=a.length>>>0,0===i)return-1;if(e=0,arguments.length>1&&(e=Number(arguments[1]),e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e)))),e>=i)return-1;for(n=e>=0?e:Math.max(i-Math.abs(e),0);n<i;n++)if(n in a&&a[n]===t)return n;return-1}),Function.prototype.bind||(Function.prototype.bind=function(t){var e,n,a,i;if("function"!=typeof this)throw new TypeError;return e=Array.prototype.slice.call(arguments,1),n=this,a=function(){},i=function(){return n.apply(this instanceof a?this:t,e.concat(Array.prototype.slice.call(arguments)))},this.prototype&&(a.prototype=this.prototype),i.prototype=new a,i}),t.Element.prototype.dispatchEvent||(t.Element.prototype.dispatchEvent=function(t){try{return this.fireEvent("on"+t.type,t)}catch(e){}})}(),e=function(a,i,o){var r=null,s=!1,l=null,c=null,u=null,f=null,h=[],d="",m=[],g=-1;if(u=o||t.document,(s=arguments[3])&&(s="boolean"==typeof s),"string"==typeof a)m=u.querySelectorAll(a);else if(a&&"object"==typeof a&&n.isElement(a,u))m=[a];else{if(!a||"object"!=typeof a||!a.length)throw new Error(e.messages.errorFactoryInvalidContainer());m=a}if(m.length<1)throw new Error(e.messages.errorFactoryContainerNotFound());for(g=0;(r=m[g])&&(!(g>0)||s);g++)r.id?d=r.id:(d="MixItUp"+n.randomHex(),r.id=d),e.instances[d]instanceof e.Mixer?(l=e.instances[d],(!i||i&&i.debug&&i.debug.showWarnings!==!1)&&console.warn(e.messages.warningFactoryPreexistingInstance())):(l=new e.Mixer,l.attach(r,u,d,i),e.instances[d]=l),c=new e.Facade(l),i&&i.debug&&i.debug.enable?h.push(l):h.push(c);return f=s?new e.Collection(h):h[0]},e.use=function(t){e.Base.prototype.callActions.call(e,"beforeUse",arguments),"function"==typeof t&&"mixitup-extension"===t.TYPE?"undefined"==typeof e.extensions[t.NAME]&&(t(e),e.extensions[t.NAME]=t):t.fn&&t.fn.jquery&&(e.libraries.$=t),e.Base.prototype.callActions.call(e,"afterUse",arguments)},e.instances={},e.extensions={},e.libraries={},n={hasClass:function(t,e){return!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(t,e){this.hasClass(t,e)||(t.className+=t.className?" "+e:e)},removeClass:function(t,e){if(this.hasClass(t,e)){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ").trim()}},extend:function(t,e,n,a){var i=[],o="",r=-1;n=n||!1,a=a||!1;try{if(Array.isArray(e))for(r=0;r<e.length;r++)i.push(r);else e&&(i=Object.keys(e));for(r=0;r<i.length;r++)o=i[r],!n||"object"!=typeof e[o]||this.isElement(e[o])?t[o]=e[o]:Array.isArray(e[o])?(t[o]||(t[o]=[]),this.extend(t[o],e[o],n,a)):(t[o]||(t[o]={}),this.extend(t[o],e[o],n,a))}catch(s){if(!a)throw s;this.handleExtendError(s,t)}return t},handleExtendError:function(t,n){var a=/property "?(\w*)"?[,:] object/i,i=null,o="",r="",s="",l="",c="",u=-1,f=-1;if(t instanceof TypeError&&(i=a.exec(t.message))){o=i[1];for(c in n){for(f=0;f<o.length&&o.charAt(f)===c.charAt(f);)f++;f>u&&(u=f,l=c)}throw u>1&&(s=e.messages.errorConfigInvalidPropertySuggestion({probableMatch:l})),r=e.messages.errorConfigInvalidProperty({erroneous:o,suggestion:s}),new TypeError(r)}throw t},template:function(t){for(var e=/\${([\w]*)}/g,n={},a=null;a=e.exec(t);)n[a[1]]=new RegExp("\\${"+a[1]+"}","g");return function(e){var a="",i=t;e=e||{};for(a in n)i=i.replace(n[a],"undefined"!=typeof e[a]?e[a]:"");return i}},on:function(e,n,a,i){e&&(e.addEventListener?e.addEventListener(n,a,i):e.attachEvent&&(e["e"+n+a]=a,e[n+a]=function(){e["e"+n+a](t.event)},e.attachEvent("on"+n,e[n+a])))},off:function(t,e,n){t&&(t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent&&(t.detachEvent("on"+e,t[e+n]),t[e+n]=null))},getCustomEvent:function(e,n,a){var i=null;return a=a||t.document,"function"==typeof t.CustomEvent?i=new t.CustomEvent(e,{detail:n,bubbles:!0,cancelable:!0}):"function"==typeof a.createEvent?(i=a.createEvent("CustomEvent"),i.initCustomEvent(e,!0,!0,n)):(i=a.createEventObject(),i.type=e,i.returnValue=!1,i.cancelBubble=!1,i.detail=n),i},getOriginalEvent:function(t){return t.touches&&t.touches.length?t.touches[0]:t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t},index:function(t,e){for(var n=0;null!==(t=t.previousElementSibling);)e&&!t.matches(e)||++n;return n},camelCase:function(t){return t.toLowerCase().replace(/([_-][a-z])/g,function(t){return t.toUpperCase().replace(/[_-]/,"")})},pascalCase:function(t){return(t=this.camelCase(t)).charAt(0).toUpperCase()+t.slice(1)},dashCase:function(t){return t.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()},isElement:function(e,n){return n=n||t.document,!!(t.HTMLElement&&e instanceof t.HTMLElement)||(!!(n.defaultView&&n.defaultView.HTMLElement&&e instanceof n.defaultView.HTMLElement)||null!==e&&1===e.nodeType&&"string"==typeof e.nodeName)},createElement:function(e,n){var a=null,i=null;for(n=n||t.document,a=n.createDocumentFragment(),i=n.createElement("div"),i.innerHTML=e.trim();i.firstChild;)a.appendChild(i.firstChild);return a},removeWhitespace:function(t){for(var e;t&&"#text"===t.nodeName;)e=t,t=t.previousSibling,e.parentElement&&e.parentElement.removeChild(e)},isEqualArray:function(t,e){var n=t.length;if(n!==e.length)return!1;for(;n--;)if(t[n]!==e[n])return!1;return!0},deepEquals:function(t,e){var n;if("object"==typeof t&&t&&"object"==typeof e&&e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(n in t)if(!e.hasOwnProperty(n)||!this.deepEquals(t[n],e[n]))return!1}else if(t!==e)return!1;return!0},arrayShuffle:function(t){for(var e=t.slice(),n=e.length,a=n,i=-1,o=[];a--;)i=~~(Math.random()*n),o=e[a],e[a]=e[i],e[i]=o;return e},arrayFromList:function(t){var e,n;try{return Array.prototype.slice.call(t)}catch(a){for(e=[],n=0;n<t.length;n++)e.push(t[n]);return e}},debounce:function(t,e,n){var a;return function(){var i=this,o=arguments,r=n&&!a,s=null;s=function(){a=null,n||t.apply(i,o)},clearTimeout(a),a=setTimeout(s,e),r&&t.apply(i,o)}},position:function(t){for(var e=0,n=0,a=t;t;)e-=t.scrollLeft,n-=t.scrollTop,t===a&&(e+=t.offsetLeft,n+=t.offsetTop,a=t.offsetParent),t=t.parentElement;return{x:e,y:n}},getHypotenuse:function(t,e){var n=t.x-e.x,a=t.y-e.y;return n=n<0?n*-1:n,a=a<0?a*-1:a,Math.sqrt(Math.pow(n,2)+Math.pow(a,2))},getIntersectionRatio:function(t,e){var n=t.width*t.height,a=-1,i=-1,o=-1,r=-1;return a=Math.max(0,Math.min(t.left+t.width,e.left+e.width)-Math.max(t.left,e.left)),i=Math.max(0,Math.min(t.top+t.height,e.top+e.height)-Math.max(t.top,e.top)),o=i*a,r=o/n},closestParent:function(e,n,a,i){var o=e.parentNode;if(i=i||t.document,a&&e.matches(n))return e;for(;o&&o!=i.body;){if(o.matches&&o.matches(n))return o;if(!o.parentNode)return null;o=o.parentNode}return null},children:function(e,n,a){var i=[],o="";return a=a||t.doc,e&&(e.id||(o="Temp"+this.randomHexKey(),e.id=o),i=a.querySelectorAll("#"+e.id+" > "+n),o&&e.removeAttribute("id")),i},clean:function(t){var e=[],n=-1;for(n=0;n<t.length;n++)""!==t[n]&&e.push(t[n]);return e},defer:function(n){var a=null,i=null,o=null;return i=new this.Deferred,e.features.has.promises?i.promise=new Promise(function(t,e){i.resolve=t,i.reject=e}):(o=t.jQuery||n.$)&&"function"==typeof o.Deferred?(a=o.Deferred(),i.promise=a.promise(),i.resolve=a.resolve,i.reject=a.reject):t.console&&console.warn(e.messages.warningNoPromiseImplementation()),i},all:function(n,a){var i=null;return e.features.has.promises?Promise.all(n):(i=t.jQuery||a.$)&&"function"==typeof i.when?i.when.apply(i,n).done(function(){return arguments}):(t.console&&console.warn(e.messages.warningNoPromiseImplementation()),[])},getPrefix:function(t,e,a){var i=-1,o="";if(n.dashCase(e)in t.style)return"";for(i=0;o=a[i];i++)if(o+e in t.style)return o.toLowerCase();return"unsupported"},randomHex:function(){return("00000"+(16777216*Math.random()<<0).toString(16)).substr(-6).toUpperCase()},getDocumentState:function(e){return e="object"==typeof e.body?e:t.document,{scrollTop:t.pageYOffset,scrollLeft:t.pageXOffset,docHeight:e.documentElement.scrollHeight,docWidth:e.documentElement.scrollWidth,viewportHeight:e.documentElement.clientHeight,viewportWidth:e.documentElement.clientWidth}},bind:function(t,e){return function(){return e.apply(t,arguments)}},isVisible:function(e){var n=null;return!!e.offsetParent||(n=t.getComputedStyle(e),"fixed"===n.position&&"hidden"!==n.visibility&&"0"!==n.opacity)},seal:function(t){"function"==typeof Object.seal&&Object.seal(t)},freeze:function(t){"function"==typeof Object.freeze&&Object.freeze(t)},compareVersions:function(t,e){var n=t.split("."),a=e.split("."),i=-1,o=-1,r=-1;for(r=0;r<n.length;r++){if(i=parseInt(n[r].replace(/[^\d.]/g,"")),o=parseInt(a[r].replace(/[^\d.]/g,"")||0),o<i)return!1;if(o>i)return!0}return!0},Deferred:function(){this.promise=null,this.resolve=null,this.reject=null,this.id=n.randomHex()},isEmptyObject:function(t){var e="";if("function"==typeof Object.keys)return 0===Object.keys(t).length;for(e in t)if(t.hasOwnProperty(e))return!1;return!0},getClassname:function(t,e,n){var a="";return a+=t.block,a.length&&(a+=t.delineatorElement),a+=t["element"+this.pascalCase(e)],n?(a.length&&(a+=t.delineatorModifier),a+=n):a},getProperty:function(t,e){var n=e.split("."),a=null,i="",o=0;if(!e)return t;for(a=function(t){return t?t[i]:null};o<n.length;)i=n[o],t=a(t),o++;return"undefined"!=typeof t?t:null}},e.h=n,e.Base=function(){},e.Base.prototype={constructor:e.Base,callActions:function(t,e){var a=this,i=a.constructor.actions[t],o="";if(i&&!n.isEmptyObject(i))for(o in i)i[o].apply(a,e)},callFilters:function(t,e,a){var i=this,o=i.constructor.filters[t],r=e,s="";if(!o||n.isEmptyObject(o))return r;a=a||[];for(s in o)a=n.arrayFromList(a),a.unshift(r),r=o[s].apply(i,a);return r}},e.BaseStatic=function(){this.actions={},this.filters={},this.extend=function(t){n.extend(this.prototype,t)},this.registerAction=function(t,e,n){(this.actions[t]=this.actions[t]||{})[e]=n},this.registerFilter=function(t,e,n){(this.filters[t]=this.filters[t]||{})[e]=n}},e.Features=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.boxSizingPrefix="",this.transformPrefix="",this.transitionPrefix="",this.boxSizingPrefix="",this.transformProp="",this.transformRule="",this.transitionProp="",this.perspectiveProp="",this.perspectiveOriginProp="",this.has=new e.Has,this.canary=null,this.BOX_SIZING_PROP="boxSizing",this.TRANSITION_PROP="transition",this.TRANSFORM_PROP="transform",this.PERSPECTIVE_PROP="perspective",this.PERSPECTIVE_ORIGIN_PROP="perspectiveOrigin",this.VENDORS=["Webkit","moz","O","ms"],this.TWEENABLE=["opacity","width","height","marginRight","marginBottom","x","y","scale","translateX","translateY","translateZ","rotateX","rotateY","rotateZ"],this.callActions("afterConstruct")},e.BaseStatic.call(e.Features),e.Features.prototype=Object.create(e.Base.prototype),n.extend(e.Features.prototype,{constructor:e.Features,init:function(){var t=this;t.callActions("beforeInit",arguments),t.canary=document.createElement("div"),t.setPrefixes(),t.runTests(),t.callActions("beforeInit",arguments)},runTests:function(){var e=this;e.callActions("beforeRunTests",arguments),e.has.promises="function"==typeof t.Promise,e.has.transitions="unsupported"!==e.transitionPrefix,e.callActions("afterRunTests",arguments),n.freeze(e.has)},setPrefixes:function(){var t=this;t.callActions("beforeSetPrefixes",arguments),t.transitionPrefix=n.getPrefix(t.canary,"Transition",t.VENDORS),t.transformPrefix=n.getPrefix(t.canary,"Transform",t.VENDORS),t.boxSizingPrefix=n.getPrefix(t.canary,"BoxSizing",t.VENDORS),t.boxSizingProp=t.boxSizingPrefix?t.boxSizingPrefix+n.pascalCase(t.BOX_SIZING_PROP):t.BOX_SIZING_PROP,t.transitionProp=t.transitionPrefix?t.transitionPrefix+n.pascalCase(t.TRANSITION_PROP):t.TRANSITION_PROP,t.transformProp=t.transformPrefix?t.transformPrefix+n.pascalCase(t.TRANSFORM_PROP):t.TRANSFORM_PROP,t.transformRule=t.transformPrefix?"-"+t.transformPrefix+"-"+t.TRANSFORM_PROP:t.TRANSFORM_PROP,t.perspectiveProp=t.transformPrefix?t.transformPrefix+n.pascalCase(t.PERSPECTIVE_PROP):t.PERSPECTIVE_PROP,t.perspectiveOriginProp=t.transformPrefix?t.transformPrefix+n.pascalCase(t.PERSPECTIVE_ORIGIN_PROP):t.PERSPECTIVE_ORIGIN_PROP,t.callActions("afterSetPrefixes",arguments)}}),e.Has=function(){this.transitions=!1,this.promises=!1,n.seal(this)},e.features=new e.Features,e.features.init(),e.ConfigAnimation=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.enable=!0,this.effects="fade scale",this.effectsIn="",this.effectsOut="",this.duration=600,this.easing="ease",this.applyPerspective=!0,this.perspectiveDistance="3000px",this.perspectiveOrigin="50% 50%",this.queue=!0,this.queueLimit=3,this.animateResizeContainer=!0,this.animateResizeTargets=!1,this.staggerSequence=null,this.reverseOut=!1,this.nudge=!0,this.clampHeight=!0,this.clampWidth=!0,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigAnimation),e.ConfigAnimation.prototype=Object.create(e.Base.prototype),e.ConfigAnimation.prototype.constructor=e.ConfigAnimation,e.ConfigBehavior=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.liveSort=!1,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigBehavior),e.ConfigBehavior.prototype=Object.create(e.Base.prototype),e.ConfigBehavior.prototype.constructor=e.ConfigBehavior,e.ConfigCallbacks=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.onMixStart=null,this.onMixBusy=null,this.onMixEnd=null,this.onMixFail=null,this.onMixClick=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigCallbacks),e.ConfigCallbacks.prototype=Object.create(e.Base.prototype),e.ConfigCallbacks.prototype.constructor=e.ConfigCallbacks,e.ConfigControls=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.enable=!0,this.live=!1,this.scope="global",this.toggleLogic="or",this.toggleDefault="all",this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigControls),e.ConfigControls.prototype=Object.create(e.Base.prototype),e.ConfigControls.prototype.constructor=e.ConfigControls,e.ConfigClassNames=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.block="mixitup",this.elementContainer="container",this.elementFilter="control",this.elementSort="control",this.elementMultimix="control",this.elementToggle="control",this.modifierActive="active",this.modifierDisabled="disabled",this.modifierFailed="failed",this.delineatorElement="-",this.delineatorModifier="-",this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigClassNames),e.ConfigClassNames.prototype=Object.create(e.Base.prototype),e.ConfigClassNames.prototype.constructor=e.ConfigClassNames,e.ConfigData=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.uidKey="",this.dirtyCheck=!1,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigData),e.ConfigData.prototype=Object.create(e.Base.prototype),e.ConfigData.prototype.constructor=e.ConfigData,e.ConfigDebug=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.enable=!1,this.showWarnings=!0,this.fauxAsync=!1,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigDebug),e.ConfigDebug.prototype=Object.create(e.Base.prototype),e.ConfigDebug.prototype.constructor=e.ConfigDebug,e.ConfigLayout=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.allowNestedTargets=!0,this.containerClassName="",this.siblingBefore=null,this.siblingAfter=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigLayout),e.ConfigLayout.prototype=Object.create(e.Base.prototype),e.ConfigLayout.prototype.constructor=e.ConfigLayout,e.ConfigLoad=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.filter="all",this.sort="default:asc",this.dataset=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigLoad),e.ConfigLoad.prototype=Object.create(e.Base.prototype),e.ConfigLoad.prototype.constructor=e.ConfigLoad,e.ConfigSelectors=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.target=".mix",this.control="",this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigSelectors),e.ConfigSelectors.prototype=Object.create(e.Base.prototype),e.ConfigSelectors.prototype.constructor=e.ConfigSelectors,e.ConfigRender=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.target=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigRender),e.ConfigRender.prototype=Object.create(e.Base.prototype),e.ConfigRender.prototype.constructor=e.ConfigRender,e.ConfigTemplates=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.ConfigTemplates),e.ConfigTemplates.prototype=Object.create(e.Base.prototype),e.ConfigTemplates.prototype.constructor=e.ConfigTemplates,e.Config=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.animation=new e.ConfigAnimation,this.behavior=new e.ConfigBehavior,this.callbacks=new e.ConfigCallbacks,this.controls=new e.ConfigControls,this.classNames=new e.ConfigClassNames,this.data=new e.ConfigData,this.debug=new e.ConfigDebug,this.layout=new e.ConfigLayout,this.load=new e.ConfigLoad,this.selectors=new e.ConfigSelectors,this.render=new e.ConfigRender,this.templates=new e.ConfigTemplates,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.Config),e.Config.prototype=Object.create(e.Base.prototype),e.Config.prototype.constructor=e.Config,e.MixerDom=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.document=null,this.body=null,this.container=null,this.parent=null,this.targets=[],this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.MixerDom),e.MixerDom.prototype=Object.create(e.Base.prototype),e.MixerDom.prototype.constructor=e.MixerDom,e.UiClassNames=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.base="",this.active="",this.disabled="",this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.UiClassNames),e.UiClassNames.prototype=Object.create(e.Base.prototype),e.UiClassNames.prototype.constructor=e.UiClassNames,e.CommandDataset=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.dataset=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.CommandDataset),e.CommandDataset.prototype=Object.create(e.Base.prototype),e.CommandDataset.prototype.constructor=e.CommandDataset,e.CommandMultimix=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.filter=null,this.sort=null,this.insert=null,this.remove=null,this.changeLayout=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.CommandMultimix),e.CommandMultimix.prototype=Object.create(e.Base.prototype),e.CommandMultimix.prototype.constructor=e.CommandMultimix,e.CommandFilter=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.selector="",this.collection=null,this.action="show",this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.CommandFilter),e.CommandFilter.prototype=Object.create(e.Base.prototype),e.CommandFilter.prototype.constructor=e.CommandFilter,e.CommandSort=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.sortString="",this.attribute="",this.order="asc",this.collection=null,this.next=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.CommandSort),e.CommandSort.prototype=Object.create(e.Base.prototype),e.CommandSort.prototype.constructor=e.CommandSort,e.CommandInsert=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.index=0,this.collection=[],this.position="before",this.sibling=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.CommandInsert),e.CommandInsert.prototype=Object.create(e.Base.prototype),e.CommandInsert.prototype.constructor=e.CommandInsert,e.CommandRemove=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.targets=[],this.collection=[],this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.CommandRemove),e.CommandRemove.prototype=Object.create(e.Base.prototype),e.CommandRemove.prototype.constructor=e.CommandRemove,e.CommandChangeLayout=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.containerClassName="",this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.CommandChangeLayout),e.CommandChangeLayout.prototype=Object.create(e.Base.prototype),e.CommandChangeLayout.prototype.constructor=e.CommandChangeLayout,e.ControlDefinition=function(t,a,i,o){e.Base.call(this),this.callActions("beforeConstruct"),this.type=t,this.selector=a,this.live=i||!1,this.parent=o||"",this.callActions("afterConstruct"),n.freeze(this),n.seal(this)},e.BaseStatic.call(e.ControlDefinition),e.ControlDefinition.prototype=Object.create(e.Base.prototype),e.ControlDefinition.prototype.constructor=e.ControlDefinition,e.controlDefinitions=[],e.controlDefinitions.push(new e.ControlDefinition("multimix","[data-filter][data-sort]")),e.controlDefinitions.push(new e.ControlDefinition("filter","[data-filter]")),e.controlDefinitions.push(new e.ControlDefinition("sort","[data-sort]")),e.controlDefinitions.push(new e.ControlDefinition("toggle","[data-toggle]")),e.Control=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.el=null,this.selector="",this.bound=[],this.pending=-1,this.type="",this.status="inactive",this.filter="",this.sort="",this.canDisable=!1,this.handler=null,this.classNames=new e.UiClassNames,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.Control),e.Control.prototype=Object.create(e.Base.prototype),n.extend(e.Control.prototype,{constructor:e.Control,init:function(t,n,a){var i=this;if(this.callActions("beforeInit",arguments),i.el=t,i.type=n,i.selector=a,i.selector)i.status="live";else switch(i.canDisable="boolean"==typeof i.el.disable,i.type){case"filter":i.filter=i.el.getAttribute("data-filter");break;case"toggle":i.filter=i.el.getAttribute("data-toggle");break;case"sort":i.sort=i.el.getAttribute("data-sort");break;case"multimix":i.filter=i.el.getAttribute("data-filter"),i.sort=i.el.getAttribute("data-sort")}i.bindClick(),e.controls.push(i),this.callActions("afterInit",arguments)},isBound:function(t){var e=this,n=!1;return this.callActions("beforeIsBound",arguments),n=e.bound.indexOf(t)>-1,e.callFilters("afterIsBound",n,arguments)},addBinding:function(t){var e=this;this.callActions("beforeAddBinding",arguments),e.isBound()||e.bound.push(t),this.callActions("afterAddBinding",arguments)},removeBinding:function(t){var n=this,a=-1;this.callActions("beforeRemoveBinding",arguments),(a=n.bound.indexOf(t))>-1&&n.bound.splice(a,1),n.bound.length<1&&(n.unbindClick(),a=e.controls.indexOf(n),e.controls.splice(a,1),"active"===n.status&&n.renderStatus(n.el,"inactive")),this.callActions("afterRemoveBinding",arguments)},bindClick:function(){var t=this;this.callActions("beforeBindClick",arguments),t.handler=function(e){t.handleClick(e)},n.on(t.el,"click",t.handler),this.callActions("afterBindClick",arguments)},unbindClick:function(){var t=this;this.callActions("beforeUnbindClick",arguments),n.off(t.el,"click",t.handler),t.handler=null,this.callActions("afterUnbindClick",arguments)},handleClick:function(t){var a=this,i=null,o=null,r=!1,s=void 0,l={},c=null,u=[],f=-1;if(this.callActions("beforeHandleClick",arguments),this.pending=0,o=a.bound[0],i=a.selector?n.closestParent(t.target,o.config.selectors.control+a.selector,!0,o.dom.document):a.el,!i)return void a.callActions("afterHandleClick",arguments);switch(a.type){case"filter":l.filter=a.filter||i.getAttribute("data-filter");break;case"sort":l.sort=a.sort||i.getAttribute("data-sort");break;case"multimix":l.filter=a.filter||i.getAttribute("data-filter"),l.sort=a.sort||i.getAttribute("data-sort");break;case"toggle":l.filter=a.filter||i.getAttribute("data-toggle"),r="live"===a.status?n.hasClass(i,a.classNames.active):"active"===a.status}for(f=0;f<a.bound.length;f++)c=new e.CommandMultimix,n.extend(c,l),u.push(c);for(u=a.callFilters("commandsHandleClick",u,arguments),a.pending=a.bound.length,f=0;o=a.bound[f];f++)l=u[f],l&&(o.lastClicked||(o.lastClicked=i),e.events.fire("mixClick",o.dom.container,{state:o.state,instance:o,originalEvent:t,control:o.lastClicked},o.dom.document),"function"==typeof o.config.callbacks.onMixClick&&(s=o.config.callbacks.onMixClick.call(o.lastClicked,o.state,t,o),s===!1)||("toggle"===a.type?r?o.toggleOff(l.filter):o.toggleOn(l.filter):o.multimix(l)));this.callActions("afterHandleClick",arguments)},update:function(t,n){var a=this,i=new e.CommandMultimix;a.callActions("beforeUpdate",arguments),a.pending--,a.pending=Math.max(0,a.pending),a.pending>0||("live"===a.status?a.updateLive(t,n):(i.sort=a.sort,i.filter=a.filter,a.callFilters("actionsUpdate",i,arguments),a.parseStatusChange(a.el,t,i,n)),a.callActions("afterUpdate",arguments))},updateLive:function(t,n){var a=this,i=null,o=null,r=null,s=-1;if(a.callActions("beforeUpdateLive",arguments),a.el){for(i=a.el.querySelectorAll(a.selector),s=0;r=i[s];s++){switch(o=new e.CommandMultimix,a.type){case"filter":o.filter=r.getAttribute("data-filter");break;case"sort":o.sort=r.getAttribute("data-sort");break;case"multimix":o.filter=r.getAttribute("data-filter"),o.sort=r.getAttribute("data-sort");break;case"toggle":o.filter=r.getAttribute("data-toggle")}o=a.callFilters("actionsUpdateLive",o,arguments),a.parseStatusChange(r,t,o,n)}a.callActions("afterUpdateLive",arguments)}},parseStatusChange:function(t,e,n,a){var i=this,o="",r="",s=-1;switch(i.callActions("beforeParseStatusChange",arguments),i.type){case"filter":e.filter===n.filter?i.renderStatus(t,"active"):i.renderStatus(t,"inactive");break;case"multimix":e.sort===n.sort&&e.filter===n.filter?i.renderStatus(t,"active"):i.renderStatus(t,"inactive");break;case"sort":e.sort.match(/:asc/g)&&(o=e.sort.replace(/:asc/g,"")),e.sort===n.sort||o===n.sort?i.renderStatus(t,"active"):i.renderStatus(t,"inactive");break;case"toggle":for(a.length<1&&i.renderStatus(t,"inactive"),e.filter===n.filter&&i.renderStatus(t,"active"),s=0;s<a.length;s++){if(r=a[s],r===n.filter){i.renderStatus(t,"active");break}i.renderStatus(t,"inactive")}}i.callActions("afterParseStatusChange",arguments)},renderStatus:function(t,e){var a=this;switch(a.callActions("beforeRenderStatus",arguments),e){case"active":n.addClass(t,a.classNames.active),n.removeClass(t,a.classNames.disabled),a.canDisable&&(a.el.disabled=!1);break;case"inactive":n.removeClass(t,a.classNames.active),n.removeClass(t,a.classNames.disabled),a.canDisable&&(a.el.disabled=!1);break;case"disabled":a.canDisable&&(a.el.disabled=!0),n.addClass(t,a.classNames.disabled),n.removeClass(t,a.classNames.active)}"live"!==a.status&&(a.status=e),a.callActions("afterRenderStatus",arguments)}}),e.controls=[],e.StyleData=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.x=0,this.y=0,this.top=0,this.right=0,this.bottom=0,this.left=0,this.width=0,this.height=0,this.marginRight=0,this.marginBottom=0,this.opacity=0,this.scale=new e.TransformData,this.translateX=new e.TransformData,this.translateY=new e.TransformData,this.translateZ=new e.TransformData,this.rotateX=new e.TransformData,this.rotateY=new e.TransformData,this.rotateZ=new e.TransformData,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.StyleData),e.StyleData.prototype=Object.create(e.Base.prototype),e.StyleData.prototype.constructor=e.StyleData,e.TransformData=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.value=0,this.unit="",this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.TransformData),e.TransformData.prototype=Object.create(e.Base.prototype),e.TransformData.prototype.constructor=e.TransformData,e.TransformDefaults=function(){e.StyleData.apply(this),this.callActions("beforeConstruct"),this.scale.value=.01,this.scale.unit="",this.translateX.value=20,this.translateX.unit="px",this.translateY.value=20,this.translateY.unit="px",this.translateZ.value=20,this.translateZ.unit="px",this.rotateX.value=90,this.rotateX.unit="deg",this.rotateY.value=90,this.rotateY.unit="deg",this.rotateX.value=90,this.rotateX.unit="deg",this.rotateZ.value=180,this.rotateZ.unit="deg",this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.TransformDefaults),e.TransformDefaults.prototype=Object.create(e.StyleData.prototype),e.TransformDefaults.prototype.constructor=e.TransformDefaults,e.transformDefaults=new e.TransformDefaults,e.EventDetail=function(){this.state=null,this.futureState=null,this.instance=null,this.originalEvent=null},e.Events=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.mixStart=null,this.mixBusy=null,this.mixEnd=null,this.mixFail=null,this.mixClick=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.Events),e.Events.prototype=Object.create(e.Base.prototype),e.Events.prototype.constructor=e.Events,e.Events.prototype.fire=function(t,a,i,o){var r=this,s=null,l=new e.EventDetail;if(r.callActions("beforeFire",arguments),"undefined"==typeof r[t])throw new Error('Event type "'+t+'" not found.');l.state=new e.State,n.extend(l.state,i.state),i.futureState&&(l.futureState=new e.State,n.extend(l.futureState,i.futureState)),l.instance=i.instance,i.originalEvent&&(l.originalEvent=i.originalEvent),s=n.getCustomEvent(t,l,o),r.callFilters("eventFire",s,arguments),a.dispatchEvent(s)},e.events=new e.Events,e.QueueItem=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.args=[],this.instruction=null,this.triggerElement=null,this.deferred=null,this.isToggling=!1,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.QueueItem),e.QueueItem.prototype=Object.create(e.Base.prototype),e.QueueItem.prototype.constructor=e.QueueItem,e.Mixer=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.config=new e.Config,this.id="",this.isBusy=!1,this.isToggling=!1,this.incPadding=!0,this.controls=[],this.targets=[],this.origOrder=[],this.cache={},this.toggleArray=[],this.targetsMoved=0,this.targetsImmovable=0,this.targetsBound=0,this.targetsDone=0,this.staggerDuration=0,this.effectsIn=null,this.effectsOut=null,this.transformIn=[],this.transformOut=[],this.queue=[],this.state=null,this.lastOperation=null,
|
17
|
+
this.lastClicked=null,this.userCallback=null,this.userDeferred=null,this.dom=new e.MixerDom,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.Mixer),e.Mixer.prototype=Object.create(e.Base.prototype),n.extend(e.Mixer.prototype,{constructor:e.Mixer,attach:function(a,i,o,r){var s=this,l=null,c=-1;for(s.callActions("beforeAttach",arguments),s.id=o,r&&n.extend(s.config,r,!0,!0),s.sanitizeConfig(),s.cacheDom(a,i),s.config.layout.containerClassName&&n.addClass(s.dom.container,s.config.layout.containerClassName),e.features.has.transitions||(s.config.animation.enable=!1),"undefined"==typeof t.console&&(s.config.debug.showWarnings=!1),s.config.data.uidKey&&(s.config.controls.enable=!1),s.indexTargets(),s.state=s.getInitialState(),c=0;l=s.lastOperation.toHide[c];c++)l.hide();s.config.controls.enable&&(s.initControls(),s.buildToggleArray(null,s.state),s.updateControls({filter:s.state.activeFilter,sort:s.state.activeSort})),s.parseEffects(),s.callActions("afterAttach",arguments)},sanitizeConfig:function(){var t=this;t.callActions("beforeSanitizeConfig",arguments),t.config.controls.scope=t.config.controls.scope.toLowerCase().trim(),t.config.controls.toggleLogic=t.config.controls.toggleLogic.toLowerCase().trim(),t.config.controls.toggleDefault=t.config.controls.toggleDefault.toLowerCase().trim(),t.config.animation.effects=t.config.animation.effects.trim(),t.callActions("afterSanitizeConfig",arguments)},getInitialState:function(){var t=this,n=new e.State,a=new e.Operation;if(t.callActions("beforeGetInitialState",arguments),n.activeContainerClassName=t.config.layout.containerClassName,t.config.load.dataset){if(!t.config.data.uidKey||"string"!=typeof t.config.data.uidKey)throw new TypeError(e.messages.errorConfigDataUidKeyNotSet());a.startDataset=a.newDataset=n.activeDataset=t.config.load.dataset.slice(),a.startContainerClassName=a.newContainerClassName=n.activeContainerClassName,a.show=t.targets.slice(),n=t.callFilters("stateGetInitialState",n,arguments)}else n.activeFilter=t.parseFilterArgs([t.config.load.filter]).command,n.activeSort=t.parseSortArgs([t.config.load.sort]).command,n.totalTargets=t.targets.length,n=t.callFilters("stateGetInitialState",n,arguments),n.activeSort.collection||n.activeSort.attribute||"random"===n.activeSort.order||"desc"===n.activeSort.order?(a.newSort=n.activeSort,t.sortOperation(a),t.printSort(!1,a),t.targets=a.newOrder):a.startOrder=a.newOrder=t.targets,a.startFilter=a.newFilter=n.activeFilter,a.startSort=a.newSort=n.activeSort,a.startContainerClassName=a.newContainerClassName=n.activeContainerClassName,"all"===a.newFilter.selector?a.newFilter.selector=t.config.selectors.target:"none"===a.newFilter.selector&&(a.newFilter.selector="");return a=t.callFilters("operationGetInitialState",a,[n]),t.lastOperation=a,a.newFilter&&t.filterOperation(a),n=t.buildState(a)},cacheDom:function(t,e){var n=this;n.callActions("beforeCacheDom",arguments),n.dom.document=e,n.dom.body=n.dom.document.querySelector("body"),n.dom.container=t,n.dom.parent=t,n.callActions("afterCacheDom",arguments)},indexTargets:function(){var t=this,a=null,i=null,o=null,r=-1;if(t.callActions("beforeIndexTargets",arguments),t.dom.targets=t.config.layout.allowNestedTargets?t.dom.container.querySelectorAll(t.config.selectors.target):n.children(t.dom.container,t.config.selectors.target,t.dom.document),t.dom.targets=n.arrayFromList(t.dom.targets),t.targets=[],(o=t.config.load.dataset)&&o.length!==t.dom.targets.length)throw new Error(e.messages.errorDatasetPrerenderedMismatch());if(t.dom.targets.length){for(r=0;i=t.dom.targets[r];r++)a=new e.Target,a.init(i,t,o?o[r]:void 0),a.isInDom=!0,t.targets.push(a);t.dom.parent=t.dom.targets[0].parentElement===t.dom.container?t.dom.container:t.dom.targets[0].parentElement}t.origOrder=t.targets,t.callActions("afterIndexTargets",arguments)},initControls:function(){var t=this,n="",a=null,i=null,o=null,r=null,s=null,l=-1,c=-1;switch(t.callActions("beforeInitControls",arguments),t.config.controls.scope){case"local":o=t.dom.container;break;case"global":o=t.dom.document;break;default:throw new Error(e.messages.errorConfigInvalidControlsScope())}for(l=0;n=e.controlDefinitions[l];l++)if(t.config.controls.live||n.live){if(n.parent){if(r=t.dom[n.parent],!r||r.length<0)continue;"number"!=typeof r.length&&(r=[r])}else r=[o];for(c=0;i=r[c];c++)s=t.getControl(i,n.type,n.selector),t.controls.push(s)}else for(a=o.querySelectorAll(t.config.selectors.control+n.selector),c=0;i=a[c];c++)s=t.getControl(i,n.type,""),s&&t.controls.push(s);t.callActions("afterInitControls",arguments)},getControl:function(t,a,i){var o=this,r=null,s=-1;if(o.callActions("beforeGetControl",arguments),!i)for(s=0;r=e.controls[s];s++){if(r.el===t&&r.isBound(o))return o.callFilters("controlGetControl",null,arguments);if(r.el===t&&r.type===a&&r.selector===i)return r.addBinding(o),o.callFilters("controlGetControl",r,arguments)}return r=new e.Control,r.init(t,a,i),r.classNames.base=n.getClassname(o.config.classNames,a),r.classNames.active=n.getClassname(o.config.classNames,a,o.config.classNames.modifierActive),r.classNames.disabled=n.getClassname(o.config.classNames,a,o.config.classNames.modifierDisabled),r.addBinding(o),o.callFilters("controlGetControl",r,arguments)},getToggleSelector:function(){var t=this,e="or"===t.config.controls.toggleLogic?", ":"",a="";return t.callActions("beforeGetToggleSelector",arguments),t.toggleArray=n.clean(t.toggleArray),a=t.toggleArray.join(e),""===a&&(a=t.config.controls.toggleDefault),t.callFilters("selectorGetToggleSelector",a,arguments)},buildToggleArray:function(t,e){var a=this,i="";if(a.callActions("beforeBuildToggleArray",arguments),t&&t.filter)i=t.filter.selector.replace(/\s/g,"");else{if(!e)return;i=e.activeFilter.selector.replace(/\s/g,"")}i!==a.config.selectors.target&&"all"!==i||(i=""),"or"===a.config.controls.toggleLogic?a.toggleArray=i.split(","):a.toggleArray=a.splitCompoundSelector(i),a.toggleArray=n.clean(a.toggleArray),a.callActions("afterBuildToggleArray",arguments)},splitCompoundSelector:function(t){var e=t.split(/([\.\[])/g),n=[],a="",i=-1;for(""===e[0]&&e.shift(),i=0;i<e.length;i++)i%2===0&&(a=""),a+=e[i],i%2!==0&&n.push(a);return n},updateControls:function(t){var a=this,i=null,o=new e.CommandMultimix,r=-1;for(a.callActions("beforeUpdateControls",arguments),t.filter?o.filter=t.filter.selector:o.filter=a.state.activeFilter.selector,t.sort?o.sort=a.buildSortString(t.sort):o.sort=a.buildSortString(a.state.activeSort),o.filter===a.config.selectors.target&&(o.filter="all"),""===o.filter&&(o.filter="none"),n.freeze(o),r=0;i=a.controls[r];r++)i.update(o,a.toggleArray);a.callActions("afterUpdateControls",arguments)},buildSortString:function(t){var e=this,n="";return n+=t.sortString,t.next&&(n+=" "+e.buildSortString(t.next)),n},insertTargets:function(t,a){var i=this,o=null,r=-1,s=null,l=null,c=null,u=-1;if(i.callActions("beforeInsertTargets",arguments),"undefined"==typeof t.index&&(t.index=0),o=i.getNextSibling(t.index,t.sibling,t.position),s=i.dom.document.createDocumentFragment(),r=o?n.index(o,i.config.selectors.target):i.targets.length,t.collection){for(u=0;c=t.collection[u];u++){if(i.dom.targets.indexOf(c)>-1)throw new Error(e.messages.errorInsertPreexistingElement());c.style.display="none",s.appendChild(c),s.appendChild(i.dom.document.createTextNode(" ")),n.isElement(c,i.dom.document)&&c.matches(i.config.selectors.target)&&(l=new e.Target,l.init(c,i),l.isInDom=!0,i.targets.splice(r,0,l),r++)}i.dom.parent.insertBefore(s,o)}a.startOrder=i.origOrder=i.targets,i.callActions("afterInsertTargets",arguments)},getNextSibling:function(t,e,n){var a=this,i=null;return t=Math.max(t,0),e&&"before"===n?i=e:e&&"after"===n?i=e.nextElementSibling||null:a.targets.length>0&&"undefined"!=typeof t?i=t<a.targets.length||!a.targets.length?a.targets[t].dom.el:a.targets[a.targets.length-1].dom.el.nextElementSibling:0===a.targets.length&&a.dom.parent.children.length>0&&(a.config.layout.siblingAfter?i=a.config.layout.siblingAfter:a.config.layout.siblingBefore?i=a.config.layout.siblingBefore.nextElementSibling:a.dom.parent.children[0]),a.callFilters("elementGetNextSibling",i,arguments)},filterOperation:function(t){var e=this,n=!1,a=-1,i="",o=null,r=-1;for(e.callActions("beforeFilterOperation",arguments),i=t.newFilter.action,r=0;o=t.newOrder[r];r++)n=t.newFilter.collection?t.newFilter.collection.indexOf(o.dom.el)>-1:""!==t.newFilter.selector&&o.dom.el.matches(t.newFilter.selector),e.evaluateHideShow(n,o,i,t);if(t.toRemove.length)for(r=0;o=t.show[r];r++)t.toRemove.indexOf(o)>-1&&(t.show.splice(r,1),(a=t.toShow.indexOf(o))>-1&&t.toShow.splice(a,1),t.toHide.push(o),t.hide.push(o),r--);t.matching=t.show.slice(),0===t.show.length&&""!==t.newFilter.selector&&0!==e.targets.length&&(t.hasFailed=!0),e.callActions("afterFilterOperation",arguments)},evaluateHideShow:function(t,e,n,a){var i=this,o=!1,r=Array.prototype.slice.call(arguments,1);o=i.callFilters("testResultEvaluateHideShow",t,r),i.callActions("beforeEvaluateHideShow",arguments),o===!0&&"show"===n||o===!1&&"hide"===n?(a.show.push(e),!e.isShown&&a.toShow.push(e)):(a.hide.push(e),e.isShown&&a.toHide.push(e)),i.callActions("afterEvaluateHideShow",arguments)},sortOperation:function(t){var a=this,i=[],o=null,r=null,s=-1;if(a.callActions("beforeSortOperation",arguments),t.startOrder=a.targets,t.newSort.collection){for(i=[],s=0;r=t.newSort.collection[s];s++){if(a.dom.targets.indexOf(r)<0)throw new Error(e.messages.errorSortNonExistentElement());o=new e.Target,o.init(r,a),o.isInDom=!0,i.push(o)}t.newOrder=i}else"random"===t.newSort.order?t.newOrder=n.arrayShuffle(t.startOrder):""===t.newSort.attribute?(t.newOrder=a.origOrder.slice(),"desc"===t.newSort.order&&t.newOrder.reverse()):(t.newOrder=t.startOrder.slice(),t.newOrder.sort(function(e,n){return a.compare(e,n,t.newSort)}));n.isEqualArray(t.newOrder,t.startOrder)&&(t.willSort=!1),a.callActions("afterSortOperation",arguments)},compare:function(t,e,n){var a=this,i=n.order,o=a.getAttributeValue(t,n.attribute),r=a.getAttributeValue(e,n.attribute);return isNaN(1*o)||isNaN(1*r)?(o=o.toLowerCase(),r=r.toLowerCase()):(o=1*o,r=1*r),o<r?"asc"===i?-1:1:o>r?"asc"===i?1:-1:o===r&&n.next?a.compare(t,e,n.next):0},getAttributeValue:function(t,n){var a=this,i="";return i=t.dom.el.getAttribute("data-"+n),null===i&&a.config.debug.showWarnings&&console.warn(e.messages.warningInconsistentSortingAttributes({attribute:"data-"+n})),a.callFilters("valueGetAttributeValue",i||0,arguments)},printSort:function(e,a){var i=this,o=e?a.newOrder:a.startOrder,r=e?a.startOrder:a.newOrder,s=o.length?o[o.length-1].dom.el.nextElementSibling:null,l=t.document.createDocumentFragment(),c=null,u=null,f=null,h=-1;for(i.callActions("beforePrintSort",arguments),h=0;u=o[h];h++)f=u.dom.el,"absolute"!==f.style.position&&(n.removeWhitespace(f.previousSibling),f.parentElement.removeChild(f));for(c=s?s.previousSibling:i.dom.parent.lastChild,c&&"#text"===c.nodeName&&n.removeWhitespace(c),h=0;u=r[h];h++)f=u.dom.el,n.isElement(l.lastChild)&&l.appendChild(t.document.createTextNode(" ")),l.appendChild(f);i.dom.parent.firstChild&&i.dom.parent.firstChild!==s&&l.insertBefore(t.document.createTextNode(" "),l.childNodes[0]),s?(l.appendChild(t.document.createTextNode(" ")),i.dom.parent.insertBefore(l,s)):i.dom.parent.appendChild(l),i.callActions("afterPrintSort",arguments)},parseSortString:function(t,a){var i=this,o=t.split(" "),r=a,s=[],l=-1;for(l=0;l<o.length;l++){switch(s=o[l].split(":"),r.sortString=o[l],r.attribute=n.dashCase(s[0]),r.order=s[1]||"asc",r.attribute){case"default":r.attribute="";break;case"random":r.attribute="",r.order="random"}if(!r.attribute||"random"===r.order)break;l<o.length-1&&(r.next=new e.CommandSort,n.freeze(r),r=r.next)}return i.callFilters("commandsParseSort",a,arguments)},parseEffects:function(){var t=this,n="",a=t.config.animation.effectsIn||t.config.animation.effects,i=t.config.animation.effectsOut||t.config.animation.effects;t.callActions("beforeParseEffects",arguments),t.effectsIn=new e.StyleData,t.effectsOut=new e.StyleData,t.transformIn=[],t.transformOut=[],t.effectsIn.opacity=t.effectsOut.opacity=1,t.parseEffect("fade",a,t.effectsIn,t.transformIn),t.parseEffect("fade",i,t.effectsOut,t.transformOut,!0);for(n in e.transformDefaults)e.transformDefaults[n]instanceof e.TransformData&&(t.parseEffect(n,a,t.effectsIn,t.transformIn),t.parseEffect(n,i,t.effectsOut,t.transformOut,!0));t.parseEffect("stagger",a,t.effectsIn,t.transformIn),t.parseEffect("stagger",i,t.effectsOut,t.transformOut,!0),t.callActions("afterParseEffects",arguments)},parseEffect:function(t,n,a,i,o){var r=this,s=/\(([^)]+)\)/,l=-1,c="",u=[],f="",h=["%","px","em","rem","vh","vw","deg"],d="",m=-1;if(r.callActions("beforeParseEffect",arguments),"string"!=typeof n)throw new TypeError(e.messages.errorConfigInvalidAnimationEffects());if(n.indexOf(t)<0)return void("stagger"===t&&(r.staggerDuration=0));switch(l=n.indexOf(t+"("),l>-1&&(c=n.substring(l),u=s.exec(c),f=u[1]),t){case"fade":a.opacity=f?parseFloat(f):0;break;case"stagger":r.staggerDuration=f?parseFloat(f):100;break;default:if(o&&r.config.animation.reverseOut&&"scale"!==t?a[t].value=(f?parseFloat(f):e.transformDefaults[t].value)*-1:a[t].value=f?parseFloat(f):e.transformDefaults[t].value,f){for(m=0;d=h[m];m++)if(f.indexOf(d)>-1){a[t].unit=d;break}}else a[t].unit=e.transformDefaults[t].unit;i.push(t+"("+a[t].value+a[t].unit+")")}r.callActions("afterParseEffect",arguments)},buildState:function(t){var n=this,a=new e.State,i=null,o=-1;for(n.callActions("beforeBuildState",arguments),o=0;i=n.targets[o];o++)(!t.toRemove.length||t.toRemove.indexOf(i)<0)&&a.targets.push(i.dom.el);for(o=0;i=t.matching[o];o++)a.matching.push(i.dom.el);for(o=0;i=t.show[o];o++)a.show.push(i.dom.el);for(o=0;i=t.hide[o];o++)(!t.toRemove.length||t.toRemove.indexOf(i)<0)&&a.hide.push(i.dom.el);return a.id=n.id,a.container=n.dom.container,a.activeFilter=t.newFilter,a.activeSort=t.newSort,a.activeDataset=t.newDataset,a.activeContainerClassName=t.newContainerClassName,a.hasFailed=t.hasFailed,a.totalTargets=n.targets.length,a.totalShow=t.show.length,a.totalHide=t.hide.length,a.totalMatching=t.matching.length,a.triggerElement=t.triggerElement,n.callFilters("stateBuildState",a,arguments)},goMix:function(a,i){var o=this,r=null;return o.callActions("beforeGoMix",arguments),o.config.animation.duration&&o.config.animation.effects&&n.isVisible(o.dom.container)||(a=!1),i.toShow.length||i.toHide.length||i.willSort||i.willChangeLayout||(a=!1),i.startState.show.length||i.show.length||(a=!1),e.events.fire("mixStart",o.dom.container,{state:i.startState,futureState:i.newState,instance:o},o.dom.document),"function"==typeof o.config.callbacks.onMixStart&&o.config.callbacks.onMixStart.call(o.dom.container,i.startState,i.newState,o),n.removeClass(o.dom.container,n.getClassname(o.config.classNames,"container",o.config.classNames.modifierFailed)),r=o.userDeferred?o.userDeferred:o.userDeferred=n.defer(e.libraries),o.isBusy=!0,a&&e.features.has.transitions?(t.pageYOffset!==i.docState.scrollTop&&t.scrollTo(i.docState.scrollLeft,i.docState.scrollTop),o.config.animation.applyPerspective&&(o.dom.parent.style[e.features.perspectiveProp]=o.config.animation.perspectiveDistance,o.dom.parent.style[e.features.perspectiveOriginProp]=o.config.animation.perspectiveOrigin),o.config.animation.animateResizeContainer&&i.startHeight!==i.newHeight&&i.viewportDeltaY!==i.startHeight-i.newHeight&&(o.dom.parent.style.height=i.startHeight+"px"),o.config.animation.animateResizeContainer&&i.startWidth!==i.newWidth&&i.viewportDeltaX!==i.startWidth-i.newWidth&&(o.dom.parent.style.width=i.startWidth+"px"),i.startHeight===i.newHeight&&(o.dom.parent.style.height=i.startHeight+"px"),i.startWidth===i.newWidth&&(o.dom.parent.style.width=i.startWidth+"px"),i.startHeight===i.newHeight&&i.startWidth===i.newWidth&&(o.dom.parent.style.overflow="hidden"),requestAnimationFrame(function(){o.moveTargets(i)}),o.callFilters("promiseGoMix",r.promise,arguments)):(o.config.debug.fauxAsync?setTimeout(function(){o.cleanUp(i)},o.config.animation.duration):o.cleanUp(i),o.callFilters("promiseGoMix",r.promise,arguments))},getStartMixData:function(n){var a=this,i=t.getComputedStyle(a.dom.parent),o=a.dom.parent.getBoundingClientRect(),r=null,s={},l=-1,c=i[e.features.boxSizingProp];for(a.incPadding="border-box"===c,a.callActions("beforeGetStartMixData",arguments),l=0;r=n.show[l];l++)s=r.getPosData(),n.showPosData[l]={startPosData:s};for(l=0;r=n.toHide[l];l++)s=r.getPosData(),n.toHidePosData[l]={startPosData:s};n.startX=o.left,n.startY=o.top,n.startHeight=a.incPadding?o.height:o.height-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderTop)-parseFloat(i.borderBottom),n.startWidth=a.incPadding?o.width:o.width-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderLeft)-parseFloat(i.borderRight),a.callActions("afterGetStartMixData",arguments)},setInter:function(t){var e=this,a=null,i=-1;for(e.callActions("beforeSetInter",arguments),e.config.animation.clampHeight&&(e.dom.parent.style.height=t.startHeight+"px",e.dom.parent.style.overflow="hidden"),e.config.animation.clampWidth&&(e.dom.parent.style.width=t.startWidth+"px",e.dom.parent.style.overflow="hidden"),i=0;a=t.toShow[i];i++)a.show();t.willChangeLayout&&(n.removeClass(e.dom.container,t.startContainerClassName),n.addClass(e.dom.container,t.newContainerClassName)),e.callActions("afterSetInter",arguments)},getInterMixData:function(t){var e=this,n=null,a=-1;for(e.callActions("beforeGetInterMixData",arguments),a=0;n=t.show[a];a++)t.showPosData[a].interPosData=n.getPosData();for(a=0;n=t.toHide[a];a++)t.toHidePosData[a].interPosData=n.getPosData();e.callActions("afterGetInterMixData",arguments)},setFinal:function(t){var e=this,n=null,a=-1;for(e.callActions("beforeSetFinal",arguments),t.willSort&&e.printSort(!1,t),a=0;n=t.toHide[a];a++)n.hide();e.callActions("afterSetFinal",arguments)},getFinalMixData:function(e){var a=this,i=null,o=null,r=null,s=-1;for(a.callActions("beforeGetFinalMixData",arguments),s=0;r=e.show[s];s++)e.showPosData[s].finalPosData=r.getPosData();for(s=0;r=e.toHide[s];s++)e.toHidePosData[s].finalPosData=r.getPosData();for((a.config.animation.clampHeight||a.config.animation.clampWidth)&&(a.dom.parent.style.height=a.dom.parent.style.width=a.dom.parent.style.overflow=""),a.incPadding||(i=t.getComputedStyle(a.dom.parent)),o=a.dom.parent.getBoundingClientRect(),e.newX=o.left,e.newY=o.top,e.newHeight=a.incPadding?o.height:o.height-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderTop)-parseFloat(i.borderBottom),e.newWidth=a.incPadding?o.width:o.width-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderLeft)-parseFloat(i.borderRight),e.viewportDeltaX=e.docState.viewportWidth-this.dom.document.documentElement.clientWidth,e.viewportDeltaY=e.docState.viewportHeight-this.dom.document.documentElement.clientHeight,e.willSort&&a.printSort(!0,e),s=0;r=e.toShow[s];s++)r.hide();for(s=0;r=e.toHide[s];s++)r.show();e.willChangeLayout&&(n.removeClass(a.dom.container,e.newContainerClassName),n.addClass(a.dom.container,a.config.layout.containerClassName)),a.callActions("afterGetFinalMixData",arguments)},getTweenData:function(t){var n=this,a=null,i=null,o=Object.getOwnPropertyNames(n.effectsIn),r="",s=null,l=-1,c=-1,u=-1,f=-1;for(n.callActions("beforeGetTweenData",arguments),u=0;a=t.show[u];u++)for(i=t.showPosData[u],i.posIn=new e.StyleData,i.posOut=new e.StyleData,i.tweenData=new e.StyleData,a.isShown?(i.posIn.x=i.startPosData.x-i.interPosData.x,i.posIn.y=i.startPosData.y-i.interPosData.y):i.posIn.x=i.posIn.y=0,i.posOut.x=i.finalPosData.x-i.interPosData.x,i.posOut.y=i.finalPosData.y-i.interPosData.y,i.posIn.opacity=a.isShown?1:n.effectsIn.opacity,i.posOut.opacity=1,i.tweenData.opacity=i.posOut.opacity-i.posIn.opacity,a.isShown||n.config.animation.nudge||(i.posIn.x=i.posOut.x,i.posIn.y=i.posOut.y),i.tweenData.x=i.posOut.x-i.posIn.x,i.tweenData.y=i.posOut.y-i.posIn.y,n.config.animation.animateResizeTargets&&(i.posIn.width=i.startPosData.width,i.posIn.height=i.startPosData.height,l=(i.startPosData.width||i.finalPosData.width)-i.interPosData.width,i.posIn.marginRight=i.startPosData.marginRight-l,c=(i.startPosData.height||i.finalPosData.height)-i.interPosData.height,i.posIn.marginBottom=i.startPosData.marginBottom-c,i.posOut.width=i.finalPosData.width,i.posOut.height=i.finalPosData.height,l=(i.finalPosData.width||i.startPosData.width)-i.interPosData.width,i.posOut.marginRight=i.finalPosData.marginRight-l,c=(i.finalPosData.height||i.startPosData.height)-i.interPosData.height,i.posOut.marginBottom=i.finalPosData.marginBottom-c,i.tweenData.width=i.posOut.width-i.posIn.width,i.tweenData.height=i.posOut.height-i.posIn.height,i.tweenData.marginRight=i.posOut.marginRight-i.posIn.marginRight,i.tweenData.marginBottom=i.posOut.marginBottom-i.posIn.marginBottom),f=0;r=o[f];f++)s=n.effectsIn[r],s instanceof e.TransformData&&s.value&&(i.posIn[r].value=s.value,i.posOut[r].value=0,i.tweenData[r].value=i.posOut[r].value-i.posIn[r].value,i.posIn[r].unit=i.posOut[r].unit=i.tweenData[r].unit=s.unit);for(u=0;a=t.toHide[u];u++)for(i=t.toHidePosData[u],i.posIn=new e.StyleData,i.posOut=new e.StyleData,i.tweenData=new e.StyleData,i.posIn.x=a.isShown?i.startPosData.x-i.interPosData.x:0,i.posIn.y=a.isShown?i.startPosData.y-i.interPosData.y:0,i.posOut.x=n.config.animation.nudge?0:i.posIn.x,i.posOut.y=n.config.animation.nudge?0:i.posIn.y,i.tweenData.x=i.posOut.x-i.posIn.x,i.tweenData.y=i.posOut.y-i.posIn.y,n.config.animation.animateResizeTargets&&(i.posIn.width=i.startPosData.width,i.posIn.height=i.startPosData.height,l=i.startPosData.width-i.interPosData.width,i.posIn.marginRight=i.startPosData.marginRight-l,c=i.startPosData.height-i.interPosData.height,i.posIn.marginBottom=i.startPosData.marginBottom-c),i.posIn.opacity=1,i.posOut.opacity=n.effectsOut.opacity,i.tweenData.opacity=i.posOut.opacity-i.posIn.opacity,f=0;r=o[f];f++)s=n.effectsOut[r],s instanceof e.TransformData&&s.value&&(i.posIn[r].value=0,i.posOut[r].value=s.value,i.tweenData[r].value=i.posOut[r].value-i.posIn[r].value,i.posIn[r].unit=i.posOut[r].unit=i.tweenData[r].unit=s.unit);n.callActions("afterGetTweenData",arguments)},moveTargets:function(t){var a=this,i=null,o=null,r=null,s="",l=!1,c=-1,u=-1,f=a.checkProgress.bind(a);for(a.callActions("beforeMoveTargets",arguments),u=0;i=t.show[u];u++)o=new e.IMoveData,r=t.showPosData[u],s=i.isShown?"none":"show",l=a.willTransition(s,t.hasEffect,r.posIn,r.posOut),l&&c++,i.show(),o.posIn=r.posIn,o.posOut=r.posOut,o.statusChange=s,o.staggerIndex=c,o.operation=t,o.callback=l?f:null,i.move(o);for(u=0;i=t.toHide[u];u++)r=t.toHidePosData[u],o=new e.IMoveData,s="hide",l=a.willTransition(s,r.posIn,r.posOut),o.posIn=r.posIn,o.posOut=r.posOut,o.statusChange=s,o.staggerIndex=u,o.operation=t,o.callback=l?f:null,i.move(o);a.config.animation.animateResizeContainer&&(a.dom.parent.style[e.features.transitionProp]="height "+a.config.animation.duration+"ms ease, width "+a.config.animation.duration+"ms ease ",requestAnimationFrame(function(){t.startHeight!==t.newHeight&&t.viewportDeltaY!==t.startHeight-t.newHeight&&(a.dom.parent.style.height=t.newHeight+"px"),t.startWidth!==t.newWidth&&t.viewportDeltaX!==t.startWidth-t.newWidth&&(a.dom.parent.style.width=t.newWidth+"px")})),t.willChangeLayout&&(n.removeClass(a.dom.container,a.config.layout.ContainerClassName),n.addClass(a.dom.container,t.newContainerClassName)),a.callActions("afterMoveTargets",arguments)},hasEffect:function(){var t=this,e=["scale","translateX","translateY","translateZ","rotateX","rotateY","rotateZ"],n="",a=null,i=!1,o=-1,r=-1;if(1!==t.effectsIn.opacity)return t.callFilters("resultHasEffect",!0,arguments);for(r=0;n=e[r];r++)if(a=t.effectsIn[n],o="undefined"!==a.value?a.value:a,0!==o){i=!0;break}return t.callFilters("resultHasEffect",i,arguments)},willTransition:function(t,e,a,i){var o=this,r=!1;return r=!!n.isVisible(o.dom.container)&&(!!("none"!==t&&e||a.x!==i.x||a.y!==i.y)||!!o.config.animation.animateResizeTargets&&(a.width!==i.width||a.height!==i.height||a.marginRight!==i.marginRight||a.marginTop!==i.marginTop)),o.callFilters("resultWillTransition",r,arguments)},checkProgress:function(t){var e=this;e.targetsDone++,e.targetsBound===e.targetsDone&&e.cleanUp(t)},cleanUp:function(t){var a=this,i=null,o=null,r=null,s=null,l=-1;for(a.callActions("beforeCleanUp",arguments),a.targetsMoved=a.targetsImmovable=a.targetsBound=a.targetsDone=0,l=0;i=t.show[l];l++)i.cleanUp(),i.show();for(l=0;i=t.toHide[l];l++)i.cleanUp(),i.hide();if(t.willSort&&a.printSort(!1,t),a.dom.parent.style[e.features.transitionProp]=a.dom.parent.style.height=a.dom.parent.style.width=a.dom.parent.style.overflow=a.dom.parent.style[e.features.perspectiveProp]=a.dom.parent.style[e.features.perspectiveOriginProp]="",t.willChangeLayout&&(n.removeClass(a.dom.container,t.startContainerClassName),n.addClass(a.dom.container,t.newContainerClassName)),t.toRemove.length){for(l=0;i=a.targets[l];l++)t.toRemove.indexOf(i)>-1&&((o=i.dom.el.previousSibling)&&"#text"===o.nodeName&&(r=i.dom.el.nextSibling)&&"#text"===r.nodeName&&n.removeWhitespace(o),t.willSort||a.dom.parent.removeChild(i.dom.el),a.targets.splice(l,1),i.isInDom=!1,l--);a.origOrder=a.targets}t.willSort&&(a.targets=t.newOrder),a.state=t.newState,a.lastOperation=t,a.dom.targets=a.state.targets,e.events.fire("mixEnd",a.dom.container,{state:a.state,instance:a},a.dom.document),"function"==typeof a.config.callbacks.onMixEnd&&a.config.callbacks.onMixEnd.call(a.dom.container,a.state,a),t.hasFailed&&(e.events.fire("mixFail",a.dom.container,{state:a.state,instance:a},a.dom.document),"function"==typeof a.config.callbacks.onMixFail&&a.config.callbacks.onMixFail.call(a.dom.container,a.state,a),n.addClass(a.dom.container,n.getClassname(a.config.classNames,"container",a.config.classNames.modifierFailed))),"function"==typeof a.userCallback&&a.userCallback.call(a.dom.container,a.state,a),"function"==typeof a.userDeferred.resolve&&a.userDeferred.resolve(a.state),a.userCallback=null,a.userDeferred=null,a.lastClicked=null,a.isToggling=!1,a.isBusy=!1,a.queue.length&&(a.callActions("beforeReadQueueCleanUp",arguments),s=a.queue.shift(),a.userDeferred=s.deferred,a.isToggling=s.isToggling,a.lastClicked=s.triggerElement,s.instruction.command instanceof e.CommandMultimix?a.multimix.apply(a,s.args):a.dataset.apply(a,s.args)),a.callActions("afterCleanUp",arguments)},parseMultimixArgs:function(t){var a=this,i=new e.UserInstruction,o=null,r=-1;for(i.animate=a.config.animation.enable,i.command=new e.CommandMultimix,r=0;r<t.length;r++)o=t[r],null!==o&&("object"==typeof o?n.extend(i.command,o):"boolean"==typeof o?i.animate=o:"function"==typeof o&&(i.callback=o));return!i.command.insert||i.command.insert instanceof e.CommandInsert||(i.command.insert=a.parseInsertArgs([i.command.insert]).command),!i.command.remove||i.command.remove instanceof e.CommandRemove||(i.command.remove=a.parseRemoveArgs([i.command.remove]).command),!i.command.filter||i.command.filter instanceof e.CommandFilter||(i.command.filter=a.parseFilterArgs([i.command.filter]).command),!i.command.sort||i.command.sort instanceof e.CommandSort||(i.command.sort=a.parseSortArgs([i.command.sort]).command),!i.command.changeLayout||i.command.changeLayout instanceof e.CommandChangeLayout||(i.command.changeLayout=a.parseChangeLayoutArgs([i.command.changeLayout]).command),i=a.callFilters("instructionParseMultimixArgs",i,arguments),n.freeze(i),i},parseFilterArgs:function(t){var a=this,i=new e.UserInstruction,o=null,r=-1;for(i.animate=a.config.animation.enable,i.command=new e.CommandFilter,r=0;r<t.length;r++)o=t[r],"string"==typeof o?i.command.selector=o:null===o?i.command.collection=[]:"object"==typeof o&&n.isElement(o,a.dom.document)?i.command.collection=[o]:"object"==typeof o&&"undefined"!=typeof o.length?i.command.collection=n.arrayFromList(o):"object"==typeof o?n.extend(i.command,o):"boolean"==typeof o?i.animate=o:"function"==typeof o&&(i.callback=o);if(i.command.selector&&i.command.collection)throw new Error(e.messages.errorFilterInvalidArguments());return i=a.callFilters("instructionParseFilterArgs",i,arguments),n.freeze(i),i},parseSortArgs:function(t){var a=this,i=new e.UserInstruction,o=null,r="",s=-1;for(i.animate=a.config.animation.enable,i.command=new e.CommandSort,s=0;s<t.length;s++)if(o=t[s],null!==o)switch(typeof o){case"string":r=o;break;case"object":o.length&&(i.command.collection=n.arrayFromList(o));break;case"boolean":i.animate=o;break;case"function":i.callback=o}return r&&(i.command=a.parseSortString(r,i.command)),i=a.callFilters("instructionParseSortArgs",i,arguments),n.freeze(i),i},parseInsertArgs:function(t){var a=this,i=new e.UserInstruction,o=null,r=-1;for(i.animate=a.config.animation.enable,i.command=new e.CommandInsert,r=0;r<t.length;r++)o=t[r],null!==o&&("number"==typeof o?i.command.index=o:"string"==typeof o&&["before","after"].indexOf(o)>-1?i.command.position=o:"string"==typeof o?i.command.collection=n.arrayFromList(n.createElement(o).childNodes):"object"==typeof o&&n.isElement(o,a.dom.document)?i.command.collection.length?i.command.sibling=o:i.command.collection=[o]:"object"==typeof o&&o.length?i.command.collection.length?i.command.sibling=o[0]:i.command.collection=o:"object"==typeof o&&o.childNodes&&o.childNodes.length?i.command.collection.length?i.command.sibling=o.childNodes[0]:i.command.collection=n.arrayFromList(o.childNodes):"object"==typeof o?n.extend(i.command,o):"boolean"==typeof o?i.animate=o:"function"==typeof o&&(i.callback=o));if(i.command.index&&i.command.sibling)throw new Error(e.messages.errorInsertInvalidArguments());return!i.command.collection.length&&a.config.debug.showWarnings&&console.warn(e.messages.warningInsertNoElements()),i=a.callFilters("instructionParseInsertArgs",i,arguments),n.freeze(i),i},parseRemoveArgs:function(t){var a=this,i=new e.UserInstruction,o=null,r=null,s=-1;for(i.animate=a.config.animation.enable,i.command=new e.CommandRemove,s=0;s<t.length;s++)if(r=t[s],null!==r)switch(typeof r){case"number":a.targets[r]&&(i.command.targets[0]=a.targets[r]);break;case"string":i.command.collection=n.arrayFromList(a.dom.parent.querySelectorAll(r));break;case"object":r&&r.length?i.command.collection=r:n.isElement(r,a.dom.document)?i.command.collection=[r]:n.extend(i.command,r);break;case"boolean":i.animate=r;break;case"function":i.callback=r}if(i.command.collection.length)for(s=0;o=a.targets[s];s++)i.command.collection.indexOf(o.dom.el)>-1&&i.command.targets.push(o);return!i.command.targets.length&&a.config.debug.showWarnings&&console.warn(e.messages.warningRemoveNoElements()),n.freeze(i),i},parseDatasetArgs:function(t){var a=this,i=new e.UserInstruction,o=null,r=-1;for(i.animate=a.config.animation.enable,i.command=new e.CommandDataset,r=0;r<t.length;r++)if(o=t[r],null!==o)switch(typeof o){case"object":Array.isArray(o)||"number"==typeof o.length?i.command.dataset=o:n.extend(i.command,o);break;case"boolean":i.animate=o;break;case"function":i.callback=o}return n.freeze(i),i},parseChangeLayoutArgs:function(t){var a=this,i=new e.UserInstruction,o=null,r=-1;for(i.animate=a.config.animation.enable,i.command=new e.CommandChangeLayout,r=0;r<t.length;r++)if(o=t[r],null!==o)switch(typeof o){case"string":i.command.containerClassName=o;break;case"object":n.extend(i.command,o);break;case"boolean":i.animate=o;break;case"function":i.callback=o}return n.freeze(i),i},queueMix:function(t){var a=this,i=null,o="";return a.callActions("beforeQueueMix",arguments),i=n.defer(e.libraries),a.config.animation.queue&&a.queue.length<a.config.animation.queueLimit?(t.deferred=i,a.queue.push(t),a.config.controls.enable&&(a.isToggling?(a.buildToggleArray(t.instruction.command),o=a.getToggleSelector(),a.updateControls({filter:{selector:o}})):a.updateControls(t.instruction.command))):(a.config.debug.showWarnings&&console.warn(e.messages.warningMultimixInstanceQueueFull()),i.resolve(a.state),e.events.fire("mixBusy",a.dom.container,{state:a.state,instance:a},a.dom.document),"function"==typeof a.config.callbacks.onMixBusy&&a.config.callbacks.onMixBusy.call(a.dom.container,a.state,a)),
|
18
|
+
a.callFilters("promiseQueueMix",i.promise,arguments)},getDataOperation:function(t){var a=this,i=new e.Operation,o=[];if(i=a.callFilters("operationUnmappedGetDataOperation",i,arguments),a.dom.targets.length&&!(o=a.state.activeDataset||[]).length)throw new Error(e.messages.errorDatasetNotSet());return i.id=n.randomHex(),i.startState=a.state,i.startDataset=o,i.newDataset=t.slice(),a.diffDatasets(i),i.startOrder=a.targets,i.newOrder=i.show,a.config.animation.enable&&(a.getStartMixData(i),a.setInter(i),i.docState=n.getDocumentState(a.dom.document),a.getInterMixData(i),a.setFinal(i),a.getFinalMixData(i),a.parseEffects(),i.hasEffect=a.hasEffect(),a.getTweenData(i)),a.targets=i.show.slice(),i.newState=a.buildState(i),Array.prototype.push.apply(a.targets,i.toRemove),i=a.callFilters("operationMappedGetDataOperation",i,arguments)},diffDatasets:function(t){var a=this,i=[],o=[],r=[],s=null,l=null,c=null,u=null,f=null,h={},d="",m=-1;for(a.callActions("beforeDiffDatasets",arguments),m=0;s=t.newDataset[m];m++){if("undefined"==typeof(d=s[a.config.data.uidKey])||d.toString().length<1)throw new TypeError(e.messages.errorDatasetInvalidUidKey({uidKey:a.config.data.uidKey}));if(h[d])throw new Error(e.messages.errorDatasetDuplicateUid({uid:d}));h[d]=!0,(l=a.cache[d])instanceof e.Target?(a.config.data.dirtyCheck&&!n.deepEquals(s,l.data)&&(c=l.render(s),l.data=s,c!==l.dom.el&&(l.isInDom&&(l.unbindEvents(),a.dom.parent.replaceChild(c,l.dom.el)),l.isShown||(c.style.display="none"),l.dom.el=c,l.isInDom&&l.bindEvents())),c=l.dom.el):(l=new e.Target,l.init(null,a,s),l.hide()),l.isInDom?(f=l.dom.el.nextElementSibling,o.push(d),u&&(u.lastElementChild&&u.appendChild(a.dom.document.createTextNode(" ")),a.insertDatasetFrag(u,l.dom.el,r),u=null)):(u||(u=a.dom.document.createDocumentFragment()),u.lastElementChild&&u.appendChild(a.dom.document.createTextNode(" ")),u.appendChild(l.dom.el),l.isInDom=!0,l.unbindEvents(),l.bindEvents(),l.hide(),t.toShow.push(l),r.push(l)),t.show.push(l)}for(u&&(f=f||a.config.layout.siblingAfter,f&&u.appendChild(a.dom.document.createTextNode(" ")),a.insertDatasetFrag(u,f,r)),m=0;s=t.startDataset[m];m++)d=s[a.config.data.uidKey],l=a.cache[d],t.show.indexOf(l)<0?(t.hide.push(l),t.toHide.push(l),t.toRemove.push(l)):i.push(d);n.isEqualArray(i,o)||(t.willSort=!0),a.callActions("afterDiffDatasets",arguments)},insertDatasetFrag:function(t,e,a){var i=this,o=e?n.arrayFromList(i.dom.parent.children).indexOf(e):i.targets.length;for(i.dom.parent.insertBefore(t,e);a.length;)i.targets.splice(o,0,a.shift()),o++},willSort:function(t,e){var n=this,a=!1;return a=!!(n.config.behavior.liveSort||"random"===t.order||t.attribute!==e.attribute||t.order!==e.order||t.collection!==e.collection||null===t.next&&e.next||t.next&&null===e.next)||!(!t.next||!e.next)&&n.willSort(t.next,e.next),n.callFilters("resultWillSort",a,arguments)},show:function(){var t=this;return t.filter("all")},hide:function(){var t=this;return t.filter("none")},isMixing:function(){var t=this;return t.isBusy},filter:function(){var t=this,e=t.parseFilterArgs(arguments);return t.multimix({filter:e.command},e.animate,e.callback)},toggleOn:function(){var t=this,e=t.parseFilterArgs(arguments),n=e.command.selector,a="";return t.isToggling=!0,t.toggleArray.indexOf(n)<0&&t.toggleArray.push(n),a=t.getToggleSelector(),t.multimix({filter:a},e.animate,e.callback)},toggleOff:function(){var t=this,e=t.parseFilterArgs(arguments),n=e.command.selector,a=t.toggleArray.indexOf(n),i="";return t.isToggling=!0,a>-1&&t.toggleArray.splice(a,1),i=t.getToggleSelector(),t.multimix({filter:i},e.animate,e.callback)},sort:function(){var t=this,e=t.parseSortArgs(arguments);return t.multimix({sort:e.command},e.animate,e.callback)},changeLayout:function(){var t=this,e=t.parseChangeLayoutArgs(arguments);return t.multimix({changeLayout:e.command},e.animate,e.callback)},dataset:function(){var t=this,n=t.parseDatasetArgs(arguments),a=null,i=null,o=!1;return t.callActions("beforeDataset",arguments),t.isBusy?(i=new e.QueueItem,i.args=arguments,i.instruction=n,t.queueMix(i)):(n.callback&&(t.userCallback=n.callback),o=n.animate^t.config.animation.enable?n.animate:t.config.animation.enable,a=t.getDataOperation(n.command.dataset),t.goMix(o,a))},multimix:function(){var t=this,n=null,a=!1,i=null,o=t.parseMultimixArgs(arguments);return t.callActions("beforeMultimix",arguments),t.isBusy?(i=new e.QueueItem,i.args=arguments,i.instruction=o,i.triggerElement=t.lastClicked,i.isToggling=t.isToggling,t.queueMix(i)):(n=t.getOperation(o.command),t.config.controls.enable&&(o.command.filter&&!t.isToggling&&(t.toggleArray.length=0,t.buildToggleArray(n.command)),t.queue.length<1&&t.updateControls(n.command)),o.callback&&(t.userCallback=o.callback),a=o.animate^t.config.animation.enable?o.animate:t.config.animation.enable,t.callFilters("operationMultimix",n,arguments),t.goMix(a,n))},getOperation:function(t){var a=this,i=t.sort,o=t.filter,r=t.changeLayout,s=t.remove,l=t.insert,c=new e.Operation;return c=a.callFilters("operationUnmappedGetOperation",c,arguments),c.id=n.randomHex(),c.command=t,c.startState=a.state,c.triggerElement=a.lastClicked,a.isBusy?(a.config.debug.showWarnings&&console.warn(e.messages.warningGetOperationInstanceBusy()),null):(l&&a.insertTargets(l,c),s&&(c.toRemove=s.targets),c.startSort=c.newSort=c.startState.activeSort,c.startOrder=c.newOrder=a.targets,i&&(c.startSort=c.startState.activeSort,c.newSort=i,c.willSort=a.willSort(i,c.startState.activeSort),c.willSort&&a.sortOperation(c)),c.startFilter=c.startState.activeFilter,o?c.newFilter=o:c.newFilter=n.extend(new e.CommandFilter,c.startFilter),"all"===c.newFilter.selector?c.newFilter.selector=a.config.selectors.target:"none"===c.newFilter.selector&&(c.newFilter.selector=""),a.filterOperation(c),c.startContainerClassName=c.startState.activeContainerClassName,r?(c.newContainerClassName=r.containerClassName,c.newContainerClassName!==c.startContainerClassName&&(c.willChangeLayout=!0)):c.newContainerClassName=c.startContainerClassName,a.config.animation.enable&&(a.getStartMixData(c),a.setInter(c),c.docState=n.getDocumentState(a.dom.document),a.getInterMixData(c),a.setFinal(c),a.getFinalMixData(c),a.parseEffects(),c.hasEffect=a.hasEffect(),a.getTweenData(c)),c.willSort&&(a.targets=c.newOrder),c.newState=a.buildState(c),a.callFilters("operationMappedGetOperation",c,arguments))},tween:function(t,e){var n=null,a=null,i=-1,o=-1;for(e=Math.min(e,1),e=Math.max(e,0),o=0;n=t.show[o];o++)a=t.showPosData[o],n.applyTween(a,e);for(o=0;n=t.hide[o];o++)n.isShown&&n.hide(),(i=t.toHide.indexOf(n))>-1&&(a=t.toHidePosData[i],n.isShown||n.show(),n.applyTween(a,e))},insert:function(){var t=this,e=t.parseInsertArgs(arguments);return t.multimix({insert:e.command},e.animate,e.callback)},insertBefore:function(){var t=this,e=t.parseInsertArgs(arguments);return t.insert(e.command.collection,"before",e.command.sibling,e.animate,e.callback)},insertAfter:function(){var t=this,e=t.parseInsertArgs(arguments);return t.insert(e.command.collection,"after",e.command.sibling,e.animate,e.callback)},prepend:function(){var t=this,e=t.parseInsertArgs(arguments);return t.insert(0,e.command.collection,e.animate,e.callback)},append:function(){var t=this,e=t.parseInsertArgs(arguments);return t.insert(t.state.totalTargets,e.command.collection,e.animate,e.callback)},remove:function(){var t=this,e=t.parseRemoveArgs(arguments);return t.multimix({remove:e.command},e.animate,e.callback)},getConfig:function(t){var e=this,a=null;return a=t?n.getProperty(e.config,t):e.config,e.callFilters("valueGetConfig",a,arguments)},configure:function(t){var e=this;e.callActions("beforeConfigure",arguments),n.extend(e.config,t,!0,!0),e.callActions("afterConfigure",arguments)},getState:function(){var t=this,a=null;return a=new e.State,n.extend(a,t.state),n.freeze(a),t.callFilters("stateGetState",a,arguments)},forceRefresh:function(){var t=this;t.indexTargets()},forceRender:function(){var t=this,e=null,n=null,a="";for(a in t.cache)e=t.cache[a],n=e.render(e.data),n!==e.dom.el&&(e.isInDom&&(e.unbindEvents(),t.dom.parent.replaceChild(n,e.dom.el)),e.isShown||(n.style.display="none"),e.dom.el=n,e.isInDom&&e.bindEvents());t.state=t.buildState(t.lastOperation)},destroy:function(t){var n=this,a=null,i=null,o=0;for(n.callActions("beforeDestroy",arguments),o=0;a=n.controls[o];o++)a.removeBinding(n);for(o=0;i=n.targets[o];o++)t&&i.show(),i.unbindEvents();n.dom.container.id.match(/^MixItUp/)&&n.dom.container.removeAttribute("id"),delete e.instances[n.id],n.callActions("afterDestroy",arguments)}}),e.IMoveData=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.posIn=null,this.posOut=null,this.operation=null,this.callback=null,this.statusChange="",this.duration=-1,this.staggerIndex=-1,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.IMoveData),e.IMoveData.prototype=Object.create(e.Base.prototype),e.IMoveData.prototype.constructor=e.IMoveData,e.TargetDom=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.el=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.TargetDom),e.TargetDom.prototype=Object.create(e.Base.prototype),e.TargetDom.prototype.constructor=e.TargetDom,e.Target=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.id="",this.sortString="",this.mixer=null,this.callback=null,this.isShown=!1,this.isBound=!1,this.isExcluded=!1,this.isInDom=!1,this.handler=null,this.operation=null,this.data=null,this.dom=new e.TargetDom,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.Target),e.Target.prototype=Object.create(e.Base.prototype),n.extend(e.Target.prototype,{constructor:e.Target,init:function(t,n,a){var i=this,o="";if(i.callActions("beforeInit",arguments),i.mixer=n,t||(t=i.render(a)),i.cacheDom(t),i.bindEvents(),"none"!==i.dom.el.style.display&&(i.isShown=!0),a&&n.config.data.uidKey){if("undefined"==typeof(o=a[n.config.data.uidKey])||o.toString().length<1)throw new TypeError(e.messages.errorDatasetInvalidUidKey({uidKey:n.config.data.uidKey}));i.id=o,i.data=a,n.cache[o]=i}i.callActions("afterInit",arguments)},render:function(t){var a=this,i=null,o=null,r=null,s="";if(a.callActions("beforeRender",arguments),i=a.callFilters("renderRender",a.mixer.config.render.target,arguments),"function"!=typeof i)throw new TypeError(e.messages.errorDatasetRendererNotSet());return s=i(t),s&&"object"==typeof s&&n.isElement(s)?o=s:"string"==typeof s&&(r=document.createElement("div"),r.innerHTML=s,o=r.firstElementChild),a.callFilters("elRender",o,arguments)},cacheDom:function(t){var e=this;e.callActions("beforeCacheDom",arguments),e.dom.el=t,e.callActions("afterCacheDom",arguments)},getSortString:function(t){var e=this,n=e.dom.el.getAttribute("data-"+t)||"";e.callActions("beforeGetSortString",arguments),n=isNaN(1*n)?n.toLowerCase():1*n,e.sortString=n,e.callActions("afterGetSortString",arguments)},show:function(){var t=this;t.callActions("beforeShow",arguments),t.isShown||(t.dom.el.style.display="",t.isShown=!0),t.callActions("afterShow",arguments)},hide:function(){var t=this;t.callActions("beforeHide",arguments),t.isShown&&(t.dom.el.style.display="none",t.isShown=!1),t.callActions("afterHide",arguments)},move:function(t){var e=this;e.callActions("beforeMove",arguments),e.isExcluded||e.mixer.targetsMoved++,e.applyStylesIn(t),requestAnimationFrame(function(){e.applyStylesOut(t)}),e.callActions("afterMove",arguments)},applyTween:function(t,n){var a=this,i="",o=null,r=t.posIn,s=[],l=new e.StyleData,c=-1;for(a.callActions("beforeApplyTween",arguments),l.x=r.x,l.y=r.y,0===n?a.hide():a.isShown||a.show(),c=0;i=e.features.TWEENABLE[c];c++)if(o=t.tweenData[i],"x"===i){if(!o)continue;l.x=r.x+o*n}else if("y"===i){if(!o)continue;l.y=r.y+o*n}else if(o instanceof e.TransformData){if(!o.value)continue;l[i].value=r[i].value+o.value*n,l[i].unit=o.unit,s.push(i+"("+l[i].value+o.unit+")")}else{if(!o)continue;l[i]=r[i]+o*n,a.dom.el.style[i]=l[i]}(l.x||l.y)&&s.unshift("translate("+l.x+"px, "+l.y+"px)"),s.length&&(a.dom.el.style[e.features.transformProp]=s.join(" ")),a.callActions("afterApplyTween",arguments)},applyStylesIn:function(t){var n=this,a=t.posIn,i=1!==n.mixer.effectsIn.opacity,o=[];n.callActions("beforeApplyStylesIn",arguments),o.push("translate("+a.x+"px, "+a.y+"px)"),n.mixer.config.animation.animateResizeTargets&&("show"!==t.statusChange&&(n.dom.el.style.width=a.width+"px",n.dom.el.style.height=a.height+"px"),n.dom.el.style.marginRight=a.marginRight+"px",n.dom.el.style.marginBottom=a.marginBottom+"px"),i&&(n.dom.el.style.opacity=a.opacity),"show"===t.statusChange&&(o=o.concat(n.mixer.transformIn)),n.dom.el.style[e.features.transformProp]=o.join(" "),n.callActions("afterApplyStylesIn",arguments)},applyStylesOut:function(t){var n=this,a=[],i=[],o=n.mixer.config.animation.animateResizeTargets,r="undefined"!=typeof n.mixer.effectsIn.opacity;if(n.callActions("beforeApplyStylesOut",arguments),a.push(n.writeTransitionRule(e.features.transformRule,t.staggerIndex)),"none"!==t.statusChange&&a.push(n.writeTransitionRule("opacity",t.staggerIndex,t.duration)),o&&(a.push(n.writeTransitionRule("width",t.staggerIndex,t.duration)),a.push(n.writeTransitionRule("height",t.staggerIndex,t.duration)),a.push(n.writeTransitionRule("margin",t.staggerIndex,t.duration))),!t.callback)return n.mixer.targetsImmovable++,void(n.mixer.targetsMoved===n.mixer.targetsImmovable&&n.mixer.cleanUp(t.operation));switch(n.operation=t.operation,n.callback=t.callback,!n.isExcluded&&n.mixer.targetsBound++,n.isBound=!0,n.applyTransition(a),o&&t.posOut.width>0&&t.posOut.height>0&&(n.dom.el.style.width=t.posOut.width+"px",n.dom.el.style.height=t.posOut.height+"px",n.dom.el.style.marginRight=t.posOut.marginRight+"px",n.dom.el.style.marginBottom=t.posOut.marginBottom+"px"),n.mixer.config.animation.nudge||"hide"!==t.statusChange||i.push("translate("+t.posOut.x+"px, "+t.posOut.y+"px)"),t.statusChange){case"hide":r&&(n.dom.el.style.opacity=n.mixer.effectsOut.opacity),i=i.concat(n.mixer.transformOut);break;case"show":r&&(n.dom.el.style.opacity=1)}(n.mixer.config.animation.nudge||!n.mixer.config.animation.nudge&&"hide"!==t.statusChange)&&i.push("translate("+t.posOut.x+"px, "+t.posOut.y+"px)"),n.dom.el.style[e.features.transformProp]=i.join(" "),n.callActions("afterApplyStylesOut",arguments)},writeTransitionRule:function(t,e,n){var a=this,i=a.getDelay(e),o="";return o=t+" "+(n>0?n:a.mixer.config.animation.duration)+"ms "+i+"ms "+("opacity"===t?"linear":a.mixer.config.animation.easing),a.callFilters("ruleWriteTransitionRule",o,arguments)},getDelay:function(t){var e=this,n=-1;return"function"==typeof e.mixer.config.animation.staggerSequence&&(t=e.mixer.config.animation.staggerSequence.call(e,t,e.state)),n=e.mixer.staggerDuration?t*e.mixer.staggerDuration:0,e.callFilters("delayGetDelay",n,arguments)},applyTransition:function(t){var n=this,a=t.join(", ");n.callActions("beforeApplyTransition",arguments),n.dom.el.style[e.features.transitionProp]=a,n.callActions("afterApplyTransition",arguments)},handleTransitionEnd:function(t){var e=this,n=t.propertyName,a=e.mixer.config.animation.animateResizeTargets;e.callActions("beforeHandleTransitionEnd",arguments),e.isBound&&t.target.matches(e.mixer.config.selectors.target)&&(n.indexOf("transform")>-1||n.indexOf("opacity")>-1||a&&n.indexOf("height")>-1||a&&n.indexOf("width")>-1||a&&n.indexOf("margin")>-1)&&(e.callback.call(e,e.operation),e.isBound=!1,e.callback=null,e.operation=null),e.callActions("afterHandleTransitionEnd",arguments)},eventBus:function(t){var e=this;switch(e.callActions("beforeEventBus",arguments),t.type){case"webkitTransitionEnd":case"transitionend":e.handleTransitionEnd(t)}e.callActions("afterEventBus",arguments)},unbindEvents:function(){var t=this;t.callActions("beforeUnbindEvents",arguments),n.off(t.dom.el,"webkitTransitionEnd",t.handler),n.off(t.dom.el,"transitionend",t.handler),t.callActions("afterUnbindEvents",arguments)},bindEvents:function(){var t=this,a="";t.callActions("beforeBindEvents",arguments),a="webkit"===e.features.transitionPrefix?"webkitTransitionEnd":"transitionend",t.handler=function(e){return t.eventBus(e)},n.on(t.dom.el,a,t.handler),t.callActions("afterBindEvents",arguments)},getPosData:function(n){var a=this,i={},o=null,r=new e.StyleData;return a.callActions("beforeGetPosData",arguments),r.x=a.dom.el.offsetLeft,r.y=a.dom.el.offsetTop,(a.mixer.config.animation.animateResizeTargets||n)&&(o=a.dom.el.getBoundingClientRect(),r.top=o.top,r.right=o.right,r.bottom=o.bottom,r.left=o.left,r.width=o.width,r.height=o.height),a.mixer.config.animation.animateResizeTargets&&(i=t.getComputedStyle(a.dom.el),r.marginBottom=parseFloat(i.marginBottom),r.marginRight=parseFloat(i.marginRight)),a.callFilters("posDataGetPosData",r,arguments)},cleanUp:function(){var t=this;t.callActions("beforeCleanUp",arguments),t.dom.el.style[e.features.transformProp]="",t.dom.el.style[e.features.transitionProp]="",t.dom.el.style.opacity="",t.mixer.config.animation.animateResizeTargets&&(t.dom.el.style.width="",t.dom.el.style.height="",t.dom.el.style.marginRight="",t.dom.el.style.marginBottom=""),t.callActions("afterCleanUp",arguments)}}),e.Collection=function(t){var e=null,a=-1;for(this.callActions("beforeConstruct"),a=0;e=t[a];a++)this[a]=e;this.length=t.length,this.callActions("afterConstruct"),n.freeze(this)},e.BaseStatic.call(e.Collection),e.Collection.prototype=Object.create(e.Base.prototype),n.extend(e.Collection.prototype,{constructor:e.Collection,mixitup:function(t){var a=this,i=null,o=Array.prototype.slice.call(arguments),r=[],s=-1;for(this.callActions("beforeMixitup"),o.shift(),s=0;i=a[s];s++)r.push(i[t].apply(i,o));return a.callFilters("promiseMixitup",n.all(r,e.libraries),arguments)}}),e.Operation=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.id="",this.args=[],this.command=null,this.showPosData=[],this.toHidePosData=[],this.startState=null,this.newState=null,this.docState=null,this.willSort=!1,this.willChangeLayout=!1,this.hasEffect=!1,this.hasFailed=!1,this.triggerElement=null,this.show=[],this.hide=[],this.matching=[],this.toShow=[],this.toHide=[],this.toMove=[],this.toRemove=[],this.startOrder=[],this.newOrder=[],this.startSort=null,this.newSort=null,this.startFilter=null,this.newFilter=null,this.startDataset=null,this.newDataset=null,this.viewportDeltaX=0,this.viewportDeltaY=0,this.startX=0,this.startY=0,this.startHeight=0,this.startWidth=0,this.newX=0,this.newY=0,this.newHeight=0,this.newWidth=0,this.startContainerClassName="",this.startDisplay="",this.newContainerClassName="",this.newDisplay="",this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.Operation),e.Operation.prototype=Object.create(e.Base.prototype),e.Operation.prototype.constructor=e.Operation,e.State=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.id="",this.activeFilter=null,this.activeSort=null,this.activeContainerClassName="",this.container=null,this.targets=[],this.hide=[],this.show=[],this.matching=[],this.totalTargets=-1,this.totalShow=-1,this.totalHide=-1,this.totalMatching=-1,this.hasFailed=!1,this.triggerElement=null,this.activeDataset=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.State),e.State.prototype=Object.create(e.Base.prototype),e.State.prototype.constructor=e.State,e.UserInstruction=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.command={},this.animate=!1,this.callback=null,this.callActions("afterConstruct"),n.seal(this)},e.BaseStatic.call(e.UserInstruction),e.UserInstruction.prototype=Object.create(e.Base.prototype),e.UserInstruction.prototype.constructor=e.UserInstruction,e.Messages=function(){e.Base.call(this),this.callActions("beforeConstruct"),this.ERROR_FACTORY_INVALID_CONTAINER="[MixItUp] An invalid selector or element reference was passed to the mixitup factory function",this.ERROR_FACTORY_CONTAINER_NOT_FOUND="[MixItUp] The provided selector yielded no container element",this.ERROR_CONFIG_INVALID_ANIMATION_EFFECTS="[MixItUp] Invalid value for `animation.effects`",this.ERROR_CONFIG_INVALID_CONTROLS_SCOPE="[MixItUp] Invalid value for `controls.scope`",this.ERROR_CONFIG_INVALID_PROPERTY='[MixitUp] Invalid configuration object property "${erroneous}"${suggestion}',this.ERROR_CONFIG_INVALID_PROPERTY_SUGGESTION='. Did you mean "${probableMatch}"?',this.ERROR_CONFIG_DATA_UID_KEY_NOT_SET="[MixItUp] To use the dataset API, a UID key must be specified using `data.uidKey`",this.ERROR_DATASET_INVALID_UID_KEY='[MixItUp] The specified UID key "${uidKey}" is not present on one or more dataset items',this.ERROR_DATASET_DUPLICATE_UID='[MixItUp] The UID "${uid}" was found on two or more dataset items. UIDs must be unique.',this.ERROR_INSERT_INVALID_ARGUMENTS="[MixItUp] Please provider either an index or a sibling and position to insert, not both",this.ERROR_INSERT_PREEXISTING_ELEMENT="[MixItUp] An element to be inserted already exists in the container",this.ERROR_FILTER_INVALID_ARGUMENTS="[MixItUp] Please provide either a selector or collection `.filter()`, not both",this.ERROR_DATASET_NOT_SET="[MixItUp] To use the dataset API with pre-rendered targets, a starting dataset must be set using `load.dataset`",this.ERROR_DATASET_PRERENDERED_MISMATCH="[MixItUp] `load.dataset` does not match pre-rendered targets",this.ERROR_DATASET_RENDERER_NOT_SET="[MixItUp] To insert an element via the dataset API, a target renderer function must be provided to `render.target`",this.ERROR_SORT_NON_EXISTENT_ELEMENT="[MixItUp] An element to be sorted does not already exist in the container",this.WARNING_FACTORY_PREEXISTING_INSTANCE="[MixItUp] WARNING: This element already has an active MixItUp instance. The provided configuration object will be ignored. If you wish to perform additional methods on this instance, please create a reference.",this.WARNING_INSERT_NO_ELEMENTS="[MixItUp] WARNING: No valid elements were passed to `.insert()`",this.WARNING_REMOVE_NO_ELEMENTS="[MixItUp] WARNING: No valid elements were passed to `.remove()`",this.WARNING_MULTIMIX_INSTANCE_QUEUE_FULL="[MixItUp] WARNING: An operation was requested but the MixItUp instance was busy. The operation was rejected because the queue is full or queuing is disabled.",this.WARNING_GET_OPERATION_INSTANCE_BUSY="[MixItUp] WARNING: Operations can be be created while the MixItUp instance is busy.",this.WARNING_NO_PROMISE_IMPLEMENTATION="[MixItUp] WARNING: No Promise implementations could be found. If you wish to use promises with MixItUp please install an ES6 Promise polyfill.",this.WARNING_INCONSISTENT_SORTING_ATTRIBUTES='[MixItUp] WARNING: The requested sorting data attribute "${attribute}" was not present on one or more target elements which may product unexpected sort output',this.callActions("afterConstruct"),this.compileTemplates(),n.seal(this)},e.BaseStatic.call(e.Messages),e.Messages.prototype=Object.create(e.Base.prototype),e.Messages.prototype.constructor=e.Messages,e.Messages.prototype.compileTemplates=function(){var t="",e="";for(t in this)"string"==typeof(e=this[t])&&(this[n.camelCase(t)]=n.template(e))},e.messages=new e.Messages,e.Facade=function(t){e.Base.call(this),this.callActions("beforeConstruct",arguments),this.configure=t.configure.bind(t),this.show=t.show.bind(t),this.hide=t.hide.bind(t),this.filter=t.filter.bind(t),this.toggleOn=t.toggleOn.bind(t),this.toggleOff=t.toggleOff.bind(t),this.sort=t.sort.bind(t),this.changeLayout=t.changeLayout.bind(t),this.multimix=t.multimix.bind(t),this.dataset=t.dataset.bind(t),this.tween=t.tween.bind(t),this.insert=t.insert.bind(t),this.insertBefore=t.insertBefore.bind(t),this.insertAfter=t.insertAfter.bind(t),this.prepend=t.prepend.bind(t),this.append=t.append.bind(t),this.remove=t.remove.bind(t),this.destroy=t.destroy.bind(t),this.forceRefresh=t.forceRefresh.bind(t),this.forceRender=t.forceRender.bind(t),this.isMixing=t.isMixing.bind(t),this.getOperation=t.getOperation.bind(t),this.getConfig=t.getConfig.bind(t),this.getState=t.getState.bind(t),this.callActions("afterConstruct",arguments),n.freeze(this),n.seal(this)},e.BaseStatic.call(e.Facade),e.Facade.prototype=Object.create(e.Base.prototype),e.Facade.prototype.constructor=e.Facade,"object"==typeof exports&&"object"==typeof module?module.exports=e:"function"==typeof define&&define.amd?define(function(){return e}):"undefined"!=typeof t.mixitup&&"function"==typeof t.mixitup||(t.mixitup=e),e.BaseStatic.call(e.constructor),e.NAME="mixitup",e.CORE_VERSION="3.3.1"}(window);
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/**!
|
2
|
+
* MixItUp MultiFilter v3.3.0
|
3
|
+
* A UI-builder for powerful multidimensional filtering
|
4
|
+
* Build 80e5e308-3902-4e4f-8c8c-4e9b732f7132
|
5
|
+
*
|
6
|
+
* Requires mixitup.js >= v^3.1.2
|
7
|
+
*
|
8
|
+
* @copyright Copyright 2014-2017 KunkaLabs Limited.
|
9
|
+
* @author KunkaLabs Limited.
|
10
|
+
* @link https://www.kunkalabs.com/mixitup-multifilter/
|
11
|
+
*
|
12
|
+
* @license Commercial use requires a commercial license.
|
13
|
+
* https://www.kunkalabs.com/mixitup-multifilter/licenses/
|
14
|
+
*
|
15
|
+
* Non-commercial use permitted under same terms as license.
|
16
|
+
* http://creativecommons.org/licenses/by-nc/3.0/
|
17
|
+
*/
|
18
|
+
!function(e){"use strict";var t=function(e){var i=e.h;if(!e.CORE_VERSION||!i.compareVersions(t.REQUIRE_CORE_VERSION,e.CORE_VERSION))throw new Error("[MixItUp Multifilter] MixItUp Multifilter v"+t.EXTENSION_VERSION+" requires at least MixItUp v"+t.REQUIRE_CORE_VERSION);e.ConfigCallbacks.registerAction("afterConstruct","multifilter",function(){this.onParseFilterGroups=null}),e.ConfigMultifilter=function(){this.enable=!1,this.logicWithinGroup="or",this.logicBetweenGroups="and",this.minSearchLength=3,this.parseOn="change",this.keyupThrottleDuration=350,i.seal(this)},e.Config.registerAction("beforeConstruct","multifilter",function(){this.multifilter=new e.ConfigMultifilter}),e.MultifilterFormEventTracker=function(){this.form=null,this.totalBound=0,this.totalHandled=0,i.seal(this)},e.FilterGroupDom=function(){this.el=null,this.form=null,i.seal(this)},e.FilterGroup=function(){this.name="",this.dom=new e.FilterGroupDom,this.activeSelectors=[],this.activeToggles=[],this.handler=null,this.mixer=null,this.logic="or",this.parseOn="change",this.keyupTimeout=-1,i.seal(this)},i.extend(e.FilterGroup.prototype,{init:function(e,t){var i=this,r=e.getAttribute("data-logic");i.dom.el=e,this.name=i.dom.el.getAttribute("data-filter-group")||"",i.cacheDom(),i.dom.form&&i.enableButtons(),i.mixer=t,(r&&"and"===r.toLowerCase()||"and"===t.config.multifilter.logicWithinGroup)&&(i.logic="and"),i.bindEvents()},cacheDom:function(){var e=this;e.dom.form=i.closestParent(e.dom.el,"form",!0)},enableButtons:function(){var e=this,t=e.dom.form.querySelectorAll('button[type="submit"]:disabled'),i=null,r=-1;for(r=0;i=t[r];r++)i.disabled&&(i.disabled=!1)},bindEvents:function(){var e=this;e.handler=function(t){switch(t.type){case"reset":case"submit":e.handleFormEvent(t);break;default:e["handle"+i.pascalCase(t.type)](t)}},i.on(e.dom.el,"click",e.handler),i.on(e.dom.el,"change",e.handler),i.on(e.dom.el,"keyup",e.handler),e.dom.form&&(i.on(e.dom.form,"reset",e.handler),i.on(e.dom.form,"submit",e.handler))},unbindEvents:function(){var e=this;i.off(e.dom.el,"click",e.handler),i.off(e.dom.el,"change",e.handler),i.off(e.dom.el,"keyup",e.handler),e.dom.form&&(i.off(e.dom.form,"reset",e.handler),i.off(e.dom.form,"submit",e.handler)),e.handler=null},handleClick:function(e){var t=this,r=i.closestParent(e.target,"[data-filter], [data-toggle]",!0),o="",l=-1,n="";r&&((o=t.mixer.config.selectors.control)&&!r.matches(o)||(e.stopPropagation(),r.matches("[data-filter]")?(n=r.getAttribute("data-filter"),t.activeSelectors=t.activeToggles=[n]):r.matches("[data-toggle]")&&(n=r.getAttribute("data-toggle"),(l=t.activeToggles.indexOf(n))>-1?t.activeToggles.splice(l,1):t.activeToggles.push(n),"and"===t.logic?t.activeSelectors=[t.activeToggles]:t.activeSelectors=t.activeToggles),t.updateControls(),"change"===t.mixer.config.multifilter.parseOn&&t.mixer.parseFilterGroups()))},handleChange:function(e){var t=this,i=e.target;switch(e.stopPropagation(),i.type){case"text":case"search":case"email":case"select-one":case"radio":t.getSingleValue(i);break;case"checkbox":case"select-multiple":t.getMultipleValues(i)}"change"===t.mixer.config.multifilter.parseOn&&t.mixer.parseFilterGroups()},handleKeyup:function(e){var t=this,i=e.target;if(!(["text","search","email"].indexOf(i.type)<0)){if("change"!==t.mixer.config.multifilter.parseOn)return void t.mixer.getSingleValue(i);clearTimeout(t.keyupTimeout),t.keyupTimeout=setTimeout(function(){t.getSingleValue(i),t.mixer.parseFilterGroups()},t.mixer.config.multifilter.keyupThrottleDuration)}},handleFormEvent:function(t){var i=this,r=null,o=null,l=-1;if("submit"===t.type&&t.preventDefault(),"reset"===t.type&&(i.activeToggles=[],i.activeSelectors=[],i.updateControls()),i.mixer.multifilterFormEventTracker)r=i.mixer.multifilterFormEventTracker;else for(r=i.mixer.multifilterFormEventTracker=new e.MultifilterFormEventTracker,r.form=t.target,l=0;o=i.mixer.filterGroups[l];l++)o.dom.form===t.target&&r.totalBound++;t.target===r.form&&(r.totalHandled++,r.totalHandled===r.totalBound&&(i.mixer.multifilterFormEventTracker=null,"submit"!==t.type&&"change"!==i.mixer.config.multifilter.parseOn||i.mixer.parseFilterGroups()))},getSingleValue:function(e){var t=this,i="",r="",o="";if(e.type.match(/text|search|email/g)){if(i=e.getAttribute("data-search-attribute"),!i)throw new Error("[MixItUp MultiFilter] A valid `data-search-attribute` must be present on text inputs");if(e.value.length<t.mixer.config.multifilter.minSearchLength)return void(t.activeSelectors=t.activeToggles=[""]);o=e.value.replace(/\W+/g," ").toLowerCase().trim(),r="["+i+'*="'+o+'"]'}else r=e.value;"string"==typeof e.value&&(t.activeSelectors=t.activeToggles=[r])},getMultipleValues:function(e){var t=this,i=[],r="",o=null,l=null,n=-1;switch(e.type){case"checkbox":r='input[type="checkbox"]';break;case"select-multiple":r="option"}for(l=t.dom.el.querySelectorAll(r),n=0;o=l[n];n++)(o.checked||o.selected)&&o.value&&i.push(o.value);t.activeToggles=i,"and"===t.logic?t.activeSelectors=[i]:t.activeSelectors=i},updateControls:function(e){var t=this,i=null,r="filter",o=-1;for(e=e||t.dom.el.querySelectorAll("[data-filter], [data-toggle]"),o=0;i=e[o];o++)i.getAttribute("data-toggle")&&(r="toggle"),t.updateControl(i,r)},updateControl:function(e,t){var r=this,o=e.getAttribute("data-"+t),l="";l=i.getClassname(r.mixer.config.classNames,t,r.mixer.config.classNames.modifierActive),r.activeToggles.indexOf(o)>-1?i.addClass(e,l):i.removeClass(e,l)},updateUi:function(){var e=this,t=e.dom.el.querySelectorAll("[data-filter], [data-toggle]"),i=e.dom.el.querySelectorAll('input[type="radio"], input[type="checkbox"], option'),r=!1,o=null,l=-1;for(t.length&&e.updateControls(t,!0),l=0;o=i[l];l++)switch(r=e.activeToggles.indexOf(o.value)>-1,o.tagName.toLowerCase()){case"option":o.selected=r;break;case"input":o.checked=r}}}),e.MixerDom.registerAction("afterConstruct","multifilter",function(){this.filterGroups=[]}),e.Mixer.registerAction("afterConstruct","multifilter",function(){this.filterGroups=[],this.filterGroupsHash={},this.multifilterFormEventTracker=null}),e.Mixer.registerAction("afterCacheDom","multifilter",function(){var t=this,i=null;if(t.config.multifilter.enable){switch(t.config.controls.scope){case"local":i=t.dom.container;break;case"global":i=t.dom.document;break;default:throw new Error(e.messages.ERROR_CONFIG_INVALID_CONTROLS_SCOPE)}t.dom.filterGroups=i.querySelectorAll("[data-filter-group]")}}),e.Mixer.registerAction("beforeInitControls","multifilter",function(){var e=this;e.config.multifilter.enable&&(e.config.controls.live=!0)}),e.Mixer.registerAction("afterSanitizeConfig","multifilter",function(){var e=this;e.config.multifilter.logicBetweenGroups=e.config.multifilter.logicBetweenGroups.toLowerCase().trim(),e.config.multifilter.logicWithinGroup=e.config.multifilter.logicWithinGroup.toLowerCase().trim()}),e.Mixer.registerAction("afterAttach","multifilter",function(){var e=this;e.dom.filterGroups.length&&e.indexFilterGroups()}),e.Mixer.registerAction("afterUpdateControls","multifilter",function(){var e=this,t=null,i=-1;for(i=0;t=e.filterGroups[i];i++)t.updateControls()}),e.Mixer.registerAction("beforeDestroy","multifilter",function(){var e=this,t=null,i=-1;for(i=0;t=e.filterGroups[i];i++)t.unbindEvents()}),e.Mixer.extend({indexFilterGroups:function(){var t=this,i=null,r=null,o=-1;for(o=0;r=t.dom.filterGroups[o];o++)if(i=new e.FilterGroup,i.init(r,t),t.filterGroups.push(i),i.name){if("undefined"!=typeof t.filterGroupsHash[i.name])throw new Error('[MixItUp MultiFilter] A filter group with name "'+i.name+'" already exists');t.filterGroupsHash[i.name]=i}},parseParseFilterGroupsArgs:function(t){var r=this,o=new e.UserInstruction,l=null,n=-1;for(o.animate=r.config.animation.enable,o.command=new e.CommandFilter,n=0;n<t.length;n++)l=t[n],"boolean"==typeof l?o.animate=l:"function"==typeof l&&(o.callback=l);return i.freeze(o),o},getFilterGroupPaths:function(){var e=this,t=null,r=null,o=null,l=[],n=[],a=[],s=-1;for(s=0;s<e.filterGroups.length;s++)(o=e.filterGroups[s].activeSelectors).length&&(l.push(o),a.push(0));return t=function(){var e=null,t=[],r=-1;for(r=0;r<l.length;r++)e=l[r][a[r]],Array.isArray(e)&&(e=e.join("")),t.push(e);t=i.clean(t),n.push(t)},r=function(e){e=e||0;for(var i=l[e];a[e]<i.length;)e<l.length-1?r(e+1):t(),a[e]++;a[e]=0},l.length?(r(),n):""},buildSelectorFromPaths:function(e){var t=this,i=null,r=[],o="",l="",n=-1;if(!e.length)return"";if("or"===t.config.multifilter.logicBetweenGroups&&(l=", "),e.length>1){for(n=0;n<e.length;n++)i=e[n],o=i.join(l),r.indexOf(o)<0&&r.push(o);return r.join(", ")}return e[0].join(l)},parseFilterGroups:function(){var e=this,t=e.parseFilterArgs(arguments),i=e.getFilterGroupPaths(),r=e.buildSelectorFromPaths(i),o=null,l={};return""===r&&(r=e.config.controls.toggleDefault),t.command.selector=r,l.filter=t.command,"function"==typeof(o=e.config.callbacks.onParseFilterGroups)&&(l=o(l)),e.multimix(l,t.animate,t.callback)},setFilterGroupSelectors:function(e,t){var i=this,r=null;if(t=Array.isArray(t)?t:[t],"undefined"==typeof(r=i.filterGroupsHash[e]))throw new Error('[MixItUp MultiFilter] No filter group could be found with the name "'+e+'"');r.activeToggles=t.slice(),"and"===r.logic?r.activeSelectors=[r.activeToggles]:r.activeSelectors=r.activeToggles,r.updateUi(r.activeToggles)},getFilterGroupSelectors:function(e){var t=this,i=null;if("undefined"==typeof(i=t.filterGroupsHash[e]))throw new Error('[MixItUp MultiFilter] No filter group could be found with the name "'+e+'"');return i.activeToggles.slice()}}),e.Facade.registerAction("afterConstruct","multifilter",function(e){this.parseFilterGroups=e.parseFilterGroups.bind(e),this.setFilterGroupSelectors=e.setFilterGroupSelectors.bind(e),this.getFilterGroupSelectors=e.getFilterGroupSelectors.bind(e)})};if(t.TYPE="mixitup-extension",t.NAME="mixitup-multifilter",t.EXTENSION_VERSION="3.3.0",t.REQUIRE_CORE_VERSION="^3.1.2","object"==typeof exports&&"object"==typeof module)module.exports=t;else if("function"==typeof define&&define.amd)define(function(){return t});else{if(!e.mixitup||"function"!=typeof e.mixitup)throw new Error("[MixItUp MultiFilter] MixItUp core not found");t(e.mixitup)}}(window);
|
@@ -0,0 +1,3 @@
|
|
1
|
+
/*! modernizr 3.6.0 (Custom Build) | MIT *
|
2
|
+
* https://modernizr.com/download/?-setclasses !*/
|
3
|
+
!function(n,e,s){function o(n,e){return typeof n===e}function a(){var n,e,s,a,i,l,r;for(var c in f)if(f.hasOwnProperty(c)){if(n=[],e=f[c],e.name&&(n.push(e.name.toLowerCase()),e.options&&e.options.aliases&&e.options.aliases.length))for(s=0;s<e.options.aliases.length;s++)n.push(e.options.aliases[s].toLowerCase());for(a=o(e.fn,"function")?e.fn():e.fn,i=0;i<n.length;i++)l=n[i],r=l.split("."),1===r.length?Modernizr[r[0]]=a:(!Modernizr[r[0]]||Modernizr[r[0]]instanceof Boolean||(Modernizr[r[0]]=new Boolean(Modernizr[r[0]])),Modernizr[r[0]][r[1]]=a),t.push((a?"":"no-")+r.join("-"))}}function i(n){var e=r.className,s=Modernizr._config.classPrefix||"";if(c&&(e=e.baseVal),Modernizr._config.enableJSClass){var o=new RegExp("(^|\\s)"+s+"no-js(\\s|$)");e=e.replace(o,"$1"+s+"js$2")}Modernizr._config.enableClasses&&(e+=" "+s+n.join(" "+s),c?r.className.baseVal=e:r.className=e)}var t=[],f=[],l={_version:"3.6.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(n,e){var s=this;setTimeout(function(){e(s[n])},0)},addTest:function(n,e,s){f.push({name:n,fn:e,options:s})},addAsyncTest:function(n){f.push({name:null,fn:n})}},Modernizr=function(){};Modernizr.prototype=l,Modernizr=new Modernizr;var r=e.documentElement,c="svg"===r.nodeName.toLowerCase();a(),i(t),delete l.addTest,delete l.addAsyncTest;for(var u=0;u<Modernizr._q.length;u++)Modernizr._q[u]();n.Modernizr=Modernizr}(window,document);
|
@@ -0,0 +1,2514 @@
|
|
1
|
+
/*! nouislider - 14.1.1 - 12/15/2019 */
|
2
|
+
(function(factory) {
|
3
|
+
if (typeof define === "function" && define.amd) {
|
4
|
+
// AMD. Register as an anonymous module.
|
5
|
+
define([], factory);
|
6
|
+
} else if (typeof exports === "object") {
|
7
|
+
// Node/CommonJS
|
8
|
+
module.exports = factory();
|
9
|
+
} else {
|
10
|
+
// Browser globals
|
11
|
+
window.noUiSlider = factory();
|
12
|
+
}
|
13
|
+
})(function() {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
var VERSION = "14.1.1";
|
17
|
+
|
18
|
+
//region Helper Methods
|
19
|
+
|
20
|
+
function isValidFormatter(entry) {
|
21
|
+
return typeof entry === "object" && typeof entry.to === "function" && typeof entry.from === "function";
|
22
|
+
}
|
23
|
+
|
24
|
+
function removeElement(el) {
|
25
|
+
el.parentElement.removeChild(el);
|
26
|
+
}
|
27
|
+
|
28
|
+
function isSet(value) {
|
29
|
+
return value !== null && value !== undefined;
|
30
|
+
}
|
31
|
+
|
32
|
+
// Bindable version
|
33
|
+
function preventDefault(e) {
|
34
|
+
e.preventDefault();
|
35
|
+
}
|
36
|
+
|
37
|
+
// Removes duplicates from an array.
|
38
|
+
function unique(array) {
|
39
|
+
return array.filter(function(a) {
|
40
|
+
return !this[a] ? (this[a] = true) : false;
|
41
|
+
}, {});
|
42
|
+
}
|
43
|
+
|
44
|
+
// Round a value to the closest 'to'.
|
45
|
+
function closest(value, to) {
|
46
|
+
return Math.round(value / to) * to;
|
47
|
+
}
|
48
|
+
|
49
|
+
// Current position of an element relative to the document.
|
50
|
+
function offset(elem, orientation) {
|
51
|
+
var rect = elem.getBoundingClientRect();
|
52
|
+
var doc = elem.ownerDocument;
|
53
|
+
var docElem = doc.documentElement;
|
54
|
+
var pageOffset = getPageOffset(doc);
|
55
|
+
|
56
|
+
// getBoundingClientRect contains left scroll in Chrome on Android.
|
57
|
+
// I haven't found a feature detection that proves this. Worst case
|
58
|
+
// scenario on mis-match: the 'tap' feature on horizontal sliders breaks.
|
59
|
+
if (/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)) {
|
60
|
+
pageOffset.x = 0;
|
61
|
+
}
|
62
|
+
|
63
|
+
return orientation
|
64
|
+
? rect.top + pageOffset.y - docElem.clientTop
|
65
|
+
: rect.left + pageOffset.x - docElem.clientLeft;
|
66
|
+
}
|
67
|
+
|
68
|
+
// Checks whether a value is numerical.
|
69
|
+
function isNumeric(a) {
|
70
|
+
return typeof a === "number" && !isNaN(a) && isFinite(a);
|
71
|
+
}
|
72
|
+
|
73
|
+
// Sets a class and removes it after [duration] ms.
|
74
|
+
function addClassFor(element, className, duration) {
|
75
|
+
if (duration > 0) {
|
76
|
+
addClass(element, className);
|
77
|
+
setTimeout(function() {
|
78
|
+
removeClass(element, className);
|
79
|
+
}, duration);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
// Limits a value to 0 - 100
|
84
|
+
function limit(a) {
|
85
|
+
return Math.max(Math.min(a, 100), 0);
|
86
|
+
}
|
87
|
+
|
88
|
+
// Wraps a variable as an array, if it isn't one yet.
|
89
|
+
// Note that an input array is returned by reference!
|
90
|
+
function asArray(a) {
|
91
|
+
return Array.isArray(a) ? a : [a];
|
92
|
+
}
|
93
|
+
|
94
|
+
// Counts decimals
|
95
|
+
function countDecimals(numStr) {
|
96
|
+
numStr = String(numStr);
|
97
|
+
var pieces = numStr.split(".");
|
98
|
+
return pieces.length > 1 ? pieces[1].length : 0;
|
99
|
+
}
|
100
|
+
|
101
|
+
// http://youmightnotneedjquery.com/#add_class
|
102
|
+
function addClass(el, className) {
|
103
|
+
if (el.classList) {
|
104
|
+
el.classList.add(className);
|
105
|
+
} else {
|
106
|
+
el.className += " " + className;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
// http://youmightnotneedjquery.com/#remove_class
|
111
|
+
function removeClass(el, className) {
|
112
|
+
if (el.classList) {
|
113
|
+
el.classList.remove(className);
|
114
|
+
} else {
|
115
|
+
el.className = el.className.replace(
|
116
|
+
new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", "gi"),
|
117
|
+
" "
|
118
|
+
);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
// https://plainjs.com/javascript/attributes/adding-removing-and-testing-for-classes-9/
|
123
|
+
function hasClass(el, className) {
|
124
|
+
return el.classList
|
125
|
+
? el.classList.contains(className)
|
126
|
+
: new RegExp("\\b" + className + "\\b").test(el.className);
|
127
|
+
}
|
128
|
+
|
129
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollY#Notes
|
130
|
+
function getPageOffset(doc) {
|
131
|
+
var supportPageOffset = window.pageXOffset !== undefined;
|
132
|
+
var isCSS1Compat = (doc.compatMode || "") === "CSS1Compat";
|
133
|
+
var x = supportPageOffset
|
134
|
+
? window.pageXOffset
|
135
|
+
: isCSS1Compat
|
136
|
+
? doc.documentElement.scrollLeft
|
137
|
+
: doc.body.scrollLeft;
|
138
|
+
var y = supportPageOffset
|
139
|
+
? window.pageYOffset
|
140
|
+
: isCSS1Compat
|
141
|
+
? doc.documentElement.scrollTop
|
142
|
+
: doc.body.scrollTop;
|
143
|
+
|
144
|
+
return {
|
145
|
+
x: x,
|
146
|
+
y: y
|
147
|
+
};
|
148
|
+
}
|
149
|
+
|
150
|
+
// we provide a function to compute constants instead
|
151
|
+
// of accessing window.* as soon as the module needs it
|
152
|
+
// so that we do not compute anything if not needed
|
153
|
+
function getActions() {
|
154
|
+
// Determine the events to bind. IE11 implements pointerEvents without
|
155
|
+
// a prefix, which breaks compatibility with the IE10 implementation.
|
156
|
+
return window.navigator.pointerEnabled
|
157
|
+
? {
|
158
|
+
start: "pointerdown",
|
159
|
+
move: "pointermove",
|
160
|
+
end: "pointerup"
|
161
|
+
}
|
162
|
+
: window.navigator.msPointerEnabled
|
163
|
+
? {
|
164
|
+
start: "MSPointerDown",
|
165
|
+
move: "MSPointerMove",
|
166
|
+
end: "MSPointerUp"
|
167
|
+
}
|
168
|
+
: {
|
169
|
+
start: "mousedown touchstart",
|
170
|
+
move: "mousemove touchmove",
|
171
|
+
end: "mouseup touchend"
|
172
|
+
};
|
173
|
+
}
|
174
|
+
|
175
|
+
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
176
|
+
// Issue #785
|
177
|
+
function getSupportsPassive() {
|
178
|
+
var supportsPassive = false;
|
179
|
+
|
180
|
+
/* eslint-disable */
|
181
|
+
try {
|
182
|
+
var opts = Object.defineProperty({}, "passive", {
|
183
|
+
get: function() {
|
184
|
+
supportsPassive = true;
|
185
|
+
}
|
186
|
+
});
|
187
|
+
|
188
|
+
window.addEventListener("test", null, opts);
|
189
|
+
} catch (e) {}
|
190
|
+
/* eslint-enable */
|
191
|
+
|
192
|
+
return supportsPassive;
|
193
|
+
}
|
194
|
+
|
195
|
+
function getSupportsTouchActionNone() {
|
196
|
+
return window.CSS && CSS.supports && CSS.supports("touch-action", "none");
|
197
|
+
}
|
198
|
+
|
199
|
+
//endregion
|
200
|
+
|
201
|
+
//region Range Calculation
|
202
|
+
|
203
|
+
// Determine the size of a sub-range in relation to a full range.
|
204
|
+
function subRangeRatio(pa, pb) {
|
205
|
+
return 100 / (pb - pa);
|
206
|
+
}
|
207
|
+
|
208
|
+
// (percentage) How many percent is this value of this range?
|
209
|
+
function fromPercentage(range, value) {
|
210
|
+
return (value * 100) / (range[1] - range[0]);
|
211
|
+
}
|
212
|
+
|
213
|
+
// (percentage) Where is this value on this range?
|
214
|
+
function toPercentage(range, value) {
|
215
|
+
return fromPercentage(range, range[0] < 0 ? value + Math.abs(range[0]) : value - range[0]);
|
216
|
+
}
|
217
|
+
|
218
|
+
// (value) How much is this percentage on this range?
|
219
|
+
function isPercentage(range, value) {
|
220
|
+
return (value * (range[1] - range[0])) / 100 + range[0];
|
221
|
+
}
|
222
|
+
|
223
|
+
function getJ(value, arr) {
|
224
|
+
var j = 1;
|
225
|
+
|
226
|
+
while (value >= arr[j]) {
|
227
|
+
j += 1;
|
228
|
+
}
|
229
|
+
|
230
|
+
return j;
|
231
|
+
}
|
232
|
+
|
233
|
+
// (percentage) Input a value, find where, on a scale of 0-100, it applies.
|
234
|
+
function toStepping(xVal, xPct, value) {
|
235
|
+
if (value >= xVal.slice(-1)[0]) {
|
236
|
+
return 100;
|
237
|
+
}
|
238
|
+
|
239
|
+
var j = getJ(value, xVal);
|
240
|
+
var va = xVal[j - 1];
|
241
|
+
var vb = xVal[j];
|
242
|
+
var pa = xPct[j - 1];
|
243
|
+
var pb = xPct[j];
|
244
|
+
|
245
|
+
return pa + toPercentage([va, vb], value) / subRangeRatio(pa, pb);
|
246
|
+
}
|
247
|
+
|
248
|
+
// (value) Input a percentage, find where it is on the specified range.
|
249
|
+
function fromStepping(xVal, xPct, value) {
|
250
|
+
// There is no range group that fits 100
|
251
|
+
if (value >= 100) {
|
252
|
+
return xVal.slice(-1)[0];
|
253
|
+
}
|
254
|
+
|
255
|
+
var j = getJ(value, xPct);
|
256
|
+
var va = xVal[j - 1];
|
257
|
+
var vb = xVal[j];
|
258
|
+
var pa = xPct[j - 1];
|
259
|
+
var pb = xPct[j];
|
260
|
+
|
261
|
+
return isPercentage([va, vb], (value - pa) * subRangeRatio(pa, pb));
|
262
|
+
}
|
263
|
+
|
264
|
+
// (percentage) Get the step that applies at a certain value.
|
265
|
+
function getStep(xPct, xSteps, snap, value) {
|
266
|
+
if (value === 100) {
|
267
|
+
return value;
|
268
|
+
}
|
269
|
+
|
270
|
+
var j = getJ(value, xPct);
|
271
|
+
var a = xPct[j - 1];
|
272
|
+
var b = xPct[j];
|
273
|
+
|
274
|
+
// If 'snap' is set, steps are used as fixed points on the slider.
|
275
|
+
if (snap) {
|
276
|
+
// Find the closest position, a or b.
|
277
|
+
if (value - a > (b - a) / 2) {
|
278
|
+
return b;
|
279
|
+
}
|
280
|
+
|
281
|
+
return a;
|
282
|
+
}
|
283
|
+
|
284
|
+
if (!xSteps[j - 1]) {
|
285
|
+
return value;
|
286
|
+
}
|
287
|
+
|
288
|
+
return xPct[j - 1] + closest(value - xPct[j - 1], xSteps[j - 1]);
|
289
|
+
}
|
290
|
+
|
291
|
+
function handleEntryPoint(index, value, that) {
|
292
|
+
var percentage;
|
293
|
+
|
294
|
+
// Wrap numerical input in an array.
|
295
|
+
if (typeof value === "number") {
|
296
|
+
value = [value];
|
297
|
+
}
|
298
|
+
|
299
|
+
// Reject any invalid input, by testing whether value is an array.
|
300
|
+
if (!Array.isArray(value)) {
|
301
|
+
throw new Error("noUiSlider (" + VERSION + "): 'range' contains invalid value.");
|
302
|
+
}
|
303
|
+
|
304
|
+
// Covert min/max syntax to 0 and 100.
|
305
|
+
if (index === "min") {
|
306
|
+
percentage = 0;
|
307
|
+
} else if (index === "max") {
|
308
|
+
percentage = 100;
|
309
|
+
} else {
|
310
|
+
percentage = parseFloat(index);
|
311
|
+
}
|
312
|
+
|
313
|
+
// Check for correct input.
|
314
|
+
if (!isNumeric(percentage) || !isNumeric(value[0])) {
|
315
|
+
throw new Error("noUiSlider (" + VERSION + "): 'range' value isn't numeric.");
|
316
|
+
}
|
317
|
+
|
318
|
+
// Store values.
|
319
|
+
that.xPct.push(percentage);
|
320
|
+
that.xVal.push(value[0]);
|
321
|
+
|
322
|
+
// NaN will evaluate to false too, but to keep
|
323
|
+
// logging clear, set step explicitly. Make sure
|
324
|
+
// not to override the 'step' setting with false.
|
325
|
+
if (!percentage) {
|
326
|
+
if (!isNaN(value[1])) {
|
327
|
+
that.xSteps[0] = value[1];
|
328
|
+
}
|
329
|
+
} else {
|
330
|
+
that.xSteps.push(isNaN(value[1]) ? false : value[1]);
|
331
|
+
}
|
332
|
+
|
333
|
+
that.xHighestCompleteStep.push(0);
|
334
|
+
}
|
335
|
+
|
336
|
+
function handleStepPoint(i, n, that) {
|
337
|
+
// Ignore 'false' stepping.
|
338
|
+
if (!n) {
|
339
|
+
return;
|
340
|
+
}
|
341
|
+
|
342
|
+
// Step over zero-length ranges (#948);
|
343
|
+
if (that.xVal[i] === that.xVal[i + 1]) {
|
344
|
+
that.xSteps[i] = that.xHighestCompleteStep[i] = that.xVal[i];
|
345
|
+
|
346
|
+
return;
|
347
|
+
}
|
348
|
+
|
349
|
+
// Factor to range ratio
|
350
|
+
that.xSteps[i] =
|
351
|
+
fromPercentage([that.xVal[i], that.xVal[i + 1]], n) / subRangeRatio(that.xPct[i], that.xPct[i + 1]);
|
352
|
+
|
353
|
+
var totalSteps = (that.xVal[i + 1] - that.xVal[i]) / that.xNumSteps[i];
|
354
|
+
var highestStep = Math.ceil(Number(totalSteps.toFixed(3)) - 1);
|
355
|
+
var step = that.xVal[i] + that.xNumSteps[i] * highestStep;
|
356
|
+
|
357
|
+
that.xHighestCompleteStep[i] = step;
|
358
|
+
}
|
359
|
+
|
360
|
+
//endregion
|
361
|
+
|
362
|
+
//region Spectrum
|
363
|
+
|
364
|
+
function Spectrum(entry, snap, singleStep) {
|
365
|
+
this.xPct = [];
|
366
|
+
this.xVal = [];
|
367
|
+
this.xSteps = [singleStep || false];
|
368
|
+
this.xNumSteps = [false];
|
369
|
+
this.xHighestCompleteStep = [];
|
370
|
+
|
371
|
+
this.snap = snap;
|
372
|
+
|
373
|
+
var index;
|
374
|
+
var ordered = []; // [0, 'min'], [1, '50%'], [2, 'max']
|
375
|
+
|
376
|
+
// Map the object keys to an array.
|
377
|
+
for (index in entry) {
|
378
|
+
if (entry.hasOwnProperty(index)) {
|
379
|
+
ordered.push([entry[index], index]);
|
380
|
+
}
|
381
|
+
}
|
382
|
+
|
383
|
+
// Sort all entries by value (numeric sort).
|
384
|
+
if (ordered.length && typeof ordered[0][0] === "object") {
|
385
|
+
ordered.sort(function(a, b) {
|
386
|
+
return a[0][0] - b[0][0];
|
387
|
+
});
|
388
|
+
} else {
|
389
|
+
ordered.sort(function(a, b) {
|
390
|
+
return a[0] - b[0];
|
391
|
+
});
|
392
|
+
}
|
393
|
+
|
394
|
+
// Convert all entries to subranges.
|
395
|
+
for (index = 0; index < ordered.length; index++) {
|
396
|
+
handleEntryPoint(ordered[index][1], ordered[index][0], this);
|
397
|
+
}
|
398
|
+
|
399
|
+
// Store the actual step values.
|
400
|
+
// xSteps is sorted in the same order as xPct and xVal.
|
401
|
+
this.xNumSteps = this.xSteps.slice(0);
|
402
|
+
|
403
|
+
// Convert all numeric steps to the percentage of the subrange they represent.
|
404
|
+
for (index = 0; index < this.xNumSteps.length; index++) {
|
405
|
+
handleStepPoint(index, this.xNumSteps[index], this);
|
406
|
+
}
|
407
|
+
}
|
408
|
+
|
409
|
+
Spectrum.prototype.getMargin = function(value) {
|
410
|
+
var step = this.xNumSteps[0];
|
411
|
+
|
412
|
+
if (step && (value / step) % 1 !== 0) {
|
413
|
+
throw new Error("noUiSlider (" + VERSION + "): 'limit', 'margin' and 'padding' must be divisible by step.");
|
414
|
+
}
|
415
|
+
|
416
|
+
return this.xPct.length === 2 ? fromPercentage(this.xVal, value) : false;
|
417
|
+
};
|
418
|
+
|
419
|
+
Spectrum.prototype.toStepping = function(value) {
|
420
|
+
value = toStepping(this.xVal, this.xPct, value);
|
421
|
+
|
422
|
+
return value;
|
423
|
+
};
|
424
|
+
|
425
|
+
Spectrum.prototype.fromStepping = function(value) {
|
426
|
+
return fromStepping(this.xVal, this.xPct, value);
|
427
|
+
};
|
428
|
+
|
429
|
+
Spectrum.prototype.getStep = function(value) {
|
430
|
+
value = getStep(this.xPct, this.xSteps, this.snap, value);
|
431
|
+
|
432
|
+
return value;
|
433
|
+
};
|
434
|
+
|
435
|
+
Spectrum.prototype.getDefaultStep = function(value, isDown, size) {
|
436
|
+
var j = getJ(value, this.xPct);
|
437
|
+
|
438
|
+
// When at the top or stepping down, look at the previous sub-range
|
439
|
+
if (value === 100 || (isDown && value === this.xPct[j - 1])) {
|
440
|
+
j = Math.max(j - 1, 1);
|
441
|
+
}
|
442
|
+
|
443
|
+
return (this.xVal[j] - this.xVal[j - 1]) / size;
|
444
|
+
};
|
445
|
+
|
446
|
+
Spectrum.prototype.getNearbySteps = function(value) {
|
447
|
+
var j = getJ(value, this.xPct);
|
448
|
+
|
449
|
+
return {
|
450
|
+
stepBefore: {
|
451
|
+
startValue: this.xVal[j - 2],
|
452
|
+
step: this.xNumSteps[j - 2],
|
453
|
+
highestStep: this.xHighestCompleteStep[j - 2]
|
454
|
+
},
|
455
|
+
thisStep: {
|
456
|
+
startValue: this.xVal[j - 1],
|
457
|
+
step: this.xNumSteps[j - 1],
|
458
|
+
highestStep: this.xHighestCompleteStep[j - 1]
|
459
|
+
},
|
460
|
+
stepAfter: {
|
461
|
+
startValue: this.xVal[j],
|
462
|
+
step: this.xNumSteps[j],
|
463
|
+
highestStep: this.xHighestCompleteStep[j]
|
464
|
+
}
|
465
|
+
};
|
466
|
+
};
|
467
|
+
|
468
|
+
Spectrum.prototype.countStepDecimals = function() {
|
469
|
+
var stepDecimals = this.xNumSteps.map(countDecimals);
|
470
|
+
return Math.max.apply(null, stepDecimals);
|
471
|
+
};
|
472
|
+
|
473
|
+
// Outside testing
|
474
|
+
Spectrum.prototype.convert = function(value) {
|
475
|
+
return this.getStep(this.toStepping(value));
|
476
|
+
};
|
477
|
+
|
478
|
+
//endregion
|
479
|
+
|
480
|
+
//region Options
|
481
|
+
|
482
|
+
/* Every input option is tested and parsed. This'll prevent
|
483
|
+
endless validation in internal methods. These tests are
|
484
|
+
structured with an item for every option available. An
|
485
|
+
option can be marked as required by setting the 'r' flag.
|
486
|
+
The testing function is provided with three arguments:
|
487
|
+
- The provided value for the option;
|
488
|
+
- A reference to the options object;
|
489
|
+
- The name for the option;
|
490
|
+
|
491
|
+
The testing function returns false when an error is detected,
|
492
|
+
or true when everything is OK. It can also modify the option
|
493
|
+
object, to make sure all values can be correctly looped elsewhere. */
|
494
|
+
|
495
|
+
var defaultFormatter = {
|
496
|
+
to: function(value) {
|
497
|
+
return value !== undefined && value.toFixed(2);
|
498
|
+
},
|
499
|
+
from: Number
|
500
|
+
};
|
501
|
+
|
502
|
+
function validateFormat(entry) {
|
503
|
+
// Any object with a to and from method is supported.
|
504
|
+
if (isValidFormatter(entry)) {
|
505
|
+
return true;
|
506
|
+
}
|
507
|
+
|
508
|
+
throw new Error("noUiSlider (" + VERSION + "): 'format' requires 'to' and 'from' methods.");
|
509
|
+
}
|
510
|
+
|
511
|
+
function testStep(parsed, entry) {
|
512
|
+
if (!isNumeric(entry)) {
|
513
|
+
throw new Error("noUiSlider (" + VERSION + "): 'step' is not numeric.");
|
514
|
+
}
|
515
|
+
|
516
|
+
// The step option can still be used to set stepping
|
517
|
+
// for linear sliders. Overwritten if set in 'range'.
|
518
|
+
parsed.singleStep = entry;
|
519
|
+
}
|
520
|
+
|
521
|
+
function testRange(parsed, entry) {
|
522
|
+
// Filter incorrect input.
|
523
|
+
if (typeof entry !== "object" || Array.isArray(entry)) {
|
524
|
+
throw new Error("noUiSlider (" + VERSION + "): 'range' is not an object.");
|
525
|
+
}
|
526
|
+
|
527
|
+
// Catch missing start or end.
|
528
|
+
if (entry.min === undefined || entry.max === undefined) {
|
529
|
+
throw new Error("noUiSlider (" + VERSION + "): Missing 'min' or 'max' in 'range'.");
|
530
|
+
}
|
531
|
+
|
532
|
+
// Catch equal start or end.
|
533
|
+
if (entry.min === entry.max) {
|
534
|
+
throw new Error("noUiSlider (" + VERSION + "): 'range' 'min' and 'max' cannot be equal.");
|
535
|
+
}
|
536
|
+
|
537
|
+
parsed.spectrum = new Spectrum(entry, parsed.snap, parsed.singleStep);
|
538
|
+
}
|
539
|
+
|
540
|
+
function testStart(parsed, entry) {
|
541
|
+
entry = asArray(entry);
|
542
|
+
|
543
|
+
// Validate input. Values aren't tested, as the public .val method
|
544
|
+
// will always provide a valid location.
|
545
|
+
if (!Array.isArray(entry) || !entry.length) {
|
546
|
+
throw new Error("noUiSlider (" + VERSION + "): 'start' option is incorrect.");
|
547
|
+
}
|
548
|
+
|
549
|
+
// Store the number of handles.
|
550
|
+
parsed.handles = entry.length;
|
551
|
+
|
552
|
+
// When the slider is initialized, the .val method will
|
553
|
+
// be called with the start options.
|
554
|
+
parsed.start = entry;
|
555
|
+
}
|
556
|
+
|
557
|
+
function testSnap(parsed, entry) {
|
558
|
+
// Enforce 100% stepping within subranges.
|
559
|
+
parsed.snap = entry;
|
560
|
+
|
561
|
+
if (typeof entry !== "boolean") {
|
562
|
+
throw new Error("noUiSlider (" + VERSION + "): 'snap' option must be a boolean.");
|
563
|
+
}
|
564
|
+
}
|
565
|
+
|
566
|
+
function testAnimate(parsed, entry) {
|
567
|
+
// Enforce 100% stepping within subranges.
|
568
|
+
parsed.animate = entry;
|
569
|
+
|
570
|
+
if (typeof entry !== "boolean") {
|
571
|
+
throw new Error("noUiSlider (" + VERSION + "): 'animate' option must be a boolean.");
|
572
|
+
}
|
573
|
+
}
|
574
|
+
|
575
|
+
function testAnimationDuration(parsed, entry) {
|
576
|
+
parsed.animationDuration = entry;
|
577
|
+
|
578
|
+
if (typeof entry !== "number") {
|
579
|
+
throw new Error("noUiSlider (" + VERSION + "): 'animationDuration' option must be a number.");
|
580
|
+
}
|
581
|
+
}
|
582
|
+
|
583
|
+
function testConnect(parsed, entry) {
|
584
|
+
var connect = [false];
|
585
|
+
var i;
|
586
|
+
|
587
|
+
// Map legacy options
|
588
|
+
if (entry === "lower") {
|
589
|
+
entry = [true, false];
|
590
|
+
} else if (entry === "upper") {
|
591
|
+
entry = [false, true];
|
592
|
+
}
|
593
|
+
|
594
|
+
// Handle boolean options
|
595
|
+
if (entry === true || entry === false) {
|
596
|
+
for (i = 1; i < parsed.handles; i++) {
|
597
|
+
connect.push(entry);
|
598
|
+
}
|
599
|
+
|
600
|
+
connect.push(false);
|
601
|
+
}
|
602
|
+
|
603
|
+
// Reject invalid input
|
604
|
+
else if (!Array.isArray(entry) || !entry.length || entry.length !== parsed.handles + 1) {
|
605
|
+
throw new Error("noUiSlider (" + VERSION + "): 'connect' option doesn't match handle count.");
|
606
|
+
} else {
|
607
|
+
connect = entry;
|
608
|
+
}
|
609
|
+
|
610
|
+
parsed.connect = connect;
|
611
|
+
}
|
612
|
+
|
613
|
+
function testOrientation(parsed, entry) {
|
614
|
+
// Set orientation to an a numerical value for easy
|
615
|
+
// array selection.
|
616
|
+
switch (entry) {
|
617
|
+
case "horizontal":
|
618
|
+
parsed.ort = 0;
|
619
|
+
break;
|
620
|
+
case "vertical":
|
621
|
+
parsed.ort = 1;
|
622
|
+
break;
|
623
|
+
default:
|
624
|
+
throw new Error("noUiSlider (" + VERSION + "): 'orientation' option is invalid.");
|
625
|
+
}
|
626
|
+
}
|
627
|
+
|
628
|
+
function testMargin(parsed, entry) {
|
629
|
+
if (!isNumeric(entry)) {
|
630
|
+
throw new Error("noUiSlider (" + VERSION + "): 'margin' option must be numeric.");
|
631
|
+
}
|
632
|
+
|
633
|
+
// Issue #582
|
634
|
+
if (entry === 0) {
|
635
|
+
return;
|
636
|
+
}
|
637
|
+
|
638
|
+
parsed.margin = parsed.spectrum.getMargin(entry);
|
639
|
+
|
640
|
+
if (!parsed.margin) {
|
641
|
+
throw new Error("noUiSlider (" + VERSION + "): 'margin' option is only supported on linear sliders.");
|
642
|
+
}
|
643
|
+
}
|
644
|
+
|
645
|
+
function testLimit(parsed, entry) {
|
646
|
+
if (!isNumeric(entry)) {
|
647
|
+
throw new Error("noUiSlider (" + VERSION + "): 'limit' option must be numeric.");
|
648
|
+
}
|
649
|
+
|
650
|
+
parsed.limit = parsed.spectrum.getMargin(entry);
|
651
|
+
|
652
|
+
if (!parsed.limit || parsed.handles < 2) {
|
653
|
+
throw new Error(
|
654
|
+
"noUiSlider (" +
|
655
|
+
VERSION +
|
656
|
+
"): 'limit' option is only supported on linear sliders with 2 or more handles."
|
657
|
+
);
|
658
|
+
}
|
659
|
+
}
|
660
|
+
|
661
|
+
function testPadding(parsed, entry) {
|
662
|
+
if (!isNumeric(entry) && !Array.isArray(entry)) {
|
663
|
+
throw new Error(
|
664
|
+
"noUiSlider (" + VERSION + "): 'padding' option must be numeric or array of exactly 2 numbers."
|
665
|
+
);
|
666
|
+
}
|
667
|
+
|
668
|
+
if (Array.isArray(entry) && !(entry.length === 2 || isNumeric(entry[0]) || isNumeric(entry[1]))) {
|
669
|
+
throw new Error(
|
670
|
+
"noUiSlider (" + VERSION + "): 'padding' option must be numeric or array of exactly 2 numbers."
|
671
|
+
);
|
672
|
+
}
|
673
|
+
|
674
|
+
if (entry === 0) {
|
675
|
+
return;
|
676
|
+
}
|
677
|
+
|
678
|
+
if (!Array.isArray(entry)) {
|
679
|
+
entry = [entry, entry];
|
680
|
+
}
|
681
|
+
|
682
|
+
// 'getMargin' returns false for invalid values.
|
683
|
+
parsed.padding = [parsed.spectrum.getMargin(entry[0]), parsed.spectrum.getMargin(entry[1])];
|
684
|
+
|
685
|
+
if (parsed.padding[0] === false || parsed.padding[1] === false) {
|
686
|
+
throw new Error("noUiSlider (" + VERSION + "): 'padding' option is only supported on linear sliders.");
|
687
|
+
}
|
688
|
+
|
689
|
+
if (parsed.padding[0] < 0 || parsed.padding[1] < 0) {
|
690
|
+
throw new Error("noUiSlider (" + VERSION + "): 'padding' option must be a positive number(s).");
|
691
|
+
}
|
692
|
+
|
693
|
+
if (parsed.padding[0] + parsed.padding[1] > 100) {
|
694
|
+
throw new Error("noUiSlider (" + VERSION + "): 'padding' option must not exceed 100% of the range.");
|
695
|
+
}
|
696
|
+
}
|
697
|
+
|
698
|
+
function testDirection(parsed, entry) {
|
699
|
+
// Set direction as a numerical value for easy parsing.
|
700
|
+
// Invert connection for RTL sliders, so that the proper
|
701
|
+
// handles get the connect/background classes.
|
702
|
+
switch (entry) {
|
703
|
+
case "ltr":
|
704
|
+
parsed.dir = 0;
|
705
|
+
break;
|
706
|
+
case "rtl":
|
707
|
+
parsed.dir = 1;
|
708
|
+
break;
|
709
|
+
default:
|
710
|
+
throw new Error("noUiSlider (" + VERSION + "): 'direction' option was not recognized.");
|
711
|
+
}
|
712
|
+
}
|
713
|
+
|
714
|
+
function testBehaviour(parsed, entry) {
|
715
|
+
// Make sure the input is a string.
|
716
|
+
if (typeof entry !== "string") {
|
717
|
+
throw new Error("noUiSlider (" + VERSION + "): 'behaviour' must be a string containing options.");
|
718
|
+
}
|
719
|
+
|
720
|
+
// Check if the string contains any keywords.
|
721
|
+
// None are required.
|
722
|
+
var tap = entry.indexOf("tap") >= 0;
|
723
|
+
var drag = entry.indexOf("drag") >= 0;
|
724
|
+
var fixed = entry.indexOf("fixed") >= 0;
|
725
|
+
var snap = entry.indexOf("snap") >= 0;
|
726
|
+
var hover = entry.indexOf("hover") >= 0;
|
727
|
+
var unconstrained = entry.indexOf("unconstrained") >= 0;
|
728
|
+
|
729
|
+
if (fixed) {
|
730
|
+
if (parsed.handles !== 2) {
|
731
|
+
throw new Error("noUiSlider (" + VERSION + "): 'fixed' behaviour must be used with 2 handles");
|
732
|
+
}
|
733
|
+
|
734
|
+
// Use margin to enforce fixed state
|
735
|
+
testMargin(parsed, parsed.start[1] - parsed.start[0]);
|
736
|
+
}
|
737
|
+
|
738
|
+
if (unconstrained && (parsed.margin || parsed.limit)) {
|
739
|
+
throw new Error(
|
740
|
+
"noUiSlider (" + VERSION + "): 'unconstrained' behaviour cannot be used with margin or limit"
|
741
|
+
);
|
742
|
+
}
|
743
|
+
|
744
|
+
parsed.events = {
|
745
|
+
tap: tap || snap,
|
746
|
+
drag: drag,
|
747
|
+
fixed: fixed,
|
748
|
+
snap: snap,
|
749
|
+
hover: hover,
|
750
|
+
unconstrained: unconstrained
|
751
|
+
};
|
752
|
+
}
|
753
|
+
|
754
|
+
function testTooltips(parsed, entry) {
|
755
|
+
if (entry === false) {
|
756
|
+
return;
|
757
|
+
}
|
758
|
+
|
759
|
+
if (entry === true) {
|
760
|
+
parsed.tooltips = [];
|
761
|
+
|
762
|
+
for (var i = 0; i < parsed.handles; i++) {
|
763
|
+
parsed.tooltips.push(true);
|
764
|
+
}
|
765
|
+
} else {
|
766
|
+
parsed.tooltips = asArray(entry);
|
767
|
+
|
768
|
+
if (parsed.tooltips.length !== parsed.handles) {
|
769
|
+
throw new Error("noUiSlider (" + VERSION + "): must pass a formatter for all handles.");
|
770
|
+
}
|
771
|
+
|
772
|
+
parsed.tooltips.forEach(function(formatter) {
|
773
|
+
if (
|
774
|
+
typeof formatter !== "boolean" &&
|
775
|
+
(typeof formatter !== "object" || typeof formatter.to !== "function")
|
776
|
+
) {
|
777
|
+
throw new Error("noUiSlider (" + VERSION + "): 'tooltips' must be passed a formatter or 'false'.");
|
778
|
+
}
|
779
|
+
});
|
780
|
+
}
|
781
|
+
}
|
782
|
+
|
783
|
+
function testAriaFormat(parsed, entry) {
|
784
|
+
parsed.ariaFormat = entry;
|
785
|
+
validateFormat(entry);
|
786
|
+
}
|
787
|
+
|
788
|
+
function testFormat(parsed, entry) {
|
789
|
+
parsed.format = entry;
|
790
|
+
validateFormat(entry);
|
791
|
+
}
|
792
|
+
|
793
|
+
function testKeyboardSupport(parsed, entry) {
|
794
|
+
parsed.keyboardSupport = entry;
|
795
|
+
|
796
|
+
if (typeof entry !== "boolean") {
|
797
|
+
throw new Error("noUiSlider (" + VERSION + "): 'keyboardSupport' option must be a boolean.");
|
798
|
+
}
|
799
|
+
}
|
800
|
+
|
801
|
+
function testDocumentElement(parsed, entry) {
|
802
|
+
// This is an advanced option. Passed values are used without validation.
|
803
|
+
parsed.documentElement = entry;
|
804
|
+
}
|
805
|
+
|
806
|
+
function testCssPrefix(parsed, entry) {
|
807
|
+
if (typeof entry !== "string" && entry !== false) {
|
808
|
+
throw new Error("noUiSlider (" + VERSION + "): 'cssPrefix' must be a string or `false`.");
|
809
|
+
}
|
810
|
+
|
811
|
+
parsed.cssPrefix = entry;
|
812
|
+
}
|
813
|
+
|
814
|
+
function testCssClasses(parsed, entry) {
|
815
|
+
if (typeof entry !== "object") {
|
816
|
+
throw new Error("noUiSlider (" + VERSION + "): 'cssClasses' must be an object.");
|
817
|
+
}
|
818
|
+
|
819
|
+
if (typeof parsed.cssPrefix === "string") {
|
820
|
+
parsed.cssClasses = {};
|
821
|
+
|
822
|
+
for (var key in entry) {
|
823
|
+
if (!entry.hasOwnProperty(key)) {
|
824
|
+
continue;
|
825
|
+
}
|
826
|
+
|
827
|
+
parsed.cssClasses[key] = parsed.cssPrefix + entry[key];
|
828
|
+
}
|
829
|
+
} else {
|
830
|
+
parsed.cssClasses = entry;
|
831
|
+
}
|
832
|
+
}
|
833
|
+
|
834
|
+
// Test all developer settings and parse to assumption-safe values.
|
835
|
+
function testOptions(options) {
|
836
|
+
// To prove a fix for #537, freeze options here.
|
837
|
+
// If the object is modified, an error will be thrown.
|
838
|
+
// Object.freeze(options);
|
839
|
+
|
840
|
+
var parsed = {
|
841
|
+
margin: 0,
|
842
|
+
limit: 0,
|
843
|
+
padding: 0,
|
844
|
+
animate: true,
|
845
|
+
animationDuration: 300,
|
846
|
+
ariaFormat: defaultFormatter,
|
847
|
+
format: defaultFormatter
|
848
|
+
};
|
849
|
+
|
850
|
+
// Tests are executed in the order they are presented here.
|
851
|
+
var tests = {
|
852
|
+
step: { r: false, t: testStep },
|
853
|
+
start: { r: true, t: testStart },
|
854
|
+
connect: { r: true, t: testConnect },
|
855
|
+
direction: { r: true, t: testDirection },
|
856
|
+
snap: { r: false, t: testSnap },
|
857
|
+
animate: { r: false, t: testAnimate },
|
858
|
+
animationDuration: { r: false, t: testAnimationDuration },
|
859
|
+
range: { r: true, t: testRange },
|
860
|
+
orientation: { r: false, t: testOrientation },
|
861
|
+
margin: { r: false, t: testMargin },
|
862
|
+
limit: { r: false, t: testLimit },
|
863
|
+
padding: { r: false, t: testPadding },
|
864
|
+
behaviour: { r: true, t: testBehaviour },
|
865
|
+
ariaFormat: { r: false, t: testAriaFormat },
|
866
|
+
format: { r: false, t: testFormat },
|
867
|
+
tooltips: { r: false, t: testTooltips },
|
868
|
+
keyboardSupport: { r: true, t: testKeyboardSupport },
|
869
|
+
documentElement: { r: false, t: testDocumentElement },
|
870
|
+
cssPrefix: { r: true, t: testCssPrefix },
|
871
|
+
cssClasses: { r: true, t: testCssClasses }
|
872
|
+
};
|
873
|
+
|
874
|
+
var defaults = {
|
875
|
+
connect: false,
|
876
|
+
direction: "ltr",
|
877
|
+
behaviour: "tap",
|
878
|
+
orientation: "horizontal",
|
879
|
+
keyboardSupport: true,
|
880
|
+
cssPrefix: "noUi-",
|
881
|
+
cssClasses: {
|
882
|
+
target: "target",
|
883
|
+
base: "base",
|
884
|
+
origin: "origin",
|
885
|
+
handle: "handle",
|
886
|
+
handleLower: "handle-lower",
|
887
|
+
handleUpper: "handle-upper",
|
888
|
+
touchArea: "touch-area",
|
889
|
+
horizontal: "horizontal",
|
890
|
+
vertical: "vertical",
|
891
|
+
background: "background",
|
892
|
+
connect: "connect",
|
893
|
+
connects: "connects",
|
894
|
+
ltr: "ltr",
|
895
|
+
rtl: "rtl",
|
896
|
+
textDirectionLtr: "txt-dir-ltr",
|
897
|
+
textDirectionRtl: "txt-dir-rtl",
|
898
|
+
draggable: "draggable",
|
899
|
+
drag: "state-drag",
|
900
|
+
tap: "state-tap",
|
901
|
+
active: "active",
|
902
|
+
tooltip: "tooltip",
|
903
|
+
pips: "pips",
|
904
|
+
pipsHorizontal: "pips-horizontal",
|
905
|
+
pipsVertical: "pips-vertical",
|
906
|
+
marker: "marker",
|
907
|
+
markerHorizontal: "marker-horizontal",
|
908
|
+
markerVertical: "marker-vertical",
|
909
|
+
markerNormal: "marker-normal",
|
910
|
+
markerLarge: "marker-large",
|
911
|
+
markerSub: "marker-sub",
|
912
|
+
value: "value",
|
913
|
+
valueHorizontal: "value-horizontal",
|
914
|
+
valueVertical: "value-vertical",
|
915
|
+
valueNormal: "value-normal",
|
916
|
+
valueLarge: "value-large",
|
917
|
+
valueSub: "value-sub"
|
918
|
+
}
|
919
|
+
};
|
920
|
+
|
921
|
+
// AriaFormat defaults to regular format, if any.
|
922
|
+
if (options.format && !options.ariaFormat) {
|
923
|
+
options.ariaFormat = options.format;
|
924
|
+
}
|
925
|
+
|
926
|
+
// Run all options through a testing mechanism to ensure correct
|
927
|
+
// input. It should be noted that options might get modified to
|
928
|
+
// be handled properly. E.g. wrapping integers in arrays.
|
929
|
+
Object.keys(tests).forEach(function(name) {
|
930
|
+
// If the option isn't set, but it is required, throw an error.
|
931
|
+
if (!isSet(options[name]) && defaults[name] === undefined) {
|
932
|
+
if (tests[name].r) {
|
933
|
+
throw new Error("noUiSlider (" + VERSION + "): '" + name + "' is required.");
|
934
|
+
}
|
935
|
+
|
936
|
+
return true;
|
937
|
+
}
|
938
|
+
|
939
|
+
tests[name].t(parsed, !isSet(options[name]) ? defaults[name] : options[name]);
|
940
|
+
});
|
941
|
+
|
942
|
+
// Forward pips options
|
943
|
+
parsed.pips = options.pips;
|
944
|
+
|
945
|
+
// All recent browsers accept unprefixed transform.
|
946
|
+
// We need -ms- for IE9 and -webkit- for older Android;
|
947
|
+
// Assume use of -webkit- if unprefixed and -ms- are not supported.
|
948
|
+
// https://caniuse.com/#feat=transforms2d
|
949
|
+
var d = document.createElement("div");
|
950
|
+
var msPrefix = d.style.msTransform !== undefined;
|
951
|
+
var noPrefix = d.style.transform !== undefined;
|
952
|
+
|
953
|
+
parsed.transformRule = noPrefix ? "transform" : msPrefix ? "msTransform" : "webkitTransform";
|
954
|
+
|
955
|
+
// Pips don't move, so we can place them using left/top.
|
956
|
+
var styles = [["left", "top"], ["right", "bottom"]];
|
957
|
+
|
958
|
+
parsed.style = styles[parsed.dir][parsed.ort];
|
959
|
+
|
960
|
+
return parsed;
|
961
|
+
}
|
962
|
+
|
963
|
+
//endregion
|
964
|
+
|
965
|
+
function scope(target, options, originalOptions) {
|
966
|
+
var actions = getActions();
|
967
|
+
var supportsTouchActionNone = getSupportsTouchActionNone();
|
968
|
+
var supportsPassive = supportsTouchActionNone && getSupportsPassive();
|
969
|
+
|
970
|
+
// All variables local to 'scope' are prefixed with 'scope_'
|
971
|
+
|
972
|
+
// Slider DOM Nodes
|
973
|
+
var scope_Target = target;
|
974
|
+
var scope_Base;
|
975
|
+
var scope_Handles;
|
976
|
+
var scope_Connects;
|
977
|
+
var scope_Pips;
|
978
|
+
var scope_Tooltips;
|
979
|
+
|
980
|
+
// Slider state values
|
981
|
+
var scope_Spectrum = options.spectrum;
|
982
|
+
var scope_Values = [];
|
983
|
+
var scope_Locations = [];
|
984
|
+
var scope_HandleNumbers = [];
|
985
|
+
var scope_ActiveHandlesCount = 0;
|
986
|
+
var scope_Events = {};
|
987
|
+
|
988
|
+
// Exposed API
|
989
|
+
var scope_Self;
|
990
|
+
|
991
|
+
// Document Nodes
|
992
|
+
var scope_Document = target.ownerDocument;
|
993
|
+
var scope_DocumentElement = options.documentElement || scope_Document.documentElement;
|
994
|
+
var scope_Body = scope_Document.body;
|
995
|
+
|
996
|
+
// Pips constants
|
997
|
+
var PIPS_NONE = -1;
|
998
|
+
var PIPS_NO_VALUE = 0;
|
999
|
+
var PIPS_LARGE_VALUE = 1;
|
1000
|
+
var PIPS_SMALL_VALUE = 2;
|
1001
|
+
|
1002
|
+
// For horizontal sliders in standard ltr documents,
|
1003
|
+
// make .noUi-origin overflow to the left so the document doesn't scroll.
|
1004
|
+
var scope_DirOffset = scope_Document.dir === "rtl" || options.ort === 1 ? 0 : 100;
|
1005
|
+
|
1006
|
+
// Creates a node, adds it to target, returns the new node.
|
1007
|
+
function addNodeTo(addTarget, className) {
|
1008
|
+
var div = scope_Document.createElement("div");
|
1009
|
+
|
1010
|
+
if (className) {
|
1011
|
+
addClass(div, className);
|
1012
|
+
}
|
1013
|
+
|
1014
|
+
addTarget.appendChild(div);
|
1015
|
+
|
1016
|
+
return div;
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
// Append a origin to the base
|
1020
|
+
function addOrigin(base, handleNumber) {
|
1021
|
+
var origin = addNodeTo(base, options.cssClasses.origin);
|
1022
|
+
var handle = addNodeTo(origin, options.cssClasses.handle);
|
1023
|
+
|
1024
|
+
addNodeTo(handle, options.cssClasses.touchArea);
|
1025
|
+
|
1026
|
+
handle.setAttribute("data-handle", handleNumber);
|
1027
|
+
|
1028
|
+
if (options.keyboardSupport) {
|
1029
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
|
1030
|
+
// 0 = focusable and reachable
|
1031
|
+
handle.setAttribute("tabindex", "0");
|
1032
|
+
handle.addEventListener("keydown", function(event) {
|
1033
|
+
return eventKeydown(event, handleNumber);
|
1034
|
+
});
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
handle.setAttribute("role", "slider");
|
1038
|
+
handle.setAttribute("aria-orientation", options.ort ? "vertical" : "horizontal");
|
1039
|
+
|
1040
|
+
if (handleNumber === 0) {
|
1041
|
+
addClass(handle, options.cssClasses.handleLower);
|
1042
|
+
} else if (handleNumber === options.handles - 1) {
|
1043
|
+
addClass(handle, options.cssClasses.handleUpper);
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
return origin;
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
// Insert nodes for connect elements
|
1050
|
+
function addConnect(base, add) {
|
1051
|
+
if (!add) {
|
1052
|
+
return false;
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
return addNodeTo(base, options.cssClasses.connect);
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
// Add handles to the slider base.
|
1059
|
+
function addElements(connectOptions, base) {
|
1060
|
+
var connectBase = addNodeTo(base, options.cssClasses.connects);
|
1061
|
+
|
1062
|
+
scope_Handles = [];
|
1063
|
+
scope_Connects = [];
|
1064
|
+
|
1065
|
+
scope_Connects.push(addConnect(connectBase, connectOptions[0]));
|
1066
|
+
|
1067
|
+
// [::::O====O====O====]
|
1068
|
+
// connectOptions = [0, 1, 1, 1]
|
1069
|
+
|
1070
|
+
for (var i = 0; i < options.handles; i++) {
|
1071
|
+
// Keep a list of all added handles.
|
1072
|
+
scope_Handles.push(addOrigin(base, i));
|
1073
|
+
scope_HandleNumbers[i] = i;
|
1074
|
+
scope_Connects.push(addConnect(connectBase, connectOptions[i + 1]));
|
1075
|
+
}
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
// Initialize a single slider.
|
1079
|
+
function addSlider(addTarget) {
|
1080
|
+
// Apply classes and data to the target.
|
1081
|
+
addClass(addTarget, options.cssClasses.target);
|
1082
|
+
|
1083
|
+
if (options.dir === 0) {
|
1084
|
+
addClass(addTarget, options.cssClasses.ltr);
|
1085
|
+
} else {
|
1086
|
+
addClass(addTarget, options.cssClasses.rtl);
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
if (options.ort === 0) {
|
1090
|
+
addClass(addTarget, options.cssClasses.horizontal);
|
1091
|
+
} else {
|
1092
|
+
addClass(addTarget, options.cssClasses.vertical);
|
1093
|
+
}
|
1094
|
+
|
1095
|
+
var textDirection = getComputedStyle(addTarget).direction;
|
1096
|
+
|
1097
|
+
if (textDirection === "rtl") {
|
1098
|
+
addClass(addTarget, options.cssClasses.textDirectionRtl);
|
1099
|
+
} else {
|
1100
|
+
addClass(addTarget, options.cssClasses.textDirectionLtr);
|
1101
|
+
}
|
1102
|
+
|
1103
|
+
return addNodeTo(addTarget, options.cssClasses.base);
|
1104
|
+
}
|
1105
|
+
|
1106
|
+
function addTooltip(handle, handleNumber) {
|
1107
|
+
if (!options.tooltips[handleNumber]) {
|
1108
|
+
return false;
|
1109
|
+
}
|
1110
|
+
|
1111
|
+
return addNodeTo(handle.firstChild, options.cssClasses.tooltip);
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
function isSliderDisabled() {
|
1115
|
+
return scope_Target.hasAttribute("disabled");
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
// Disable the slider dragging if any handle is disabled
|
1119
|
+
function isHandleDisabled(handleNumber) {
|
1120
|
+
var handleOrigin = scope_Handles[handleNumber];
|
1121
|
+
return handleOrigin.hasAttribute("disabled");
|
1122
|
+
}
|
1123
|
+
|
1124
|
+
function removeTooltips() {
|
1125
|
+
if (scope_Tooltips) {
|
1126
|
+
removeEvent("update.tooltips");
|
1127
|
+
scope_Tooltips.forEach(function(tooltip) {
|
1128
|
+
if (tooltip) {
|
1129
|
+
removeElement(tooltip);
|
1130
|
+
}
|
1131
|
+
});
|
1132
|
+
scope_Tooltips = null;
|
1133
|
+
}
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
// The tooltips option is a shorthand for using the 'update' event.
|
1137
|
+
function tooltips() {
|
1138
|
+
removeTooltips();
|
1139
|
+
|
1140
|
+
// Tooltips are added with options.tooltips in original order.
|
1141
|
+
scope_Tooltips = scope_Handles.map(addTooltip);
|
1142
|
+
|
1143
|
+
bindEvent("update.tooltips", function(values, handleNumber, unencoded) {
|
1144
|
+
if (!scope_Tooltips[handleNumber]) {
|
1145
|
+
return;
|
1146
|
+
}
|
1147
|
+
|
1148
|
+
var formattedValue = values[handleNumber];
|
1149
|
+
|
1150
|
+
if (options.tooltips[handleNumber] !== true) {
|
1151
|
+
formattedValue = options.tooltips[handleNumber].to(unencoded[handleNumber]);
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
scope_Tooltips[handleNumber].innerHTML = formattedValue;
|
1155
|
+
});
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
function aria() {
|
1159
|
+
bindEvent("update", function(values, handleNumber, unencoded, tap, positions) {
|
1160
|
+
// Update Aria Values for all handles, as a change in one changes min and max values for the next.
|
1161
|
+
scope_HandleNumbers.forEach(function(index) {
|
1162
|
+
var handle = scope_Handles[index];
|
1163
|
+
|
1164
|
+
var min = checkHandlePosition(scope_Locations, index, 0, true, true, true);
|
1165
|
+
var max = checkHandlePosition(scope_Locations, index, 100, true, true, true);
|
1166
|
+
|
1167
|
+
var now = positions[index];
|
1168
|
+
|
1169
|
+
// Formatted value for display
|
1170
|
+
var text = options.ariaFormat.to(unencoded[index]);
|
1171
|
+
|
1172
|
+
// Map to slider range values
|
1173
|
+
min = scope_Spectrum.fromStepping(min).toFixed(1);
|
1174
|
+
max = scope_Spectrum.fromStepping(max).toFixed(1);
|
1175
|
+
now = scope_Spectrum.fromStepping(now).toFixed(1);
|
1176
|
+
|
1177
|
+
handle.children[0].setAttribute("aria-valuemin", min);
|
1178
|
+
handle.children[0].setAttribute("aria-valuemax", max);
|
1179
|
+
handle.children[0].setAttribute("aria-valuenow", now);
|
1180
|
+
handle.children[0].setAttribute("aria-valuetext", text);
|
1181
|
+
});
|
1182
|
+
});
|
1183
|
+
}
|
1184
|
+
|
1185
|
+
function getGroup(mode, values, stepped) {
|
1186
|
+
// Use the range.
|
1187
|
+
if (mode === "range" || mode === "steps") {
|
1188
|
+
return scope_Spectrum.xVal;
|
1189
|
+
}
|
1190
|
+
|
1191
|
+
if (mode === "count") {
|
1192
|
+
if (values < 2) {
|
1193
|
+
throw new Error("noUiSlider (" + VERSION + "): 'values' (>= 2) required for mode 'count'.");
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
// Divide 0 - 100 in 'count' parts.
|
1197
|
+
var interval = values - 1;
|
1198
|
+
var spread = 100 / interval;
|
1199
|
+
|
1200
|
+
values = [];
|
1201
|
+
|
1202
|
+
// List these parts and have them handled as 'positions'.
|
1203
|
+
while (interval--) {
|
1204
|
+
values[interval] = interval * spread;
|
1205
|
+
}
|
1206
|
+
|
1207
|
+
values.push(100);
|
1208
|
+
|
1209
|
+
mode = "positions";
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
if (mode === "positions") {
|
1213
|
+
// Map all percentages to on-range values.
|
1214
|
+
return values.map(function(value) {
|
1215
|
+
return scope_Spectrum.fromStepping(stepped ? scope_Spectrum.getStep(value) : value);
|
1216
|
+
});
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
if (mode === "values") {
|
1220
|
+
// If the value must be stepped, it needs to be converted to a percentage first.
|
1221
|
+
if (stepped) {
|
1222
|
+
return values.map(function(value) {
|
1223
|
+
// Convert to percentage, apply step, return to value.
|
1224
|
+
return scope_Spectrum.fromStepping(scope_Spectrum.getStep(scope_Spectrum.toStepping(value)));
|
1225
|
+
});
|
1226
|
+
}
|
1227
|
+
|
1228
|
+
// Otherwise, we can simply use the values.
|
1229
|
+
return values;
|
1230
|
+
}
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
function generateSpread(density, mode, group) {
|
1234
|
+
function safeIncrement(value, increment) {
|
1235
|
+
// Avoid floating point variance by dropping the smallest decimal places.
|
1236
|
+
return (value + increment).toFixed(7) / 1;
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
var indexes = {};
|
1240
|
+
var firstInRange = scope_Spectrum.xVal[0];
|
1241
|
+
var lastInRange = scope_Spectrum.xVal[scope_Spectrum.xVal.length - 1];
|
1242
|
+
var ignoreFirst = false;
|
1243
|
+
var ignoreLast = false;
|
1244
|
+
var prevPct = 0;
|
1245
|
+
|
1246
|
+
// Create a copy of the group, sort it and filter away all duplicates.
|
1247
|
+
group = unique(
|
1248
|
+
group.slice().sort(function(a, b) {
|
1249
|
+
return a - b;
|
1250
|
+
})
|
1251
|
+
);
|
1252
|
+
|
1253
|
+
// Make sure the range starts with the first element.
|
1254
|
+
if (group[0] !== firstInRange) {
|
1255
|
+
group.unshift(firstInRange);
|
1256
|
+
ignoreFirst = true;
|
1257
|
+
}
|
1258
|
+
|
1259
|
+
// Likewise for the last one.
|
1260
|
+
if (group[group.length - 1] !== lastInRange) {
|
1261
|
+
group.push(lastInRange);
|
1262
|
+
ignoreLast = true;
|
1263
|
+
}
|
1264
|
+
|
1265
|
+
group.forEach(function(current, index) {
|
1266
|
+
// Get the current step and the lower + upper positions.
|
1267
|
+
var step;
|
1268
|
+
var i;
|
1269
|
+
var q;
|
1270
|
+
var low = current;
|
1271
|
+
var high = group[index + 1];
|
1272
|
+
var newPct;
|
1273
|
+
var pctDifference;
|
1274
|
+
var pctPos;
|
1275
|
+
var type;
|
1276
|
+
var steps;
|
1277
|
+
var realSteps;
|
1278
|
+
var stepSize;
|
1279
|
+
var isSteps = mode === "steps";
|
1280
|
+
|
1281
|
+
// When using 'steps' mode, use the provided steps.
|
1282
|
+
// Otherwise, we'll step on to the next subrange.
|
1283
|
+
if (isSteps) {
|
1284
|
+
step = scope_Spectrum.xNumSteps[index];
|
1285
|
+
}
|
1286
|
+
|
1287
|
+
// Default to a 'full' step.
|
1288
|
+
if (!step) {
|
1289
|
+
step = high - low;
|
1290
|
+
}
|
1291
|
+
|
1292
|
+
// Low can be 0, so test for false. If high is undefined,
|
1293
|
+
// we are at the last subrange. Index 0 is already handled.
|
1294
|
+
if (low === false || high === undefined) {
|
1295
|
+
return;
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
// Make sure step isn't 0, which would cause an infinite loop (#654)
|
1299
|
+
step = Math.max(step, 0.0000001);
|
1300
|
+
|
1301
|
+
// Find all steps in the subrange.
|
1302
|
+
for (i = low; i <= high; i = safeIncrement(i, step)) {
|
1303
|
+
// Get the percentage value for the current step,
|
1304
|
+
// calculate the size for the subrange.
|
1305
|
+
newPct = scope_Spectrum.toStepping(i);
|
1306
|
+
pctDifference = newPct - prevPct;
|
1307
|
+
|
1308
|
+
steps = pctDifference / density;
|
1309
|
+
realSteps = Math.round(steps);
|
1310
|
+
|
1311
|
+
// This ratio represents the amount of percentage-space a point indicates.
|
1312
|
+
// For a density 1 the points/percentage = 1. For density 2, that percentage needs to be re-divided.
|
1313
|
+
// Round the percentage offset to an even number, then divide by two
|
1314
|
+
// to spread the offset on both sides of the range.
|
1315
|
+
stepSize = pctDifference / realSteps;
|
1316
|
+
|
1317
|
+
// Divide all points evenly, adding the correct number to this subrange.
|
1318
|
+
// Run up to <= so that 100% gets a point, event if ignoreLast is set.
|
1319
|
+
for (q = 1; q <= realSteps; q += 1) {
|
1320
|
+
// The ratio between the rounded value and the actual size might be ~1% off.
|
1321
|
+
// Correct the percentage offset by the number of points
|
1322
|
+
// per subrange. density = 1 will result in 100 points on the
|
1323
|
+
// full range, 2 for 50, 4 for 25, etc.
|
1324
|
+
pctPos = prevPct + q * stepSize;
|
1325
|
+
indexes[pctPos.toFixed(5)] = [scope_Spectrum.fromStepping(pctPos), 0];
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
// Determine the point type.
|
1329
|
+
type = group.indexOf(i) > -1 ? PIPS_LARGE_VALUE : isSteps ? PIPS_SMALL_VALUE : PIPS_NO_VALUE;
|
1330
|
+
|
1331
|
+
// Enforce the 'ignoreFirst' option by overwriting the type for 0.
|
1332
|
+
if (!index && ignoreFirst) {
|
1333
|
+
type = 0;
|
1334
|
+
}
|
1335
|
+
|
1336
|
+
if (!(i === high && ignoreLast)) {
|
1337
|
+
// Mark the 'type' of this point. 0 = plain, 1 = real value, 2 = step value.
|
1338
|
+
indexes[newPct.toFixed(5)] = [i, type];
|
1339
|
+
}
|
1340
|
+
|
1341
|
+
// Update the percentage count.
|
1342
|
+
prevPct = newPct;
|
1343
|
+
}
|
1344
|
+
});
|
1345
|
+
|
1346
|
+
return indexes;
|
1347
|
+
}
|
1348
|
+
|
1349
|
+
function addMarking(spread, filterFunc, formatter) {
|
1350
|
+
var element = scope_Document.createElement("div");
|
1351
|
+
|
1352
|
+
var valueSizeClasses = [];
|
1353
|
+
valueSizeClasses[PIPS_NO_VALUE] = options.cssClasses.valueNormal;
|
1354
|
+
valueSizeClasses[PIPS_LARGE_VALUE] = options.cssClasses.valueLarge;
|
1355
|
+
valueSizeClasses[PIPS_SMALL_VALUE] = options.cssClasses.valueSub;
|
1356
|
+
|
1357
|
+
var markerSizeClasses = [];
|
1358
|
+
markerSizeClasses[PIPS_NO_VALUE] = options.cssClasses.markerNormal;
|
1359
|
+
markerSizeClasses[PIPS_LARGE_VALUE] = options.cssClasses.markerLarge;
|
1360
|
+
markerSizeClasses[PIPS_SMALL_VALUE] = options.cssClasses.markerSub;
|
1361
|
+
|
1362
|
+
var valueOrientationClasses = [options.cssClasses.valueHorizontal, options.cssClasses.valueVertical];
|
1363
|
+
var markerOrientationClasses = [options.cssClasses.markerHorizontal, options.cssClasses.markerVertical];
|
1364
|
+
|
1365
|
+
addClass(element, options.cssClasses.pips);
|
1366
|
+
addClass(element, options.ort === 0 ? options.cssClasses.pipsHorizontal : options.cssClasses.pipsVertical);
|
1367
|
+
|
1368
|
+
function getClasses(type, source) {
|
1369
|
+
var a = source === options.cssClasses.value;
|
1370
|
+
var orientationClasses = a ? valueOrientationClasses : markerOrientationClasses;
|
1371
|
+
var sizeClasses = a ? valueSizeClasses : markerSizeClasses;
|
1372
|
+
|
1373
|
+
return source + " " + orientationClasses[options.ort] + " " + sizeClasses[type];
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
function addSpread(offset, value, type) {
|
1377
|
+
// Apply the filter function, if it is set.
|
1378
|
+
type = filterFunc ? filterFunc(value, type) : type;
|
1379
|
+
|
1380
|
+
if (type === PIPS_NONE) {
|
1381
|
+
return;
|
1382
|
+
}
|
1383
|
+
|
1384
|
+
// Add a marker for every point
|
1385
|
+
var node = addNodeTo(element, false);
|
1386
|
+
node.className = getClasses(type, options.cssClasses.marker);
|
1387
|
+
node.style[options.style] = offset + "%";
|
1388
|
+
|
1389
|
+
// Values are only appended for points marked '1' or '2'.
|
1390
|
+
if (type > PIPS_NO_VALUE) {
|
1391
|
+
node = addNodeTo(element, false);
|
1392
|
+
node.className = getClasses(type, options.cssClasses.value);
|
1393
|
+
node.setAttribute("data-value", value);
|
1394
|
+
node.style[options.style] = offset + "%";
|
1395
|
+
node.innerHTML = formatter.to(value);
|
1396
|
+
}
|
1397
|
+
}
|
1398
|
+
|
1399
|
+
// Append all points.
|
1400
|
+
Object.keys(spread).forEach(function(offset) {
|
1401
|
+
addSpread(offset, spread[offset][0], spread[offset][1]);
|
1402
|
+
});
|
1403
|
+
|
1404
|
+
return element;
|
1405
|
+
}
|
1406
|
+
|
1407
|
+
function removePips() {
|
1408
|
+
if (scope_Pips) {
|
1409
|
+
removeElement(scope_Pips);
|
1410
|
+
scope_Pips = null;
|
1411
|
+
}
|
1412
|
+
}
|
1413
|
+
|
1414
|
+
function pips(grid) {
|
1415
|
+
// Fix #669
|
1416
|
+
removePips();
|
1417
|
+
|
1418
|
+
var mode = grid.mode;
|
1419
|
+
var density = grid.density || 1;
|
1420
|
+
var filter = grid.filter || false;
|
1421
|
+
var values = grid.values || false;
|
1422
|
+
var stepped = grid.stepped || false;
|
1423
|
+
var group = getGroup(mode, values, stepped);
|
1424
|
+
var spread = generateSpread(density, mode, group);
|
1425
|
+
var format = grid.format || {
|
1426
|
+
to: Math.round
|
1427
|
+
};
|
1428
|
+
|
1429
|
+
scope_Pips = scope_Target.appendChild(addMarking(spread, filter, format));
|
1430
|
+
|
1431
|
+
return scope_Pips;
|
1432
|
+
}
|
1433
|
+
|
1434
|
+
// Shorthand for base dimensions.
|
1435
|
+
function baseSize() {
|
1436
|
+
var rect = scope_Base.getBoundingClientRect();
|
1437
|
+
var alt = "offset" + ["Width", "Height"][options.ort];
|
1438
|
+
return options.ort === 0 ? rect.width || scope_Base[alt] : rect.height || scope_Base[alt];
|
1439
|
+
}
|
1440
|
+
|
1441
|
+
// Handler for attaching events trough a proxy.
|
1442
|
+
function attachEvent(events, element, callback, data) {
|
1443
|
+
// This function can be used to 'filter' events to the slider.
|
1444
|
+
// element is a node, not a nodeList
|
1445
|
+
|
1446
|
+
var method = function(e) {
|
1447
|
+
e = fixEvent(e, data.pageOffset, data.target || element);
|
1448
|
+
|
1449
|
+
// fixEvent returns false if this event has a different target
|
1450
|
+
// when handling (multi-) touch events;
|
1451
|
+
if (!e) {
|
1452
|
+
return false;
|
1453
|
+
}
|
1454
|
+
|
1455
|
+
// doNotReject is passed by all end events to make sure released touches
|
1456
|
+
// are not rejected, leaving the slider "stuck" to the cursor;
|
1457
|
+
if (isSliderDisabled() && !data.doNotReject) {
|
1458
|
+
return false;
|
1459
|
+
}
|
1460
|
+
|
1461
|
+
// Stop if an active 'tap' transition is taking place.
|
1462
|
+
if (hasClass(scope_Target, options.cssClasses.tap) && !data.doNotReject) {
|
1463
|
+
return false;
|
1464
|
+
}
|
1465
|
+
|
1466
|
+
// Ignore right or middle clicks on start #454
|
1467
|
+
if (events === actions.start && e.buttons !== undefined && e.buttons > 1) {
|
1468
|
+
return false;
|
1469
|
+
}
|
1470
|
+
|
1471
|
+
// Ignore right or middle clicks on start #454
|
1472
|
+
if (data.hover && e.buttons) {
|
1473
|
+
return false;
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
// 'supportsPassive' is only true if a browser also supports touch-action: none in CSS.
|
1477
|
+
// iOS safari does not, so it doesn't get to benefit from passive scrolling. iOS does support
|
1478
|
+
// touch-action: manipulation, but that allows panning, which breaks
|
1479
|
+
// sliders after zooming/on non-responsive pages.
|
1480
|
+
// See: https://bugs.webkit.org/show_bug.cgi?id=133112
|
1481
|
+
if (!supportsPassive) {
|
1482
|
+
e.preventDefault();
|
1483
|
+
}
|
1484
|
+
|
1485
|
+
e.calcPoint = e.points[options.ort];
|
1486
|
+
|
1487
|
+
// Call the event handler with the event [ and additional data ].
|
1488
|
+
callback(e, data);
|
1489
|
+
};
|
1490
|
+
|
1491
|
+
var methods = [];
|
1492
|
+
|
1493
|
+
// Bind a closure on the target for every event type.
|
1494
|
+
events.split(" ").forEach(function(eventName) {
|
1495
|
+
element.addEventListener(eventName, method, supportsPassive ? { passive: true } : false);
|
1496
|
+
methods.push([eventName, method]);
|
1497
|
+
});
|
1498
|
+
|
1499
|
+
return methods;
|
1500
|
+
}
|
1501
|
+
|
1502
|
+
// Provide a clean event with standardized offset values.
|
1503
|
+
function fixEvent(e, pageOffset, eventTarget) {
|
1504
|
+
// Filter the event to register the type, which can be
|
1505
|
+
// touch, mouse or pointer. Offset changes need to be
|
1506
|
+
// made on an event specific basis.
|
1507
|
+
var touch = e.type.indexOf("touch") === 0;
|
1508
|
+
var mouse = e.type.indexOf("mouse") === 0;
|
1509
|
+
var pointer = e.type.indexOf("pointer") === 0;
|
1510
|
+
|
1511
|
+
var x;
|
1512
|
+
var y;
|
1513
|
+
|
1514
|
+
// IE10 implemented pointer events with a prefix;
|
1515
|
+
if (e.type.indexOf("MSPointer") === 0) {
|
1516
|
+
pointer = true;
|
1517
|
+
}
|
1518
|
+
|
1519
|
+
// The only thing one handle should be concerned about is the touches that originated on top of it.
|
1520
|
+
if (touch) {
|
1521
|
+
// Returns true if a touch originated on the target.
|
1522
|
+
var isTouchOnTarget = function(checkTouch) {
|
1523
|
+
return checkTouch.target === eventTarget || eventTarget.contains(checkTouch.target);
|
1524
|
+
};
|
1525
|
+
|
1526
|
+
// In the case of touchstart events, we need to make sure there is still no more than one
|
1527
|
+
// touch on the target so we look amongst all touches.
|
1528
|
+
if (e.type === "touchstart") {
|
1529
|
+
var targetTouches = Array.prototype.filter.call(e.touches, isTouchOnTarget);
|
1530
|
+
|
1531
|
+
// Do not support more than one touch per handle.
|
1532
|
+
if (targetTouches.length > 1) {
|
1533
|
+
return false;
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
x = targetTouches[0].pageX;
|
1537
|
+
y = targetTouches[0].pageY;
|
1538
|
+
} else {
|
1539
|
+
// In the other cases, find on changedTouches is enough.
|
1540
|
+
var targetTouch = Array.prototype.find.call(e.changedTouches, isTouchOnTarget);
|
1541
|
+
|
1542
|
+
// Cancel if the target touch has not moved.
|
1543
|
+
if (!targetTouch) {
|
1544
|
+
return false;
|
1545
|
+
}
|
1546
|
+
|
1547
|
+
x = targetTouch.pageX;
|
1548
|
+
y = targetTouch.pageY;
|
1549
|
+
}
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
pageOffset = pageOffset || getPageOffset(scope_Document);
|
1553
|
+
|
1554
|
+
if (mouse || pointer) {
|
1555
|
+
x = e.clientX + pageOffset.x;
|
1556
|
+
y = e.clientY + pageOffset.y;
|
1557
|
+
}
|
1558
|
+
|
1559
|
+
e.pageOffset = pageOffset;
|
1560
|
+
e.points = [x, y];
|
1561
|
+
e.cursor = mouse || pointer; // Fix #435
|
1562
|
+
|
1563
|
+
return e;
|
1564
|
+
}
|
1565
|
+
|
1566
|
+
// Translate a coordinate in the document to a percentage on the slider
|
1567
|
+
function calcPointToPercentage(calcPoint) {
|
1568
|
+
var location = calcPoint - offset(scope_Base, options.ort);
|
1569
|
+
var proposal = (location * 100) / baseSize();
|
1570
|
+
|
1571
|
+
// Clamp proposal between 0% and 100%
|
1572
|
+
// Out-of-bound coordinates may occur when .noUi-base pseudo-elements
|
1573
|
+
// are used (e.g. contained handles feature)
|
1574
|
+
proposal = limit(proposal);
|
1575
|
+
|
1576
|
+
return options.dir ? 100 - proposal : proposal;
|
1577
|
+
}
|
1578
|
+
|
1579
|
+
// Find handle closest to a certain percentage on the slider
|
1580
|
+
function getClosestHandle(clickedPosition) {
|
1581
|
+
var smallestDifference = 100;
|
1582
|
+
var handleNumber = false;
|
1583
|
+
|
1584
|
+
scope_Handles.forEach(function(handle, index) {
|
1585
|
+
// Disabled handles are ignored
|
1586
|
+
if (isHandleDisabled(index)) {
|
1587
|
+
return;
|
1588
|
+
}
|
1589
|
+
|
1590
|
+
var handlePosition = scope_Locations[index];
|
1591
|
+
var differenceWithThisHandle = Math.abs(handlePosition - clickedPosition);
|
1592
|
+
|
1593
|
+
// Initial state
|
1594
|
+
var clickAtEdge = differenceWithThisHandle === 100 && smallestDifference === 100;
|
1595
|
+
|
1596
|
+
// Difference with this handle is smaller than the previously checked handle
|
1597
|
+
var isCloser = differenceWithThisHandle < smallestDifference;
|
1598
|
+
var isCloserAfter = differenceWithThisHandle <= smallestDifference && clickedPosition > handlePosition;
|
1599
|
+
|
1600
|
+
if (isCloser || isCloserAfter || clickAtEdge) {
|
1601
|
+
handleNumber = index;
|
1602
|
+
smallestDifference = differenceWithThisHandle;
|
1603
|
+
}
|
1604
|
+
});
|
1605
|
+
|
1606
|
+
return handleNumber;
|
1607
|
+
}
|
1608
|
+
|
1609
|
+
// Fire 'end' when a mouse or pen leaves the document.
|
1610
|
+
function documentLeave(event, data) {
|
1611
|
+
if (event.type === "mouseout" && event.target.nodeName === "HTML" && event.relatedTarget === null) {
|
1612
|
+
eventEnd(event, data);
|
1613
|
+
}
|
1614
|
+
}
|
1615
|
+
|
1616
|
+
// Handle movement on document for handle and range drag.
|
1617
|
+
function eventMove(event, data) {
|
1618
|
+
// Fix #498
|
1619
|
+
// Check value of .buttons in 'start' to work around a bug in IE10 mobile (data.buttonsProperty).
|
1620
|
+
// https://connect.microsoft.com/IE/feedback/details/927005/mobile-ie10-windows-phone-buttons-property-of-pointermove-event-always-zero
|
1621
|
+
// IE9 has .buttons and .which zero on mousemove.
|
1622
|
+
// Firefox breaks the spec MDN defines.
|
1623
|
+
if (navigator.appVersion.indexOf("MSIE 9") === -1 && event.buttons === 0 && data.buttonsProperty !== 0) {
|
1624
|
+
return eventEnd(event, data);
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
// Check if we are moving up or down
|
1628
|
+
var movement = (options.dir ? -1 : 1) * (event.calcPoint - data.startCalcPoint);
|
1629
|
+
|
1630
|
+
// Convert the movement into a percentage of the slider width/height
|
1631
|
+
var proposal = (movement * 100) / data.baseSize;
|
1632
|
+
|
1633
|
+
moveHandles(movement > 0, proposal, data.locations, data.handleNumbers);
|
1634
|
+
}
|
1635
|
+
|
1636
|
+
// Unbind move events on document, call callbacks.
|
1637
|
+
function eventEnd(event, data) {
|
1638
|
+
// The handle is no longer active, so remove the class.
|
1639
|
+
if (data.handle) {
|
1640
|
+
removeClass(data.handle, options.cssClasses.active);
|
1641
|
+
scope_ActiveHandlesCount -= 1;
|
1642
|
+
}
|
1643
|
+
|
1644
|
+
// Unbind the move and end events, which are added on 'start'.
|
1645
|
+
data.listeners.forEach(function(c) {
|
1646
|
+
scope_DocumentElement.removeEventListener(c[0], c[1]);
|
1647
|
+
});
|
1648
|
+
|
1649
|
+
if (scope_ActiveHandlesCount === 0) {
|
1650
|
+
// Remove dragging class.
|
1651
|
+
removeClass(scope_Target, options.cssClasses.drag);
|
1652
|
+
setZindex();
|
1653
|
+
|
1654
|
+
// Remove cursor styles and text-selection events bound to the body.
|
1655
|
+
if (event.cursor) {
|
1656
|
+
scope_Body.style.cursor = "";
|
1657
|
+
scope_Body.removeEventListener("selectstart", preventDefault);
|
1658
|
+
}
|
1659
|
+
}
|
1660
|
+
|
1661
|
+
data.handleNumbers.forEach(function(handleNumber) {
|
1662
|
+
fireEvent("change", handleNumber);
|
1663
|
+
fireEvent("set", handleNumber);
|
1664
|
+
fireEvent("end", handleNumber);
|
1665
|
+
});
|
1666
|
+
}
|
1667
|
+
|
1668
|
+
// Bind move events on document.
|
1669
|
+
function eventStart(event, data) {
|
1670
|
+
// Ignore event if any handle is disabled
|
1671
|
+
if (data.handleNumbers.some(isHandleDisabled)) {
|
1672
|
+
return false;
|
1673
|
+
}
|
1674
|
+
|
1675
|
+
var handle;
|
1676
|
+
|
1677
|
+
if (data.handleNumbers.length === 1) {
|
1678
|
+
var handleOrigin = scope_Handles[data.handleNumbers[0]];
|
1679
|
+
|
1680
|
+
handle = handleOrigin.children[0];
|
1681
|
+
scope_ActiveHandlesCount += 1;
|
1682
|
+
|
1683
|
+
// Mark the handle as 'active' so it can be styled.
|
1684
|
+
addClass(handle, options.cssClasses.active);
|
1685
|
+
}
|
1686
|
+
|
1687
|
+
// A drag should never propagate up to the 'tap' event.
|
1688
|
+
event.stopPropagation();
|
1689
|
+
|
1690
|
+
// Record the event listeners.
|
1691
|
+
var listeners = [];
|
1692
|
+
|
1693
|
+
// Attach the move and end events.
|
1694
|
+
var moveEvent = attachEvent(actions.move, scope_DocumentElement, eventMove, {
|
1695
|
+
// The event target has changed so we need to propagate the original one so that we keep
|
1696
|
+
// relying on it to extract target touches.
|
1697
|
+
target: event.target,
|
1698
|
+
handle: handle,
|
1699
|
+
listeners: listeners,
|
1700
|
+
startCalcPoint: event.calcPoint,
|
1701
|
+
baseSize: baseSize(),
|
1702
|
+
pageOffset: event.pageOffset,
|
1703
|
+
handleNumbers: data.handleNumbers,
|
1704
|
+
buttonsProperty: event.buttons,
|
1705
|
+
locations: scope_Locations.slice()
|
1706
|
+
});
|
1707
|
+
|
1708
|
+
var endEvent = attachEvent(actions.end, scope_DocumentElement, eventEnd, {
|
1709
|
+
target: event.target,
|
1710
|
+
handle: handle,
|
1711
|
+
listeners: listeners,
|
1712
|
+
doNotReject: true,
|
1713
|
+
handleNumbers: data.handleNumbers
|
1714
|
+
});
|
1715
|
+
|
1716
|
+
var outEvent = attachEvent("mouseout", scope_DocumentElement, documentLeave, {
|
1717
|
+
target: event.target,
|
1718
|
+
handle: handle,
|
1719
|
+
listeners: listeners,
|
1720
|
+
doNotReject: true,
|
1721
|
+
handleNumbers: data.handleNumbers
|
1722
|
+
});
|
1723
|
+
|
1724
|
+
// We want to make sure we pushed the listeners in the listener list rather than creating
|
1725
|
+
// a new one as it has already been passed to the event handlers.
|
1726
|
+
listeners.push.apply(listeners, moveEvent.concat(endEvent, outEvent));
|
1727
|
+
|
1728
|
+
// Text selection isn't an issue on touch devices,
|
1729
|
+
// so adding cursor styles can be skipped.
|
1730
|
+
if (event.cursor) {
|
1731
|
+
// Prevent the 'I' cursor and extend the range-drag cursor.
|
1732
|
+
scope_Body.style.cursor = getComputedStyle(event.target).cursor;
|
1733
|
+
|
1734
|
+
// Mark the target with a dragging state.
|
1735
|
+
if (scope_Handles.length > 1) {
|
1736
|
+
addClass(scope_Target, options.cssClasses.drag);
|
1737
|
+
}
|
1738
|
+
|
1739
|
+
// Prevent text selection when dragging the handles.
|
1740
|
+
// In noUiSlider <= 9.2.0, this was handled by calling preventDefault on mouse/touch start/move,
|
1741
|
+
// which is scroll blocking. The selectstart event is supported by FireFox starting from version 52,
|
1742
|
+
// meaning the only holdout is iOS Safari. This doesn't matter: text selection isn't triggered there.
|
1743
|
+
// The 'cursor' flag is false.
|
1744
|
+
// See: http://caniuse.com/#search=selectstart
|
1745
|
+
scope_Body.addEventListener("selectstart", preventDefault, false);
|
1746
|
+
}
|
1747
|
+
|
1748
|
+
data.handleNumbers.forEach(function(handleNumber) {
|
1749
|
+
fireEvent("start", handleNumber);
|
1750
|
+
});
|
1751
|
+
}
|
1752
|
+
|
1753
|
+
// Move closest handle to tapped location.
|
1754
|
+
function eventTap(event) {
|
1755
|
+
// The tap event shouldn't propagate up
|
1756
|
+
event.stopPropagation();
|
1757
|
+
|
1758
|
+
var proposal = calcPointToPercentage(event.calcPoint);
|
1759
|
+
var handleNumber = getClosestHandle(proposal);
|
1760
|
+
|
1761
|
+
// Tackle the case that all handles are 'disabled'.
|
1762
|
+
if (handleNumber === false) {
|
1763
|
+
return false;
|
1764
|
+
}
|
1765
|
+
|
1766
|
+
// Flag the slider as it is now in a transitional state.
|
1767
|
+
// Transition takes a configurable amount of ms (default 300). Re-enable the slider after that.
|
1768
|
+
if (!options.events.snap) {
|
1769
|
+
addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration);
|
1770
|
+
}
|
1771
|
+
|
1772
|
+
setHandle(handleNumber, proposal, true, true);
|
1773
|
+
|
1774
|
+
setZindex();
|
1775
|
+
|
1776
|
+
fireEvent("slide", handleNumber, true);
|
1777
|
+
fireEvent("update", handleNumber, true);
|
1778
|
+
fireEvent("change", handleNumber, true);
|
1779
|
+
fireEvent("set", handleNumber, true);
|
1780
|
+
|
1781
|
+
if (options.events.snap) {
|
1782
|
+
eventStart(event, { handleNumbers: [handleNumber] });
|
1783
|
+
}
|
1784
|
+
}
|
1785
|
+
|
1786
|
+
// Fires a 'hover' event for a hovered mouse/pen position.
|
1787
|
+
function eventHover(event) {
|
1788
|
+
var proposal = calcPointToPercentage(event.calcPoint);
|
1789
|
+
|
1790
|
+
var to = scope_Spectrum.getStep(proposal);
|
1791
|
+
var value = scope_Spectrum.fromStepping(to);
|
1792
|
+
|
1793
|
+
Object.keys(scope_Events).forEach(function(targetEvent) {
|
1794
|
+
if ("hover" === targetEvent.split(".")[0]) {
|
1795
|
+
scope_Events[targetEvent].forEach(function(callback) {
|
1796
|
+
callback.call(scope_Self, value);
|
1797
|
+
});
|
1798
|
+
}
|
1799
|
+
});
|
1800
|
+
}
|
1801
|
+
|
1802
|
+
// Handles keydown on focused handles
|
1803
|
+
// Don't move the document when pressing arrow keys on focused handles
|
1804
|
+
function eventKeydown(event, handleNumber) {
|
1805
|
+
if (isSliderDisabled() || isHandleDisabled(handleNumber)) {
|
1806
|
+
return false;
|
1807
|
+
}
|
1808
|
+
|
1809
|
+
var horizontalKeys = ["Left", "Right"];
|
1810
|
+
var verticalKeys = ["Down", "Up"];
|
1811
|
+
var largeStepKeys = ["PageDown", "PageUp"];
|
1812
|
+
var edgeKeys = ["Home", "End"];
|
1813
|
+
|
1814
|
+
if (options.dir && !options.ort) {
|
1815
|
+
// On an right-to-left slider, the left and right keys act inverted
|
1816
|
+
horizontalKeys.reverse();
|
1817
|
+
} else if (options.ort && !options.dir) {
|
1818
|
+
// On a top-to-bottom slider, the up and down keys act inverted
|
1819
|
+
verticalKeys.reverse();
|
1820
|
+
largeStepKeys.reverse();
|
1821
|
+
}
|
1822
|
+
|
1823
|
+
// Strip "Arrow" for IE compatibility. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
|
1824
|
+
var key = event.key.replace("Arrow", "");
|
1825
|
+
|
1826
|
+
var isLargeDown = key === largeStepKeys[0];
|
1827
|
+
var isLargeUp = key === largeStepKeys[1];
|
1828
|
+
var isDown = key === verticalKeys[0] || key === horizontalKeys[0] || isLargeDown;
|
1829
|
+
var isUp = key === verticalKeys[1] || key === horizontalKeys[1] || isLargeUp;
|
1830
|
+
var isMin = key === edgeKeys[0];
|
1831
|
+
var isMax = key === edgeKeys[1];
|
1832
|
+
|
1833
|
+
if (!isDown && !isUp && !isMin && !isMax) {
|
1834
|
+
return true;
|
1835
|
+
}
|
1836
|
+
|
1837
|
+
event.preventDefault();
|
1838
|
+
|
1839
|
+
var to;
|
1840
|
+
|
1841
|
+
if (isUp || isDown) {
|
1842
|
+
var multiplier = 5;
|
1843
|
+
var direction = isDown ? 0 : 1;
|
1844
|
+
var steps = getNextStepsForHandle(handleNumber);
|
1845
|
+
var step = steps[direction];
|
1846
|
+
|
1847
|
+
// At the edge of a slider, do nothing
|
1848
|
+
if (step === null) {
|
1849
|
+
return false;
|
1850
|
+
}
|
1851
|
+
|
1852
|
+
// No step set, use the default of 10% of the sub-range
|
1853
|
+
if (step === false) {
|
1854
|
+
step = scope_Spectrum.getDefaultStep(scope_Locations[handleNumber], isDown, 10);
|
1855
|
+
}
|
1856
|
+
|
1857
|
+
if (isLargeUp || isLargeDown) {
|
1858
|
+
step *= multiplier;
|
1859
|
+
}
|
1860
|
+
|
1861
|
+
// Step over zero-length ranges (#948);
|
1862
|
+
step = Math.max(step, 0.0000001);
|
1863
|
+
|
1864
|
+
// Decrement for down steps
|
1865
|
+
step = (isDown ? -1 : 1) * step;
|
1866
|
+
|
1867
|
+
to = scope_Values[handleNumber] + step;
|
1868
|
+
} else if (isMax) {
|
1869
|
+
// End key
|
1870
|
+
to = options.spectrum.xVal[options.spectrum.xVal.length - 1];
|
1871
|
+
} else {
|
1872
|
+
// Home key
|
1873
|
+
to = options.spectrum.xVal[0];
|
1874
|
+
}
|
1875
|
+
|
1876
|
+
setHandle(handleNumber, scope_Spectrum.toStepping(to), true, true);
|
1877
|
+
|
1878
|
+
fireEvent("slide", handleNumber);
|
1879
|
+
fireEvent("update", handleNumber);
|
1880
|
+
fireEvent("change", handleNumber);
|
1881
|
+
fireEvent("set", handleNumber);
|
1882
|
+
|
1883
|
+
return false;
|
1884
|
+
}
|
1885
|
+
|
1886
|
+
// Attach events to several slider parts.
|
1887
|
+
function bindSliderEvents(behaviour) {
|
1888
|
+
// Attach the standard drag event to the handles.
|
1889
|
+
if (!behaviour.fixed) {
|
1890
|
+
scope_Handles.forEach(function(handle, index) {
|
1891
|
+
// These events are only bound to the visual handle
|
1892
|
+
// element, not the 'real' origin element.
|
1893
|
+
attachEvent(actions.start, handle.children[0], eventStart, {
|
1894
|
+
handleNumbers: [index]
|
1895
|
+
});
|
1896
|
+
});
|
1897
|
+
}
|
1898
|
+
|
1899
|
+
// Attach the tap event to the slider base.
|
1900
|
+
if (behaviour.tap) {
|
1901
|
+
attachEvent(actions.start, scope_Base, eventTap, {});
|
1902
|
+
}
|
1903
|
+
|
1904
|
+
// Fire hover events
|
1905
|
+
if (behaviour.hover) {
|
1906
|
+
attachEvent(actions.move, scope_Base, eventHover, {
|
1907
|
+
hover: true
|
1908
|
+
});
|
1909
|
+
}
|
1910
|
+
|
1911
|
+
// Make the range draggable.
|
1912
|
+
if (behaviour.drag) {
|
1913
|
+
scope_Connects.forEach(function(connect, index) {
|
1914
|
+
if (connect === false || index === 0 || index === scope_Connects.length - 1) {
|
1915
|
+
return;
|
1916
|
+
}
|
1917
|
+
|
1918
|
+
var handleBefore = scope_Handles[index - 1];
|
1919
|
+
var handleAfter = scope_Handles[index];
|
1920
|
+
var eventHolders = [connect];
|
1921
|
+
|
1922
|
+
addClass(connect, options.cssClasses.draggable);
|
1923
|
+
|
1924
|
+
// When the range is fixed, the entire range can
|
1925
|
+
// be dragged by the handles. The handle in the first
|
1926
|
+
// origin will propagate the start event upward,
|
1927
|
+
// but it needs to be bound manually on the other.
|
1928
|
+
if (behaviour.fixed) {
|
1929
|
+
eventHolders.push(handleBefore.children[0]);
|
1930
|
+
eventHolders.push(handleAfter.children[0]);
|
1931
|
+
}
|
1932
|
+
|
1933
|
+
eventHolders.forEach(function(eventHolder) {
|
1934
|
+
attachEvent(actions.start, eventHolder, eventStart, {
|
1935
|
+
handles: [handleBefore, handleAfter],
|
1936
|
+
handleNumbers: [index - 1, index]
|
1937
|
+
});
|
1938
|
+
});
|
1939
|
+
});
|
1940
|
+
}
|
1941
|
+
}
|
1942
|
+
|
1943
|
+
// Attach an event to this slider, possibly including a namespace
|
1944
|
+
function bindEvent(namespacedEvent, callback) {
|
1945
|
+
scope_Events[namespacedEvent] = scope_Events[namespacedEvent] || [];
|
1946
|
+
scope_Events[namespacedEvent].push(callback);
|
1947
|
+
|
1948
|
+
// If the event bound is 'update,' fire it immediately for all handles.
|
1949
|
+
if (namespacedEvent.split(".")[0] === "update") {
|
1950
|
+
scope_Handles.forEach(function(a, index) {
|
1951
|
+
fireEvent("update", index);
|
1952
|
+
});
|
1953
|
+
}
|
1954
|
+
}
|
1955
|
+
|
1956
|
+
// Undo attachment of event
|
1957
|
+
function removeEvent(namespacedEvent) {
|
1958
|
+
var event = namespacedEvent && namespacedEvent.split(".")[0];
|
1959
|
+
var namespace = event && namespacedEvent.substring(event.length);
|
1960
|
+
|
1961
|
+
Object.keys(scope_Events).forEach(function(bind) {
|
1962
|
+
var tEvent = bind.split(".")[0];
|
1963
|
+
var tNamespace = bind.substring(tEvent.length);
|
1964
|
+
|
1965
|
+
if ((!event || event === tEvent) && (!namespace || namespace === tNamespace)) {
|
1966
|
+
delete scope_Events[bind];
|
1967
|
+
}
|
1968
|
+
});
|
1969
|
+
}
|
1970
|
+
|
1971
|
+
// External event handling
|
1972
|
+
function fireEvent(eventName, handleNumber, tap) {
|
1973
|
+
Object.keys(scope_Events).forEach(function(targetEvent) {
|
1974
|
+
var eventType = targetEvent.split(".")[0];
|
1975
|
+
|
1976
|
+
if (eventName === eventType) {
|
1977
|
+
scope_Events[targetEvent].forEach(function(callback) {
|
1978
|
+
callback.call(
|
1979
|
+
// Use the slider public API as the scope ('this')
|
1980
|
+
scope_Self,
|
1981
|
+
// Return values as array, so arg_1[arg_2] is always valid.
|
1982
|
+
scope_Values.map(options.format.to),
|
1983
|
+
// Handle index, 0 or 1
|
1984
|
+
handleNumber,
|
1985
|
+
// Un-formatted slider values
|
1986
|
+
scope_Values.slice(),
|
1987
|
+
// Event is fired by tap, true or false
|
1988
|
+
tap || false,
|
1989
|
+
// Left offset of the handle, in relation to the slider
|
1990
|
+
scope_Locations.slice()
|
1991
|
+
);
|
1992
|
+
});
|
1993
|
+
}
|
1994
|
+
});
|
1995
|
+
}
|
1996
|
+
|
1997
|
+
// Split out the handle positioning logic so the Move event can use it, too
|
1998
|
+
function checkHandlePosition(reference, handleNumber, to, lookBackward, lookForward, getValue) {
|
1999
|
+
// For sliders with multiple handles, limit movement to the other handle.
|
2000
|
+
// Apply the margin option by adding it to the handle positions.
|
2001
|
+
if (scope_Handles.length > 1 && !options.events.unconstrained) {
|
2002
|
+
if (lookBackward && handleNumber > 0) {
|
2003
|
+
to = Math.max(to, reference[handleNumber - 1] + options.margin);
|
2004
|
+
}
|
2005
|
+
|
2006
|
+
if (lookForward && handleNumber < scope_Handles.length - 1) {
|
2007
|
+
to = Math.min(to, reference[handleNumber + 1] - options.margin);
|
2008
|
+
}
|
2009
|
+
}
|
2010
|
+
|
2011
|
+
// The limit option has the opposite effect, limiting handles to a
|
2012
|
+
// maximum distance from another. Limit must be > 0, as otherwise
|
2013
|
+
// handles would be unmovable.
|
2014
|
+
if (scope_Handles.length > 1 && options.limit) {
|
2015
|
+
if (lookBackward && handleNumber > 0) {
|
2016
|
+
to = Math.min(to, reference[handleNumber - 1] + options.limit);
|
2017
|
+
}
|
2018
|
+
|
2019
|
+
if (lookForward && handleNumber < scope_Handles.length - 1) {
|
2020
|
+
to = Math.max(to, reference[handleNumber + 1] - options.limit);
|
2021
|
+
}
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
// The padding option keeps the handles a certain distance from the
|
2025
|
+
// edges of the slider. Padding must be > 0.
|
2026
|
+
if (options.padding) {
|
2027
|
+
if (handleNumber === 0) {
|
2028
|
+
to = Math.max(to, options.padding[0]);
|
2029
|
+
}
|
2030
|
+
|
2031
|
+
if (handleNumber === scope_Handles.length - 1) {
|
2032
|
+
to = Math.min(to, 100 - options.padding[1]);
|
2033
|
+
}
|
2034
|
+
}
|
2035
|
+
|
2036
|
+
to = scope_Spectrum.getStep(to);
|
2037
|
+
|
2038
|
+
// Limit percentage to the 0 - 100 range
|
2039
|
+
to = limit(to);
|
2040
|
+
|
2041
|
+
// Return false if handle can't move
|
2042
|
+
if (to === reference[handleNumber] && !getValue) {
|
2043
|
+
return false;
|
2044
|
+
}
|
2045
|
+
|
2046
|
+
return to;
|
2047
|
+
}
|
2048
|
+
|
2049
|
+
// Uses slider orientation to create CSS rules. a = base value;
|
2050
|
+
function inRuleOrder(v, a) {
|
2051
|
+
var o = options.ort;
|
2052
|
+
return (o ? a : v) + ", " + (o ? v : a);
|
2053
|
+
}
|
2054
|
+
|
2055
|
+
// Moves handle(s) by a percentage
|
2056
|
+
// (bool, % to move, [% where handle started, ...], [index in scope_Handles, ...])
|
2057
|
+
function moveHandles(upward, proposal, locations, handleNumbers) {
|
2058
|
+
var proposals = locations.slice();
|
2059
|
+
|
2060
|
+
var b = [!upward, upward];
|
2061
|
+
var f = [upward, !upward];
|
2062
|
+
|
2063
|
+
// Copy handleNumbers so we don't change the dataset
|
2064
|
+
handleNumbers = handleNumbers.slice();
|
2065
|
+
|
2066
|
+
// Check to see which handle is 'leading'.
|
2067
|
+
// If that one can't move the second can't either.
|
2068
|
+
if (upward) {
|
2069
|
+
handleNumbers.reverse();
|
2070
|
+
}
|
2071
|
+
|
2072
|
+
// Step 1: get the maximum percentage that any of the handles can move
|
2073
|
+
if (handleNumbers.length > 1) {
|
2074
|
+
handleNumbers.forEach(function(handleNumber, o) {
|
2075
|
+
var to = checkHandlePosition(
|
2076
|
+
proposals,
|
2077
|
+
handleNumber,
|
2078
|
+
proposals[handleNumber] + proposal,
|
2079
|
+
b[o],
|
2080
|
+
f[o],
|
2081
|
+
false
|
2082
|
+
);
|
2083
|
+
|
2084
|
+
// Stop if one of the handles can't move.
|
2085
|
+
if (to === false) {
|
2086
|
+
proposal = 0;
|
2087
|
+
} else {
|
2088
|
+
proposal = to - proposals[handleNumber];
|
2089
|
+
proposals[handleNumber] = to;
|
2090
|
+
}
|
2091
|
+
});
|
2092
|
+
}
|
2093
|
+
|
2094
|
+
// If using one handle, check backward AND forward
|
2095
|
+
else {
|
2096
|
+
b = f = [true];
|
2097
|
+
}
|
2098
|
+
|
2099
|
+
var state = false;
|
2100
|
+
|
2101
|
+
// Step 2: Try to set the handles with the found percentage
|
2102
|
+
handleNumbers.forEach(function(handleNumber, o) {
|
2103
|
+
state = setHandle(handleNumber, locations[handleNumber] + proposal, b[o], f[o]) || state;
|
2104
|
+
});
|
2105
|
+
|
2106
|
+
// Step 3: If a handle moved, fire events
|
2107
|
+
if (state) {
|
2108
|
+
handleNumbers.forEach(function(handleNumber) {
|
2109
|
+
fireEvent("update", handleNumber);
|
2110
|
+
fireEvent("slide", handleNumber);
|
2111
|
+
});
|
2112
|
+
}
|
2113
|
+
}
|
2114
|
+
|
2115
|
+
// Takes a base value and an offset. This offset is used for the connect bar size.
|
2116
|
+
// In the initial design for this feature, the origin element was 1% wide.
|
2117
|
+
// Unfortunately, a rounding bug in Chrome makes it impossible to implement this feature
|
2118
|
+
// in this manner: https://bugs.chromium.org/p/chromium/issues/detail?id=798223
|
2119
|
+
function transformDirection(a, b) {
|
2120
|
+
return options.dir ? 100 - a - b : a;
|
2121
|
+
}
|
2122
|
+
|
2123
|
+
// Updates scope_Locations and scope_Values, updates visual state
|
2124
|
+
function updateHandlePosition(handleNumber, to) {
|
2125
|
+
// Update locations.
|
2126
|
+
scope_Locations[handleNumber] = to;
|
2127
|
+
|
2128
|
+
// Convert the value to the slider stepping/range.
|
2129
|
+
scope_Values[handleNumber] = scope_Spectrum.fromStepping(to);
|
2130
|
+
|
2131
|
+
var translation = 10 * (transformDirection(to, 0) - scope_DirOffset);
|
2132
|
+
var translateRule = "translate(" + inRuleOrder(translation + "%", "0") + ")";
|
2133
|
+
|
2134
|
+
scope_Handles[handleNumber].style[options.transformRule] = translateRule;
|
2135
|
+
|
2136
|
+
updateConnect(handleNumber);
|
2137
|
+
updateConnect(handleNumber + 1);
|
2138
|
+
}
|
2139
|
+
|
2140
|
+
// Handles before the slider middle are stacked later = higher,
|
2141
|
+
// Handles after the middle later is lower
|
2142
|
+
// [[7] [8] .......... | .......... [5] [4]
|
2143
|
+
function setZindex() {
|
2144
|
+
scope_HandleNumbers.forEach(function(handleNumber) {
|
2145
|
+
var dir = scope_Locations[handleNumber] > 50 ? -1 : 1;
|
2146
|
+
var zIndex = 3 + (scope_Handles.length + dir * handleNumber);
|
2147
|
+
scope_Handles[handleNumber].style.zIndex = zIndex;
|
2148
|
+
});
|
2149
|
+
}
|
2150
|
+
|
2151
|
+
// Test suggested values and apply margin, step.
|
2152
|
+
function setHandle(handleNumber, to, lookBackward, lookForward) {
|
2153
|
+
to = checkHandlePosition(scope_Locations, handleNumber, to, lookBackward, lookForward, false);
|
2154
|
+
|
2155
|
+
if (to === false) {
|
2156
|
+
return false;
|
2157
|
+
}
|
2158
|
+
|
2159
|
+
updateHandlePosition(handleNumber, to);
|
2160
|
+
|
2161
|
+
return true;
|
2162
|
+
}
|
2163
|
+
|
2164
|
+
// Updates style attribute for connect nodes
|
2165
|
+
function updateConnect(index) {
|
2166
|
+
// Skip connects set to false
|
2167
|
+
if (!scope_Connects[index]) {
|
2168
|
+
return;
|
2169
|
+
}
|
2170
|
+
|
2171
|
+
var l = 0;
|
2172
|
+
var h = 100;
|
2173
|
+
|
2174
|
+
if (index !== 0) {
|
2175
|
+
l = scope_Locations[index - 1];
|
2176
|
+
}
|
2177
|
+
|
2178
|
+
if (index !== scope_Connects.length - 1) {
|
2179
|
+
h = scope_Locations[index];
|
2180
|
+
}
|
2181
|
+
|
2182
|
+
// We use two rules:
|
2183
|
+
// 'translate' to change the left/top offset;
|
2184
|
+
// 'scale' to change the width of the element;
|
2185
|
+
// As the element has a width of 100%, a translation of 100% is equal to 100% of the parent (.noUi-base)
|
2186
|
+
var connectWidth = h - l;
|
2187
|
+
var translateRule = "translate(" + inRuleOrder(transformDirection(l, connectWidth) + "%", "0") + ")";
|
2188
|
+
var scaleRule = "scale(" + inRuleOrder(connectWidth / 100, "1") + ")";
|
2189
|
+
|
2190
|
+
scope_Connects[index].style[options.transformRule] = translateRule + " " + scaleRule;
|
2191
|
+
}
|
2192
|
+
|
2193
|
+
// Parses value passed to .set method. Returns current value if not parse-able.
|
2194
|
+
function resolveToValue(to, handleNumber) {
|
2195
|
+
// Setting with null indicates an 'ignore'.
|
2196
|
+
// Inputting 'false' is invalid.
|
2197
|
+
if (to === null || to === false || to === undefined) {
|
2198
|
+
return scope_Locations[handleNumber];
|
2199
|
+
}
|
2200
|
+
|
2201
|
+
// If a formatted number was passed, attempt to decode it.
|
2202
|
+
if (typeof to === "number") {
|
2203
|
+
to = String(to);
|
2204
|
+
}
|
2205
|
+
|
2206
|
+
to = options.format.from(to);
|
2207
|
+
to = scope_Spectrum.toStepping(to);
|
2208
|
+
|
2209
|
+
// If parsing the number failed, use the current value.
|
2210
|
+
if (to === false || isNaN(to)) {
|
2211
|
+
return scope_Locations[handleNumber];
|
2212
|
+
}
|
2213
|
+
|
2214
|
+
return to;
|
2215
|
+
}
|
2216
|
+
|
2217
|
+
// Set the slider value.
|
2218
|
+
function valueSet(input, fireSetEvent) {
|
2219
|
+
var values = asArray(input);
|
2220
|
+
var isInit = scope_Locations[0] === undefined;
|
2221
|
+
|
2222
|
+
// Event fires by default
|
2223
|
+
fireSetEvent = fireSetEvent === undefined ? true : !!fireSetEvent;
|
2224
|
+
|
2225
|
+
// Animation is optional.
|
2226
|
+
// Make sure the initial values were set before using animated placement.
|
2227
|
+
if (options.animate && !isInit) {
|
2228
|
+
addClassFor(scope_Target, options.cssClasses.tap, options.animationDuration);
|
2229
|
+
}
|
2230
|
+
|
2231
|
+
// First pass, without lookAhead but with lookBackward. Values are set from left to right.
|
2232
|
+
scope_HandleNumbers.forEach(function(handleNumber) {
|
2233
|
+
setHandle(handleNumber, resolveToValue(values[handleNumber], handleNumber), true, false);
|
2234
|
+
});
|
2235
|
+
|
2236
|
+
var i = scope_HandleNumbers.length === 1 ? 0 : 1;
|
2237
|
+
|
2238
|
+
// Secondary passes. Now that all base values are set, apply constraints.
|
2239
|
+
// Iterate all handles to ensure constraints are applied for the entire slider (Issue #1009)
|
2240
|
+
for (; i < scope_HandleNumbers.length; ++i) {
|
2241
|
+
scope_HandleNumbers.forEach(function(handleNumber) {
|
2242
|
+
setHandle(handleNumber, scope_Locations[handleNumber], true, true);
|
2243
|
+
});
|
2244
|
+
}
|
2245
|
+
|
2246
|
+
setZindex();
|
2247
|
+
|
2248
|
+
scope_HandleNumbers.forEach(function(handleNumber) {
|
2249
|
+
fireEvent("update", handleNumber);
|
2250
|
+
|
2251
|
+
// Fire the event only for handles that received a new value, as per #579
|
2252
|
+
if (values[handleNumber] !== null && fireSetEvent) {
|
2253
|
+
fireEvent("set", handleNumber);
|
2254
|
+
}
|
2255
|
+
});
|
2256
|
+
}
|
2257
|
+
|
2258
|
+
// Reset slider to initial values
|
2259
|
+
function valueReset(fireSetEvent) {
|
2260
|
+
valueSet(options.start, fireSetEvent);
|
2261
|
+
}
|
2262
|
+
|
2263
|
+
// Set value for a single handle
|
2264
|
+
function valueSetHandle(handleNumber, value, fireSetEvent) {
|
2265
|
+
// Ensure numeric input
|
2266
|
+
handleNumber = Number(handleNumber);
|
2267
|
+
|
2268
|
+
if (!(handleNumber >= 0 && handleNumber < scope_HandleNumbers.length)) {
|
2269
|
+
throw new Error("noUiSlider (" + VERSION + "): invalid handle number, got: " + handleNumber);
|
2270
|
+
}
|
2271
|
+
|
2272
|
+
// Look both backward and forward, since we don't want this handle to "push" other handles (#960);
|
2273
|
+
setHandle(handleNumber, resolveToValue(value, handleNumber), true, true);
|
2274
|
+
|
2275
|
+
fireEvent("update", handleNumber);
|
2276
|
+
|
2277
|
+
if (fireSetEvent) {
|
2278
|
+
fireEvent("set", handleNumber);
|
2279
|
+
}
|
2280
|
+
}
|
2281
|
+
|
2282
|
+
// Get the slider value.
|
2283
|
+
function valueGet() {
|
2284
|
+
var values = scope_Values.map(options.format.to);
|
2285
|
+
|
2286
|
+
// If only one handle is used, return a single value.
|
2287
|
+
if (values.length === 1) {
|
2288
|
+
return values[0];
|
2289
|
+
}
|
2290
|
+
|
2291
|
+
return values;
|
2292
|
+
}
|
2293
|
+
|
2294
|
+
// Removes classes from the root and empties it.
|
2295
|
+
function destroy() {
|
2296
|
+
for (var key in options.cssClasses) {
|
2297
|
+
if (!options.cssClasses.hasOwnProperty(key)) {
|
2298
|
+
continue;
|
2299
|
+
}
|
2300
|
+
removeClass(scope_Target, options.cssClasses[key]);
|
2301
|
+
}
|
2302
|
+
|
2303
|
+
while (scope_Target.firstChild) {
|
2304
|
+
scope_Target.removeChild(scope_Target.firstChild);
|
2305
|
+
}
|
2306
|
+
|
2307
|
+
delete scope_Target.noUiSlider;
|
2308
|
+
}
|
2309
|
+
|
2310
|
+
function getNextStepsForHandle(handleNumber) {
|
2311
|
+
var location = scope_Locations[handleNumber];
|
2312
|
+
var nearbySteps = scope_Spectrum.getNearbySteps(location);
|
2313
|
+
var value = scope_Values[handleNumber];
|
2314
|
+
var increment = nearbySteps.thisStep.step;
|
2315
|
+
var decrement = null;
|
2316
|
+
|
2317
|
+
// If snapped, directly use defined step value
|
2318
|
+
if (options.snap) {
|
2319
|
+
return [
|
2320
|
+
value - nearbySteps.stepBefore.startValue || null,
|
2321
|
+
nearbySteps.stepAfter.startValue - value || null
|
2322
|
+
];
|
2323
|
+
}
|
2324
|
+
|
2325
|
+
// If the next value in this step moves into the next step,
|
2326
|
+
// the increment is the start of the next step - the current value
|
2327
|
+
if (increment !== false) {
|
2328
|
+
if (value + increment > nearbySteps.stepAfter.startValue) {
|
2329
|
+
increment = nearbySteps.stepAfter.startValue - value;
|
2330
|
+
}
|
2331
|
+
}
|
2332
|
+
|
2333
|
+
// If the value is beyond the starting point
|
2334
|
+
if (value > nearbySteps.thisStep.startValue) {
|
2335
|
+
decrement = nearbySteps.thisStep.step;
|
2336
|
+
} else if (nearbySteps.stepBefore.step === false) {
|
2337
|
+
decrement = false;
|
2338
|
+
}
|
2339
|
+
|
2340
|
+
// If a handle is at the start of a step, it always steps back into the previous step first
|
2341
|
+
else {
|
2342
|
+
decrement = value - nearbySteps.stepBefore.highestStep;
|
2343
|
+
}
|
2344
|
+
|
2345
|
+
// Now, if at the slider edges, there is no in/decrement
|
2346
|
+
if (location === 100) {
|
2347
|
+
increment = null;
|
2348
|
+
} else if (location === 0) {
|
2349
|
+
decrement = null;
|
2350
|
+
}
|
2351
|
+
|
2352
|
+
// As per #391, the comparison for the decrement step can have some rounding issues.
|
2353
|
+
var stepDecimals = scope_Spectrum.countStepDecimals();
|
2354
|
+
|
2355
|
+
// Round per #391
|
2356
|
+
if (increment !== null && increment !== false) {
|
2357
|
+
increment = Number(increment.toFixed(stepDecimals));
|
2358
|
+
}
|
2359
|
+
|
2360
|
+
if (decrement !== null && decrement !== false) {
|
2361
|
+
decrement = Number(decrement.toFixed(stepDecimals));
|
2362
|
+
}
|
2363
|
+
|
2364
|
+
return [decrement, increment];
|
2365
|
+
}
|
2366
|
+
|
2367
|
+
// Get the current step size for the slider.
|
2368
|
+
function getNextSteps() {
|
2369
|
+
return scope_HandleNumbers.map(getNextStepsForHandle);
|
2370
|
+
}
|
2371
|
+
|
2372
|
+
// Updateable: margin, limit, padding, step, range, animate, snap
|
2373
|
+
function updateOptions(optionsToUpdate, fireSetEvent) {
|
2374
|
+
// Spectrum is created using the range, snap, direction and step options.
|
2375
|
+
// 'snap' and 'step' can be updated.
|
2376
|
+
// If 'snap' and 'step' are not passed, they should remain unchanged.
|
2377
|
+
var v = valueGet();
|
2378
|
+
|
2379
|
+
var updateAble = [
|
2380
|
+
"margin",
|
2381
|
+
"limit",
|
2382
|
+
"padding",
|
2383
|
+
"range",
|
2384
|
+
"animate",
|
2385
|
+
"snap",
|
2386
|
+
"step",
|
2387
|
+
"format",
|
2388
|
+
"pips",
|
2389
|
+
"tooltips"
|
2390
|
+
];
|
2391
|
+
|
2392
|
+
// Only change options that we're actually passed to update.
|
2393
|
+
updateAble.forEach(function(name) {
|
2394
|
+
// Check for undefined. null removes the value.
|
2395
|
+
if (optionsToUpdate[name] !== undefined) {
|
2396
|
+
originalOptions[name] = optionsToUpdate[name];
|
2397
|
+
}
|
2398
|
+
});
|
2399
|
+
|
2400
|
+
var newOptions = testOptions(originalOptions);
|
2401
|
+
|
2402
|
+
// Load new options into the slider state
|
2403
|
+
updateAble.forEach(function(name) {
|
2404
|
+
if (optionsToUpdate[name] !== undefined) {
|
2405
|
+
options[name] = newOptions[name];
|
2406
|
+
}
|
2407
|
+
});
|
2408
|
+
|
2409
|
+
scope_Spectrum = newOptions.spectrum;
|
2410
|
+
|
2411
|
+
// Limit, margin and padding depend on the spectrum but are stored outside of it. (#677)
|
2412
|
+
options.margin = newOptions.margin;
|
2413
|
+
options.limit = newOptions.limit;
|
2414
|
+
options.padding = newOptions.padding;
|
2415
|
+
|
2416
|
+
// Update pips, removes existing.
|
2417
|
+
if (options.pips) {
|
2418
|
+
pips(options.pips);
|
2419
|
+
} else {
|
2420
|
+
removePips();
|
2421
|
+
}
|
2422
|
+
|
2423
|
+
// Update tooltips, removes existing.
|
2424
|
+
if (options.tooltips) {
|
2425
|
+
tooltips();
|
2426
|
+
} else {
|
2427
|
+
removeTooltips();
|
2428
|
+
}
|
2429
|
+
|
2430
|
+
// Invalidate the current positioning so valueSet forces an update.
|
2431
|
+
scope_Locations = [];
|
2432
|
+
valueSet(optionsToUpdate.start || v, fireSetEvent);
|
2433
|
+
}
|
2434
|
+
|
2435
|
+
// Initialization steps
|
2436
|
+
function setupSlider() {
|
2437
|
+
// Create the base element, initialize HTML and set classes.
|
2438
|
+
// Add handles and connect elements.
|
2439
|
+
scope_Base = addSlider(scope_Target);
|
2440
|
+
|
2441
|
+
addElements(options.connect, scope_Base);
|
2442
|
+
|
2443
|
+
// Attach user events.
|
2444
|
+
bindSliderEvents(options.events);
|
2445
|
+
|
2446
|
+
// Use the public value method to set the start values.
|
2447
|
+
valueSet(options.start);
|
2448
|
+
|
2449
|
+
if (options.pips) {
|
2450
|
+
pips(options.pips);
|
2451
|
+
}
|
2452
|
+
|
2453
|
+
if (options.tooltips) {
|
2454
|
+
tooltips();
|
2455
|
+
}
|
2456
|
+
|
2457
|
+
aria();
|
2458
|
+
}
|
2459
|
+
|
2460
|
+
setupSlider();
|
2461
|
+
|
2462
|
+
// noinspection JSUnusedGlobalSymbols
|
2463
|
+
scope_Self = {
|
2464
|
+
destroy: destroy,
|
2465
|
+
steps: getNextSteps,
|
2466
|
+
on: bindEvent,
|
2467
|
+
off: removeEvent,
|
2468
|
+
get: valueGet,
|
2469
|
+
set: valueSet,
|
2470
|
+
setHandle: valueSetHandle,
|
2471
|
+
reset: valueReset,
|
2472
|
+
// Exposed for unit testing, don't use this in your application.
|
2473
|
+
__moveHandles: function(a, b, c) {
|
2474
|
+
moveHandles(a, b, scope_Locations, c);
|
2475
|
+
},
|
2476
|
+
options: originalOptions, // Issue #600, #678
|
2477
|
+
updateOptions: updateOptions,
|
2478
|
+
target: scope_Target, // Issue #597
|
2479
|
+
removePips: removePips,
|
2480
|
+
removeTooltips: removeTooltips,
|
2481
|
+
pips: pips // Issue #594
|
2482
|
+
};
|
2483
|
+
|
2484
|
+
return scope_Self;
|
2485
|
+
}
|
2486
|
+
|
2487
|
+
// Run the standard initializer
|
2488
|
+
function initialize(target, originalOptions) {
|
2489
|
+
if (!target || !target.nodeName) {
|
2490
|
+
throw new Error("noUiSlider (" + VERSION + "): create requires a single element, got: " + target);
|
2491
|
+
}
|
2492
|
+
|
2493
|
+
// Throw an error if the slider was already initialized.
|
2494
|
+
if (target.noUiSlider) {
|
2495
|
+
throw new Error("noUiSlider (" + VERSION + "): Slider was already initialized.");
|
2496
|
+
}
|
2497
|
+
|
2498
|
+
// Test the options and create the slider environment;
|
2499
|
+
var options = testOptions(originalOptions, target);
|
2500
|
+
var api = scope(target, options, originalOptions);
|
2501
|
+
|
2502
|
+
target.noUiSlider = api;
|
2503
|
+
|
2504
|
+
return api;
|
2505
|
+
}
|
2506
|
+
|
2507
|
+
// Use an object instead of a function for future expandability;
|
2508
|
+
return {
|
2509
|
+
// Exposed for unit testing, don't use this in your application.
|
2510
|
+
__spectrum: Spectrum,
|
2511
|
+
version: VERSION,
|
2512
|
+
create: initialize
|
2513
|
+
};
|
2514
|
+
});
|