visrecall/WebInterface/Front-end/assets/lib/semantic/components/progress.min.js

10 lines
12 KiB
JavaScript
Raw Normal View History

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