2015-10-17 23:49:24 +02:00
|
|
|
'use strict';
|
|
|
|
|
2016-07-17 21:08:23 +02:00
|
|
|
const MobileRegex = /iPhone|iPad|iPod|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop|Windows Phone|webOS/i;
|
|
|
|
const MinDesktopScreenWidth = 800;
|
|
|
|
|
2015-10-17 23:49:24 +02:00
|
|
|
var FeatureDetector = {
|
2016-07-17 21:08:23 +02:00
|
|
|
isMac: navigator.platform.indexOf('Mac') >= 0,
|
|
|
|
isWindows: navigator.platform.indexOf('Win') >= 0,
|
|
|
|
isiOS: /iPad|iPhone|iPod/i.test(navigator.userAgent),
|
|
|
|
isMobile: MobileRegex.test(navigator.userAgent) || screen.width < MinDesktopScreenWidth,
|
|
|
|
|
|
|
|
isBeta: window.location.href.toLowerCase().indexOf('beta.') > 0,
|
|
|
|
|
2015-10-17 23:49:24 +02:00
|
|
|
actionShortcutSymbol: function(formatting) {
|
2016-07-17 21:08:23 +02:00
|
|
|
return this.isMac ? '⌘' : formatting ? '<span class="thin">ctrl + </span>' : 'ctrl-';
|
2015-10-17 23:49:24 +02:00
|
|
|
},
|
|
|
|
altShortcutSymbol: function(formatting) {
|
2016-07-17 21:08:23 +02:00
|
|
|
return this.isMac ? '⌥' : formatting ? '<span class="thin">alt + </span>' : 'alt-';
|
2015-10-27 22:57:56 +01:00
|
|
|
},
|
2016-02-28 18:13:23 +01:00
|
|
|
globalShortcutSymbol: function(formatting) {
|
2016-07-17 21:08:23 +02:00
|
|
|
return this.isMac ? '⌃⌥' : formatting ? '<span class="thin">shift+alt+</span>' : 'shift-alt-';
|
2016-02-28 18:13:23 +01:00
|
|
|
},
|
|
|
|
globalShortcutIsLarge: function() {
|
2016-07-17 21:08:23 +02:00
|
|
|
return !this.isMac;
|
2016-02-28 18:13:23 +01:00
|
|
|
},
|
2016-03-31 22:52:04 +02:00
|
|
|
screenshotToClipboardShortcut: function() {
|
2016-07-17 21:08:23 +02:00
|
|
|
if (this.isiOS) { return 'Sleep+Home'; }
|
|
|
|
if (this.isMobile) { return ''; }
|
|
|
|
if (this.isMac) { return 'Command-Shift-Control-4'; }
|
|
|
|
if (this.isWindows) { return 'Alt+PrintScreen'; }
|
2016-03-31 22:52:04 +02:00
|
|
|
return '';
|
|
|
|
},
|
2015-10-27 22:57:56 +01:00
|
|
|
shouldMoveHiddenInputToCopySource: function() {
|
2016-09-14 07:16:43 +02:00
|
|
|
return this.isiOS && !/Version\/10/.test(navigator.userAgent);
|
2015-10-29 22:13:15 +01:00
|
|
|
},
|
|
|
|
canCopyReadonlyInput: function() {
|
|
|
|
return !(/CriOS/i.test(navigator.userAgent));
|
2015-10-17 23:49:24 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = FeatureDetector;
|