Current Path : /var/www/mainsite/wp-content/themes/maxcoach/assets/libs/growl/js/ |
Current File : /var/www/mainsite/wp-content/themes/maxcoach/assets/libs/growl/js/jquery.growl.min.js |
(function(){"use strict";var a,b,c;a=jQuery,b=function(){class d{static transition(e){var f,g,h,i;for(i in f=e[0],g=this.transitions,g)if(h=g[i],null!=f.style[i])return h}}return d.transitions={webkitTransition:"webkitTransitionEnd",mozTransition:"mozTransitionEnd",oTransition:"oTransitionEnd",transition:"transitionend"},d}(),c=function(){class d{static growl(e={}){return new d(e)}constructor(e={}){this.render=this.render.bind(this),this.bind=this.bind.bind(this),this.unbind=this.unbind.bind(this),this.mouseEnter=this.mouseEnter.bind(this),this.mouseLeave=this.mouseLeave.bind(this),this.click=this.click.bind(this),this.close=this.close.bind(this),this.cycle=this.cycle.bind(this),this.waitAndDismiss=this.waitAndDismiss.bind(this),this.present=this.present.bind(this),this.dismiss=this.dismiss.bind(this),this.remove=this.remove.bind(this),this.animate=this.animate.bind(this),this.$growls=this.$growls.bind(this),this.$growl=this.$growl.bind(this),this.html=this.html.bind(this),this.content=this.content.bind(this),this.container=this.container.bind(this),this.settings=a.extend({},d.settings,e),this.initialize(this.settings.location),this.render()}initialize(e){var f;return f="growls-"+e,a("body:not(:has(#"+f+"))").append("<div id=\""+f+"\" />")}render(){var e;e=this.$growl(),this.$growls(this.settings.location).append(e),this.settings.fixed?this.present():this.cycle()}bind(e=this.$growl()){return e.on("click",this.click),this.settings.delayOnHover&&(e.on("mouseenter",this.mouseEnter),e.on("mouseleave",this.mouseLeave)),e.on("contextmenu",this.close).find(`.${this.settings.namespace}-close`).on("click",this.close)}unbind(e=this.$growl()){return e.off("click",this.click),this.settings.delayOnHover&&(e.off("mouseenter",this.mouseEnter),e.off("mouseleave",this.mouseLeave)),e.off("contextmenu",this.close).find(`.${this.settings.namespace}-close`).off("click",this.close)}mouseEnter(){var f;return f=this.$growl(),f.stop(!0,!0)}mouseLeave(){return this.waitAndDismiss()}click(e){if(null!=this.settings.url)return e.preventDefault(),e.stopPropagation(),window.open(this.settings.url)}close(e){var f;return e.preventDefault(),e.stopPropagation(),f=this.$growl(),f.stop().queue(this.dismiss).queue(this.remove)}cycle(){var e;return e=this.$growl(),e.queue(this.present).queue(this.waitAndDismiss())}waitAndDismiss(){var e;return e=this.$growl(),e.delay(this.settings.duration).queue(this.dismiss).queue(this.remove)}present(e){var f;return f=this.$growl(),this.bind(f),this.animate(f,`${this.settings.namespace}-incoming`,"out",e)}dismiss(e){var f;return f=this.$growl(),this.unbind(f),this.animate(f,`${this.settings.namespace}-outgoing`,"in",e)}remove(e){return this.$growl().remove(),"function"==typeof e?e():void 0}animate(e,f,g="in",h){var i;i=b.transition(e),e["in"===g?"removeClass":"addClass"](f),e.offset().position,e["in"===g?"addClass":"removeClass"](f),null==h||(null==i?h():e.one(i,h))}$growls(e){var f;return null==this.$_growls&&(this.$_growls=[]),null==(f=this.$_growls)[e]?f[e]=a("#growls-"+e):f[e]}$growl(){return null==this.$_growl?this.$_growl=a(this.html()):this.$_growl}html(){return this.container(this.content())}content(){return`<div class='${this.settings.namespace}-close'>${this.settings.close}</div>\n<div class='${this.settings.namespace}-title'>${this.settings.title}</div>\n<div class='${this.settings.namespace}-message'>${this.settings.message}</div>`}container(e){return`<div class='${this.settings.namespace} ${this.settings.namespace}-${this.settings.style} ${this.settings.namespace}-${this.settings.size}'>\n ${e}\n</div>`}}return d.settings={namespace:"growl",duration:3200,close:"×",location:"default",style:"default",size:"medium",delayOnHover:!0},d}(),this.Growl=c,a.growl=function(d={}){return c.growl(d)},a.growl.error=function(d={}){var e;return e={title:"Error!",style:"error"},a.growl(a.extend(e,d))},a.growl.notice=function(d={}){var e;return e={title:"Notice!",style:"notice"},a.growl(a.extend(e,d))},a.growl.warning=function(d={}){var e;return e={title:"Warning!",style:"warning"},a.growl(a.extend(e,d))}}).call(this);