-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.growl.min.js
8 lines (8 loc) · 5.77 KB
/
jquery.growl.min.js
1
2
3
4
5
6
7
8
/**
* Minified by jsDelivr using UglifyJS v3.4.0.
* Original file: /npm/[email protected]/javascripts/jquery.growl.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
var _createClass=function(){function s(t,i){for(var e=0;e<i.length;e++){var s=i[e];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(t,i,e){return i&&s(t.prototype,i),e&&s(t,e),t}}();function _classCallCheck(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(function(){"use strict";var e,o,i,t,s;e=jQuery,(t=function(){function t(){_classCallCheck(this,t)}return _createClass(t,null,[{key:"transition",value:function(t){var i,e,s,n;for(n in i=t[0],e=this.transitions)if(s=e[n],null!=i.style[n])return s}}]),t}()).transitions={webkitTransition:"webkitTransitionEnd",mozTransition:"mozTransitionEnd",oTransition:"oTransitionEnd",transition:"transitionend"},o=t,(s=function(){function i(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,i),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=e.extend({},i.settings,t),this.initialize(this.settings.location),this.render()}return _createClass(i,null,[{key:"growl",value:function(){return new i(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}}]),_createClass(i,[{key:"initialize",value:function(t){var i;return e("body:not(:has(#"+(i="growls-"+t)+"))").append('<div id="'+i+'" />')}},{key:"render",value:function(){var t;t=this.$growl(),this.$growls(this.settings.location).append(t),this.settings.fixed?this.present():this.cycle()}},{key:"bind",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.$growl();return t.on("click",this.click),this.settings.delayOnHover&&(t.on("mouseenter",this.mouseEnter),t.on("mouseleave",this.mouseLeave)),t.on("contextmenu",this.close).find("."+this.settings.namespace+"-close").on("click",this.close)}},{key:"unbind",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.$growl();return t.off("click",this.click),this.settings.delayOnHover&&(t.off("mouseenter",this.mouseEnter),t.off("mouseleave",this.mouseLeave)),t.off("contextmenu",this.close).find("."+this.settings.namespace+"-close").off("click",this.close)}},{key:"mouseEnter",value:function(t){return this.$growl().stop(!0,!0)}},{key:"mouseLeave",value:function(t){return this.waitAndDismiss()}},{key:"click",value:function(t){if(null!=this.settings.url)return t.preventDefault(),t.stopPropagation(),window.open(this.settings.url)}},{key:"close",value:function(t){return t.preventDefault(),t.stopPropagation(),this.$growl().stop().queue(this.dismiss).queue(this.remove)}},{key:"cycle",value:function(){return this.$growl().queue(this.present).queue(this.waitAndDismiss())}},{key:"waitAndDismiss",value:function(){return this.$growl().delay(this.settings.duration).queue(this.dismiss).queue(this.remove)}},{key:"present",value:function(t){var i;return i=this.$growl(),this.bind(i),this.animate(i,this.settings.namespace+"-incoming","out",t)}},{key:"dismiss",value:function(t){var i;return i=this.$growl(),this.unbind(i),this.animate(i,this.settings.namespace+"-outgoing","in",t)}},{key:"remove",value:function(t){return this.$growl().remove(),"function"==typeof t?t():void 0}},{key:"animate",value:function(t,i){var e,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"in",n=arguments[3];e=o.transition(t),t["in"===s?"removeClass":"addClass"](i),t.offset().position,t["in"===s?"addClass":"removeClass"](i),null!=n&&(null!=e?t.one(e,n):n())}},{key:"$growls",value:function(t){var i;return null==this.$_growls&&(this.$_growls=[]),null!=(i=this.$_growls)[t]?i[t]:i[t]=e("#growls-"+t)}},{key:"$growl",value:function(){return null!=this.$_growl?this.$_growl:this.$_growl=e(this.html())}},{key:"html",value:function(){return this.container(this.content())}},{key:"content",value:function(){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>"}},{key:"container",value:function(t){return"<div class='"+this.settings.namespace+" "+this.settings.namespace+"-"+this.settings.style+" "+this.settings.namespace+"-"+this.settings.size+"'>\n "+t+"\n</div>"}}]),i}()).settings={namespace:"growl",duration:3200,close:"×",location:"default",style:"default",size:"medium",delayOnHover:!0},i=s,this.Growl=i,e.growl=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return i.growl(t)},e.growl.error=function(){var t,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return t={title:"Error!",style:"error"},e.growl(e.extend(t,i))},e.growl.notice=function(){var t,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return t={title:"Notice!",style:"notice"},e.growl(e.extend(t,i))},e.growl.warning=function(){var t,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return t={title:"Warning!",style:"warning"},e.growl(e.extend(t,i))}}).call(this);
//# sourceMappingURL=/sm/1f1caaec1f8c32ee86692613df2e2f1e031d300cd0ca4a87ebfdbe67abce45a3.map