From 72d70421ac7ec141a8a820c23cec54507b411dee Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 25 Nov 2018 23:20:01 +0100 Subject: mobile css --- docs/js/util.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'docs/js/util.js') diff --git a/docs/js/util.js b/docs/js/util.js index 9455825..e40db4a 100644 --- a/docs/js/util.js +++ b/docs/js/util.js @@ -1,3 +1,10 @@ +const is_iphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) +const is_ipad = (navigator.userAgent.match(/iPad/i)) +const is_android = (navigator.userAgent.match(/Android/i)) +const is_mobile = is_iphone || is_ipad || is_android +const is_desktop = !is_mobile; +document.body.parentNode.classList.add(is_desktop ? 'desktop' : 'mobile') + function avg(a,b,n){ return (a*(n-1) + b)/n } function rand(n){ return Math.random()*n } function randint(n) { return ~~(Math.random()*n) } -- cgit v1.2.3-70-g09d2