Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Fix add/remove files for overflow menu
Browse files Browse the repository at this point in the history
  • Loading branch information
maykar authored Jun 30, 2021
1 parent 05866f4 commit b36ea1b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions kiosk-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ class KioskMode {
const huiRoot = lovelace.shadowRoot.querySelector("hui-root").shadowRoot;
const drawerLayout = this.main.querySelector("app-drawer-layout");
const appToolbar = huiRoot.querySelector("app-toolbar");
const overflowStyle = "ha-button-menu{display:none !important;}";
const headerStyle = "#view{min-height:100vh !important;--header-height:0;}app-header{display:none;}";

if (this.hideHeader) {
this.addStyle("#view{min-height:100vh !important;--header-height:0;}app-header{display:none;}", huiRoot);
if (this.queryString("cache")) this.setCache("kmHeader", "true");
if (this.hideHeader || this.hideOverflow) {
this.addStyle(`${this.hideheader ? headerStyle : ""}${this.hideOverflow ? overflowStyle : ""}`, huiRoot);
if (this.hideHeader && this.queryString("cache")) this.setCache("kmHeader", "true");
if (this.hideOverflow && this.queryString("cache")) this.setCache("kmOverflow", "true");
} else {
this.removeStyle(huiRoot);
}
Expand All @@ -104,13 +107,6 @@ class KioskMode {
} else {
this.removeStyle([appToolbar, drawerLayout]);
}

if (this.hideOverflow) {
this.addStyle("ha-button-menu{display:none !important;}", huiRoot);
if (this.queryString("cache")) this.setCache("kmOverflow", "true");
} else {
this.removeStyle(appToolbar);
}

// Resize window to "refresh" view.
window.dispatchEvent(new Event("resize"));
Expand Down

0 comments on commit b36ea1b

Please sign in to comment.