mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-27 07:45:08 +02:00
fixed focus detector
This commit is contained in:
parent
7fd72ff687
commit
75eaf88d84
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
@ -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-';
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user