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

2 lines
9.2 KiB
JavaScript
Raw Permalink Normal View History

var _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},_extends=Object.assign||function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},PNotifyDesktop=function(i){"use strict";i=i&&i.__esModule?i.default:i;var A=void 0,s=window.Notification,a=function(t,i,e,n){return(a="Notification"in window?function(t,i,e,n){var o=new s(t,i);return"NotificationEvent"in window?(o.addEventListener("notificationclick",e),o.addEventListener("close",n)):"addEventListener"in o?(o.addEventListener("click",e),o.addEventListener("close",n)):(o.onclick=e,o.onclose=n),o}:"mozNotification"in navigator?function(t,i,e,n){var o=navigator.mozNotification.createNotification(t,i.body,i.icon).show();return o.onclick=e,o.onclose=n,o}:"webkitNotifications"in window?function(t,i,e,n){var o=window.webkitNotifications.createNotification(i.icon,t,i.body);return o.onclick=e,o.onclose=n,o}:function(t,i,e,n){return null})(t,i,e,n)};var e,t={initModule:function(t){var o=this;this.set(t);var s=this.get()._notice;this.set({_oldAnimation:s.get().animation}),s.on("state",function(t){var i=t.changed,e=t.current,n=t.previous;i.animation&&(void 0===n.animation||"none"!==e.animation||"none"===n.animation&&e.animation!==o.get()._oldAnimation)&&o.set({_oldAnimation:e.animation}),i._animatingClass&&(""===e._animatingClass||0!==A&&o.get().fallback||!o.get().desktop||s.set({_animatingClass:""}))}),this.get().desktop&&(0===(A=i.modules.Desktop.checkPermission())?(s.set({animation:"none"}),s.addModuleClass("ui-pnotify-desktop-hide"),this.genNotice()):this.get().fallback||s.set({autoDisplay:!1}))},update:function(){var t=this.get()._notice;if(0!==A&&this.get().fallback||!this.get().desktop)return t.set({animation:this.get()._oldAnimation}),void t.removeModuleClass("ui-pnotify-desktop-hide");t.set({animation:"none"}),t.addModuleClass("ui-pnotify-desktop-hide"),this.genNotice()},beforeOpen:function(){if(this.get().desktop&&0!==A&&i.modules.Desktop.permission(),(0===A||!this.get().fallback)&&this.get().desktop){var t=this.get()._desktop;t&&"show"in t&&(this.get()._notice.set({_moduleIsNoticeOpen:!0}),t.show())}},beforeClose:function(){if((0===A||!this.get().fallback)&&this.get().desktop){var t=this.get()._desktop;t&&"close"in t&&(t.close(),this.get()._notice.set({_moduleIsNoticeOpen:!1}))}},genNotice:function(){var t=this.get(),i=t._notice,e=t.icon;if(null===e)switch(i.get().type){case"error":this.set({_icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATQg7e6HvQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABr0lEQVRYw8WXu0oDQRSGv7hRSFYrLTTWKihaqUgUJO+gphBLL1jYpPSCVcAggpWthYhC7Ows9An0IbSPkMRCw8ZmFuI6yczs9cAPuzNz5v92brtrESxGARtokkCcAg2hk7jNl4G2R/m4zFPAiwTgWdRFHnmJuaulOAAaPQDqUZvv9DB3tR0lwIcGwHtU5uca5q4qYZvngJbHpAZ8CtU8dS1gLEyAisegBGTFKWiL65KnzVlY5uOSId6VtNuTtMupOu/TAHiQlNmSskHNXCOAGWBeUp7VhFoApoMAXAOWJoCszBJ9+ALY6vL0JiPgjsKmKUAaOOoBZwIAcNxlJLsCrAOTIQJMAWu62y4LOIqT7lGS96TIcYCMDkBZ46h1gB+PHI28ssq8X/G6DaqG8Piz2DrjVjGXbtSBy46F5QAHwJAizwZugKKscs7gSaqS/KpB/qxsFxwafhf6Odb/eblJi8BGwJdW26BtURxQpMU83hmaDQsNiPtvYMSwj3tgAqDgYzU7wJdHjo9+CgBvEW47lV5Tgj5DMtG0xIfESkIAF+522gdWxTzGEX3i9+6KpOMXF5UBt0NKJCAAAAAASUVORK5CYII="});break;case"success":this.set({_icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gQJATQPRj+65AAAAdBJREFUWMPtlzsvRFEQx3+7HmEjoiYKolVJJDRqnS8ggvVIVEQhCIUsEYJGCEH2E4h4FPREaLTbEo1IEJXHrmY2GTf33nPuY7ud5OTenTMz//89Z86ZWShLWf5LB3AOfACFiOMF2AkC3qOc88BXxFEAxlX8ftGdaNCEen8H6oFHYBR4FocwkpTngzzHgF01fwL0aYcp9fVtMW/rsMcWXWijK1Hexgye9smRT6CxaHgjytMYwccNSXqoja9FeVbiZS+OVaeDiUBLAPAJA/i2m5MXgRSQk7llC/DBMOBeBGqAe0eAjQhfvurH3EmgQk6EW6CVEHt+ZFo6J4EU8OoTcF35jhnAl2wSx20LFgyB1yyOWtY2c72ScMAAkPeZy6g4zUBdGAIAcyEq4Z7y7xbdTFgCACMBwPVJqVDHeNqvaplkH5i0sNuUwmaNkQxww20ZSOy7gFvX7SAk0i7
//# sourceMappingURL=PNotifyDesktop.js.map