LocalCDN-Firefox-Chrome-Brave/resources/semantic-ui/2.5.0/components/progress.min.jsm

1 line
12 KiB
JavaScript
Raw Normal View History

2022-10-07 06:16:13 +02:00
!function(E,e,P,T){"use strict";void 0!==(e=void 0!==e&&e.Math==Math?e:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")())&&e.Math==Math||"undefined"!=typeof self&&self.Math==Math||Function("return this")();E.fn.progress=function(m){var b,e=E(this),h=e.selector||"",x=(new Date).getTime(),w=[],y=m,V="string"==typeof y,C=[].slice.call(arguments,1);return e.each(function(){var r=E.isPlainObject(m)?E.extend(!0,{},E.fn.progress.settings,m):E.extend({},E.fn.progress.settings),t=r.className,n=r.metadata,e=r.namespace,a=r.selector,s=r.error,o="."+e,i="module-"+e,l=E(this),c=E(this).find(a.bar),u=E(this).find(a.progress),d=E(this).find(a.label),g=this,v=l.data(i),p=!1,f={initialize:function(){f.debug("Initializing progress bar",r),f.set.duration(),f.set.transitionEvent(),f.read.metadata(),f.read.settings(),f.instantiate()},instantiate:function(){f.verbose("Storing instance of progress",f),v=f,l.data(i,f)},destroy:function(){f.verbose("Destroying previous progress for",l),clearInterval(v.interval),f.remove.state(),l.removeData(i),v=T},reset:function(){f.remove.nextValue(),f.update.progress(0)},complete:function(){(f.percent===T||f.percent<100)&&(f.remove.progressPoll(),f.set.percent(100))},read:{metadata:function(){var e={percent:l.data(n.percent),total:l.data(n.total),value:l.data(n.value)};e.percent&&(f.debug("Current percent value set from metadata",e.percent),f.set.percent(e.percent)),e.total&&(f.debug("Total value set from metadata",e.total),f.set.total(e.total)),e.value&&(f.debug("Current value set from metadata",e.value),f.set.value(e.value),f.set.progress(e.value))},settings:function(){!1!==r.total&&(f.debug("Current total set in settings",r.total),f.set.total(r.total)),!1!==r.value&&(f.debug("Current value set in settings",r.value),f.set.value(r.value),f.set.progress(f.value)),!1!==r.percent&&(f.debug("Current percent set in settings",r.percent),f.set.percent(r.percent))}},bind:{transitionEnd:function(t){var e=f.get.transitionEnd();c.one(e+o,function(e){clearTimeout(f.failSafeTimer),t.call(this,e)}),f.failSafeTimer=setTimeout(function(){c.triggerHandler(e)},r.duration+r.failSafeDelay),f.verbose("Adding fail safe timer",f.timer)}},increment:function(e){var t,n;f.has.total()?n=(t=f.get.value())+(e=e||1):(n=(t=f.get.percent())+(e=e||f.get.randomValue()),f.debug("Incrementing percentage by",t,n)),n=f.get.normalizedValue(n),f.set.progress(n)},decrement:function(e){var t,n;f.get.total()?(n=(t=f.get.value())-(e=e||1),f.debug("Decrementing value by",e,t)):(n=(t=f.get.percent())-(e=e||f.get.randomValue()),f.debug("Decrementing percentage by",e,t)),n=f.get.normalizedValue(n),f.set.progress(n)},has:{progressPoll:function(){return f.progressPoll},total:function(){return!1!==f.get.total()}},get:{text:function(e){var t=f.value||0,n=f.total||0,r=p?f.get.displayPercent():f.percent||0,a=0<f.total?n-t:100-r;return e=(e=e||"").replace("{value}",t).replace("{total}",n).replace("{left}",a).replace("{percent}",r),f.verbose("Adding variables to progress bar text",e),e},normalizedValue:function(e){if(e<0)return f.debug("Value cannot decrement below 0"),0;if(f.has.total()){if(e>f.total)return f.debug("Value cannot increment above total",f.total),f.total}else if(100<e)return f.debug("Value cannot increment above 100 percent"),100;return e},updateInterval:function(){return"auto"==r.updateInterval?r.duration:r.updateInterval},randomValue:function(){return f.debug("Generating random increment percentage"),Math.floor(Math.random()*r.random.max+r.random.min)},numericValue:function(e){return"string"==typeof e?""!==e.replace(/[^\d.]/g,"")&&+e.replace(/[^\d.]/g,""):e},transitionEnd:function(){var e,t=P.createElement("element"),n={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in n)if(t.style[e]!==T)return n[e]},displayPercent:function(){var e=c.width(),t=l.width(),n=parseInt(c.css("min-width"),10)<e?e/t*100:f.percent;return 0<r.precision?Math.round(n*(10*r.precision))/(10*r.precision):Math.round(n)},percent:function(){return f.percent||0},value:func