www-thermferm/jqwidgets/jqxrangeselector.js

changeset 511
2d1d43c3a2c2
parent 373
f6850e0b5d35
child 617
b216f9d4b917
equal deleted inserted replaced
510:2da3d3340403 511:2d1d43c3a2c2
1 /* 1 /*
2 jQWidgets v3.8.0 (2015-Apr) 2 jQWidgets v4.5.2 (2017-May)
3 Copyright (c) 2011-2015 jQWidgets. 3 Copyright (c) 2011-2017 jQWidgets.
4 License: http://jqwidgets.com/license/ 4 License: http://jqwidgets.com/license/
5 */ 5 */
6 !function(a){a.jqx.jqxWidget("jqxRangeSelector","",{}),a.extend(a.jqx._jqxRangeSelector.prototype,{defineInstance:function(){var b={width:400,height:100,min:0,max:100,range:{from:0,to:1/0,min:0,max:1/0},majorTicksInterval:10,minorTicksInterval:1,showMajorTicks:!0,showMinorTicks:!1,snapToTicks:!0,labelsFormat:null,markersFormat:null,showLabels:!0,labelsOnTicks:!0,markersPosition:"top",labelsFormatFunction:null,groupLabelsFormatFunction:null,markersFormatFunction:null,showGroupLabels:!1,showMarkers:!0,resizable:!0,moveOnClick:!0,disabled:!1,rtl:!1,padding:"auto",events:["change"]};return this===a.jqx._jqxRangeSelector.prototype?b:(a.extend(!0,this,b),b)},createInstance:function(b){var c=this;if(this._isTouchDevice=a.jqx.mobile.isTouchDevice(),!a.jqx.dataAdapter)throw new Error("jqxRangeSelector: Missing reference to the following module: 'jqxdata.js'.");var d=a.jqx.isHidden(this.host);this.render();var e=this.host.width(),f=this.host.height();a.jqx.utilities.resize(this.host,function(){var a=c.host.width(),b=c.host.height();c.range=c.getRange(),d?(c.refresh(),d=!1):e==a&&f==b||c.refresh(),e=c.host.width(),f=c.host.height()})},render:function(){(this.host.children().length>1||this.rangeSelector)&&(this._removeHandlers(),this.rangeSelector&&this.rangeSelector.remove()),this.host.addClass(this.toThemeProperty("jqx-widget")),this.host.addClass(this.toThemeProperty("jqx-rangeselector")),this.host.children(":eq(0)").addClass(this.toThemeProperty("jqx-rangeselector-content")),this._id=this.element.id,"string"==typeof this.min||this.min instanceof Date?this._dataType="date":this._dataType="number",this._privateProperties(),this._checkProperties(),this._setSize(),this._scale(),this._initSlider()},refresh:function(a){1!=a&&(this.host.children(".jqx-rangeselector-ticks-container").remove(),this._removeHandlers(),this._privateProperties(),this._checkProperties(),this._setSize(),this._scale(),this._initSlider())},destroy:function(){this._removeHandlers(),this.host.remove()},setRange:function(a,b){if(a>b)throw new Error("jqxRangeSelector: range object initialization error. 'min' should be less than 'max'");var c=this._getValue();if(c.from!=a||c.to!=b){var d="number"==this._dataType?"numeric":"date",e="The set values are in the wrong format. Please set "+d+" values.";if("string"==typeof a||a instanceof Date){if("number"==this._dataType)throw new Error(e)}else if("date"==this._dataType)throw new Error(e);a=this._validateInput(a),b=this._validateInput(b),a>this._max&&(a=this._max),a<this._min&&(a=this._min),b>this._max&&(b=this._max),b<this._min&&(b=this._min);var f=b-a;f>this._range._max?b=a+this._range._max:f<this._range._min&&(b=a+this._range._min);var g=this._valuesArray.indexOf(a),h=this._valuesArray.indexOf(b),i=this._ticksArray[g],j=this._ticksArray[h],k=Math.abs(j-i);this.slider[0].style.width=k+"px";var l=this.rtl?j:i;if(this.slider[0].style.left=l,this._moveSlider(l),"date"==this._dataType)var a=new Date(a),b=new Date(b);this._raiseEvent("0",{type:null,from:a,to:b})}},val:function(a){return 0==arguments.length?this.getRange():void(void 0!=a.from&&this.setRange(a.from,a.to))},getRange:function(){var a=this._getValue();return a},propertyChangedHandler:function(b,c,d,e){switch(c){case"showMinorTicks":1==e?a("#"+this._id+" .jqx-rangeselector-ticks-minor").css("visibility","visible"):a("#"+this._id+" .jqx-rangeselector-ticks-minor").css("visibility","hidden");break;case"showMarkers":var f=a("#"+this._id+"LeftMarker, #"+this._id+"RightMarker, #"+this._id+"LeftMarkerArrow, #"+this._id+"RightMarkerArrow");1==e?f.css("visibility","visible"):f.css("visibility","hidden");break;default:this.refresh()}},_raiseEvent:function(b,c){var d=this.events[b],e=new a.Event(d);e.owner=this,e.args=c;try{var f=this.host.trigger(e)}catch(a){}return f},_setSize:function(){this.host.width(this.width),this.host.height(this.height)},resize:function(a,b){this.width=a,this.height=b,this.refresh()},_scale:function(){var a=this.host.width(),b=this._max-this._min;this._unitPerPixel=parseFloat((b/a).toFixed(4)),this._pixelPerUnit=a/b,this._minWidth=this._roundNumber(this._range._min/this._unitPerPixel),this._maxWidth=this._roundNumber(this._range._max/this._unitPerPixel),this._minWidth=parseInt(this._minWidth),this._maxWidth=parseInt(this._maxWidth),"number"==this._dataType&&(this._majorTicksCount=b/this.majorTicksInterval,this._majorTicksCount=Math.floor(this._majorTicksCount)+1,this._majorTicksDistance=parseInt(this._roundNumber(a/(b/this.majorTicksInterval))),this._unitsCount=b/this.minorTicksInterval,this._unitsCount=Math.floor(this._unitsCount)+1,this._unitsDistance=parseInt(this._roundNumber(a/(b/this.minorTicksInterval)))),this._addTicks()},_addTicks:function(){this.host.append("<div id='"+this._id+"TicksContainer' class='jqx-rangeselector-ticks-container'></div>"),this.rangeSelector=a("#"+this._id+"TicksContainer"),this._majorTicksArray=new Array,this._ticksArray=new Array,this._valuesArray=new Array;var b=new String;a("#"+this._id+"TicksContainer").append("<div id='labelPlaceholder' style='visibility: hidden; position: absolute;'></div>");var c=this.rangeSelector.height();b="number"==this._dataType?this._addNumericTicks(c):this._addDateTicks(c);var d=0;this.showLabels&&(d+=a("#labelPlaceholder").outerHeight()+6),"number"!=this._dataType&&this.showGroupLabels&&(d+=a("#labelPlaceholder").outerHeight()+6),"auto"==this.padding&&this.host.css("padding-bottom",d),a("#labelPlaceholder").remove(),a("#"+this._id+"TicksContainer").append(b),this._ticksArray.sort(function(a,b){return a-b});for(var e=1;e<this._ticksArray.length;e++)this._ticksArray[e]=this._roundNumber(this._ticksArray[e]);if(this._valuesArray.sort(function(a,b){return a-b}),"number"==this._dataType)for(var e=1;e<this._valuesArray.length;e++)this._valuesArray[e]=this._roundNumber(this._valuesArray[e],"marker",!0);for(var e=1;e<this._ticksArray.length;e++)this._ticksArray[e-1]==this._ticksArray[e]&&(this._ticksArray.splice(e,1),this._valuesArray.splice(e,1));this.rtl&&(this._valuesArray=this._valuesArray.reverse())},_addNumericTicks:function(b){for(var c=this,d=new String,e=0,f=this._min,g=this._max,h=0;h<this._majorTicksCount;h++){var i=this._id+"LabelTick"+(h+1);h==this._majorTicksCount-1&&(e=this.host.width());var j=c.showMajorTicks?"visible":"hidden";d+="<div id='"+i+"' class='"+this.toThemeProperty("jqx-rangeselector-ticks")+" "+this.toThemeProperty("jqx-slider-tick-horizontal")+"' style='visibility: "+j+"; left: "+e+"px;'></div>",this._ticksArray.push(e),this._majorTicksArray.push(e);var k=this._id+"Label"+(h+1),l=f;this._valuesArray.push(parseFloat(l.toFixed(4))),c.rtl&&(l=g),l=this._formatOutput(l,this.labelsFormat,this.minorTicksInterval>=1?0:2,"label"),a("#labelPlaceholder").html(l);var m=a("#labelPlaceholder").width(),n=c.showLabels?"visible":"hidden";c.labelsOnTicks&&(d+="<div id='"+k+"' class='"+this.toThemeProperty("jqx-rangeselector-labels")+"' style='visibility: "+n+"; left: "+(e-m/2)+"px; top: "+b+"px;'>"+l+"</div>");var o=e;f+=this.majorTicksInterval,g-=this.majorTicksInterval;var e=(f-c._min)/c._unitPerPixel;if(e=parseInt(e),!this.labelsOnTicks&&h<this._majorTicksCount-1){var p=Math.abs(o-e);d+="<div id='"+k+"' class='"+this.toThemeProperty("jqx-rangeselector-labels")+"' style='visibility: "+n+"; left: "+(o+p/2-m/2)+"px; top: "+b+"px;'>"+l+"</div>"}}for(var e=0,q=this.showMinorTicks?"visible":"hidden",f=this._min,h=0;h<this._unitsCount;h++){var i=this._id+"MinorTick"+(h+1);h==this._unitsCount-1&&(e=this.host.width()),d+="<div id='"+i+"' class='"+this.toThemeProperty("jqx-rangeselector-ticks")+" "+this.toThemeProperty("jqx-rangeselector-ticks-minor")+" "+this.toThemeProperty("jqx-slider-tick-horizontal")+"' style='visibility: "+q+"; left: "+e+"px;'></div>";var r=f;this._valuesArray.indexOf(parseFloat(r.toFixed(4)))===-1&&(this._valuesArray.push(parseFloat(r.toFixed(4))),this._ticksArray.push(e)),f+=this.minorTicksInterval;var e=(f-c._min)/c._unitPerPixel;e=parseInt(e)}return d},_getMillisecondsByInterval:function(a){var b={};return"year"==a||a.years?(b.divisor=a.years?a.years:1,31536e6*b.divisor):"month"==a||a.months?(b.divisor=a.months?a.months:1,2592e6*b.divisor):"week"==a||a.weeks?(b.divisor=a.weeks?a.weeks:1,6048e5*b.divisor):"day"==a||a.days?(b.divisor=a.days?a.days:1,864e5*b.divisor):"hour"==a||a.hours?(b.divisor=a.hours?a.hours:1,36e5*b.divisor):"minute"==a||a.minutes?(b.divisor=a.minutes?a.minutes:1,60*b.divisor*1e3):"second"==a||a.seconds?(b.divisor=a.seconds?a.seconds:1,1e3*b.divisor):"millisecond"==a||a.milliseconds?(b.divisor=a.milliseconds?a.milliseconds:1,1*b.divisor):b},_addDateTicks:function(b){var c=this,d=new String,e=function(a){var b="majorTicksInterval"==a?c.majorTicksInterval:c.minorTicksInterval,d=new Object;return"year"==b||b.years?(d.period="year",d.interval=864e5,d.divisor=b.years?b.years:1,d.value=31536e6*d.divisor):"month"==b||b.months?(d.period="month",d.interval=864e5,d.divisor=b.months?b.months:1,d.value=2592e6*d.divisor):"week"==b||b.weeks?(d.period="week",d.interval=864e5,d.divisor=b.weeks?b.weeks:1,d.value=6048e5*d.divisor):"day"==b||b.days?(d.period="day",d.interval=36e5,d.divisor=b.days?b.days:1,d.value=864e5*d.divisor):"hour"==b||b.hours?(d.period="hour",d.interval=6e4,d.divisor=b.hours?b.hours:1,d.value=36e5*d.divisor):"minute"==b||b.minutes?(d.period="minute",d.interval=6e4,d.divisor=b.minutes?b.minutes:1,d.value=60*d.divisor*1e3):"second"==b||b.seconds?(d.period="second",d.interval=1e3,d.divisor=b.seconds?b.seconds:1,d.value=1e3*d.divisor):("millisecond"==b||b.milliseconds)&&(d.period="millisecond",d.interval=1,d.divisor=b.milliseconds?b.milliseconds:1,d.value=1*d.divisor),d},f=function(a,b){var c=new Date(a),d=c.getDate(),e="year"==b&&0==c.getMonth()&&1==d,f="month"==b&&1==d,g="week"==b&&0==c.getDay(),h="day"==b&&0==c.getHours(),i="hour"==b&&0==c.getMinutes(),j="minute"==b&&0==c.getSeconds(),k="minute"==b&&0==c.getMilliseconds(),l="millisecond"==b;return!!(e||f||g||h||i||j||k||l)},g=function(e,f,g){var h=(e-c._min)/c._unitPerPixel;c.rtl&&(e="majorTicksInterval"==f?c._dateMajorTicks[c._dateMajorTicks.length-g]:c._dateMinorTicks[c._dateMinorTicks.length-g]),h=parseInt(h);var i=e;if(c._valuesArray.indexOf(i)===-1&&(c._ticksArray.push(h),c._valuesArray.push(i),"majorTicksInterval"==f&&c._majorTicksArray.push(h)),"majorTicksInterval"==f){var j=c._id+"LabelTick"+g,k=c.showMajorTicks?"visible":"hidden";d+="<div id='"+j+"' class='"+c.toThemeProperty("jqx-rangeselector-ticks")+" "+c.toThemeProperty("jqx-slider-tick-horizontal")+"' style='visibility: "+k+"; left: "+h+"px;'></div>";var l=i;l=c._formatOutput(l,c.labelsFormat,c.labelPrecision,"label"),a("#labelPlaceholder").html(l);var m=a("#labelPlaceholder").width(),n=c._id+"Label"+g,o=c.showLabels?"visible":"hidden";if(c.labelsOnTicks)c.labelsOnTicks&&(d+="<div id='"+n+"' class='"+c.toThemeProperty("jqx-rangeselector-labels")+"' style='visibility: "+o+"; left: "+(h-m/2)+"px; top: "+b+"px;'>"+l+"</div>");else{var p=c._getMillisecondsByInterval(c.majorTicksInterval)/c._unitPerPixel,q=p/2;d+="<div id='"+n+"' class='"+c.toThemeProperty("jqx-rangeselector-labels")+"' style='visibility: "+o+"; left: "+(q+h-m/2)+"px; top: "+b+"px;'>"+l+"</div>"}}else{var k=c.showMinorTicks?"visible":"hidden",r=c._id+"MinorTick"+g;d+="<div id='"+r+"' class='"+c.toThemeProperty("jqx-rangeselector-ticks")+" "+c.toThemeProperty("jqx-rangeselector-ticks-minor")+" "+c.toThemeProperty("jqx-slider-tick-horizontal")+"' style='visibility: "+k+"; left: "+h+"px;'></div>"}},h=function(a,b,d){for(var e=0,h=1,i=new Date(c._min).getHours(),j=864e5==b.interval,k=new Array,l=c._min;l<=c._max;l+=b.interval){if(1==j){var m=new Date(l).getHours();if(i!=m){var n;1==m?n=1:23==m&&(n=-1),l-=36e5*n,i=new Date(l).getHours()}}var o=f(l,b.period);1==o&&(e%b.divisor==0&&(d?k.push(l):g(l,a,h,b.interval),h++),e++)}return k};return c._dateMajorTicks=h("majorTicksInterval",e("majorTicksInterval"),!0),c._dateMinorTicks=h("minorTicksInterval",e("minorTicksInterval"),!0),h("majorTicksInterval",e("majorTicksInterval")),h("minorTicksInterval",e("minorTicksInterval")),1==this.showGroupLabels&&this.showLabels&&this._addGroupLabels(a("#labelPlaceholder").height()+b),d},_addGroupLabels:function(b){var c=this,d=new Date(this._min),e=new Date(this._max);if(e.getFullYear()-d.getFullYear()>0)var f="year",g=864e5;else if(e.getMonth()-d.getMonth()>0)var f="month",g=864e5;else{if(!(e.getDate()-d.getDate()>0))return;var f="day",g=36e5}for(var h=function(b){var d,e=new Date(b),g=e.getFullYear(),h=e.getMonth(),i=e.getDate(),j=!0;"year"==f&&0==h&&1==i?d=g:"month"==f&&1==i?(d=a.jqx.dataFormat.formatdate(e,"MMMM"),0==h&&(d=g+" "+d)):"day"==f&&0==e.getHours()?d=a.jqx.dataFormat.formatdate(e,"dddd"):j=!1;var k;k=1==j&&c.groupLabelsFormatFunction?c.groupLabelsFormatFunction(d,e):d;var l={check:j,value:k};return l},i=new String,j=this.toThemeProperty("jqx-rangeselector-group-labels-ticks")+" "+this.toThemeProperty("jqx-slider-tick-horizontal"),k=1,l=this._min;l<this._max;l+=g){var m=h(l);if(1==m.check){var n=(l-this._min)/this._unitPerPixel;i+="<div class='"+this.toThemeProperty("jqx-rangeselector-labels")+"' style='left: "+n+"px; top: "+b+"px;'><div class='"+j+"'></div><div id='"+this._id+"GroupLabel"+k+"' class='"+this.toThemeProperty("jqx-rangeselector-group-labels")+"' style='margin-left: 5px;'>"+m.value+"</div></div>",k++}}a("#"+this._id+"TicksContainer").append(i)},_updateCursor:function(a,b){var c=this.element.style.cursor,d=this.slider.offset().left,e=parseInt(this.slider[0].style.width),f=d+e;a>d-5&&a<d+5||a>f-5&&a<f+5?""!=c&&"auto"!=c||(this.element.style.cursor="e-resize"):"e-resize"==c&&(this.element.style.cursor="auto")},_handleMouseMove:function(b){var c=this,d=c.slider,e=b.pageX,f=b.pageY;if(c._isTouchDevice){var g=a.jqx.position(b);e=g.left,f=g.top}var h=c._hostOffset.left,i=c._hostWidth;if(c.resizable&&!c.dragging&&"none"==c.resizeDirection&&e>=h&&e<=h+i&&f>=c._hostOffset.top&&f<=c._hostOffset.top+c._hostHeight&&this._updateCursor(e,f),!c.isMouseDown)return!0;if(c._isTouchDevice&&(f<c._hostOffset.top||f>c._hostOffset.top+c._hostHeight))return!0;var j=c._findNearestTick(c._sliderLeftOffset+e-c._mouseDownX),k=parseInt(j);if(k<0)return!0;k<0&&(k=0);var l=parseInt(d[0].style.width),m=function(a){var b=parseInt(c._maxWidth),d=parseInt(c._minWidth);if(a<d||a>b)return!1;var e=parseInt(c.rightMarker[0].style.left),f=parseInt(c.leftMarker[0].style.left);return!(f>e)};if(1==c.resizable&&!c.dragging){var n=k*c._unitPerPixel+c._min;if("left"==c.resizeDirection||c.isLeftMarkerCaptured){var o=c.isLeftMarkerCaptured?c.leftMarker.outerWidth():0;e<h-o&&(e=h-o),e>h+i+o&&(e=h+i+o+1);var p=d[0].style.left,q=k-parseInt(p),r=parseInt(l-q);if(!m(r))if(e>c._mouseDownX){if(e=c.sliderRight-c._minWidth-h,r=c._minWidth,l==r)return!0;var j=c._findNearestTick(e);if(k=j,k<0)return!0;var n=(parseInt(p)*c._unitPerPixel+c._min,k*c._unitPerPixel+c._min)}else{if(!(0!=c._maxWidth&&e<c._mouseDownX&&r>c._maxWidth))return!0;if(e=c.sliderRight-c._maxWidth-h,r=c._maxWidth,l==r)return!0;var j=c._findNearestTick(e);if(k=j,k<0)return!0;var n=(parseInt(p)*c._unitPerPixel+c._min,k*c._unitPerPixel+c._min)}c.slider[0].style.left=k+"px",p!=d[0].style.left&&(c.slider[0].style.width=r+"px");var s=c._findNearestTick(k),t=c._valuesArray[c._ticksArray.indexOf(s)];void 0!=t?(c.leftMarkerValue[0].innerHTML=c._formatOutput(t,c.markersFormat,0,"left"),k!=s&&(c.slider[0].style.left=s+"px")):c.leftMarkerValue[0].innerHTML=c._formatOutput(n,c.markersFormat,0,"left"),c.oldX=e,c.moved=!0}else if("right"==c.resizeDirection||c.isRightMarkerCaptured){var o=c.isRightMarkerCaptured?c.rightMarker.outerWidth():0,u=!1,v=!1;e<h-o&&(e=h-o,v=!0),e>h+i+o&&(e=h+i+o,u=!0);var w=c._sliderInitialWidth,x=c._findNearestTick(w+c._sliderLeftOffset),y=c._findNearestTick(w+e-c._mouseDownX+c._sliderLeftOffset);if(y<0)return!0;var q=x-y,r=w-q;r<=0&&(q=w,r=0);var z=parseInt(c.element.style.width);c.element.style.width.indexOf("%")>=0&&(z=c.host.width()),(u||c._sliderLeftOffset+r>=z)&&(r=z-c._sliderLeftOffset,boundDetected=!0),r>parseInt(this._maxWidth)&&(r=parseInt(this._maxWidth)),r<parseInt(this._minWidth)&&(r=parseInt(this._minWidth)),c.slider[0].style.width=r+"px";var n=(c._sliderLeftOffset+r)*c._unitPerPixel+c._min,A=c._findNearestTick(c._sliderLeftOffset+r),B=c._valuesArray[c._ticksArray.indexOf(A)];void 0!=B?(c._sliderLeftOffset+r!=A&&(c.slider[0].style.width=A-c._sliderLeftOffset+"px"),c.rightMarkerValue[0].innerHTML=c._formatOutput(B,c.markersFormat,0,"right")):c.rightMarkerValue[0].innerHTML=c._formatOutput(n,c.markersFormat,0,"right"),c.oldX=e}c._layoutShutter(),c._layoutMarkers(),c.moved=!0}1==c.dragging&&(c._moveSlider(k,!0),c.oldX=e)},_moveSlider:function(a,b){var c=this;c.moved=!0;var d=parseInt(this.slider[0].style.width),e=parseInt(a+d),f=this._hostWidth,g=a;if(g<0&&(g=0,a=g),g+d>f&&(g=f-d,a=g),g>=0&&g+d<=f){this.slider[0].style.left=g+"px";var h=this._findNearestTick(g),i=this._majorTicksArray.indexOf(h)!=-1,j=this._valuesArray[this._ticksArray.indexOf(h)];if(void 0!=j){if(this.leftMarkerValue[0].innerHTML=this._formatOutput(j,this.markersFormat,0,"left"),a!=h&&i&&b){this.slider[0].style.left=h+"px";var e=parseInt(h+d)}}else this.leftMarkerValue[0].innerHTML=this._formatOutput(g*this._unitPerPixel+this._min,this.markersFormat,0,"left");var k=this._findNearestTick(e),l=this._valuesArray[this._ticksArray.indexOf(k)];if(void 0!=l){var m=this._majorTicksArray.indexOf(k)!=-1;if(this.rightMarkerValue[0].innerHTML=this._formatOutput(l,this.markersFormat,0,"right"),e!=k&&m&&i&&b){var n=k-h;this.slider[0].style.width=n+"px"}}else this.rightMarkerValue[0].innerHTML=this._formatOutput((g+d)*this._unitPerPixel+this._min,this.markersFormat,0,"right")}this._layoutShutter(),this._layoutMarkers()},_initSlider:function(){var b=this,c=this.toThemeProperty("jqx-rangeselector-shutter")+" "+this.toThemeProperty("jqx-scrollbar-state-normal");a("#"+this._id+"TicksContainer").append("<div id='"+this._id+"ShutterLeft' class='"+c+"'></div><div id='"+this._id+"Slider' class='"+this.toThemeProperty("jqx-rangeselector-slider")+" "+this.toThemeProperty("jqx-scrollbar-thumb-state-normal")+"'><div class='"+this.toThemeProperty("jqx-rangeselector-inner-slider")+"'></div></div><div id='"+this._id+"ShutterRight' class='"+c+"'></div>"),this.slider=a("#"+this._id+"Slider"),this.shutterLeft=a("#"+this._id+"ShutterLeft"),this.shutterRight=a("#"+this._id+"ShutterRight"),this._hostOffset=this.rangeSelector.offset(),this._hostWidth=this.rangeSelector.width(),this._hostHeight=this.rangeSelector.height();var d=this._hostOffset,e=this._initRange(),f=e.left,g=e.right-f,h=g/this._unitPerPixel;this.slider[0].style.width=Math.round(h)+"px";var i=d.left+parseInt((f-this._min)/this._unitPerPixel);if(this.slider.offset({left:i}),this._layoutShutter(),this._initMarkers(),0==this.disabled){this.host.removeClass(this.toThemeProperty("jqx-fill-state-disabled")),this.addHandler(this.host,"dragstart.rangeselector"+this._id,function(){return!1}),this.addHandler(a(window),"jqxReady.rangeselector",function(){return b._layoutMarkers(),!1}),this.isSliderCaptured=!1,this.resizeDirection="none",this.isLeftMarkerCaptured=!1,this.isRightMarkerCaptured=!1,this.dragging=!1,this._mouseDownX;var j,k,l="mousedown.rangeselector"+this.element.id;this._isTouchDevice&&(l=a.jqx.mobile.getTouchEventName("touchstart")+".rangeselector"+this.element.id),this.addHandler(this.host,l,function(c){b.isMouseDown=!0,b._hostOffset=b.rangeSelector.offset(),b._hostWidth=b.rangeSelector.width(),b._hostHeight=b.rangeSelector.height(),b._sliderLeftOffset=parseInt(b.slider[0].style.left);var d=c.pageX,e=c.pageY;if(b._isTouchDevice){var f=a.jqx.position(c);d=f.left,e=f.top}b._initialSliderOffset=d-b.slider.offset().left;var g=b.slider.width();b._sliderInitialWidth=g,j=b.slider.offset().left,k=b._sliderInitialWidth,b.initialOffset=j;var h=parseInt(j+k);if(b.oldX=d,b._mouseDownX=d,b.resizeDirection="none",b.sliderRight=h,d>j-5&&d<j+5&&b._heightCheck(e))b.isSliderCaptured=!1,b.dragging=!1,b.resizeDirection="left";else if(d>h-5&&d<h+5&&b._heightCheck(e))b.isSliderCaptured=!1,b.dragging=!1,b.resizeDirection="right";else if(d>=j+5&&d<=h+5&&b._heightCheck(e))b.isSliderCaptured=!0,b.dragging=!0;else if(b.isSliderCaptured=!1,b.dragging=!1,b.moveOnClick){if(b.isLeftMarkerCaptured||b.isRightMarkerCaptured)return!1;var i=b._sliderLeftOffset+b._initialSliderOffset,l=b._findNearestTick(i);i=l,i<0&&(i=0);var m=parseInt(b.slider[0].style.width);e>=b.slider.offset().top&&(d>h?b._moveSlider(i-m,!0):b._moveSlider(i,!0))}}),this.addHandler(b.leftMarker,l,function(c){if(b.leftMarkerAndArrow.addClass(b.toThemeProperty("jqx-fill-state-pressed")),b.oldLeftX=c.pageX,b._isTouchDevice){var d=a.jqx.position(c);oldLeftX=d.left}b._mouseDownX=b.oldLeftX,b.isLeftMarkerCaptured=!0}),this.addHandler(b.rightMarker,l,function(c){if(b.rightMarkerAndArrow.addClass(b.toThemeProperty("jqx-fill-state-pressed")),b.oldRightX=c.pageX,b._isTouchDevice){var d=a.jqx.position(c);oldRightX=d.left}b._mouseDownX=b.oldRightX,b.isRightMarkerCaptured=!0}),this.addHandler(a(document),"selectstart.rangeselector"+this._id,function(a){if(1==b.isSliderCaptured||1==b.isLeftMarkerCaptured||1==b.isRightMarkerCaptured||1==b.dragging)return a.preventDefault(),!1});var m="mousemove.rangeselector"+this.element.id;this._isTouchDevice&&(m=a.jqx.mobile.getTouchEventName("touchmove")+".rangeselector"+this.element.id),this.addHandler(a(document),m,function(a){b._handleMouseMove(a)});var n=function(a){try{var c=b.moved;if(b.moved=!1,b.isMouseDown=!1,b.dragging=!1,b.resizeDirection="none",1==b.isLeftMarkerCaptured&&(b.leftMarkerAndArrow.removeClass(b.toThemeProperty("jqx-fill-state-pressed")),b.isLeftMarkerCaptured=!1),1==b.isRightMarkerCaptured&&(b.rightMarkerAndArrow.removeClass(b.toThemeProperty("jqx-fill-state-pressed")),b.isRightMarkerCaptured=!1),c){var d=b._getValue();b._raiseEvent("0",{type:"mouse",from:d.from,to:d.to})}}catch(a){}};this.addHandler(a(document),"mouseup.rangeselector"+this._id,function(a){n(a)});try{if((""!=document.referrer||window.frameElement)&&null!=window.top&&window.top!=window.self){var o=function(a){n(a)},p=null;window.parent&&document.referrer&&(p=document.referrer),p&&p.indexOf(document.location.host)!=-1&&window.top.document&&(window.top.document.addEventListener?window.top.document.addEventListener("mouseup",o,!1):window.top.document.attachEvent&&window.top.document.attachEvent("onmouseup",o))}}catch(a){}}else this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"));this._moveSlider(parseInt(b.slider[0].style.left)),this.moved=!1},_initMarkers:function(){var b=a("#"+this._id+"TicksContainer"),c=this.toThemeProperty("jqx-rangeselector-markers")+" "+this.toThemeProperty("jqx-disableselect")+" "+this.toThemeProperty("jqx-fill-state-normal");b.append("<div id='"+this._id+"LeftMarker' class='"+c+"'></div><div id='"+this._id+"RightMarker' class='"+c+"'></div>");var d=this.toThemeProperty("jqx-rangeselector-marker-arrow")+" "+this.toThemeProperty("jqx-fill-state-normal");d+="bottom"==this.markersPosition?" "+this.toThemeProperty("jqx-rangeselector-marker-arrow-bottom"):" "+this.toThemeProperty("jqx-rangeselector-marker-arrow-top"),b.append("<div id='"+this._id+"LeftMarkerArrow' class='"+d+" "+this.toThemeProperty("jqx-rangeselector-marker-left-arrow")+"'></div>"),b.append("<div id='"+this._id+"RightMarkerArrow' class='"+d+" "+this.toThemeProperty("jqx-rangeselector-marker-right-arrow")+"'></div>"),a("#"+this._id+"LeftMarker").append("<div id='"+this._id+"LeftMarkerValue' class='"+this.toThemeProperty("jqx-disableselect")+" "+this.toThemeProperty("jqx-rangeselector-markers-value")+"'></div>"),a("#"+this._id+"RightMarker").append("<div id='"+this._id+"RightMarkerValue' class='"+this.toThemeProperty("jqx-disableselect")+" "+this.toThemeProperty("jqx-rangeselector-markers-value")+"'></div>");var e=a("#"+this._id+"LeftMarker, #"+this._id+"RightMarker, #"+this._id+"LeftMarkerArrow, #"+this._id+"RightMarkerArrow"),f=a("#"+this._id+"LeftMarker, #"+this._id+"LeftMarkerArrow"),g=a("#"+this._id+"RightMarker, #"+this._id+"RightMarkerArrow");if(1==this.showMarkers?e.css("visibility","visible"):e.css("visibility","hidden"),0==this.disabled&&1==this.resizable){var h=this;this.addHandler(f,"mouseenter.rangeselector"+this._id,function(a){h.element.style.cursor="pointer",f.addClass(h.toThemeProperty("jqx-fill-state-hover"))}),this.addHandler(f,"mouseleave.rangeselector"+this._id,function(a){h.element.style.cursor="auto",f.removeClass(h.toThemeProperty("jqx-fill-state-hover"))}),this.addHandler(g,"mouseenter.rangeselector"+this._id,function(a){h.element.style.cursor="pointer",g.addClass(h.toThemeProperty("jqx-fill-state-hover"))}),this.addHandler(g,"mouseleave.rangeselector"+this._id,function(a){h.element.style.cursor="auto",g.removeClass(h.toThemeProperty("jqx-fill-state-hover"))})}this.leftMarkerAndArrow=f,this.rightMarkerAndArrow=g,this.leftMarkerArrow=a("#"+this._id+"LeftMarkerArrow"),this.rightMarkerArrow=a("#"+this._id+"RightMarkerArrow"),this.leftMarker=a("#"+this._id+"LeftMarker"),this.rightMarker=a("#"+this._id+"RightMarker"),this.leftMarkerValue=a("#"+this._id+"LeftMarkerValue"),this.rightMarkerValue=a("#"+this._id+"RightMarkerValue");var i=this._initRange();this._updateMarkersValues(i.left,i.right),this._layoutMarkers(),"auto"==this.padding?(this.host.css("padding-left",this.leftMarker[0].offsetWidth),this.host.css("padding-right",this.rightMarker[0].offsetWidth),this.host.css("padding-top",this._leftMarkerHeight+7)):this.host.css("padding",this.padding)},_layoutMarkers:function(){if(1==this.showMarkers){this._hostOffset||(this._hostOffset=this.rangeSelector.offset()),this._leftMarkerHeight||(this._leftMarkerHeight=this.leftMarker.outerHeight(),this._rightMarkerHeight=this.rightMarker.outerHeight());var a=(this._hostOffset.top,parseInt(this.slider[0].style.left)+this._hostOffset.left),b=-5;"bottom"==this.markersPosition&&(b=parseInt(this.element.style.height)+4+this._rightMarkerHeight);var c=b-this._leftMarkerHeight,d=b-this._rightMarkerHeight;"bottom"==this.markersPosition&&(b=parseInt(this.element.style.height)-6);var e=this.leftMarker[0].offsetWidth,f=1+a-e-this._hostOffset.left;this.leftMarker[0].style.left=f+"px",this.leftMarker[0].style.top=c+"px",this.leftMarkerArrow[0].style.left=2+f+e+"px",this.leftMarkerArrow[0].style.top=6+b+"px";var g=a+parseInt(this.slider[0].style.width)-this._hostOffset.left;this.rightMarker[0].style.left=g+"px",this.rightMarker[0].style.top=d+"px",this.rightMarkerArrow[0].style.left=7+g+"px",this.rightMarkerArrow[0].style.top=6+b+"px"}},_updateMarkersValues:function(a,b){var c=a,d=b;this.leftMarkerValue[0].innerHTML=this._formatOutput(c,this.markersFormat,0,"left",!0),this.rightMarkerValue[0].innerHTML=this._formatOutput(d,this.markersFormat,0,"right",!0)},_removeHandlers:function(){var b=this.element.id,c=a("#"+b+"LeftMarker, #"+b+"LeftMarkerArrow"),d=a("#"+b+"RightMarker, #"+b+"RightMarkerArrow"),e="mousemove.rangeselector"+b,f="mousedown.rangeselector"+b;this._isTouchDevice&&(e=a.jqx.mobile.getTouchEventName("touchmove")+".rangeselector"+b,f=a.jqx.mobile.getTouchEventName("touchstart")+".rangeselector"+b),this.removeHandler(a(document),e),this.removeHandler(a(document),"mouseup.rangeselector"+b),this.removeHandler(this.host,f),this.removeHandler(this.host,"click.rangeselector"+b),this.removeHandler(this.host,"dragstart.rangeselector"+b),this.removeHandler(c,"mouseenter.rangeselector"+b),this.removeHandler(c,"mouseleave.rangeselector"+b),this.removeHandler(d,"mouseenter.rangeselector"+b),this.removeHandler(d,"mouseleave.rangeselector"+b),this.removeHandler(a("#"+b+"LeftMarker"),f),this.removeHandler(a("#"+b+"RightMarker"),f),this.removeHandler(a("#"+b+"LeftMarkerValue, #"+b+"RightMarkerValue"),"selectstart.rangeselector"+b)},_heightCheck:function(a){var b=this.slider,c=b.offset().top;return a>=c&&a<=c+b.height()},_checkProperties:function(){this._range._from<this._min?this._range._from=this._min:this._range._from>this._min&&this._range._from>this._max&&(this._range._from=this._min),this._range._to>this._max?this._range._to=this._max:this._range._to<this._min&&this._range._to<this._max&&(this._range._to=this._max);var a=this._max-this._min;this._range._min>a&&(this._range._min=a),this._range._max>a&&(this._range._max=a);var b=this._range._to-this._range._from;b<this._range._min?this._range._to=this._range._from+this._range._min:b>this._range._max&&(this._range._to=this._range._from+this._range._max)},_findNearestTick:function(a){for(var b=0,c=Math.abs(a-this._ticksArray[0]),d=1;d<this._ticksArray.length;d++){var e=Math.abs(a-this._ticksArray[d]);c>e&&(c=e,b=d)}return this._ticksArray[b]},_privateProperties:function(){this._min=this._validateInput(this.min),this._max=this._validateInput(this.max),this._range=new Object,this._range._from=this._validateInput(void 0!=this.range.from?this.range.from:0),this._range._to=this._validateInput(void 0!=this.range.to?this.range.to:1/0),this._range._min=this._minMaxDate(void 0!=this.range.min?this.range.min:0),this._range._max=this._minMaxDate(void 0!=this.range.max?this.range.max:1/0)},_validateInput:function(a){var b;return"number"==typeof a?b=a:"string"==typeof a?b=Date.parse(a):a instanceof Date&&(b=a.getTime()),b},_minMaxDate:function(a){if("number"!=typeof a){var b;switch(a){case"millisecond":b=1;break;case"second":b=1e3;break;case"minute":b=6e4;break;case"hour":b=36e5;break;case"day":b=864e5;break;case"week":b=6048e5;break;default:b=a.milliseconds?a.milliseconds:0+a.seconds?1e3*a.seconds:0+a.minutes?6e4*a.minutes:0+a.hours?36e5*a.hours:0+a.days?864e5*a.days:0+a.weeks?6048e5*a.weeks:0}return b}return a},_formatOutput:function(b,c,d,e,f){var g;if(this.values||(this.values=new Array),this.values[e]=b,"label"==e&&this.labelsFormatFunction)g="date"==this._dataType?this._roundDate(b):this._roundNumber(b,"label"),g=this.labelsFormatFunction(g);else if("label"!=e&&this.markersFormatFunction)"date"==this._dataType&&(g=this._roundDate(b)),g=this.markersFormatFunction(b,e);else if(c)"number"==this._dataType?g=a.jqx.dataFormat.formatnumber(b,c):(g=this._roundDate(b),g=a.jqx.dataFormat.formatdate(g,c));else{if("date"==this._dataType){var h;null==this.labelsFormat&&null==this.markersFormat?h="both labelsFormat and markersFormat":null==this.labelsFormat?h="labelsFormat":null==this.markersFormat&&(h="markersFormat");var i="When the data format is date, "+h+" should be set.";throw new Error(i)}g=b.toFixed(d)}return g},_getValue:function(a){function b(a){return"number"===c._dataType?Math.round(a/d)*d:c._roundNumber(a,"marker")}var c=this,d=c.minorTicksInterval,e=this.slider,f=e.width(),g=new Object,h=e.offset().left-this.rangeSelector.offset().left,i=h*this._unitPerPixel+this._min;if(g.from=b(i),g.to=b(i+f*this._unitPerPixel),!a&&1==this.snapToTicks){var j=this._findNearestTick((g.from-this._min)/this._unitPerPixel);g.from=this._valuesArray[this._ticksArray.indexOf(j)];var k=this._findNearestTick((g.to-this._min)/this._unitPerPixel);g.to=this._valuesArray[this._ticksArray.indexOf(k)]}return"date"==this._dataType&&(g.from=new Date(g.from),g.to=new Date(g.to)),g},_roundNumber:function(a,b,c){var d;return"marker"==b?(1==c&&(a=parseFloat(a)),d=parseFloat(a)):d="label"==b?parseFloat(a):parseFloat(a),d},_roundDate:function(a){"number"==typeof a&&(a=new Date(a));var b=this._max-this._min;if(b>12096e5){var c=a.getDate(),d=a.getHours();d>12&&(a.setDate(c+1),a.setHours(0),a.setMinutes(0),a.setSeconds(0))}else b>1728e5&&(a.setHours(a.getHours()+Math.round(a.getMinutes()/60)),a.setMinutes(0),a.setSeconds(0));return a},_layoutShutter:function(){var b=parseInt(this.slider[0].style.left);this.shutterLeft[0].style.width=b+"px",this.shutterLeft[0].style.left="0px",a.jqx.browser.msie&&a.jqx.browser.version<9&&(this.shutterLeft[0].style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=75)",this.shutterRight[0].style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=75)");var c=1+b+parseInt(this.slider[0].style.width);this.shutterRight[0].style.left=c+"px";var d=parseInt(this.element.style.width);
7 if(this.element.style.width.indexOf("%")>=0)var d=parseInt(this.host.width());var e=d-1-b-parseInt(this.slider[0].style.width);e<0&&(e=0),this.shutterRight[0].style.width=1+e+"px",c+1+e<2+d&&(this.shutterRight[0].style.width=2+e+"px"),0==e&&(this.shutterRight[0].style.width="0px")},_initRange:function(){if(this._range._from>this._range._to)throw new Error("jqxRangeSelector: range object initialization error. 'min' should be less than 'max'");var a=this._range._from,b=this._range._to,c={left:a,right:b};return c}})}(jqxBaseFramework);
6 8
7 (function(a){a.jqx.jqxWidget("jqxRangeSelector","",{});a.extend(a.jqx._jqxRangeSelector.prototype,{defineInstance:function(){var b={width:400,height:100,min:0,max:100,range:{from:0,to:Infinity,min:0,max:Infinity},majorTicksInterval:10,minorTicksInterval:1,showMajorTicks:true,showMinorTicks:false,snapToTicks:true,labelsFormat:null,markersFormat:null,showLabels:true,labelsOnTicks:true,markersPosition:"top",labelsFormatFunction:null,groupLabelsFormatFunction:null,markersFormatFunction:null,showGroupLabels:false,showMarkers:true,resizable:true,moveOnClick:true,disabled:false,rtl:false,padding:"auto",events:["change"]};a.extend(true,this,b);return b},createInstance:function(c){var e=this;this._isTouchDevice=a.jqx.mobile.isTouchDevice();if(!a.jqx.dataAdapter){throw new Error("jqxRangeSelector: Missing reference to the following module: 'jqxdata.js'.")}var f=a.jqx.isHidden(this.host);this.render();var d=this.host.width();var b=this.host.height();a.jqx.utilities.resize(this.host,function(){var h=e.host.width();var g=e.host.height();e.range=e.getRange();if(f){e.refresh();f=false}else{if(d!=h||b!=g){e.refresh()}}d=e.host.width();b=e.host.height()})},render:function(){if(this.host.children().length>1||this.rangeSelector){this._removeHandlers();if(this.rangeSelector){this.rangeSelector.remove()}}this.host.addClass(this.toThemeProperty("jqx-widget"));this.host.addClass(this.toThemeProperty("jqx-rangeselector"));this.host.children(":eq(0)").addClass(this.toThemeProperty("jqx-rangeselector-content"));this._id=this.element.id;if(typeof this.min=="string"||this.min instanceof Date){this._dataType="date"}else{this._dataType="number"}this._privateProperties();this._checkProperties();this._setSize();this._scale();this._initSlider()},refresh:function(b){if(b==true){return}this.host.children(".jqx-rangeselector-ticks-container").remove();this._removeHandlers();this._privateProperties();this._checkProperties();this._setSize();this._scale();this._initSlider()},destroy:function(){this._removeHandlers();this.host.remove()},setRange:function(k,l){if(k>l){throw new Error("jqxRangeSelector: range object initialization error. 'min' should be less than 'max'");return}var g=this._getValue();if(g.from!=k||g.to!=l){var d=this._dataType=="number"?"numeric":"date";var i="The set values are in the wrong format. Please set "+d+" values.";if(typeof k=="string"||k instanceof Date){if(this._dataType=="number"){throw new Error(i)}}else{if(this._dataType=="date"){throw new Error(i)}}k=this._validateInput(k);l=this._validateInput(l);if(k>this._max){k=this._max}if(k<this._min){k=this._min}if(l>this._max){l=this._max}if(l<this._min){l=this._min}var f=l-k;if(f>this._range._max){l=k+this._range._max}else{if(f<this._range._min){l=k+this._range._min}}var j=this._valuesArray.indexOf(k);var e=this._valuesArray.indexOf(l);var m=this._ticksArray[j];var h=this._ticksArray[e];var b=Math.abs(h-m);this.slider[0].style.width=b+"px";var c=!this.rtl?m:h;this.slider[0].style.left=c;this._moveSlider(c);if(this._dataType=="date"){var k=new Date(k);var l=new Date(l)}this._raiseEvent("0",{from:k,to:l})}},val:function(b){if(arguments.length==0){return this.getRange()}if(b.from!=undefined){this.setRange(b.from,b.to)}},getRange:function(){var b=this._getValue();return b},propertyChangedHandler:function(b,c,e,d){switch(c){case"showMinorTicks":if(d==true){a("#"+this._id+" .jqx-rangeselector-ticks-minor").css("visibility","visible")}else{a("#"+this._id+" .jqx-rangeselector-ticks-minor").css("visibility","hidden")}break;case"showMarkers":var f=a("#"+this._id+"LeftMarker, #"+this._id+"RightMarker, #"+this._id+"LeftMarkerArrow, #"+this._id+"RightMarkerArrow");if(d==true){f.css("visibility","visible")}else{f.css("visibility","hidden")}break;default:this.refresh()}},_raiseEvent:function(g,e){var c=this.events[g];var f=new a.Event(c);f.owner=this;f.args=e;try{var b=this.host.trigger(f)}catch(d){}return b},_setSize:function(){this.host.width(this.width);this.host.height(this.height)},resize:function(c,b){this.width=c;this.height=b;this.refresh()},_scale:function(){var c=this.host.width();var b=this._max-this._min;this._unitPerPixel=parseFloat((b/c).toFixed(4));this._pixelPerUnit=c/b;4;this._minWidth=this._roundNumber(this._range._min/this._unitPerPixel);this._maxWidth=this._roundNumber(this._range._max/this._unitPerPixel);this._minWidth=parseInt(this._minWidth);this._maxWidth=parseInt(this._maxWidth);if(this._dataType=="number"){this._majorTicksCount=b/this.majorTicksInterval;this._majorTicksCount=Math.floor(this._majorTicksCount)+1;this._majorTicksDistance=parseInt(this._roundNumber(c/(b/this.majorTicksInterval)));this._unitsCount=b/this.minorTicksInterval;this._unitsCount=Math.floor(this._unitsCount)+1;this._unitsDistance=parseInt(this._roundNumber(c/(b/this.minorTicksInterval)))}this._addTicks()},_addTicks:function(){var f=this;this.host.append("<div id='"+this._id+"TicksContainer' class='jqx-rangeselector-ticks-container'></div>");this.rangeSelector=a("#"+this._id+"TicksContainer");this._majorTicksArray=new Array();this._ticksArray=new Array();this._valuesArray=new Array();var c=new String();a("#"+this._id+"TicksContainer").append("<div id='labelPlaceholder' style='visibility: hidden; position: absolute;'></div>");var e=this.rangeSelector.height();if(this._dataType=="number"){c=this._addNumericTicks(e)}else{c=this._addDateTicks(e)}var b=0;if(this.showLabels){b+=a("#labelPlaceholder").outerHeight()+6}if(this._dataType!="number"){if(this.showGroupLabels){b+=a("#labelPlaceholder").outerHeight()+6}}if(this.padding=="auto"){this.host.css("padding-bottom",b)}a("#labelPlaceholder").remove();a("#"+this._id+"TicksContainer").append(c);this._ticksArray.sort(function(h,g){return h-g});for(var d=1;d<this._ticksArray.length;d++){this._ticksArray[d]=this._roundNumber(this._ticksArray[d])}this._valuesArray.sort(function(h,g){return h-g});if(this._dataType=="number"){for(var d=1;d<this._valuesArray.length;d++){this._valuesArray[d]=this._roundNumber(this._valuesArray[d],"marker",true)}}for(var d=1;d<this._ticksArray.length;d++){if(this._ticksArray[d-1]==this._ticksArray[d]){this._ticksArray.splice(d,1);this._valuesArray.splice(d,1)}}if(this.rtl){this._valuesArray=this._valuesArray.reverse()}},_addNumericTicks:function(g){var n=this;var l=new String();var h=0;var f=this._min;var r=this._max;for(var k=0;k<this._majorTicksCount;k++){var e=this._id+"LabelTick"+(k+1);if(k==this._majorTicksCount-1){h=this.host.width()}var m=n.showMajorTicks?"visible":"hidden";l+="<div id='"+e+"' class='"+this.toThemeProperty("jqx-rangeselector-ticks")+" "+this.toThemeProperty("jqx-slider-tick-horizontal")+"' style='visibility: "+m+"; left: "+h+"px;'></div>";this._ticksArray.push(h);this._majorTicksArray.push(h);var c=this._id+"Label"+(k+1);var j=f;this._valuesArray.push(parseFloat(j.toFixed(4)));if(n.rtl){j=r}j=this._formatOutput(j,this.labelsFormat,this.minorTicksInterval>=1?0:2,"label");a("#labelPlaceholder").html(j);var q=a("#labelPlaceholder").width();var p=n.showLabels?"visible":"hidden";if(n.labelsOnTicks){l+="<div id='"+c+"' class='"+this.toThemeProperty("jqx-rangeselector-labels")+"' style='visibility: "+p+"; left: "+(h-q/2)+"px; top: "+g+"px;'>"+j+"</div>"}var d=h;f=f+this.majorTicksInterval;r=r-this.majorTicksInterval;var h=(f-n._min)/n._unitPerPixel;h=parseInt(h);if(!this.labelsOnTicks&&k<this._majorTicksCount-1){var o=Math.abs(d-h);l+="<div id='"+c+"' class='"+this.toThemeProperty("jqx-rangeselector-labels")+"' style='visibility: "+p+"; left: "+(d+o/2-q/2)+"px; top: "+g+"px;'>"+j+"</div>"}}var h=0;var b=this.showMinorTicks?"visible":"hidden";var f=this._min;for(var k=0;k<this._unitsCount;k++){var e=this._id+"MinorTick"+(k+1);if(k==this._unitsCount-1){h=this.host.width()}l+="<div id='"+e+"' class='"+this.toThemeProperty("jqx-rangeselector-ticks")+" "+this.toThemeProperty("jqx-rangeselector-ticks-minor")+" "+this.toThemeProperty("jqx-slider-tick-horizontal")+"' style='visibility: "+b+"; left: "+h+"px;'></div>";var s=f;if(this._valuesArray.indexOf(parseFloat(s.toFixed(4)))===-1){this._valuesArray.push(parseFloat(s.toFixed(4)));this._ticksArray.push(h)}f=f+this.minorTicksInterval;var h=(f-n._min)/n._unitPerPixel;h=parseInt(h)}return l},_getMillisecondsByInterval:function(c){var b={};if(c=="year"||c.years){b.divisor=c.years?c.years:1;return b.divisor*(365*24*3600*1000)}else{if(c=="month"||c.months){b.divisor=c.months?c.months:1;return b.divisor*(30*24*3600*1000)}else{if(c=="week"||c.weeks){b.divisor=c.weeks?c.weeks:1;return b.divisor*(7*24*3600*1000)}else{if(c=="day"||c.days){b.divisor=c.days?c.days:1;return b.divisor*(24*3600*1000)}else{if(c=="hour"||c.hours){b.divisor=c.hours?c.hours:1;return b.divisor*(3600*1000)}else{if(c=="minute"||c.minutes){b.divisor=c.minutes?c.minutes:1;return b.divisor*60*1000}else{if(c=="second"||c.seconds){b.divisor=c.seconds?c.seconds:1;return b.divisor*1000}else{if(c=="millisecond"||c.milliseconds){b.divisor=c.milliseconds?c.milliseconds:1;return b.divisor*1}}}}}}}}return b},_addDateTicks:function(e){var d=this;var c=new String();var b=function(k){var j=k=="majorTicksInterval"?d.majorTicksInterval:d.minorTicksInterval;var i=new Object();if(j=="year"||j.years){i.period="year";i.interval=86400000;i.divisor=j.years?j.years:1;i.value=i.divisor*(365*24*3600*1000)}else{if(j=="month"||j.months){i.period="month";i.interval=86400000;i.divisor=j.months?j.months:1;i.value=i.divisor*(30*24*3600*1000)}else{if(j=="week"||j.weeks){i.period="week";i.interval=86400000;i.divisor=j.weeks?j.weeks:1;i.value=i.divisor*(7*24*3600*1000)}else{if(j=="day"||j.days){i.period="day";i.interval=3600000;i.divisor=j.days?j.days:1;i.value=i.divisor*(24*3600*1000)}else{if(j=="hour"||j.hours){i.period="hour";i.interval=60000;i.divisor=j.hours?j.hours:1;i.value=i.divisor*(3600*1000)}else{if(j=="minute"||j.minutes){i.period="minute";i.interval=60*1000;i.divisor=j.minutes?j.minutes:1;i.value=i.divisor*60*1000}else{if(j=="second"||j.seconds){i.period="second";i.interval=1000;i.divisor=j.seconds?j.seconds:1;i.value=i.divisor*1000}else{if(j=="millisecond"||j.milliseconds){i.period="millisecond";i.interval=1;i.divisor=j.milliseconds?j.milliseconds:1;i.value=i.divisor*1}}}}}}}}return i};var f=function(n,q){var l=new Date(n);var r=l.getDate();var s=q=="year"&&l.getMonth()==0&&r==1;var k=q=="month"&&r==1;var t=q=="week"&&l.getDay()==0;var j=q=="day"&&l.getHours()==0;var i=q=="hour"&&l.getMinutes()==0;var o=q=="minute"&&l.getSeconds()==0;var m=q=="minute"&&l.getMilliseconds()==0;var p=q=="millisecond";if(s||k||t||j||i||o||m||p){return true}else{return false}};var h=function(p,u,n){var l=(p-d._min)/d._unitPerPixel;if(d.rtl){if(u=="majorTicksInterval"){p=d._dateMajorTicks[d._dateMajorTicks.length-n]}else{p=d._dateMinorTicks[d._dateMinorTicks.length-n]}}l=parseInt(l);var v=p;if(d._valuesArray.indexOf(v)===-1){d._ticksArray.push(l);d._valuesArray.push(v);if(u=="majorTicksInterval"){d._majorTicksArray.push(l)}}if(u=="majorTicksInterval"){var q=d._id+"LabelTick"+n;var k=d.showMajorTicks?"visible":"hidden";c+="<div id='"+q+"' class='"+d.toThemeProperty("jqx-rangeselector-ticks")+" "+d.toThemeProperty("jqx-slider-tick-horizontal")+"' style='visibility: "+k+"; left: "+l+"px;'></div>";var o=v;o=d._formatOutput(o,d.labelsFormat,d.labelPrecision,"label");a("#labelPlaceholder").html(o);var t=a("#labelPlaceholder").width();var j=d._id+"Label"+n;var s=d.showLabels?"visible":"hidden";if(!d.labelsOnTicks){var w=d._getMillisecondsByInterval(d.majorTicksInterval)/d._unitPerPixel;var r=w/2;c+="<div id='"+j+"' class='"+d.toThemeProperty("jqx-rangeselector-labels")+"' style='visibility: "+s+"; left: "+(r+l-t/2)+"px; top: "+e+"px;'>"+o+"</div>"}else{if(d.labelsOnTicks){c+="<div id='"+j+"' class='"+d.toThemeProperty("jqx-rangeselector-labels")+"' style='visibility: "+s+"; left: "+(l-t/2)+"px; top: "+e+"px;'>"+o+"</div>"}}}else{var k=d.showMinorTicks?"visible":"hidden";var m=d._id+"MinorTick"+n;c+="<div id='"+m+"' class='"+d.toThemeProperty("jqx-rangeselector-ticks")+" "+d.toThemeProperty("jqx-rangeselector-ticks-minor")+" "+d.toThemeProperty("jqx-slider-tick-horizontal")+"' style='visibility: "+k+"; left: "+l+"px;'></div>"}};var g=function(s,o,j){var p=0;var l=1;var m=new Date(d._min).getHours();var r=o.interval==86400000?true:false;var k=0;var t=new Array();for(var n=d._min;n<=d._max;n+=o.interval){if(r==true){var u=new Date(n).getHours();if(m!=u){var q;if(u==1){q=1}else{if(u==23){q=-1}}n=n-q*3600000;m=new Date(n).getHours()}}var v=f(n,o.period);if(v==true){if(p%o.divisor==0){if(j){t.push(n)}else{h(n,s,l,o.interval)}l++}p++}}return t};d._dateMajorTicks=g("majorTicksInterval",b("majorTicksInterval"),true);d._dateMinorTicks=g("minorTicksInterval",b("minorTicksInterval"),true);g("majorTicksInterval",b("majorTicksInterval"));g("minorTicksInterval",b("minorTicksInterval"));if(this.showGroupLabels==true&&this.showLabels){this._addGroupLabels(a("#labelPlaceholder").height()+e)}return c},_addGroupLabels:function(n){var k=this;var e=new Date(this._min);var m=new Date(this._max);if(m.getFullYear()-e.getFullYear()>0){var l="year";var b=86400000}else{if(m.getMonth()-e.getMonth()>0){var l="month";var b=86400000}else{if(m.getDate()-e.getDate()>0){var l="day";var b=3600000}else{return}}}var j=function(q){var p=new Date(q);var s=p.getFullYear();var r=p.getMonth();var u=p.getDate();var v;var i=true;if(l=="year"&&r==0&&u==1){v=s}else{if(l=="month"&&u==1){v=a.jqx.dataFormat.formatdate(p,"MMMM");if(r==0){v=s+" "+v}}else{if(l=="day"&&p.getHours()==0){v=a.jqx.dataFormat.formatdate(p,"dddd")}else{i=false}}}var t;if((i==true)&&k.groupLabelsFormatFunction){t=k.groupLabelsFormatFunction(v,p)}else{t=v}var w={check:i,value:t};return w};var h=new String();var g=this.toThemeProperty("jqx-rangeselector-group-labels-ticks")+" "+this.toThemeProperty("jqx-slider-tick-horizontal");var d=1;for(var f=this._min;f<this._max;f+=b){var o=j(f);if(o.check==true){var c=(f-this._min)/this._unitPerPixel;h+="<div class='"+this.toThemeProperty("jqx-rangeselector-labels")+"' style='left: "+c+"px; top: "+n+"px;'><div class='"+g+"'></div><div id='"+this._id+"GroupLabel"+d+"' class='"+this.toThemeProperty("jqx-rangeselector-group-labels")+"' style='margin-left: 5px;'>"+o.value+"</div></div>";d++}}a("#"+this._id+"TicksContainer").append(h)},_updateCursor:function(b,g){var f=this.element.style.cursor;var e=this.slider.offset().left;var d=parseInt(this.slider[0].style.width);var c=e+d;if((((b>e-5)&&(b<e+5))||((b>c-5)&&(b<c+5)))){if(f==""||f=="auto"){this.element.style.cursor="e-resize"}}else{if(f=="e-resize"){this.element.style.cursor="auto"}}},_handleMouseMove:function(w){var j=this;var s=j.slider;var l=w.pageX;var k=w.pageY;if(j._isTouchDevice){var h=a.jqx.position(w);l=h.left;k=h.top}var D=j._hostOffset.left;var t=j._hostWidth;if(j.resizable&&!j.dragging&&j.resizeDirection=="none"){if(l>=D&&l<=D+t){if(k>=j._hostOffset.top&&k<=j._hostOffset.top+j._hostHeight){this._updateCursor(l,k)}}}if(!j.isMouseDown){return true}if(j._isTouchDevice){if(k<j._hostOffset.top||k>j._hostOffset.top+j._hostHeight){return true}}var f=j._findNearestTick(j._sliderLeftOffset+l-j._mouseDownX);var c=parseInt(f);if(c<0){return true}if(c<0){c=0}var b=parseInt(s[0].style.width);var i=c+b;var r=function(G){var y=parseInt(j._maxWidth);var x=parseInt(j._minWidth);if(G<x||G>y){return false}var I=parseInt(j.rightMarker[0].style.left);var H=parseInt(j.leftMarker[0].style.left);if(H>I){return false}return true};if(j.resizable==true&&!j.dragging){var A=c*j._unitPerPixel+j._min;if(j.resizeDirection=="left"||j.isLeftMarkerCaptured){var E=j.isLeftMarkerCaptured?j.leftMarker.outerWidth():0;if(l<D-E){l=D-E}if(l>D+t+E){l=D+t+E+1}var q=s[0].style.left;var g=c-parseInt(q);var o=parseInt(b-g);if(!r(o)){if(l>j._mouseDownX){l=j.sliderRight-j._minWidth-D;o=j._minWidth;if(b==o){return true}var f=j._findNearestTick(l);c=f;if(c<0){return true}var p=parseInt(q)*j._unitPerPixel+j._min;var A=c*j._unitPerPixel+j._min}else{if(j._maxWidth!=0&&l<j._mouseDownX&&o>j._maxWidth){l=j.sliderRight-j._maxWidth-D;o=j._maxWidth;if(b==o){return true}var f=j._findNearestTick(l);c=f;if(c<0){return true}var p=parseInt(q)*j._unitPerPixel+j._min;var A=c*j._unitPerPixel+j._min}else{return true}}}j.slider[0].style.left=c+"px";if(q!=s[0].style.left){j.slider[0].style.width=o+"px"}var n=j._findNearestTick(c);var v=j._valuesArray[j._ticksArray.indexOf(n)];if(v!=undefined){j.leftMarkerValue[0].innerHTML=j._formatOutput(v,j.markersFormat,0,"left");if(c!=n){j.slider[0].style.left=n+"px"}}else{j.leftMarkerValue[0].innerHTML=j._formatOutput(A,j.markersFormat,0,"left")}j.oldX=l;j.moved=true}else{if(j.resizeDirection=="right"||j.isRightMarkerCaptured){var E=j.isRightMarkerCaptured?j.rightMarker.outerWidth():0;var F=false;var u=false;if(l<D-E){l=D-E;u=true}if(l>D+t+E){l=D+t+E;F=true}var e=j._sliderInitialWidth;var m=j._findNearestTick(e+j._sliderLeftOffset);var C=j._findNearestTick(e+l-j._mouseDownX+j._sliderLeftOffset);if(C<0){return true}var g=m-C;var o=e-g;if(o<=0){g=e;o=0}var B=parseInt(j.element.style.width);if(j.element.style.width.indexOf("%")>=0){B=j.host.width()}if(F||(j._sliderLeftOffset+o>=B)){o=B-j._sliderLeftOffset;boundDetected=true}if(o>parseInt(this._maxWidth)){o=parseInt(this._maxWidth)}if(o<parseInt(this._minWidth)){o=parseInt(this._minWidth)}j.slider[0].style.width=o+"px";var A=(j._sliderLeftOffset+o)*j._unitPerPixel+j._min;var z=j._findNearestTick(j._sliderLeftOffset+o);var d=j._valuesArray[j._ticksArray.indexOf(z)];if(d!=undefined){if(j._sliderLeftOffset+o!=z){j.slider[0].style.width=z-j._sliderLeftOffset+"px"}j.rightMarkerValue[0].innerHTML=j._formatOutput(d,j.markersFormat,0,"right")}else{j.rightMarkerValue[0].innerHTML=(j._formatOutput(A,j.markersFormat,0,"right"))}j.oldX=l}}j._layoutShutter();j._layoutMarkers();j.moved=true}if(j.dragging==1){j._moveSlider(c,true);j.oldX=l}},_moveSlider:function(b,d){var g=this;g.moved=true;var e=parseInt(this.slider[0].style.width);var c=parseInt((b+e));var n=this._hostWidth;var j=b;if(j<0){j=0;b=j}if(j+e>n){j=n-e;b=j}if((j>=0)&&((j+e)<=(n))){this.slider[0].style.left=j+"px";var o=this._findNearestTick(j);var k=this._majorTicksArray.indexOf(o)!=-1;var m=this._valuesArray[this._ticksArray.indexOf(o)];if(m!=undefined){this.leftMarkerValue[0].innerHTML=this._formatOutput(m,this.markersFormat,0,"left");if(b!=o&&k){if(d){this.slider[0].style.left=o+"px";var c=parseInt((o+e))}}}else{this.leftMarkerValue[0].innerHTML=this._formatOutput(((j)*this._unitPerPixel+this._min),this.markersFormat,0,"left")}var i=this._findNearestTick(c);var l=this._valuesArray[this._ticksArray.indexOf(i)];if(l!=undefined){var h=this._majorTicksArray.indexOf(i)!=-1;this.rightMarkerValue[0].innerHTML=this._formatOutput(l,this.markersFormat,0,"right");if(c!=i&&h&&k){if(d){var f=(i-o);this.slider[0].style.width=f+"px"}}}else{this.rightMarkerValue[0].innerHTML=this._formatOutput(((j+e)*this._unitPerPixel+this._min),this.markersFormat,0,"right")}}this._layoutShutter();this._layoutMarkers()},_initSlider:function(){var n=this;var r=this.toThemeProperty("jqx-rangeselector-shutter")+" "+this.toThemeProperty("jqx-scrollbar-state-normal");a("#"+this._id+"TicksContainer").append("<div id='"+this._id+"ShutterLeft' class='"+r+"'></div><div id='"+this._id+"Slider' class='"+this.toThemeProperty("jqx-rangeselector-slider")+" "+this.toThemeProperty("jqx-scrollbar-thumb-state-normal")+"'><div class='"+this.toThemeProperty("jqx-rangeselector-inner-slider")+"'></div></div><div id='"+this._id+"ShutterRight' class='"+r+"'></div>");this.slider=a("#"+this._id+"Slider");this.shutterLeft=a("#"+this._id+"ShutterLeft");this.shutterRight=a("#"+this._id+"ShutterRight");this._hostOffset=this.rangeSelector.offset();this._hostWidth=this.rangeSelector.width();this._hostHeight=this.rangeSelector.height();var o=this._hostOffset;var m=this._initRange();var q=m.left;var c=m.right-q;var g=c/this._unitPerPixel;this.slider[0].style.width=Math.round(g)+"px";var h=o.left+parseInt((q-this._min)/this._unitPerPixel);this.slider.offset({left:h});this._layoutShutter();this._initMarkers();if(this.disabled==false){this.host.removeClass(this.toThemeProperty("jqx-fill-state-disabled"));this.addHandler(this.host,"dragstart.rangeselector"+this._id,function(){return false});this.addHandler(a(window),"jqxReady.rangeselector",function(){n._layoutMarkers();return false});this.isSliderCaptured=false;this.resizeDirection="none";this.isLeftMarkerCaptured=false;this.isRightMarkerCaptured=false;this.dragging=false;this._mouseDownX;var d;var f;var i="mousedown.rangeselector"+this.element.id;if(this._isTouchDevice){i=a.jqx.mobile.getTouchEventName("touchstart")+".rangeselector"+this.element.id}this.addHandler(this.host,i,function(t){n.isMouseDown=true;n._hostOffset=n.rangeSelector.offset();n._hostWidth=n.rangeSelector.width();n._hostHeight=n.rangeSelector.height();n._sliderLeftOffset=parseInt(n.slider[0].style.left);var A=t.pageX;var v=t.pageY;if(n._isTouchDevice){var z=a.jqx.position(t);A=z.left;v=z.top}n._initialSliderOffset=A-n.slider.offset().left;var B=n.slider.width();n._sliderInitialWidth=B;d=n.slider.offset().left;f=n._sliderInitialWidth;n.initialOffset=d;var s=parseInt((d+f));n.oldX=A;n._mouseDownX=A;n.resizeDirection="none";n.sliderRight=s;if((A>d-5)&&(A<d+5)&&n._heightCheck(v)){n.isSliderCaptured=false;n.dragging=false;n.resizeDirection="left"}else{if((A>s-5)&&(A<s+5)&&n._heightCheck(v)){n.isSliderCaptured=false;n.dragging=false;n.resizeDirection="right"}else{if((A>=d+5)&&(A<=s+5)&&n._heightCheck(v)){n.isSliderCaptured=true;n.dragging=true}else{n.isSliderCaptured=false;n.dragging=false;if(n.moveOnClick){if(n.isLeftMarkerCaptured||n.isRightMarkerCaptured){return false}var l=n._sliderLeftOffset+n._initialSliderOffset;var C=n._findNearestTick(l);l=C;if(l<0){l=0}var u=parseInt(n.slider[0].style.width);if(v>=n.slider.offset().top){if(A>s){n._moveSlider(l-u,true)}else{n._moveSlider(l,true)}}}}}}});this.addHandler(n.leftMarker,i,function(l){n.leftMarkerAndArrow.addClass(n.toThemeProperty("jqx-fill-state-pressed"));n.oldLeftX=l.pageX;if(n._isTouchDevice){var s=a.jqx.position(l);oldLeftX=s.left}n._mouseDownX=n.oldLeftX;n.isLeftMarkerCaptured=true});this.addHandler(n.rightMarker,i,function(l){n.rightMarkerAndArrow.addClass(n.toThemeProperty("jqx-fill-state-pressed"));n.oldRightX=l.pageX;if(n._isTouchDevice){var s=a.jqx.position(l);oldRightX=s.left}n._mouseDownX=n.oldRightX;n.isRightMarkerCaptured=true});this.addHandler(a(document),"selectstart.rangeselector"+this._id,function(l){if(n.isSliderCaptured==true||n.isLeftMarkerCaptured==true||n.isRightMarkerCaptured==true||n.dragging==true){l.preventDefault();return false}});var b="mousemove.rangeselector"+this.element.id;if(this._isTouchDevice){b=a.jqx.mobile.getTouchEventName("touchmove")+".rangeselector"+this.element.id}this.addHandler(a(document),b,function(l){n._handleMouseMove(l)});var k=function(t){try{var s=n.moved;n.moved=false;n.isMouseDown=false;n.dragging=false;n.resizeDirection="none";if(n.isLeftMarkerCaptured==true){n.leftMarkerAndArrow.removeClass(n.toThemeProperty("jqx-fill-state-pressed"));n.isLeftMarkerCaptured=false}if(n.isRightMarkerCaptured==true){n.rightMarkerAndArrow.removeClass(n.toThemeProperty("jqx-fill-state-pressed"));n.isRightMarkerCaptured=false}if(s){var u=n._getValue();n._raiseEvent("0",{from:u.from,to:u.to})}}catch(l){}};this.addHandler(a(document),"mouseup.rangeselector"+this._id,function(l){k(l)});try{if(document.referrer!=""||window.frameElement){if(window.top!=null&&window.top!=window.self){var j=function(l){k(l)};var e=null;if(window.parent&&document.referrer){e=document.referrer}if(e&&e.indexOf(document.location.host)!=-1){if(window.top.document){if(window.top.document.addEventListener){window.top.document.addEventListener("mouseup",j,false)}else{if(window.top.document.attachEvent){window.top.document.attachEvent("onmouseup",j)}}}}}}}catch(p){}}else{this.host.addClass(this.toThemeProperty("jqx-fill-state-disabled"))}this._moveSlider(parseInt(n.slider[0].style.left));this.moved=false},_initMarkers:function(){var c=a("#"+this._id+"TicksContainer");var d=this.toThemeProperty("jqx-rangeselector-markers")+" "+this.toThemeProperty("jqx-disableselect")+" "+this.toThemeProperty("jqx-fill-state-normal");c.append("<div id='"+this._id+"LeftMarker' class='"+d+"'></div><div id='"+this._id+"RightMarker' class='"+d+"'></div>");var e=this.toThemeProperty("jqx-rangeselector-marker-arrow")+" "+this.toThemeProperty("jqx-fill-state-normal");if(this.markersPosition=="bottom"){e+=" "+this.toThemeProperty("jqx-rangeselector-marker-arrow-bottom")}else{e+=" "+this.toThemeProperty("jqx-rangeselector-marker-arrow-top")}c.append("<div id='"+this._id+"LeftMarkerArrow' class='"+e+" "+this.toThemeProperty("jqx-rangeselector-marker-left-arrow")+"'></div>");c.append("<div id='"+this._id+"RightMarkerArrow' class='"+e+" "+this.toThemeProperty("jqx-rangeselector-marker-right-arrow")+"'></div>");a("#"+this._id+"LeftMarker").append("<div id='"+this._id+"LeftMarkerValue' class='"+this.toThemeProperty("jqx-disableselect")+" "+this.toThemeProperty("jqx-rangeselector-markers-value")+"'></div>");a("#"+this._id+"RightMarker").append("<div id='"+this._id+"RightMarkerValue' class='"+this.toThemeProperty("jqx-disableselect")+" "+this.toThemeProperty("jqx-rangeselector-markers-value")+"'></div>");var i=a("#"+this._id+"LeftMarker, #"+this._id+"RightMarker, #"+this._id+"LeftMarkerArrow, #"+this._id+"RightMarkerArrow");var h=a("#"+this._id+"LeftMarker, #"+this._id+"LeftMarkerArrow");var b=a("#"+this._id+"RightMarker, #"+this._id+"RightMarkerArrow");if(this.showMarkers==true){i.css("visibility","visible")}else{i.css("visibility","hidden")}if(this.disabled==false&&this.resizable==true){var f=this;this.addHandler(h,"mouseenter.rangeselector"+this._id,function(j){f.element.style.cursor="pointer";h.addClass(f.toThemeProperty("jqx-fill-state-hover"))});this.addHandler(h,"mouseleave.rangeselector"+this._id,function(j){f.element.style.cursor="auto";h.removeClass(f.toThemeProperty("jqx-fill-state-hover"))});this.addHandler(b,"mouseenter.rangeselector"+this._id,function(j){f.element.style.cursor="pointer";b.addClass(f.toThemeProperty("jqx-fill-state-hover"))});this.addHandler(b,"mouseleave.rangeselector"+this._id,function(j){f.element.style.cursor="auto";b.removeClass(f.toThemeProperty("jqx-fill-state-hover"))})}this.leftMarkerAndArrow=h;this.rightMarkerAndArrow=b;this.leftMarkerArrow=a("#"+this._id+"LeftMarkerArrow");this.rightMarkerArrow=a("#"+this._id+"RightMarkerArrow");this.leftMarker=a("#"+this._id+"LeftMarker");this.rightMarker=a("#"+this._id+"RightMarker");this.leftMarkerValue=a("#"+this._id+"LeftMarkerValue");this.rightMarkerValue=a("#"+this._id+"RightMarkerValue");var g=this._initRange();this._updateMarkersValues(g.left,g.right);this._layoutMarkers();if(this.padding=="auto"){this.host.css("padding-left",this.leftMarker[0].offsetWidth);this.host.css("padding-right",this.rightMarker[0].offsetWidth);this.host.css("padding-top",this._leftMarkerHeight+7)}else{this.host.css("padding",this.padding)}},_layoutMarkers:function(){if(this.showMarkers!=true){return}if(!this._hostOffset){this._hostOffset=this.rangeSelector.offset()}if(!this._leftMarkerHeight){this._leftMarkerHeight=this.leftMarker.outerHeight();this._rightMarkerHeight=this.rightMarker.outerHeight()}var e=this._hostOffset.top;var g=parseInt(this.slider[0].style.left)+this._hostOffset.left;var d=-5;if(this.markersPosition=="bottom"){d=parseInt(this.element.style.height)+4+this._rightMarkerHeight}var c=d-this._leftMarkerHeight;var f=d-this._rightMarkerHeight;if(this.markersPosition=="bottom"){d=parseInt(this.element.style.height)-6}var i=this.leftMarker[0].offsetWidth;var b=1+g-i-this._hostOffset.left;this.leftMarker[0].style.left=b+"px";this.leftMarker[0].style.top=c+"px";this.leftMarkerArrow[0].style.left=2+b+i+"px";this.leftMarkerArrow[0].style.top=6+d+"px";var h=g+parseInt(this.slider[0].style.width)-this._hostOffset.left;this.rightMarker[0].style.left=h+"px";this.rightMarker[0].style.top=f+"px";this.rightMarkerArrow[0].style.left=7+h+"px";this.rightMarkerArrow[0].style.top=6+d+"px"},_updateMarkersValues:function(e,d){var c=e;var b=d;this.leftMarkerValue[0].innerHTML=this._formatOutput(c,this.markersFormat,0,"left",true);this.rightMarkerValue[0].innerHTML=this._formatOutput(b,this.markersFormat,0,"right",true)},_removeHandlers:function(){var f=this.element.id;var e=a("#"+f+"LeftMarker, #"+f+"LeftMarkerArrow");var b=a("#"+f+"RightMarker, #"+f+"RightMarkerArrow");var d="mousemove.rangeselector"+f;var c="mousedown.rangeselector"+f;if(this._isTouchDevice){d=a.jqx.mobile.getTouchEventName("touchmove")+".rangeselector"+f;c=a.jqx.mobile.getTouchEventName("touchstart")+".rangeselector"+f}this.removeHandler(a(document),d);this.removeHandler(a(document),"mouseup.rangeselector"+f);this.removeHandler(this.host,c);this.removeHandler(this.host,"click.rangeselector"+f);this.removeHandler(this.host,"dragstart.rangeselector"+f);this.removeHandler(e,"mouseenter.rangeselector"+f);this.removeHandler(e,"mouseleave.rangeselector"+f);this.removeHandler(b,"mouseenter.rangeselector"+f);this.removeHandler(b,"mouseleave.rangeselector"+f);this.removeHandler(a("#"+f+"LeftMarker"),c);this.removeHandler(a("#"+f+"RightMarker"),c);this.removeHandler(a("#"+f+"LeftMarkerValue, #"+f+"RightMarkerValue"),"selectstart.rangeselector"+f)},_heightCheck:function(b){var d=this.slider;var c=d.offset().top;if(b>=c&&b<=c+d.height()){return true}else{return false}},_checkProperties:function(){if(this._range._from<this._min){this._range._from=this._min}else{if(this._range._from>this._min&&this._range._from>this._max){this._range._from=this._min}}if(this._range._to>this._max){this._range._to=this._max}else{if(this._range._to<this._min&&this._range._to<this._max){this._range._to=this._max}}var c=this._max-this._min;if(this._range._min>c){this._range._min=c}if(this._range._max>c){this._range._max=c}var b=this._range._to-this._range._from;if(b<this._range._min){this._range._to=this._range._from+this._range._min}else{if(b>this._range._max){this._range._to=this._range._from+this._range._max}}},_findNearestTick:function(d){var f=0;var e=Math.abs(d-this._ticksArray[0]);for(var c=1;c<this._ticksArray.length;c++){var b=Math.abs(d-this._ticksArray[c]);if(e>b){e=b;f=c}}return this._ticksArray[f]},_privateProperties:function(){this._min=this._validateInput(this.min);this._max=this._validateInput(this.max);this._range=new Object();this._range._from=this._validateInput(this.range.from!=undefined?this.range.from:0);this._range._to=this._validateInput(this.range.to!=undefined?this.range.to:Infinity);this._range._min=this._minMaxDate(this.range.min!=undefined?this.range.min:0);this._range._max=this._minMaxDate(this.range.max!=undefined?this.range.max:Infinity)},_validateInput:function(c){var b;if(typeof c=="number"){b=c}else{if(typeof c=="string"){b=Date.parse(c)}else{if(c instanceof Date){b=c.getTime()}}}return b},_minMaxDate:function(c){if(typeof c!="number"){var b;switch(c){case"millisecond":b=1;break;case"second":b=1000;break;case"minute":b=60000;break;case"hour":b=3600000;break;case"day":b=86400000;break;case"week":b=604800000;break;default:b=c.milliseconds?c.milliseconds:0+c.seconds?1000*c.seconds:0+c.minutes?60000*c.minutes:0+c.hours?3600000*c.hours:0+c.days?86400000*c.days:0+c.weeks?604800000*c.weeks:0}return b}else{return c}},_formatOutput:function(f,g,c,e,h){var d;if(!this.values){this.values=new Array()}this.values[e]=f;if((e=="label")&&this.labelsFormatFunction){if(this._dataType=="date"){d=this._roundDate(f)}else{d=this._roundNumber(f,"label")}d=this.labelsFormatFunction(d)}else{if(e!="label"&&this.markersFormatFunction){if(this._dataType=="date"){d=this._roundDate(f)}d=this.markersFormatFunction(f,e)}else{if(!g){if(this._dataType=="date"){var b;if(this.labelsFormat==null&&this.markersFormat==null){b="both labelsFormat and markersFormat"}else{if(this.labelsFormat==null){b="labelsFormat"}else{if(this.markersFormat==null){b="markersFormat"}}}var i="When the data format is date, "+b+" should be set.";throw new Error(i)}d=f.toFixed(c)}else{if(this._dataType=="number"){d=a.jqx.dataFormat.formatnumber(f,g)}else{d=this._roundDate(f);d=a.jqx.dataFormat.formatdate(d,g)}}}}return d},_getValue:function(i){var f=this.slider;var e=f.width();var b=new Object();var d=f.offset().left-this.rangeSelector.offset().left;var h=(d*this._unitPerPixel+this._min);b.from=this._roundNumber(h,"marker");b.to=this._roundNumber(h+e*this._unitPerPixel,"marker");if(!i&&this.snapToTicks==true){var g=this._findNearestTick((b.from-this._min)/this._unitPerPixel);b.from=this._valuesArray[this._ticksArray.indexOf(g)];var c=this._findNearestTick((b.to-this._min)/this._unitPerPixel);b.to=this._valuesArray[this._ticksArray.indexOf(c)]}if(this._dataType=="date"){b.from=new Date(b.from);b.to=new Date(b.to)}return b},_roundNumber:function(e,b,d){var c;if(b=="marker"){if(d==true){e=parseFloat(e)}c=parseFloat(e)}else{if(b=="label"){c=parseFloat(e)}else{c=parseFloat(e)}}return c},_roundDate:function(c){if(typeof c=="number"){c=new Date(c)}var d=this._max-this._min;if(d>1209600000){var e=c.getDate();var b=c.getHours();if(b>12){c.setDate(e+1);c.setHours(0);c.setMinutes(0);c.setSeconds(0)}}else{if(d>172800000){c.setHours(c.getHours()+Math.round(c.getMinutes()/60));c.setMinutes(0);c.setSeconds(0)}}return c},_layoutShutter:function(){var d=parseInt(this.slider[0].style.left);this.shutterLeft[0].style.width=d+"px";this.shutterLeft[0].style.left="0px";if(a.jqx.browser.msie&&a.jqx.browser.version<9){this.shutterLeft[0].style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=75)";this.shutterRight[0].style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=75)"}var c=1+d+parseInt(this.slider[0].style.width);this.shutterRight[0].style.left=c+"px";var e=parseInt(this.element.style.width);if(this.element.style.width.indexOf("%")>=0){var e=parseInt(this.host.width())}var b=e-1-d-parseInt(this.slider[0].style.width);if(b<0){b=0}this.shutterRight[0].style.width=1+b+"px";if(c+1+b<2+e){this.shutterRight[0].style.width=2+b+"px"}if(b==0){this.shutterRight[0].style.width="0px"}},_initRange:function(){if(this._range._from>this._range._to){throw new Error("jqxRangeSelector: range object initialization error. 'min' should be less than 'max'");return}var c=this;var e=this._range._from;var b=this._range._to;var d={left:e,right:b};return d}})})(jqxBaseFramework);

mercurial