mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Correct app visibility event in appHost
This commit is contained in:
parent
6599362a28
commit
93b1dd53b5
1 changed files with 13 additions and 17 deletions
|
@ -351,8 +351,6 @@ define(["appSettings", "browser", "events", "htmlMediaHelper", "webSettings"], f
|
||||||
var deviceName;
|
var deviceName;
|
||||||
var appName = "Jellyfin Web";
|
var appName = "Jellyfin Web";
|
||||||
var appVersion = "10.5.0";
|
var appVersion = "10.5.0";
|
||||||
var visibilityChange;
|
|
||||||
var visibilityState;
|
|
||||||
|
|
||||||
var appHost = {
|
var appHost = {
|
||||||
getWindowState: function () {
|
getWindowState: function () {
|
||||||
|
@ -427,26 +425,24 @@ define(["appSettings", "browser", "events", "htmlMediaHelper", "webSettings"], f
|
||||||
};
|
};
|
||||||
|
|
||||||
var isHidden = false;
|
var isHidden = false;
|
||||||
|
var hidden;
|
||||||
|
var visibilityChange;
|
||||||
|
|
||||||
if (self.document) {
|
if (typeof document.hidden !== "undefined") { /* eslint-disable-line compat/compat */
|
||||||
if (self.document.visibilityState !== undefined) {
|
hidden = "hidden";
|
||||||
visibilityChange = "visibilitychange";
|
visibilityChange = "visibilitychange";
|
||||||
visibilityState = "hidden";
|
} else if (typeof document.msHidden !== "undefined") {
|
||||||
} else if (self.document.mozHidden !== undefined) {
|
hidden = "msHidden";
|
||||||
visibilityChange = "mozvisibilitychange";
|
visibilityChange = "msvisibilitychange";
|
||||||
visibilityState = "mozVisibilityState";
|
} else if (typeof document.webkitHidden !== "undefined") {
|
||||||
} else if (self.document.msHidden !== undefined) {
|
hidden = "webkitHidden";
|
||||||
visibilityChange = "msvisibilitychange";
|
visibilityChange = "webkitvisibilitychange";
|
||||||
visibilityState = "msVisibilityState";
|
|
||||||
} else if (self.document.webkitHidden !== undefined) {
|
|
||||||
visibilityChange = "webkitvisibilitychange";
|
|
||||||
visibilityState = "webkitVisibilityState";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.document) {
|
if (self.document) {
|
||||||
document.addEventListener(visibilityChange, function () {
|
document.addEventListener(visibilityChange, function () {
|
||||||
if (visibilityState) {
|
/* eslint-disable-next-line compat/compat */
|
||||||
|
if (document[hidden]) {
|
||||||
onAppHidden();
|
onAppHidden();
|
||||||
} else {
|
} else {
|
||||||
onAppVisible();
|
onAppVisible();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue