File "mad.alert-box.min.js"
Full Path: /var/www/vhosts/hogsandbbqs.co.uk/httpdocs/select2/assets/js/modules/mad.alert-box.min.js
File size: 2.16 KB
MIME-type: text/plain
Charset: utf-8
var MadAlertBox=function(b){function d(a,c){this.config=b.extend({cssPrefix:"",type:"info",message:null,hasClose:!0,closeBtnText:"Close",anchor:b("body"),duration:400,easing:"linear",classMap:{container:"alert-box",inner:"alert-box-inner",close:"alert-box-close",success:"alert-box--success",warning:"alert-box--warning",info:"alert-box--info",error:"alert-box--error"}},a);Object.defineProperties(this,{containerClass:{get:function(){return this.config.cssPrefix+this.config.classMap.container+" "+
(this.config.cssPrefix+this.config.classMap[this.config.type])}},innerClass:{get:function(){return this.config.cssPrefix+this.config.classMap.inner}},closeClass:{get:function(){return this.config.cssPrefix+this.config.classMap.close}},$elementClose:{get:function(){return this.$element.find("."+this.closeClass)}}});this.$element=void 0===c?this._generateTemplate():c;this._bindEvents()}d.prototype._generateTemplate=function(){this.$alert=b("<div></div>",{role:"alert","class":this.containerClass,style:"display: none"});
this.$alertInner=b("<div></div>",{"class":this.innerClass,text:this.config.message});this.config.hasClose&&(this.$alertClose=b("<button></button>",{type:"button","class":this.closeClass,text:this.config.closeBtnText}),this.$alertInner.append(this.$alertClose));this.$alert.append(this.$alertInner);return this.$alert};d.prototype._bindEvents=function(){var a=this;if(this.config.hasClose)this.$elementClose.on("click.AlertBox",function(b){a.close();b.preventDefault()})};d.prototype.render=function(){var a=
this,c=this.config.anchor;c.length||(c=b("body"));c.after(this.$element);setTimeout(function(){a.$element.slideDown({easing:a.config.easing,duration:a.config.duration,complete:function(){b(document).trigger("pushed.milenia.alert",[b(this),a])}})},4);return this.$element};d.prototype.close=function(){var a=this;this.$element.slideUp({easing:a.config.easing,duration:a.config.duration,complete:function(){b(this).remove();b(document).trigger("closed.milenia.alert",[b(this),a])}})};return{init:function(a,
c){return a.each(function(a,f){var e=b(f);e.data("AlertBox",new d(c,e))})},push:function(a){a=new d(a);a.$element.data("AlertBox",a);return a.render()}}}(window.jQuery);