abbott_2024_event/Line/assets/javascript/pages/toastr-demo.min.js

3 lines
1.9 KiB
JavaScript

"use strict";function _classCallCheck(t,o){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,o){for(var e=0;e<o.length;e++){var s=o[e];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function _createClass(t,o,e){return o&&_defineProperties(t.prototype,o),e&&_defineProperties(t,e),t}var ToastrDemo=function(){function t(){_classCallCheck(this,t),this.init()}return _createClass(t,[{key:"init",value:function(){toastr.options.positionClass="toast-top-full-width",toastr.options.closeButton=!0,toastr.options.progressBar=!0,toastr.options.extendedTimeOut=0,toastr.options.timeOut=3e3,toastr.options.fadeOut=250,toastr.options.fadeIn=250,this.i=0,this.handleToastr()}},{key:"handleToastr",value:function(){var t=this;$("#toastr-demo").click(function(){$("#toastr-demo").prop("disabled",!0),t.delayToasts()})}},{key:"toasts",value:function(){function t(t,o,e){this.type=t,this.css=o,this.msg="This is positioned in the ".concat(e,".")}return[new t("info","toast-bottom-full-width","bottom full width"),new t("error","toast-top-full-width","top full width"),new t("warning","toast-top-left","top left"),new t("success","toast-top-right","top right"),new t("info","toast-top-center","top center"),new t("info","toast-bottom-right","bottom right"),new t("info","toast-bottom-left","bottom left"),new t("info","toast-bottom-center","bottom center")]}},{key:"delayToasts",value:function(){var t=this,o=t.toasts(),e=t.i;if(e!==o.length){var s=0===e?0:4100;setTimeout(function(){t.showToast()},s),e===o.length-1&&setTimeout(function(){$("#toastr-demo").prop("disabled",!1),t.i=0},1e3+s)}}},{key:"showToast",value:function(){var t=this.toasts()[this.i];toastr.options.positionClass=t.css,toastr[t.type](t.msg),this.i++,this.delayToasts()}}]),t}();$(document).on("theme:init",function(){new ToastrDemo});
//# sourceMappingURL=../../sourcemaps/pages/toastr-demo.min.js.map