diff options
author | Samuel Mannehed <samuel@cendio.se> | 2019-01-09 13:08:01 +0100 |
---|---|---|
committer | Samuel Mannehed <samuel@cendio.se> | 2019-01-09 14:58:03 +0100 |
commit | 47b3eac82bb01518a39a7c69d0e409b3d2812aa1 (patch) | |
tree | dbd87f3c57e7ff89cf2769cbf10c5d2114d3980a | |
parent | 97e23ebbb29e87a8afe095da180e5ce9eb2908f8 (diff) | |
download | novnc-47b3eac82bb01518a39a7c69d0e409b3d2812aa1.tar.gz |
Move UI.isSafari into core/util/browser.js
This is where the rest of these kinds of functions are.
-rw-r--r-- | app/ui.js | 9 | ||||
-rw-r--r-- | core/util/browser.js | 5 |
2 files changed, 7 insertions, 7 deletions
@@ -8,7 +8,7 @@ import * as Log from '../core/util/logging.js'; import _, { l10n } from './localization.js'; -import { isTouchDevice, dragThreshold } from '../core/util/browser.js'; +import { isTouchDevice, isSafari, dragThreshold } from '../core/util/browser.js'; import { setCapture, getPointerEvent } from '../core/util/events.js'; import KeyTable from "../core/input/keysym.js"; import keysyms from "../core/input/keysymdef.js"; @@ -31,7 +31,6 @@ const UI = { controlbarMouseDownClientY: 0, controlbarMouseDownOffsetY: 0, - isSafari: false, lastKeyboardinput: null, defaultKeyboardinputLen: 100, @@ -56,10 +55,6 @@ const UI = { // Render default UI and initialize settings menu start(callback) { - // Setup global variables first - UI.isSafari = (navigator.userAgent.indexOf('Safari') !== -1 && - navigator.userAgent.indexOf('Chrome') === -1); - UI.initSettings(); // Translate the DOM @@ -117,7 +112,7 @@ const UI = { initFullscreen() { // Only show the button if fullscreen is properly supported // * Safari doesn't support alphanumerical input while in fullscreen - if (!UI.isSafari && + if (!isSafari() && (document.documentElement.requestFullscreen || document.documentElement.mozRequestFullScreen || document.documentElement.webkitRequestFullscreen || diff --git a/core/util/browser.js b/core/util/browser.js index b2b19fa..088997b 100644 --- a/core/util/browser.js +++ b/core/util/browser.js @@ -64,6 +64,11 @@ export function isIOS() { !!(/ipod/i).exec(navigator.platform)); } +export function isSafari() { + return navigator && (navigator.userAgent.indexOf('Safari') !== -1 && + navigator.userAgent.indexOf('Chrome') === -1); +} + export function isIE() { return navigator && !!(/trident/i).exec(navigator.userAgent); } |