1 line
29 KiB
JavaScript
1 line
29 KiB
JavaScript
|
|
"use strict";var PipsMode,PipsType;function isValidFormatter(t){return isValidPartialFormatter(t)&&"function"==typeof t.from}function isValidPartialFormatter(t){return"object"==typeof t&&"function"==typeof t.to}function removeElement(t){t.parentElement.removeChild(t)}function isSet(t){return null!=t}function preventDefault(t){t.preventDefault()}function unique(t){return t.filter(function(t){return!this[t]&&(this[t]=!0)},{})}function closest(t,e){return Math.round(t/e)*e}function offset(t,e){var r=t.getBoundingClientRect(),n=t.ownerDocument,t=n.documentElement,n=getPageOffset(n);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(n.x=0),e?r.top+n.y-t.clientTop:r.left+n.x-t.clientLeft}function isNumeric(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function addClassFor(t,e,r){0<r&&(addClass(t,e),setTimeout(function(){removeClass(t,e)},r))}function limit(t){return Math.max(Math.min(t,100),0)}function asArray(t){return Array.isArray(t)?t:[t]}function countDecimals(t){t=(t=String(t)).split(".");return 1<t.length?t[1].length:0}function addClass(t,e){t.classList&&!/\s/.test(e)?t.classList.add(e):t.className+=" "+e}function removeClass(t,e){t.classList&&!/\s/.test(e)?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}function hasClass(t,e){return t.classList?t.classList.contains(e):new RegExp("\\b"+e+"\\b").test(t.className)}function getPageOffset(t){var e=void 0!==window.pageXOffset,r="CSS1Compat"===(t.compatMode||"");return{x:e?window.pageXOffset:(r?t.documentElement:t.body).scrollLeft,y:e?window.pageYOffset:(r?t.documentElement:t.body).scrollTop}}function getActions(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function getSupportsPassive(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e)}catch(t){}return t}function getSupportsTouchActionNone(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function subRangeRatio(t,e){return 100/(e-t)}function fromPercentage(t,e,r){return 100*e/(t[r+1]-t[r])}function toPercentage(t,e){return fromPercentage(t,t[0]<0?e+Math.abs(t[0]):e-t[0],0)}function isPercentage(t,e){return e*(t[1]-t[0])/100+t[0]}function getJ(t,e){for(var r=1;t>=e[r];)r+=1;return r}function toStepping(t,e,r){if(r>=t.slice(-1)[0])return 100;var n=getJ(r,t),i=t[n-1],s=t[n],t=e[n-1],n=e[n];return t+toPercentage([i,s],r)/subRangeRatio(t,n)}function fromStepping(t,e,r){if(100<=r)return t.slice(-1)[0];var n=getJ(r,e),i=t[n-1],s=t[n],t=e[n-1];return isPercentage([i,s],(r-t)*subRangeRatio(t,e[n]))}function getStep(t,e,r,n){if(100===n)return n;var i=getJ(n,t),s=t[i-1],o=t[i];return r?(o-s)/2<n-s?o:s:e[i-1]?t[i-1]+closest(n-t[i-1],e[i-1]):n}!function(t){t.Range="range",t.Steps="steps",t.Positions="positions",t.Count="count",t.Values="values"}(PipsMode=PipsMode||{}),function(t){t[t.None=-1]="None",t[t.NoValue=0]="NoValue",t[t.LargeValue=1]="LargeValue",t[t.SmallValue=2]="SmallValue"}(PipsType=PipsType||{});var Spectrum=function(){function t(e,t,r){var n;this.xPct=[],this.xVal=[],this.xSteps=[],this.xNumSteps=[],this.xHighestCompleteStep=[],this.xSteps=[r||!1],this.xNumSteps=[!1],this.snap=t;var i=[];for(Object.keys(e).forEach(function(t){i.push([asArray(e[t]),t])}),i.sort(function(t,e){return t[0][0]-e[0][0]}),n=0;n<i.length;n++)this.handleEntryPoint(i[n][1],i[n][0]);for(this.xNumSteps=this.xSteps.slice(0),n=0;n<this.xNumSteps.length;n++)this.handleStepPoint(n,this.xNumSteps[n])}return t.prototype.getDistance=function(t){for(var e=[],r=0;r<this.xNumSteps.length-1;r++)e[r]=fromPercentage(this.xVal,t,r);return e},t.prototype.getAbsoluteDistance=function(t,e,r){var n=0;if(t<this.xPct[this.xPct.length-1])for(;t>this.xPct[n+1];)n++;else t===this.xPct[this.xPct.length-1]&&(n=this.xPct.length-2);r||t!==this.xPct[n+1]||n++;for(var i,s=1,o=(e=null=
|