!function($){"use strict";var transEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},transEndEventName=transEndEventNames[Modernizr.prefixed("transition")],support={transitions:Modernizr.csstransitions};ABB.UIProgressButtonCircle=function(el,options){this.el=el,this.options=$.extend({},options),this._init()},ABB.UIProgressButtonCircle.prototype._init=function(){this.button=this.el.querySelector("button"),this.progressEl=new ABB.SVGEl(this.el.querySelector("svg.progress-circle")),this.successEl=new ABB.SVGEl(this.el.querySelector("svg.checkmark")),this.errorEl=new ABB.SVGEl(this.el.querySelector("svg.cross")),this._initEvents(),this._enable()},ABB.UIProgressButtonCircle.prototype._initEvents=function(){var self=this;this.button.addEventListener("click",function(){self._submit()})},ABB.UIProgressButtonCircle.prototype._submit=function(){$(this.el).addClass("loading");var self=this,onEndBtnTransitionFn=function(ev){support.transitions&&this.removeEventListener(transEndEventName,onEndBtnTransitionFn),this.setAttribute("disabled",""),"function"==typeof self.options.callback?self.options.callback(self):(self.setProgress(1),self.stop())};support.transitions?this.button.addEventListener(transEndEventName,onEndBtnTransitionFn):onEndBtnTransitionFn()},ABB.UIProgressButtonCircle.prototype.stop=function(status){var self=this,endLoading=function(){if(self.progressEl.draw(0),"number"==typeof status){var statusClass=status>=0?"success":"error",statusEl=status>=0?self.successEl:self.errorEl;statusEl.draw(1),$(self.el).addClass(statusClass),setTimeout(function(){$(self.el).removeClass(statusClass),statusEl.draw(0),self._enable()},self.options.statusTime)}else self._enable();$(self.el).removeClass("loading")};setTimeout(endLoading,300)},ABB.UIProgressButtonCircle.prototype.setProgress=function(val){this.progressEl.draw(val)},ABB.UIProgressButtonCircle.prototype._enable=function(){this.button.removeAttribute("disabled")}}(jQuery);