summaryrefslogtreecommitdiff
path: root/client/util.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-06-21 00:50:15 +0200
committerJules Laplace <julescarbon@gmail.com>2017-06-21 00:50:15 +0200
commit0b854ecccfe7832ba9a837605822a103fd9d8bc0 (patch)
treed4a11b5677ff96618d29b114e43d25a334f66412 /client/util.js
parentfbbb3a348018081bb2a89439eb3275153105d2e0 (diff)
clearing out old code
Diffstat (limited to 'client/util.js')
-rw-r--r--client/util.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/client/util.js b/client/util.js
new file mode 100644
index 0000000..fe8ec35
--- /dev/null
+++ b/client/util.js
@@ -0,0 +1,10 @@
+const isIphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))
+const isIpad = (navigator.userAgent.match(/iPad/i))
+const isAndroid = (navigator.userAgent.match(/Android/i))
+const isMobile = isIphone || isIpad || isAndroid
+const isDesktop = ! isMobile
+
+document.body.classList.add(isDesktop ? 'desktop' : 'mobile')
+
+export default { isIphone, isIpad, isAndroid, isMobile, isDesktop }
+