2 lines
6.4 KiB
JavaScript
2 lines
6.4 KiB
JavaScript
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("jquery")):"function"==typeof define&&define.amd?define(["@flasher/flasher","jquery"],t):((e="undefined"!=typeof globalThis?globalThis:e||self).flasher=e.flasher||{},e.flasher.toastr=t(e.flasher,e.jQuery))}(this,(function(e,t){"use strict";var o=function(){return o=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++)for(var s in t=arguments[o])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},o.apply(this,arguments)};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var s={exports:{}};!function(e){var o;o=function(e){return function(){var t,o,n,s=0,i="error",a="info",r="success",l="warning",c={clear:function(o,n){var s=h();t||u(s),d(o,s,n)||function(o){for(var n=t.children(),s=n.length-1;s>=0;s--)d(e(n[s]),o)}(s)},remove:function(o){var n=h();t||u(n),o&&0===e(":focus",o).length?g(o):t.children().length&&t.remove()},error:function(e,t,o){return f({type:i,iconClass:h().iconClasses.error,message:e,optionsOverride:o,title:t})},getContainer:u,info:function(e,t,o){return f({type:a,iconClass:h().iconClasses.info,message:e,optionsOverride:o,title:t})},options:{},subscribe:function(e){o=e},success:function(e,t,o){return f({type:r,iconClass:h().iconClasses.success,message:e,optionsOverride:o,title:t})},version:"2.1.4",warning:function(e,t,o){return f({type:l,iconClass:h().iconClasses.warning,message:e,optionsOverride:o,title:t})}};return c;function u(o,n){return o||(o=h()),(t=e("#"+o.containerId)).length||n&&(t=function(o){return(t=e("<div/>").attr("id",o.containerId).addClass(o.positionClass)).appendTo(e(o.target)),t}(o)),t}function d(t,o,n){var s=!(!n||!n.force)&&n.force;return!(!t||!s&&0!==e(":focus",t).length||(t[o.hideMethod]({duration:o.hideDuration,easing:o.hideEasing,complete:function(){g(t)}}),0))}function p(e){o&&o(e)}function f(o){var i=h(),a=o.iconClass||i.iconClass;if(void 0!==o.optionsOverride&&(i=e.extend(i,o.optionsOverride),a=o.optionsOverride.iconClass||a),!function(e,t){if(e.preventDuplicates){if(t.message===n)return!0;n=t.message}return!1}(i,o)){s++,t=u(i,!0);var r=null,l=e("<div/>"),c=e("<div/>"),d=e("<div/>"),f=e("<div/>"),m=e(i.closeHtml),v={intervalId:null,hideEta:null,maxHideTime:null},C={toastId:s,state:"visible",startTime:new Date,options:i,map:o};return o.iconClass&&l.addClass(i.toastClass).addClass(a),function(){if(o.title){var e=o.title;i.escapeHtml&&(e=w(o.title)),c.append(e).addClass(i.titleClass),l.append(c)}}(),function(){if(o.message){var e=o.message;i.escapeHtml&&(e=w(o.message)),d.append(e).addClass(i.messageClass),l.append(d)}}(),i.closeButton&&(m.addClass(i.closeClass).attr("role","button"),l.prepend(m)),i.progressBar&&(f.addClass(i.progressClass),l.prepend(f)),i.rtl&&l.addClass("rtl"),i.newestOnTop?t.prepend(l):t.append(l),function(){var e="";switch(o.iconClass){case"toast-success":case"toast-info":e="polite";break;default:e="assertive"}l.attr("aria-live",e)}(),l.hide(),l[i.showMethod]({duration:i.showDuration,easing:i.showEasing,complete:i.onShown}),i.timeOut>0&&(r=setTimeout(y,i.timeOut),v.maxHideTime=parseFloat(i.timeOut),v.hideEta=(new Date).getTime()+v.maxHideTime,i.progressBar&&(v.intervalId=setInterval(T,10))),i.closeOnHover&&l.hover(b,O),!i.onclick&&i.tapToDismiss&&l.click(y),i.closeButton&&m&&m.click((function(e){e.stopPropagation?e.stopPropagation():void 0!==e.cancelBubble&&!0!==e.cancelBubble&&(e.cancelBubble=!0),i.onCloseClick&&i.onCloseClick(e),y(!0)})),i.onclick&&l.click((function(e){i.onclick(e),y()})),p(C),i.debug&&console&&console.log(C),l}function w(e){return null==e&&(e=""),e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function y(t){var o=t&&!1!==i.closeMethod?i.closeMethod:i.hideMethod,n=t&&!1!==i.closeDuration?i.closeDuration:i.hideDuration,s=t&&!1!==i.closeEasing?i.closeEasing:i.hideEasing;if(!e(":focus",l).length||t)return clearTimeout(v.intervalId),l[o]({duration:n,easing:s,complete:function(){g(l),clearT
|