Skip to content

Commit

Permalink
Attempt to detect fullscreen better
Browse files Browse the repository at this point in the history
  • Loading branch information
KTibow committed Dec 30, 2021
1 parent 2063b63 commit f0b8016
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fullscreen-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ class FullscreenCard extends HTMLElement {
this.atag.style.borderRadius = "var(--ha-card-border-radius, 4px)";
this.atag.style.cursor = "pointer";
this.atag.onclick = function () {
if (this.fullscreen) {
if (this.fullscreen || window["fullScreen"] || document.fullscreenElement) {
document.exitFullscreen();
this.fullscreen = false;
this.atag.innerHTML =
this.config["go_fullscreen"] || "Go fullscreen";
} else {
document.documentElement.requestFullscreen();
this.fullscreen = true;
this.atag.innerHTML =
this.config["exit_fullscreen"] || "Exit fullscreen";
}
this.fullscreen = !this.fullscreen;
}.bind(this);
this.content.appendChild(this.atag);
this.appendChild(this.content);
Expand Down

0 comments on commit f0b8016

Please sign in to comment.