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/utils/ |
Upload File : |
import { warn, callIfFunction } from './utils.js' import * as dom from './dom/index.js' import defaultInputValidators from './defaultInputValidators.js' function setDefaultInputValidators (params) { // Use default `inputValidator` for supported input types if not provided if (!params.inputValidator) { Object.keys(defaultInputValidators).forEach((key) => { if (params.input === key) { params.inputValidator = defaultInputValidators[key] } }) } } function validateCustomTargetElement (params) { // Determine if the custom target element is valid if ( !params.target || (typeof params.target === 'string' && !document.querySelector(params.target)) || (typeof params.target !== 'string' && !params.target.appendChild) ) { warn('Target parameter is not valid, defaulting to "body"') params.target = 'body' } } /** * Set type, text and actions on popup * * @param params * @returns {boolean} */ export default function setParameters (params) { setDefaultInputValidators(params) // showLoaderOnConfirm && preConfirm if (params.showLoaderOnConfirm && !params.preConfirm) { warn( 'showLoaderOnConfirm is set to true, but preConfirm is not defined.\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' + 'https://sweetalert2.github.io/#ajax-request' ) } // params.animation will be actually used in renderPopup.js // but in case when params.animation is a function, we need to call that function // before popup (re)initialization, so it'll be possible to check Swal.isVisible() // inside the params.animation function params.animation = callIfFunction(params.animation) validateCustomTargetElement(params) // Replace newlines with <br> in title if (typeof params.title === 'string') { params.title = params.title.split('\n').join('<br />') } dom.init(params) }