2023-12-19 14:36:33 +00:00
|
|
|
!function(X,t,n){"use strict";t=void 0!==t&&t.Math===Math?t:globalThis,X.fn.slider=function(D){var S,e=X(this),A=X(n),F=X(t),O=Date.now(),j=[],I=D,z="string"==typeof I,N=[].slice.call(arguments,1),B=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],U=0;return e.each(function(){var l,r,s,u,e,d,c,t,m,g,v,f,o,b,i,h,p=X.isPlainObject(D)?X.extend(!0,{},X.fn.slider.settings,D):X.extend({},X.fn.slider.settings),n=p.className,a=p.metadata,V=p.namespace,k=p.error,T=p.keys,w=p.interpretLabel,y=!1,x="."+V,M="module-"+V,R=X(this),C=this,P=R.data(M),L=1,E={initialize:function(){E.debug("Initializing slider",p),h=!0,t=U+=1,E.setup.layout(),E.setup.labels(),E.bind.events(),E.read.metadata(),E.read.settings(),h=!1,E.instantiate()},instantiate:function(){E.verbose("Storing instance of slider",E),P=E,R.data(M,E)},destroy:function(){E.verbose("Destroying previous slider for",R),clearInterval(P.interval),E.unbind.events(),E.unbind.slidingEvents(),R.removeData(M),P=void 0},setup:{layout:function(){void 0===R.attr("tabindex")&&R.attr("tabindex",0),0===R.find(".inner").length&&R.append('<div class="inner"><div class="track"></div><div class="track-fill"></div><div class="thumb"></div></div>'),o=E.get.precision(),s=R.find(".thumb:not(.second)"),p.showThumbTooltip&&s.attr("data-position",p.tooltipConfig.position).attr("data-variation",p.tooltipConfig.variation),l=s,E.is.range()&&(0===R.find(".thumb.second").length&&R.find(".inner").append('<div class="thumb second"></div>'),u=R.find(".thumb.second"),p.showThumbTooltip&&u.attr("data-position",p.tooltipConfig.position).attr("data-variation",p.tooltipConfig.variation)),e=R.find(".track"),d=R.find(".track-fill"),f=s.width()/2},labels:function(){E.is.labeled()&&(0<(c=R.find(".labels:not(.auto)")).length?E.setup.customLabel():E.setup.autoLabel(),p.showLabelTicks&&R.addClass(n.ticked))},customLabel:function(){var n,e=c.find(".label"),a=e.length,o=E.get.min(),i=E.get.max();e.each(function(e){var t=X(this).attr("data-value");n=t?((t=i<t?i:t<o?o:t)-o)/(i-o):(e+1)/(a+1),E.update.labelPosition(n,X(this))})},autoLabel:function(){0<(c=R.find(".labels")).length?c.empty():c=R.append('<ul class="auto labels"></ul>').find(".labels");for(var e=0,t=E.get.numLabels();e<=t;e++){var n=E.get.label(e),a=0===p.restrictedLabels.length||0<=p.restrictedLabels.indexOf(n),a=""===n||!a&&"always"!==p.showLabelTicks?null:e%E.get.gapRatio()?X('<li class="halftick label"></li>'):X('<li class="label">'+(a?n:"")+"</li>");a&&(E.update.labelPosition(e/t,a),c.append(a))}}},bind:{events:function(){E.bind.globalKeyboardEvents(),E.bind.keyboardEvents(),E.bind.mouseEvents(),p.autoAdjustLabels&&E.bind.windowEvents()},keyboardEvents:function(){E.verbose("Binding keyboard events"),R.on("keydown"+x,E.event.keydown)},globalKeyboardEvents:function(){A.on("keydown"+x+t,E.event.activateFocus)},mouseEvents:function(){E.verbose("Binding mouse and touch events"),R.find(".track, .thumb, .inner").on("mousedown"+x,function(e){e.stopImmediatePropagation(),e.preventDefault(),E.event.down(e)}),R.on("mousedown"+x,E.event.down),R.on("mouseenter"+x,function(e){y=!0}),R.on("mouseleave"+x,function(e){y=!1}),R.find(".thumb").on("touchstart"+x,E.event.touchDown).on("touchmove"+x,E.event.move).on("touchend"+x,E.event.up).on("touchcancel"+x,E.event.touchCancel)},slidingEvents:function(){E.verbose("Binding page wide events while handle is being draged"),A.on("mousemove"+x,E.event.move),A.on("mouseup"+x,E.event.up)},windowEvents:function(){F.on("resize"+x,E.event.resize)}},unbind:{events:function(){R.find(".track, .thumb, .inner").off("mousedown"+x),R.off("mousedown"+x),R.off("mouseenter"+x),R.off("mouseleave"+x),R.find(".thumb").off("touchstart"+x).off("touchmove"+x).off("touchend"+x).off("touchcancel"+x),R.off("keydown"+x),R.off("focusout"+x),A.off("keydown"+x+t,E.event.activateFocus),F.off("resize"+x)},slidingEvents:function(){A.off("mousemove"+x),A.off("mouseup"+x)}},event:{down:function(e){e.preventDefault(),E.is.range()?(e=E.determine.eventPos(e),e=E.determine.pos(e),l=p.preventCrossover&&E.is.range()&&E.
|