streams/library/jgrowl/jquery.jgrowl.min.js

2 lines
5.6 KiB
JavaScript
Raw Normal View History

2019-04-30 04:20:39 +00:00
!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),i(t),t}:i(jQuery)}(function(a){a.jGrowl=function(e,t){0===a("#jGrowl").length&&a('<div id="jGrowl"></div>').addClass(t&&t.position?t.position:a.jGrowl.defaults.position).appendTo(t&&t.appendTo?t.appendTo:a.jGrowl.defaults.appendTo),a("#jGrowl").jGrowl(e,t)},a.fn.jGrowl=function(e,t){if(void 0===t&&a.isPlainObject(e)&&(e=(t=e).message),a.isFunction(this.each)){var i=arguments;return this.each(function(){void 0===a(this).data("jGrowl.instance")&&(a(this).data("jGrowl.instance",a.extend(new a.fn.jGrowl,{notifications:[],element:null,interval:null})),a(this).data("jGrowl.instance").startup(this)),a.isFunction(a(this).data("jGrowl.instance")[e])?a(this).data("jGrowl.instance")[e].apply(a(this).data("jGrowl.instance"),a.makeArray(i).slice(1)):a(this).data("jGrowl.instance").create(e,t)})}},a.extend(a.fn.jGrowl.prototype,{defaults:{pool:0,header:"",group:"",sticky:!1,position:"top-right",appendTo:"body",glue:"after",theme:"default",themeState:"highlight",corners:"10px",check:250,life:3e3,closeDuration:"normal",openDuration:"normal",easing:"swing",closer:!0,closeTemplate:"&times;",closerTemplate:"<div>[ close all ]</div>",log:function(){},beforeOpen:function(){},afterOpen:function(){},open:function(){},beforeClose:function(){},close:function(){},click:function(){},animateOpen:{opacity:"show"},animateClose:{opacity:"hide"}},notifications:[],element:null,interval:null,create:function(e,t){var i=a.extend({},this.defaults,t);void 0!==i.speed&&(i.openDuration=i.speed,i.closeDuration=i.speed),this.notifications.push({message:e,options:i}),i.log.apply(this.element,[this.element,e,i])},render:function(e){var t=this,i=e.message,n=e.options;n.themeState=""===n.themeState?"":"ui-state-"+n.themeState;var o=a("<div/>").addClass("jGrowl-notification alert "+n.themeState+" ui-corner-all"+(void 0!==n.group&&""!==n.group?" "+n.group:"")).append(a("<button/>").addClass("jGrowl-close").html(n.closeTemplate)).append(a("<div/>").addClass("jGrowl-header").html(n.header)).append(a("<div/>").addClass("jGrowl-message").html(i)).data("jGrowl",n).addClass(n.theme).children(".jGrowl-close").bind("click.jGrowl",function(){return a(this).parent().trigger("jGrowl.beforeClose"),!1}).parent();a(o).bind("mouseover.jGrowl",function(){a(".jGrowl-notification",t.element).data("jGrowl.pause",!0)}).bind("mouseout.jGrowl",function(){a(".jGrowl-notification",t.element).data("jGrowl.pause",!1)}).bind("jGrowl.beforeOpen",function(){!1!==n.beforeOpen.apply(o,[o,i,n,t.element])&&a(this).trigger("jGrowl.open")}).bind("jGrowl.open",function(){!1!==n.open.apply(o,[o,i,n,t.element])&&("after"==n.glue?a(".jGrowl-notification:last",t.element).after(o):a(".jGrowl-notification:first",t.element).before(o),a(this).animate(n.animateOpen,n.openDuration,n.easing,function(){!1===a.support.opacity&&this.style.removeAttribute("filter"),null!==a(this).data("jGrowl")&&void 0!==a(this).data("jGrowl")&&(a(this).data("jGrowl").created=new Date),a(this).trigger("jGrowl.afterOpen")}))}).bind("jGrowl.afterOpen",function(){n.afterOpen.apply(o,[o,i,n,t.element])}).bind("click",function(){n.click.apply(o,[o,i,n,t.element])}).bind("jGrowl.beforeClose",function(){!1!==n.beforeClose.apply(o,[o,i,n,t.element])&&a(this).trigger("jGrowl.close")}).bind("jGrowl.close",function(){a(this).data("jGrowl.pause",!0),a(this).animate(n.animateClose,n.closeDuration,n.easing,function(){a.isFunction(n.close)?!1!==n.close.apply(o,[o,i,n,t.element])&&a(this).remove():a(this).remove()})}).trigger("jGrowl.beforeOpen"),""!==n.corners&&void 0!==a.fn.corner&&a(o).corner(n.corners),1<a(".jGrowl-notification:parent",t.element).length&&0===a(".jGrowl-closer",t.element).length&&!1!==this.defaults.closer&&a(this.defaults.closerTemplate).addClass("jGrowl-closer "+this.defaults.themeState+" ui-corner-all").addClass(this.defaults.theme).appendTo(t.element).animate(this.defaults.animateOpen,this.defaults.sp
//# sourceMappingURL=jquery.jgrowl.map