From 8dae6a5044f9c1b7a8497cc1c96155fd262b40cf Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 26 Oct 2017 01:41:16 +0200 Subject: iphone x fixes --- StoneIsland/www/js/index.js | 2 +- StoneIsland/www/js/vendor/util.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'StoneIsland/www/js') diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js index 413c3bc5..eb3b32b9 100755 --- a/StoneIsland/www/js/index.js +++ b/StoneIsland/www/js/index.js @@ -82,7 +82,7 @@ var app = (function(){ var image = new Image image.src = "./img/compass-logo.png" } - + if (is_iphone_x) { StatusBar.hide() } diff --git a/StoneIsland/www/js/vendor/util.js b/StoneIsland/www/js/vendor/util.js index d45c4b98..27bdf008 100755 --- a/StoneIsland/www/js/vendor/util.js +++ b/StoneIsland/www/js/vendor/util.js @@ -174,6 +174,7 @@ var browser = (function( ua ) { var is_iphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) var is_ipad = (navigator.userAgent.match(/iPad/i)) var is_ios = is_iphone || is_ipad +var is_iphone_x = isIphoneX() var is_android = (navigator.userAgent.match(/Android/i)) var is_mobile = is_iphone || is_ipad || is_android var is_desktop = ! is_mobile; @@ -185,6 +186,14 @@ else { document.body.parentNode.classList.add("ios") } +function isIphoneX() { + return ( + is_iphone && + !is_ipad && + (window.innerHeight === 812 || window.innerWidth === 812) + ); +} + function selectElementContents(el) { if (window.getSelection && document.createRange) { var sel = window.getSelection(); -- cgit v1.2.3-70-g09d2