This repository was archived by the owner on Mar 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblitz.min.js
More file actions
1 lines (1 loc) · 2.18 KB
/
blitz.min.js
File metadata and controls
1 lines (1 loc) · 2.18 KB
1
!function(){window.Blitz=function(){function a(a,b){null==b&&(b={}),this.container=a,this.options=this._defaults(b,this.defaults)}return a.VERSION="0.7.1",a.prototype.blitzTemplate='<div class="blitz hide">\n <div class="blitz-inner-wrapper">\n <span class="blitz-message"></span>\n <span class="blitz-spinner hide"></span>\n <a href="#" class="blitz-close">×</a>\n </div>\n</div>',a.prototype.defaults={delay:0,replace:!1,spinner:!1},a.prototype.setOptions=function(a){var b,c,d;d=[];for(b in a)c=a[b],d.push(this.options[b]=c);return d},a.prototype.notice=function(a,b){return null==b&&(b={}),this._display(a,"notice",b)},a.prototype.alert=function(a,b){return null==b&&(b={}),this._display(a,"alert",b)},a.prototype.success=function(a,b){return null==b&&(b={}),this._display(a,"success",b)},a.prototype.hide=function(){return null!=this.$wrapper&&null!=this.$spinner?(this.$wrapper.addClass("hide"),this.$spinner.addClass("hide")):void 0},a.prototype._display=function(a,b,c){return c=this._defaults(c,this.options),this._render(c.replace),this._bindDomEvents(),this._startAutoHide(c.delay),this._toggleSpinner(c.spinner),this.$message.html(a),this.$wrapper.removeClass("hide notice alert success").addClass(b)},a.prototype._render=function(){return this._rendered?void 0:(this._rendered=!0,this.$wrapper=$(this.blitzTemplate),this.$message=$(".blitz-message",this.$wrapper),this.$spinner=$(".blitz-spinner",this.$wrapper),this.$close=$(".blitz-close",this.$wrapper),this.options.replace?$(this.container).replaceWith(this.$wrapper):$(this.container).append(this.$wrapper))},a.prototype._bindDomEvents=function(){var a;return this._domEventsBound?void 0:(a=this,this.$wrapper.on("click.blitz",".blitz-close",function(){return a.hide(),!1}))},a.prototype._startAutoHide=function(a){var b,c;return this._clearTimeout(),a>0?(c=this,b=function(){return c.hide()},this.autoHideTimeout=setTimeout(b,a)):void 0},a.prototype._clearTimeout=function(){return null!=this.autoHideTimeout?clearTimeout(this.autoHideTimeout):void 0},a.prototype._toggleSpinner=function(a){return this.$spinner.toggleClass("hide",!a)},a.prototype._defaults=function(a,b){var c,d;for(c in b)d=b[c],null==a[c]&&(a[c]=b[c]);return a},a}()}.call(this);