1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-21 07:06:39 +02:00

fixed focus detector

This commit is contained in:
antelle 2019-01-14 19:05:16 +01:00
parent 7fd72ff687
commit 75eaf88d84
3 changed files with 9 additions and 7 deletions

View File

@ -1,19 +1,22 @@
const FeatureDetector = require('./feature-detector');
const FeatureDetector = require('../util/feature-detector');
const Launcher = require('../comp/launcher');
const FocusDetector = function () {
this.isFocused = false;
if (FeatureDetector.isBrowser) {
this.isFocused = true;
this.detectsFocusWithEvents = !FeatureDetector.isDesktop && !FeatureDetector.isMobile;
if (this.detectsFocusWithEvents) {
window.onblur = () => { this.isFocused = false; };
window.onfocus = () => { this.isFocused = true; };
}
};
FocusDetector.prototype.hasFocus = function () {
if (FeatureDetector.isBrowser) {
if (this.detectsFocusWithEvents) {
return this.isFocused;
} else {
} else if (Launcher) {
return Launcher.isAppFocused();
} else {
return true;
}
};

View File

@ -14,7 +14,6 @@ const FeatureDetector = {
isFrame: window.top !== window,
isSelfHosted: !isDesktop && !/^http(s?):\/\/((localhost:8085)|((app|beta)\.keeweb\.info))/.test(location.href),
needFixClicks: /Edge\/14/.test(navigator.appVersion),
isBrowser: !this.isDesktop && !this.isMobile,
actionShortcutSymbol: function(formatting) {
return this.isMac ? '⌘' : formatting ? '<span class="thin">ctrl + </span>' : 'ctrl-';

View File

@ -14,7 +14,7 @@ const InputFx = require('../util/input-fx');
const Comparators = require('../util/comparators');
const Storage = require('../storage');
const Launcher = require('../comp/launcher');
const FocusDetector = require('../util/focus-detector');
const FocusDetector = require('../comp/focus-detector');
const logger = new Logger('open-view');