���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/thietkeweb2/layout/default/node_modules/sweetalert2/src/utils/ |
/* istanbul ignore file */ import { swalClasses } from '../utils/classes.js' import * as dom from './dom/index.js' // Fix iOS scrolling http://stackoverflow.com/q/39626302 export const iOSfix = () => { const iOS = // @ts-ignore (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1) if (iOS && !dom.hasClass(document.body, swalClasses.iosfix)) { const offset = document.body.scrollTop document.body.style.top = `${offset * -1}px` dom.addClass(document.body, swalClasses.iosfix) lockBodyScroll() addBottomPaddingForTallPopups() } } /** * https://github.com/sweetalert2/sweetalert2/issues/1948 */ const addBottomPaddingForTallPopups = () => { const ua = navigator.userAgent const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i) const webkit = !!ua.match(/WebKit/i) const iOSSafari = iOS && webkit && !ua.match(/CriOS/i) if (iOSSafari) { const bottomPanelHeight = 44 if (dom.getPopup().scrollHeight > window.innerHeight - bottomPanelHeight) { dom.getContainer().style.paddingBottom = `${bottomPanelHeight}px` } } } /** * https://github.com/sweetalert2/sweetalert2/issues/1246 */ const lockBodyScroll = () => { const container = dom.getContainer() let preventTouchMove /** * @param {TouchEvent} event */ container.ontouchstart = (event) => { preventTouchMove = shouldPreventTouchMove(event) } /** * @param {TouchEvent} event */ container.ontouchmove = (event) => { if (preventTouchMove) { event.preventDefault() event.stopPropagation() } } } /** * @param {TouchEvent} event * @returns {boolean} */ const shouldPreventTouchMove = (event) => { const target = event.target const container = dom.getContainer() if (isStylus(event) || isZoom(event)) { return false } if (target === container) { return true } if ( !dom.isScrollable(container) && target instanceof HTMLElement && target.tagName !== 'INPUT' && // #1603 target.tagName !== 'TEXTAREA' && // #2266 !( dom.isScrollable(dom.getHtmlContainer()) && // #1944 dom.getHtmlContainer().contains(target) ) ) { return true } return false } /** * https://github.com/sweetalert2/sweetalert2/issues/1786 * * @param {*} event * @returns {boolean} */ const isStylus = (event) => { return event.touches && event.touches.length && event.touches[0].touchType === 'stylus' } /** * https://github.com/sweetalert2/sweetalert2/issues/1891 * * @param {TouchEvent} event * @returns {boolean} */ const isZoom = (event) => { return event.touches && event.touches.length > 1 } export const undoIOSfix = () => { if (dom.hasClass(document.body, swalClasses.iosfix)) { const offset = parseInt(document.body.style.top, 10) dom.removeClass(document.body, swalClasses.iosfix) document.body.style.top = '' document.body.scrollTop = offset * -1 } }