Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. !function(t){"use strict";function n(t,n){t.addEventListener("mouseup",function(t){n(t)}),t.addEventListener("touchend",function(t){n(t)}),t.addEventListener("keyup",function(t){32===t.keyCode&&(o=!1,n(t))})}function e(t,n){t.addEventListener("mousedown",function(t){t.preventDefault(),n(t)}),t.addEventListener("touchstart",function(t){t.cancelable&&t.preventDefault(),n(t)}),t.addEventListener("keydown",function(t){32!==t.keyCode||o||(o=!0,n(t))})}var o=!1,a=t.fn.val;t.fn.val=function(t){if(arguments.length>=1&&this[0]&&this[0]["bootstrap-input-spinner"]&&this[0].setValue){var n=this[0];setTimeout(function(){n.setValue(t)})}return a.apply(this,arguments)},t.fn.InputSpinner=t.fn.inputSpinner=function(o){var a={decrementButton:"<strong>-</strong>",incrementButton:"<strong>+</strong>",groupClass:"",buttonsClass:"btn-outline-secondary",buttonsWidth:"2.5rem",textAlign:"center",autoDelay:500,autoInterval:100,boostThreshold:10,boostMultiplier:"auto",locale:null};for(var r in o)a[r]=o[r];var i='<div class="input-group '+a.groupClass+'"><div class="input-group-prepend"><button style="min-width: '+a.buttonsWidth+'" class="btn btn-decrement '+a.buttonsClass+'" type="button">'+a.decrementButton+'</button></div><input type="text" style="text-align: '+a.textAlign+'" class="form-control"/><div class="input-group-append"><button style="min-width: '+a.buttonsWidth+'" class="btn btn-increment '+a.buttonsClass+'" type="button">'+a.incrementButton+"</button></div></div>",u=a.locale||navigator.language||"en-US";this.each(function(){function o(t,n){void 0===n&&(n=!0),isNaN(t)||""===t?(f[0].value="",n&&(E[0].value=""),D=0):(t=parseFloat(t),t=Math.min(Math.max(t,w),F),t=Math.round(t*Math.pow(10,N))/Math.pow(10,N),f[0].value=t,n&&(E[0].value=C.format(t)),D=t)}function r(t,n){n&&setTimeout(function(){var e;"function"==typeof Event?e=new Event(n,{bubbles:!0}):(e=document.createEvent("Event"),e.initEvent(n,!0,!0)),t[0].dispatchEvent(e)})}function s(t){E[0].disabled||(p(t),l(),m=setTimeout(function(){v=setInterval(function(){T>a.boostThreshold?b?(p(t*parseInt(g,10)),g<1e8&&(g*=1.1),I&&(g=Math.min(I,g))):p(t*g):p(t),T++},a.autoInterval)},a.autoDelay))}function p(t){isNaN(D)&&(D=0),o(Math.round(D/t)*t+t),r(f,"input"),r(f,"change")}function l(){T=0,g=g=b?1:a.boostMultiplier,clearTimeout(m),clearTimeout(v)}function c(){E.prop("required",f.prop("required")),E.prop("placeholder",f.prop("placeholder"));var t=f.prop("disabled");E.prop("disabled",t),x.prop("disabled",t),y.prop("disabled",t),t&&l();var n=f.prop("class"),e="";/form-control-sm/g.test(n)?e="input-group-sm":/form-control-lg/g.test(n)&&(e="input-group-lg");var o=n.replace(/form-control(-(sm|lg))?/g,"");h.prop("class","input-group "+e+" "+a.groupClass),E.prop("class","form-control "+o),w=parseFloat(f.prop("min"))||0,F=isNaN(f.prop("max"))||""===f.prop("max")?1/0:parseFloat(f.prop("max")),M=parseFloat(f.prop("step"))||1,I=parseInt(f.attr("data-step-max"))||0;var r=parseInt(f.attr("data-decimals"))||0;N!==r&&(N=r,C=new Intl.NumberFormat(u,{minimumFractionDigits:N,maximumFractionDigits:N}))}function d(t){var n=new Intl.NumberFormat(u),e=n.format(1111).replace(/1/g,""),o=n.format(1.1).replace(/1/g,"");return parseFloat(t.replace(new RegExp("\\"+e,"g"),"").replace(new RegExp("\\"+o),"."))}var f=t(this);f[0]["bootstrap-input-spinner"]=!0,f.hide();var m=null,v=null,b="auto"===a.boostMultiplier,g=b?1:a.boostMultiplier,h=t(i),y=h.find(".btn-decrement"),x=h.find(".btn-increment"),E=h.find("input"),w=null,F=null,M=null,I=null,N=null;c();var C=new Intl.NumberFormat(u,{minimumFractionDigits:N,maximumFractionDigits:N}),D=parseFloat(f[0].value),T=0,L=f.attr("data-prefix")||"",k=f.attr("data-suffix")||"";if(L){var B=t('<span class="input-group-text">'+L+"</span>");h.find(".input-group-prepend").append(B)}if(k){var S=t('<span class="input-group-text">'+k+"</span>");h.find(".input-group-append").prepend(S)}f[0].setValue=function(t){o(t)},new MutationObserver(function(){c(),o(D,!0)}).observe(f[0],{attributes:!0}),f.after(h),o(D),E.on("paste input change focusout",function(t){var n=E[0].value,e="focusout"===t.type;n=d(n),o(n,e),r(f,t.type)}),e(y[0],function(){s(-M)}),e(x[0],function(){s(M)}),n(document.body,function(){l()})})}}(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement