Move UI.isSafari into core/util/browser.js

This is where the rest of these kinds of functions are.
This commit is contained in:
Samuel Mannehed 2019-01-09 13:08:01 +01:00
parent 97e23ebbb2
commit 47b3eac82b
2 changed files with 7 additions and 7 deletions

View File

@ -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 ||

View File

@ -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);
}