/** * @author Script47 (https://github.com/Script47/Toast) * @description Toast - A Bootstrap 4.2+ jQuery plugin for the toast component * @version 0.8.0 **/ (function(g){g.toast=function(b){var c=g("body");b.container&&1===b.container.length&&(c=b.container);c.children(".toast-container").length||(c.prepend('
'),c.children(".toast-container").append('
'),c.on("hidden.bs.toast",".toast",function(){g(this).remove()}));c=c.children(".toast-container").children(".toast-wrapper");var k="toast-"+(g(".toast").length+1),a="",d=a="",e="text-muted",f="",t=b.title|| "Notice!",u=b.subtitle||"",r=b.content||"",l=b.delay||-1,h=b.img,m=b.ico,n=b.pause_on_hover||!1,p=!1,v=b.prepend,q="";switch(b.type||"info"){case "info":a="bg-info";f=e=d="text-white";break;case "success":a="bg-success";f=e=d="text-white";break;case "warning":case "warn":a="bg-warning";f=e=d="text-white";break;case "error":case "danger":a="bg-danger";f=e=d="text-white";break;case "dark":a="bg-dark";f=e=d="text-white";break;case "primary":a="bg-primary";f=e=d="text-white";break;case "secondary":a= "bg-secondary";f=e=d="text-white";break;case "light":a="bg-light";f=e=d="";break;case "white":a="bg-white";f=e=d="text-dark";break;case "transparent":a="bg-transparent",f=e=d=""}!1!==n?(b=Math.floor(Date.now()/1E3)+l/1E3,q='data-autohide="false"',n='data-hide-timestamp="'+b+'"'):q=-1===l?'data-autohide="false"':'data-delay="'+l+'"';a='";!0===v?(c.prepend(a),c.find(".toast:first").toast("show")):(c.append(a),c.find(".toast:last").toast("show"));!1!==n&&(setTimeout(function(){p||g("#"+k).toast("hide")},l),g(document).on("mouseover","#"+k,function(){p=!0}),g(document).on("mouseleave","#"+k,function(){var a=Math.floor(Date.now()/1E3),b=parseInt(g(this).data("hide-timestamp"));p=!1;a>=b&&g(this).toast("hide")}))}})(jQuery);