forked from CodeSeven/toastr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoastr.min.js
2 lines (2 loc) · 2.52 KB
/
toastr.min.js
1
2
(function(n){n(["jquery"],function(n){return function(){function u(r){return(r||(r=i()),t=n("#"+r.containerId),t.children().length)?t:(t=n("<div/>").attr("id",r.containerId).addClass(r.positionClass),t.appendTo(n(r.target)),t)}function i(){return n.extend({},o,f.options)}function e(n){(t||(t=u()),n.is(":visible"))||(n.remove(),n=null,t.children().length===0&&t.remove())}var t,o={tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,fadeIn:300,onFadeIn:undefined,fadeOut:1e3,onFadeOut:undefined,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",target:"body"},s=function(n,t,u){return r({iconClass:i().iconClasses.error,message:n,optionsOverride:u,title:t})},h=function(n,t,u){return r({iconClass:i().iconClasses.info,message:n,optionsOverride:u,title:t})},r=function(r){function s(){if(!(n(":focus",o).length>0))return o.fadeOut(f.fadeOut,function(){e(o),f.onFadeOut&&f.onFadeOut()})}function y(){(f.timeOut>0||f.extendedTimeOut>0)&&(c=setTimeout(s,f.extendedTimeOut))}function p(){clearTimeout(c),o.stop(!0,!0).fadeIn(f.fadeIn)}var f=i(),h=r.iconClass||f.iconClass;typeof r.optionsOverride!="undefined"&&(f=n.extend(f,r.optionsOverride),h=r.optionsOverride.iconClass||h),t=u(f);var c=null,o=n("<div/>"),l=n("<div/>"),a=n("<div/>"),v={options:f,map:r};return r.iconClass&&o.addClass(f.toastClass).addClass(h),r.title&&(l.append(r.title).addClass(f.titleClass),o.append(l)),r.message&&(a.append(r.message).addClass(f.messageClass),o.append(a)),o.hide(),t.prepend(o),o.fadeIn(f.fadeIn,f.onFadeIn),f.timeOut>0&&(c=setTimeout(s,f.timeOut)),o.hover(p,y),!f.onclick&&f.tapToDismiss&&o.click(s),f.onclick&&o.click(function(){f.onclick()&&s()}),f.debug&&console&&console.log(v),o},c=function(n,t,u){return r({iconClass:i().iconClasses.success,message:n,optionsOverride:u,title:t})},l=function(n,t,u){return r({iconClass:i().iconClasses.warning,message:n,optionsOverride:u,title:t})},a=function(r){var f=i();if(t||u(f),r&&n(":focus",r).length===0){r.fadeOut(f.fadeOut,function(){e(r)});return}t.children().length&&t.fadeOut(f.fadeOut,function(){t.remove()})},f={clear:a,error:s,getContainer:u,info:h,options:{},success:c,version:"1.2.3",warning:l};return f}()})})(typeof define=="function"&&define.amd?define:function(n,t){typeof module!="undefined"&&module.exports?module.exports=t(require(n[0])):window.toastr=t(window.jQuery)});
//@ sourceMappingURL=toastr.min.js.map