Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame^] | 1 | const UA = navigator.userAgent; |
| 2 | const testElement = document.createElement( 'div' ); |
| 3 | |
| 4 | export const isMobile = /(iphone|ipod|ipad|android)/gi.test( UA ) || |
| 5 | ( navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 ); // iPadOS |
| 6 | |
| 7 | export const isChrome = /chrome/i.test( UA ) && !/edge/i.test( UA ); |
| 8 | |
| 9 | export const isAndroid = /android/gi.test( UA ); |
| 10 | |
| 11 | // Flags if we should use zoom instead of transform to scale |
| 12 | // up slides. Zoom produces crisper results but has a lot of |
| 13 | // xbrowser quirks so we only use it in whitelisted browsers. |
| 14 | export const supportsZoom = 'zoom' in testElement.style && !isMobile && |
| 15 | ( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) ); |