-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrapAlert.min.js
More file actions
7 lines (7 loc) · 1.49 KB
/
bootstrapAlert.min.js
File metadata and controls
7 lines (7 loc) · 1.49 KB
1
2
3
4
5
6
7
/*!
* BootstrapAlert v1.0
* Copyright MantaCode Sp. z o.o.
* Licensed under MIT
* requires: jQuery, Bootstrap
*/
!function(e,t){"use strict";"function"==typeof define&&define.amd?define("bootstrapAlert",["jquery"],function(n){return e.BootstrapAlert=t(n)}):"object"==typeof exports?module.exports=t(require("jquery")):e.BootstrapAlert=t(jQuery)}(this,function(e){"use strict";function t(){function t(t,n){var i={autoHide:!0,hideTimeout:3e3,dissmissible:!1,parentClass:"bootstrap-alert",innerClass:"bootstrap-alert-message",title:"",message:""};e.extend(i,n);var s=["position: relative;","width: 100%;","left: -50%;"].join(""),o=document.createElement("div");o.className="alert "+i.innerClass+" "+t,o.setAttribute("role","alert"),o.style=s,i.dissmissible&&(o.innerHTML+=['<button type="button" class="close" data-dismiss="alert">','<span aria-hidden="true">×</span>',"</button>"].join("")),o.innerHTML+="<strong>"+i.title+"</strong> "+i.message;var r=document.createElement("div");r.className=i.parentClass,r.style=["position: fixed;","width: 90%;","max-width: 600px;","left: 50%;","top: 15px;","z-index: 9999;"].join(""),r.appendChild(o),document.body.appendChild(r),i.autoHide&&window.setTimeout(function(){e(r).fadeOut(function(){e(r).remove()})},i.hideTimeout),e(r).on("closed.bs.alert",function(){e(r).remove()})}var n={};return n.alert=function(e){t("alert-danger",e)},n.info=function(e){t("alert-info",e)},n.warning=function(e){t("alert-warning",e)},n.success=function(e){t("alert-success",e)},n}return t()});