diff options
author | Maxim Devaev <[email protected]> | 2022-10-07 02:36:46 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-10-07 02:37:57 +0300 |
commit | e1c4a5163de2df49b35bb11efeaa0505ea6bbc64 (patch) | |
tree | 96d02d1eceb4c7a682381f4bc108a8d108e926bb /web/share/js/tools.js | |
parent | 684b0185f79c67b8730b64390cd4a040aa435b5d (diff) |
Minimal android compatibility
Note that Samsung devices can't handle (hover: none) media query
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r-- | web/share/js/tools.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js index 9fc6384c..fee47824 100644 --- a/web/share/js/tools.js +++ b/web/share/js/tools.js @@ -372,14 +372,6 @@ export var tools = new function() { // Blink engine detection let is_blink = ((is_chrome || is_opera) && !!window.CSS); - // iOS browsers - // https://stackoverflow.com/questions/9038625/detect-if-device-is-ios - // https://github.com/lancedikson/bowser/issues/329 - let is_ios = (!!navigator.platform && ( - /iPad|iPhone|iPod/.test(navigator.platform) - || (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 && !window["MSStream"]) - )); - // Any browser on Mac let is_mac = (( window.navigator.oscpu @@ -391,15 +383,27 @@ export var tools = new function() { // Any Windows let is_win = (navigator && !!(/win/i).exec(navigator.platform)); + // iOS browsers + // https://stackoverflow.com/questions/9038625/detect-if-device-is-ios + // https://github.com/lancedikson/bowser/issues/329 + let is_ios = (!!navigator.platform && ( + /iPad|iPhone|iPod/.test(navigator.platform) + || (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1 && !window["MSStream"]) + )); + + let is_android = /android/i.test(navigator.userAgent); + return { "is_opera": is_opera, "is_firefox": is_firefox, "is_safari": is_safari, "is_chrome": is_chrome, "is_blink": is_blink, - "is_ios": is_ios, "is_mac": is_mac, "is_win": is_win, + "is_ios": is_ios, + "is_android": is_android, + "is_mobile": (is_ios || is_android), }; }; self.info("Browser:", self.browser); |