Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
windowsPhone: false,
iphone: false,
iphoneX: false,
ipod: false,
ipad: false,
edge: false,
ie: false,
firefox: false,
macos: false,
windows: false,
cordova: !!(window.cordova || window.phonegap),
phonegap: !!(window.cordova || window.phonegap),
electron: false,
};
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
const windowsPhone = ua.match(/(Windows Phone);?[\s\/]+([\d.]+)?/); // eslint-disable-line
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const iphoneX = iphone && (
(screenWidth === 375 && screenHeight === 812) // X/XS
|| (screenWidth === 414 && screenHeight === 896) // XR / XS Max
);
const ie = ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
const edge = ua.indexOf('Edge/') >= 0;
const firefox = ua.indexOf('Gecko/') >= 0 && ua.indexOf('Firefox/') >= 0;
const windows = platform === 'Win32';
const electron = ua.toLowerCase().indexOf('electron') >= 0;
if (!$(e).closest(params.swipeHandler)[0]) return;
}
touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
const startX = touches.currentX;
const startY = touches.currentY;
// Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
if (
Device.ios &&
!Device.cordova &&
params.iOSEdgeSwipeDetection &&
(startX <= params.iOSEdgeSwipeThreshold) &&
(startX >= window.screen.width - params.iOSEdgeSwipeThreshold)
) {
return;
}
Utils.extend(data, {
isTouched: true,
isMoved: false,
allowTouchCallbacks: true,
isScrolling: undefined,
startMoving: undefined,
});
touches.startX = startX;
touches.startY = startY;
data.touchStartTime = Utils.now();
swiper.allowClick = true;
desktop: false,
iphone: false,
ipod: false,
ipad: false,
edge: false,
ie: false,
firefox: false,
macos: false,
windows: false,
cordova: !!(window.cordova || window.phonegap),
phonegap: !!(window.cordova || window.phonegap),
electron: false,
};
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const ie = ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
const edge = ua.indexOf('Edge/') >= 0;
const firefox = ua.indexOf('Gecko/') >= 0 && ua.indexOf('Firefox/') >= 0;
const windows = platform === 'Win32';
const electron = ua.toLowerCase().indexOf('electron') >= 0;
let macos = platform === 'MacIntel';
// iPadOs 13 fix
if (!ipad
&& macos
&& Support.touch
androidChrome: false,
desktop: false,
iphone: false,
ipod: false,
ipad: false,
edge: false,
ie: false,
firefox: false,
macos: false,
windows: false,
cordova: !!(window.cordova || window.phonegap),
phonegap: !!(window.cordova || window.phonegap),
electron: false,
};
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const ie = ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
const edge = ua.indexOf('Edge/') >= 0;
const firefox = ua.indexOf('Gecko/') >= 0 && ua.indexOf('Firefox/') >= 0;
const windows = platform === 'Win32';
const electron = ua.toLowerCase().indexOf('electron') >= 0;
let macos = platform === 'MacIntel';
// iPadOs 13 fix
if (!ipad
&& macos
iphone: false,
iphoneX: false,
ipod: false,
ipad: false,
edge: false,
ie: false,
firefox: false,
macos: false,
windows: false,
cordova: !!(window.cordova || window.phonegap),
phonegap: !!(window.cordova || window.phonegap),
electron: false,
};
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
const windowsPhone = ua.match(/(Windows Phone);?[\s\/]+([\d.]+)?/); // eslint-disable-line
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const iphoneX = iphone && (
(screenWidth === 375 && screenHeight === 812) // X/XS
|| (screenWidth === 414 && screenHeight === 896) // XR / XS Max
);
const ie = ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
const edge = ua.indexOf('Edge/') >= 0;
const firefox = ua.indexOf('Gecko/') >= 0 && ua.indexOf('Firefox/') >= 0;
const windows = platform === 'Win32';
const electron = ua.toLowerCase().indexOf('electron') >= 0;
let macos = platform === 'MacIntel';
androidChrome: false,
desktop: false,
iphone: false,
ipod: false,
ipad: false,
edge: false,
ie: false,
firefox: false,
macos: false,
windows: false,
cordova: !!(window.cordova || window.phonegap),
phonegap: !!(window.cordova || window.phonegap),
electron: false,
};
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const ie = ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
const edge = ua.indexOf('Edge/') >= 0;
const firefox = ua.indexOf('Gecko/') >= 0 && ua.indexOf('Firefox/') >= 0;
const windows = platform === 'Win32';
const electron = ua.toLowerCase().indexOf('electron') >= 0;
let macos = platform === 'MacIntel';
// iPadOs 13 fix
if (!ipad
&& macos
if (!$targetEl.closest(params.swipeHandler)[0]) return;
}
touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
const startX = touches.currentX;
const startY = touches.currentY;
// Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;
const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;
if (
edgeSwipeDetection
&& ((startX <= edgeSwipeThreshold)
|| (startX >= window.screen.width - edgeSwipeThreshold))
) {
return;
}
Utils.extend(data, {
isTouched: true,
isMoved: false,
allowTouchCallbacks: true,
isScrolling: undefined,
startMoving: undefined,
});
touches.startX = startX;
touches.startY = startY;
data.touchStartTime = Utils.now();
swiper.allowClick = true;
desktop: false,
windows: false,
iphone: false,
iphoneX: false,
ipod: false,
ipad: false,
cordova: window.cordova || window.phonegap,
phonegap: window.cordova || window.phonegap,
};
const windows = ua.match(/(Windows Phone);?[\s\/]+([\d.]+)?/); // eslint-disable-line
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
const ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const iphoneX = iphone && window.screen.width === 375 && window.screen.height === 812;
// Windows
if (windows) {
device.os = 'windows';
device.osVersion = windows[2];
device.windows = true;
}
// Android
if (android && !windows) {
device.os = 'android';
device.osVersion = android[2];
device.android = true;
device.androidChrome = ua.toLowerCase().indexOf('chrome') >= 0;
}
if (ipad || iphone || ipod) {
desktop: false,
iphone: false,
ipod: false,
ipad: false,
edge: false,
ie: false,
firefox: false,
macos: false,
windows: false,
cordova: !!(window.cordova || window.phonegap),
phonegap: !!(window.cordova || window.phonegap),
electron: false,
};
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
let ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/);
const ie = ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0;
const edge = ua.indexOf('Edge/') >= 0;
const firefox = ua.indexOf('Gecko/') >= 0 && ua.indexOf('Firefox/') >= 0;
const windows = platform === 'Win32';
const electron = ua.toLowerCase().indexOf('electron') >= 0;
let macos = platform === 'MacIntel';
// iPadOs 13 fix
if (!ipad
&& macos
&& Support.touch
device.needsStatusbarOverlay = function needsStatusbarOverlay() {
if (device.desktop) return false;
if (device.standalone && device.ios && metaStatusbar && metaStatusbar.content === 'black-translucent') {
return true;
}
if ((device.webView || (device.android && device.cordova)) && (window.innerWidth * window.innerHeight === window.screen.width * window.screen.height)) {
if (device.iphoneX && (window.orientation === 90 || window.orientation === -90)) {
return false;
}
return true;
}
return false;
};
device.statusbar = device.needsStatusbarOverlay();