Only exit fullscreen when in fullscreen mode

This commit is contained in:
Unrud 2020-08-26 03:30:21 +02:00
parent 9ad8590517
commit 1f410b5a18

View file

@ -318,7 +318,9 @@ window.addEventListener("load", function() {
} }
function showKeys() { function showKeys() {
exitFullscreen(); if (fullscreenElement()) {
exitFullscreen();
}
showScene(keys); showScene(keys);
if (history.state != "keys") { if (history.state != "keys") {
history.pushState("keys", ""); history.pushState("keys", "");
@ -326,7 +328,9 @@ window.addEventListener("load", function() {
} }
function showKeyboard() { function showKeyboard() {
exitFullscreen(); if (fullscreenElement()) {
exitFullscreen();
}
showScene(keyboard); showScene(keyboard);
text.focus(); text.focus();
if (history.state != "keyboard") { if (history.state != "keyboard") {
@ -359,7 +363,9 @@ window.addEventListener("load", function() {
}; };
ws.onclose = function() { ws.onclose = function() {
exitFullscreen(); if (fullscreenElement()) {
exitFullscreen();
}
showScene(closed); showScene(closed);
}; };