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 | |
parent | 684b0185f79c67b8730b64390cd4a040aa435b5d (diff) |
Minimal android compatibility
Note that Samsung devices can't handle (hover: none) media query
Diffstat (limited to 'web/share/js')
-rw-r--r-- | web/share/js/kvm/mouse.js | 2 | ||||
-rw-r--r-- | web/share/js/kvm/ocr.js | 2 | ||||
-rw-r--r-- | web/share/js/tools.js | 22 | ||||
-rw-r--r-- | web/share/js/wm.js | 2 |
4 files changed, 16 insertions, 12 deletions
diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js index 894d64cf..a2c7e2c9 100644 --- a/web/share/js/kvm/mouse.js +++ b/web/share/js/kvm/mouse.js @@ -129,7 +129,7 @@ export function Mouse(__getGeometry, __recordWsEvent) { var __updateOnlineLeds = function() { let is_captured; if (__absolute) { - is_captured = (__stream_hovered || tools.browser.is_ios); + is_captured = (__stream_hovered || tools.browser.is_mobile); } else { is_captured = __isRelativeCaptured(); } diff --git a/web/share/js/kvm/ocr.js b/web/share/js/kvm/ocr.js index 5f410d91..fa69dff4 100644 --- a/web/share/js/kvm/ocr.js +++ b/web/share/js/kvm/ocr.js @@ -71,7 +71,7 @@ export function Ocr(__getGeometry) { /************************************************************************/ self.setState = function(state) { - let enabled = (state && state.ocr.enabled && navigator.clipboard && !tools.browser.is_ios); + let enabled = (state && state.ocr.enabled && navigator.clipboard && !tools.browser.is_mobile); if (enabled) { let selected = tools.storage.get("stream.ocr.lang", state.ocr.langs["default"]); let html = ""; 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); diff --git a/web/share/js/wm.js b/web/share/js/wm.js index fd26c730..51f6c01a 100644 --- a/web/share/js/wm.js +++ b/web/share/js/wm.js @@ -362,7 +362,7 @@ function __WindowManager() { var __organizeWindowsOnBrowserResize = function() { for (let el_window of $$("window")) { if (el_window.style.visibility === "visible") { - if (tools.browser.is_ios && el_window.classList.contains("window-resizable")) { + if (tools.browser.is_mobile && el_window.classList.contains("window-resizable")) { // FIXME: При смене ориентации на мобильном браузере надо сбрасывать // настройки окна стрима, поэтому тут стоит вот этот костыль el_window.style.width = ""; |