Move UI.isSafari into core/util/browser.js
This is where the rest of these kinds of functions are.
This commit is contained in:
parent
97e23ebbb2
commit
47b3eac82b
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import * as Log from '../core/util/logging.js';
|
import * as Log from '../core/util/logging.js';
|
||||||
import _, { l10n } from './localization.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 { setCapture, getPointerEvent } from '../core/util/events.js';
|
||||||
import KeyTable from "../core/input/keysym.js";
|
import KeyTable from "../core/input/keysym.js";
|
||||||
import keysyms from "../core/input/keysymdef.js";
|
import keysyms from "../core/input/keysymdef.js";
|
||||||
|
@ -31,7 +31,6 @@ const UI = {
|
||||||
controlbarMouseDownClientY: 0,
|
controlbarMouseDownClientY: 0,
|
||||||
controlbarMouseDownOffsetY: 0,
|
controlbarMouseDownOffsetY: 0,
|
||||||
|
|
||||||
isSafari: false,
|
|
||||||
lastKeyboardinput: null,
|
lastKeyboardinput: null,
|
||||||
defaultKeyboardinputLen: 100,
|
defaultKeyboardinputLen: 100,
|
||||||
|
|
||||||
|
@ -56,10 +55,6 @@ const UI = {
|
||||||
// Render default UI and initialize settings menu
|
// Render default UI and initialize settings menu
|
||||||
start(callback) {
|
start(callback) {
|
||||||
|
|
||||||
// Setup global variables first
|
|
||||||
UI.isSafari = (navigator.userAgent.indexOf('Safari') !== -1 &&
|
|
||||||
navigator.userAgent.indexOf('Chrome') === -1);
|
|
||||||
|
|
||||||
UI.initSettings();
|
UI.initSettings();
|
||||||
|
|
||||||
// Translate the DOM
|
// Translate the DOM
|
||||||
|
@ -117,7 +112,7 @@ const UI = {
|
||||||
initFullscreen() {
|
initFullscreen() {
|
||||||
// Only show the button if fullscreen is properly supported
|
// Only show the button if fullscreen is properly supported
|
||||||
// * Safari doesn't support alphanumerical input while in fullscreen
|
// * Safari doesn't support alphanumerical input while in fullscreen
|
||||||
if (!UI.isSafari &&
|
if (!isSafari() &&
|
||||||
(document.documentElement.requestFullscreen ||
|
(document.documentElement.requestFullscreen ||
|
||||||
document.documentElement.mozRequestFullScreen ||
|
document.documentElement.mozRequestFullScreen ||
|
||||||
document.documentElement.webkitRequestFullscreen ||
|
document.documentElement.webkitRequestFullscreen ||
|
||||||
|
|
|
@ -64,6 +64,11 @@ export function isIOS() {
|
||||||
!!(/ipod/i).exec(navigator.platform));
|
!!(/ipod/i).exec(navigator.platform));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isSafari() {
|
||||||
|
return navigator && (navigator.userAgent.indexOf('Safari') !== -1 &&
|
||||||
|
navigator.userAgent.indexOf('Chrome') === -1);
|
||||||
|
}
|
||||||
|
|
||||||
export function isIE() {
|
export function isIE() {
|
||||||
return navigator && !!(/trident/i).exec(navigator.userAgent);
|
return navigator && !!(/trident/i).exec(navigator.userAgent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue