2020-03-09 17:51:07 +00:00
|
|
|
const UA = navigator.userAgent;
|
|
|
|
const testElement = document.createElement( 'div' );
|
|
|
|
|
|
|
|
export const isMobile = /(iphone|ipod|ipad|android)/gi.test( UA ) ||
|
|
|
|
( navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 ); // iPadOS
|
|
|
|
|
|
|
|
export const isChrome = /chrome/i.test( UA ) && !/edge/i.test( UA );
|
|
|
|
|
|
|
|
export const isAndroid = /android/gi.test( UA );
|
|
|
|
|
|
|
|
// Flags if we should use zoom instead of transform to scale
|
|
|
|
// up slides. Zoom produces crisper results but has a lot of
|
2020-03-10 09:18:37 +00:00
|
|
|
// xbrowser quirks so we only use it in whitelisted browsers.
|
2020-03-09 17:51:07 +00:00
|
|
|
export const supportsZoom = 'zoom' in testElement.style && !isMobile &&
|
2020-03-31 11:09:44 +00:00
|
|
|
( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) );
|
|
|
|
|
|
|
|
export const supportsHistoryAPI = typeof window.history.replaceState === 'function' && !/PhantomJS/.test( UA );
|