summaryrefslogtreecommitdiffhomepage
path: root/presentation/js/utils/device.js
diff options
context:
space:
mode:
authorMarvin Borner2021-07-13 19:40:17 +0200
committerMarvin Borner2021-07-13 19:40:17 +0200
commit08cd951ea8410bc87e316e6c11d34a118437ba8b (patch)
treef57baaee689ee81b590bb5d01df3591da10cccc7 /presentation/js/utils/device.js
parent1b429c0fc28e5cd8b474ad5a1de1fa6f3d7c2e2a (diff)
Added colloq summary and final presentation
Diffstat (limited to 'presentation/js/utils/device.js')
-rw-r--r--presentation/js/utils/device.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/presentation/js/utils/device.js b/presentation/js/utils/device.js
new file mode 100644
index 0000000..ec1034f
--- /dev/null
+++ b/presentation/js/utils/device.js
@@ -0,0 +1,15 @@
+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
+// xbrowser quirks so we only use it in whitelisted browsers.
+export const supportsZoom = 'zoom' in testElement.style && !isMobile &&
+ ( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) ); \ No newline at end of file