Onionr/static-data/www/shared/node_modules/pnotify/dist/iife/PNotify.js

2 lines
26 KiB
JavaScript
Raw Permalink Normal View History

var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},PNotify=function(){"use strict";function t(){h.defaultStack.context=document.body,window.addEventListener("resize",function(){n&&clearTimeout(n),n=setTimeout(function(){h.positionAll()},10)})}function m(t){t.overlay.parentNode&&t.overlay.parentNode.removeChild(t.overlay)}function e(t,e){return"object"!==(void 0===t?"undefined":_typeof(t))&&(t={text:t}),e&&(t.type=e),{target:document.body,data:t}}var h=void 0,n=void 0;var i={runModules:function(t){if("init"===t){for(var e in h.modules)if(h.modules.hasOwnProperty(e)&&"function"==typeof h.modules[e].init){var i=h.modules[e].init(this);this.initModule(i)}}else{var n=this.get()._modules;for(var o in n)if(n.hasOwnProperty(o)){var s=_extends({_notice:this,_options:this.get()},this.get().modules[o]);n[o].set(s),"function"==typeof n[o][t]&&n[o][t]()}}},initModule:function(t){var e=this.get().modules;e.hasOwnProperty(t.constructor.key)||(e[t.constructor.key]={});var i=_extends({_notice:this,_options:this.get()},e[t.constructor.key]);t.initModule(i),this.get()._modules[t.constructor.key]=t},update:function(t){var e=this.get().hide,i=this.get().icon;this.set(t),this.runModules("update"),this.get().hide?e||this.queueClose():this.cancelClose(),this.queuePosition();var n=this.get().icon;return n!==i&&(!0===n&&"fontawesome5"===this.get().icons||"string"==typeof n&&n.match(/(^| )fa[srlb]($| )/))&&(this.set({icon:!1}),this.set({icon:n})),this},open:function(){var t=this,e=this.get(),i=e._state,n=e.hide;if("opening"!==i){if("open"!==i){this.set({_state:"opening",_animatingClass:"ui-pnotify-initial-hidden"}),this.runModules("beforeOpen");var o=this.get().stack;if(!this.refs.elem.parentNode||o&&o.context&&o.context!==this.refs.elem.parentNode)if(o&&o.context)o.context.appendChild(this.refs.elem);else{if(!document.body)throw new Error("No context to open this notice in.");document.body.appendChild(this.refs.elem)}return setTimeout(function(){o&&(o.animation=!1,h.positionAll(),o.animation=!0),t.animateIn(function(){t.get().hide&&t.queueClose(),t.set({_state:"open"}),t.runModules("afterOpen")})},0),this}n&&this.queueClose()}},remove:function(t){return this.close(t)},close:function(t){var e=this,i=this.get()._state;if("closing"!==i&&"closed"!==i){this.set({_state:"closing",_timerHide:!!t}),this.runModules("beforeClose");var n=this.get()._timer;return n&&clearTimeout&&(clearTimeout(n),this.set({_timer:null})),this.animateOut(function(){if(e.set({_state:"closed"}),e.runModules("afterClose"),e.queuePosition(),e.get().remove&&e.refs.elem.parentNode.removeChild(e.refs.elem),e.runModules("beforeDestroy"),e.get().destroy&&null!==h.notices){var t=h.notices.indexOf(e);-1!==t&&h.notices.splice(t,1)}e.runModules("afterDestroy")}),this}},animateIn:function(a){var c=this;this.set({_animating:"in"});function l(){c.refs.elem.removeEventListener("transitionend",l);var t=c.get(),e=t._animTimer,i=t._animating,n=t._moduleIsNoticeOpen;if(e&&clearTimeout(e),"in"===i){var o=n;if(!o){var s=c.refs.elem.getBoundingClientRect();for(var r in s)if(0<s[r]){o=!0;break}}o?(a&&a.call(),c.set({_animating:!1})):c.set({_animTimer:setTimeout(l,40)})}}"fade"===this.get().animation?(this.refs.elem.addEventListener("transitionend",l),this.set({_animatingClass:"ui-pnotify-in"}),this.refs.elem.style.opacity,this.set({_animatingClass:"ui-pnotify-in ui-pnotify-fade-in"}),this.set({_animTimer:setTimeout(l,650)})):(this.set({_animatingClass:"ui-pnotify-in"}),l())},animateOut:function(f){var d=this;this.set({_animating:"out"});function p(){d.refs.elem.removeEventListener("transitionend",p);var t=d.get(),e=t._animTimer,i=t._animating,n=t._moduleIsNoticeOpen;if(e&&clearTimeout(e),"out"===i){var o=n;if(!o){var s=d.refs.elem.getBoundingClientRect();for(var r in s)if
//# sourceMappingURL=PNotify.js.map