onionr/static-data/www/shared/node_modules/pnotify/dist/iife/PNotifyMobile.js

2 lines
7.9 KiB
JavaScript
Raw Permalink Normal View History

var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},_extends=Object.assign||function(i){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=e[o])}return i},PNotifyMobile=function(e){"use strict";e=e&&e.__esModule?e.default:e;var t,i={initModule:function(i){var o=this;this.set(i);var n=this.get()._notice,s=null,r=null,l=null,a=null,f="left",p="X",e="Width";n.on("touchstart",function(i){if(o.get().swipeDismiss){var t=n.get().stack;if(!1!==t)switch(t.dir1){case"up":case"down":f="left",p="X",e="Width";break;case"left":case"right":f="top",p="Y",e="Height"}s=i.touches[0]["screen"+p],l=n.refs.elem["scroll"+e],a=window.getComputedStyle(n.refs.elem).opacity,n.refs.container.style[f]=0}}),n.on("touchmove",function(i){if(s&&o.get().swipeDismiss){var t=i.touches[0]["screen"+p];r=t-s;var e=(1-Math.abs(r)/l)*a;n.refs.elem.style.opacity=e,n.refs.container.style[f]=r+"px"}}),n.on("touchend",function(){if(s&&o.get().swipeDismiss){if(n.refs.container.classList.add("ui-pnotify-mobile-animate-left"),40<Math.abs(r)){var i=r<0?-2*l:2*l;n.refs.elem.style.opacity=0,n.refs.container.style[f]=i+"px",n.close()}else n.refs.elem.style.removeProperty("opacity"),n.refs.container.style.removeProperty(f);a=l=r=s=null}}),n.on("touchcancel",function(){s&&o.get().swipeDismiss&&(n.refs.elem.style.removeProperty("opacity"),n.refs.container.style.removeProperty(f),a=l=r=s=null)}),this.doMobileStyling()},update:function(){this.doMobileStyling()},beforeOpen:function(){window.addEventListener("resize",this.get()._doMobileStylingBound)},afterClose:function(){if(window.removeEventListener("resize",this.get()._doMobileStylingBound),this.get().swipeDismiss){var i=this.get()._notice;i.refs.elem.style.removeProperty("opacity"),i.refs.container.style.removeProperty("left"),i.refs.container.style.removeProperty("top")}},doMobileStyling:function(){var i=this.get()._notice,t=i.get().stack;if(this.get().styling){if(!1!==t)switch(window.innerWidth<=480?(t.mobileOrigSpacing1||(t.mobileOrigSpacing1=t.spacing1),t.spacing1=0,t.mobileOrigFirstpos1||(t.mobileOrigFirstpos1=t.firstpos1),t.firstpos1=0,t.mobileOrigSpacing2||(t.mobileOrigSpacing2=t.spacing2),t.spacing2=0,t.mobileOrigFirstpos2||(t.mobileOrigFirstpos2=t.firstpos2),t.firstpos2=0):(t.mobileOrigSpacing1&&(t.spacing1=t.mobileOrigSpacing1,delete t.mobileOrigSpacing1),t.mobileOrigFirstpos1&&(t.firstpos1=t.mobileOrigFirstpos1,delete t.mobileOrigFirstpos1),t.mobileOrigSpacing2&&(t.spacing2=t.mobileOrigSpacing2,delete t.mobileOrigSpacing2),t.mobileOrigFirstpos2&&(t.firstpos2=t.mobileOrigFirstpos2,delete t.mobileOrigFirstpos2)),t.dir1){case"down":i.addModuleClass("ui-pnotify-mobile-top");break;case"up":i.addModuleClass("ui-pnotify-mobile-bottom");break;case"left":i.addModuleClass("ui-pnotify-mobile-right");break;case"right":i.addModuleClass("ui-pnotify-mobile-left")}i.addModuleClass("ui-pnotify-mobile-able")}else i.removeModuleClass("ui-pnotify-mobile-able","ui-pnotify-mobile-top","ui-pnotify-mobile-bottom","ui-pnotify-mobile-right","ui-pnotify-mobile-left"),!1!==t&&(t.mobileOrigSpacing1&&(t.spacing1=t.mobileOrigSpacing1,delete t.mobileOrigSpacing1),t.mobileOrigFirstpos1&&(t.firstpos1=t.mobileOrigFirstpos1,delete t.mobileOrigFirstpos1),t.mobileOrigSpacing2&&(t.spacing2=t.mobileOrigSpacing2,delete t.mobileOrigSpacing2),t.mobileOrigFirstpos2&&(t.firstpos2=t.mobileOrigFirstpos2,delete t.mobileOrigFirstpos2))}};function o(){var i=function(i){return document.createElement(i)}("style");i.id="svelte-49u8sj-style",i.textContent="[ui-pnotify] .ui-pnotify-container{position:relative}[ui-pnotify] .ui-pnotify-mobile-animate-left{transition:left .1s ease}[ui-pnotify] .ui-pnotify-mobile-animate-top{transition:top .1s ease}@media(max-width: 480px){[ui-pnotify].ui-pnotify.ui-pnotify-mobile-able{font-size:1.2em;-webkit-font-smoothing:antialiased;-moz-font-smoothing:antialiased;-ms-font-smoothing:antialiased;font-smoothin
//# sourceMappingURL=PNotifyMobile.js.map