summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mannehed <samuel@cendio.se>2019-01-09 13:08:01 +0100
committerSamuel Mannehed <samuel@cendio.se>2019-01-09 14:58:03 +0100
commit47b3eac82bb01518a39a7c69d0e409b3d2812aa1 (patch)
treedbd87f3c57e7ff89cf2769cbf10c5d2114d3980a
parent97e23ebbb29e87a8afe095da180e5ce9eb2908f8 (diff)
downloadnovnc-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.js9
-rw-r--r--core/util/browser.js5
2 files changed, 7 insertions, 7 deletions
diff --git a/app/ui.js b/app/ui.js
index 9daa689..4e4aec7 100644
--- a/app/ui.js
+++ b/app/ui.js
@@ -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);
}