praiadeseselle/wire/modules/Inputfield/InputfieldDatetime/timepicker/jquery-ui-sliderAccess.min.js

1 line
1.5 KiB
JavaScript
Raw Permalink Normal View History

2022-03-08 15:55:41 +01:00
(function(a){a.fn.extend({sliderAccess:function(b){b=b||{};b.touchonly=b.touchonly!==undefined?b.touchonly:true;if(b.touchonly===true&&!("ontouchend" in document)){return a(this)}return a(this).each(function(e,g){var j=a(this),h=a.extend({},{where:"after",step:j.slider("option","step"),upIcon:"ui-icon-plus",downIcon:"ui-icon-minus",text:false,upText:"+",downText:"-",buttonset:true,buttonsetTag:"span",isRTL:false},b),d=a("<"+h.buttonsetTag+' class="ui-slider-access"><button data-icon="'+h.downIcon+'" data-step="'+(h.isRTL?h.step:h.step*-1)+'">'+h.downText+'</button><button data-icon="'+h.upIcon+'" data-step="'+(h.isRTL?h.step*-1:h.step)+'">'+h.upText+"</button></"+h.buttonsetTag+">");d.children("button").each(function(i,l){var k=a(this);k.button({text:h.text,icons:{primary:k.data("icon")}}).click(function(s){var o=k.data("step"),r=j.slider("value"),p=r+=o*1,n=j.slider("option","min"),m=j.slider("option","max"),q=j.slider("option","slide")||function(){},t=j.slider("option","stop")||function(){};s.preventDefault();if(p<n||p>m){return}j.slider("value",p);q.call(j,null,{value:p});t.call(j,null,{value:p})})});j[h.where](d);if(h.buttonset){d.removeClass("ui-corner-right").removeClass("ui-corner-left").buttonset();d.eq(0).addClass("ui-corner-left");d.eq(1).addClass("ui-corner-right")}var c=d.css({marginLeft:((h.where==="after"&&!h.isRTL)||(h.where==="before"&&h.isRTL)?10:0),marginRight:((h.where==="before"&&!h.isRTL)||(h.where==="after"&&h.isRTL)?10:0)}).outerWidth(true)+5;var f=j.outerWidth(true);j.css("display","inline-block").width(f-c)})}})})(jQuery);