Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/rabbithabit.com/public_html/themes/3/swal_alert/src/instanceMethods/ |
Upload File : |
import { callIfFunction } from '../utils/utils.js' import { DismissReason } from '../utils/DismissReason.js' export const handlePopupClick = (domCache, innerParams, dismissWith) => { if (innerParams.toast) { handleToastClick(domCache, innerParams, dismissWith) } else { // Ignore click events that had mousedown on the popup but mouseup on the container // This can happen when the user drags a slider handleModalMousedown(domCache) // Ignore click events that had mousedown on the container but mouseup on the popup handleContainerMousedown(domCache) handleModalClick(domCache, innerParams, dismissWith) } } const handleToastClick = (domCache, innerParams, dismissWith) => { // Closing toast by internal click domCache.popup.onclick = () => { if ( innerParams.showConfirmButton || innerParams.showCancelButton || innerParams.showCloseButton || innerParams.input ) { return } dismissWith(DismissReason.close) } } let ignoreOutsideClick = false const handleModalMousedown = (domCache) => { domCache.popup.onmousedown = () => { domCache.container.onmouseup = function (e) { domCache.container.onmouseup = undefined // We only check if the mouseup target is the container because usually it doesn't // have any other direct children aside of the popup if (e.target === domCache.container) { ignoreOutsideClick = true } } } } const handleContainerMousedown = (domCache) => { domCache.container.onmousedown = () => { domCache.popup.onmouseup = function (e) { domCache.popup.onmouseup = undefined // We also need to check if the mouseup target is a child of the popup if (e.target === domCache.popup || domCache.popup.contains(e.target)) { ignoreOutsideClick = true } } } } const handleModalClick = (domCache, innerParams, dismissWith) => { domCache.container.onclick = (e) => { if (ignoreOutsideClick) { ignoreOutsideClick = false return } if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) { dismissWith(DismissReason.backdrop) } } }